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