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