b8f302f8 |
1 | #!/bin/bash\r |
2 | \r |
3 | #\r |
4 | # Get, build and install the latest cross-development tools and libraries\r |
5 | #\r |
6 | \r |
7 | #\r |
8 | # Specify the architectures for which the tools are to be built\r |
9 | # To build for single target: ARCHS="m68k"\r |
10 | #\r |
11 | ARCHS="${ARCHS:-i386}"\r |
12 | \r |
13 | # Let's be nice\r |
14 | renice 10 -p $$\r |
15 | \r |
16 | # If any thing goes wrong, we'll bail out.\r |
17 | set -ex\r |
18 | \r |
19 | #\r |
20 | # Specify the versions\r |
21 | #\r |
22 | GCC=gcc-4.0.2\r |
23 | BINUTILS=binutils-2.16.1\r |
24 | CYGWIN_SNAP=20060120 # You may need to find a more recent one.\r |
25 | \r |
26 | #\r |
27 | # Where to install\r |
28 | #\r |
29 | PREFIX="${PREFIX:-/opt/tiano/}"\r |
30 | \r |
31 | #\r |
32 | # Where to get the GNU tools\r |
33 | #\r |
34 | BINUTILS_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/binutils/${BINUTILS}.tar.bz2\r |
35 | GCC_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/gcc/gcc-4.0.2/${GCC}.tar.bz2\r |
36 | CYG_LOC=http://cygwin.com/snapshots/cygwin-src-${CYGWIN_SNAP}.tar.bz2\r |
37 | export http_proxy=http://proxy.dp.intel.com:911\r |
38 | export ftp_proxy=http://proxy.dp.intel.com:911\r |
39 | \r |
40 | #\r |
41 | # Uncomment one of the following depending upon which your system provides\r |
42 | #\r |
43 | GET_COMMAND="curl --remote-name"\r |
44 | #GET_COMMAND="wget -nc --no-directories --retr-symlinks "\r |
45 | \r |
46 | #\r |
47 | # Allow environment to override some programs\r |
48 | #\r |
49 | MAKE="${MAKE:-make}"\r |
50 | export MAKE\r |
51 | SHELL="${SHELL:-/bin/sh}"\r |
52 | export SHELL\r |
53 | \r |
54 | #\r |
55 | # Get the source\r |
56 | # If you don't have curl on your machine, try using\r |
57 | # wget --passive-ftp --no-directories --retr-symlinks <<url>>\r |
58 | # If that doesn't work, try without the --passive-ftp option.\r |
59 | #\r |
60 | getSource() {\r |
61 | ${GET_COMMAND} "${BINUTILS_URL}" &\r |
62 | ${GET_COMMAND} "${GCC_URL}" &\r |
63 | ${GET_COMMAND} "${CYG_LOC}" &\r |
64 | wait\r |
65 | }\r |
66 | \r |
67 | #\r |
68 | # Unpack the source\r |
69 | #\r |
70 | unpackSource() {\r |
71 | (rm -rf "${BINUTILS}"\r |
72 | tar jxf "${BINUTILS}.tar.bz2"\r |
73 | ) &\r |
74 | \r |
75 | (rm -rf "${GCC}"\r |
76 | tar jxf "${GCC}.tar.bz2"\r |
77 | ) &\r |
78 | \r |
79 | (rm -rf cygwin-snapshot-${CYGWIN_SNAP}-1/\r |
80 | tar jxf cygwin-src-${CYGWIN_SNAP}.tar.bz2\r |
81 | ) &\r |
82 | \r |
83 | wait\r |
84 | \r |
85 | # (cd "${GCC}" ; ln -sf "../cygwin-snapshot-20060120-1/newlib" newlib)\r |
86 | \r |
87 | }\r |
88 | \r |
89 | CONF_SHELL="${CONF_SHELL:-/bin/bash}"\r |
90 | # CONF_SHELL="${CONF_SHELL:-echo}"\r |
91 | \r |
92 | #\r |
93 | # Build\r |
94 | #\r |
95 | build() {\r |
96 | for arch in $ARCHS\r |
97 | do (\r |
98 | export targ=${arch}-tiano-pe\r |
99 | export pref=${PREFIX}${targ}\r |
100 | export PATH="${pref}/bin:$PATH"\r |
101 | \r |
102 | ( mkdir -p build-binutils-$targ\r |
103 | cd build-binutils-$targ\r |
104 | "${CONF_SHELL}" "../${BINUTILS}/configure" \\r |
105 | --disable-nls "--target=${targ}" "--prefix=${pref}"\r |
106 | ${MAKE} -j1 -w all\r |
107 | ${MAKE} -w install\r |
108 | ) >> ${targ}.log 2>&1\r |
109 | \r |
110 | (\r |
111 | mkdir -p $pref/$targ/sys-include;\r |
112 | cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/newlib/libc/include/* $pref/$targ/sys-include\r |
113 | cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/winsup/cygwin/include/* $pref/$targ/sys-include\r |
114 | )\r |
115 | \r |
116 | ( mkdir -p build-gcc-$targ\r |
117 | cd build-gcc-$targ\r |
118 | "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \\r |
119 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \\r |
120 | --disable-nls --enable-languages=c\r |
121 | ${MAKE} -j1 -w all\r |
122 | ${MAKE} -w install \r |
123 | ) >> ${targ}.log 2>&1\r |
124 | ) &\r |
125 | done\r |
126 | \r |
127 | wait\r |
128 | }\r |
129 | \r |
130 | \r |
131 | \r |
132 | #\r |
133 | # Do everything\r |
134 | #\r |
135 | # Comment out any activities you wish to omit\r |
136 | #\r |
137 | getSource\r |
138 | unpackSource\r |
139 | build\r |
140 | \r |