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