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 |
c9d5da94 |
23 | BINUTILS=binutils-2.16.1 |
24 | # BINUTILS=binutils-2.16.91-20060119-1 |
8db4c50c |
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 | # |
c9d5da94 |
35 | # BINUTILS_URL=http://superb.dl.sourceforge.net/sourceforge/mingw/${BINUTILS}-src.tar.gz |
36 | BINUTILS_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/binutils/${BINUTILS}.tar.bz2 |
37 | # GCC_URL=http://mirrors.ibiblio.org/pub/mirrors/gnu/ftp/gnu/gcc/gcc-${GCC}/${GCC}.tar.bz2 |
38 | GCC_URL=ftp://mirrors.kernel.org/gnu/gcc/$GCC/$GCC.tar.bz2 |
8db4c50c |
39 | CYG_LOC=http://cygwin.com/snapshots/cygwin-src-${CYGWIN_SNAP}.tar.bz2 |
40 | # export http_proxy=http://proxy.dp.intel.com:911 |
41 | # export ftp_proxy=http://proxy.dp.intel.com:911 |
42 | |
43 | # |
44 | # Uncomment one of the following depending upon which your system provides |
45 | # |
c9d5da94 |
46 | #GET_COMMAND="curl --remote-name" |
47 | GET_COMMAND="wget -nc --no-directories --retr-symlinks " |
8db4c50c |
48 | |
49 | # |
50 | # Allow environment to override some programs |
51 | # |
52 | MAKE="${MAKE:-make}" |
53 | export MAKE |
54 | SHELL="${SHELL:-/bin/sh}" |
55 | export SHELL |
56 | |
57 | # |
58 | # Get the source |
59 | # If you don't have curl on your machine, try using |
60 | # wget --passive-ftp --no-directories --retr-symlinks <<url>> |
61 | # If that doesn't work, try without the --passive-ftp option. |
62 | # |
63 | getSource() { |
64 | ${GET_COMMAND} "${BINUTILS_URL}" & |
65 | ${GET_COMMAND} "${GCC_URL}" & |
66 | ${GET_COMMAND} "${CYG_LOC}" & |
67 | wait |
68 | } |
69 | |
70 | # |
71 | # Unpack the source |
72 | # |
73 | unpackSource() { |
74 | (rm -rf "${BINUTILS}" |
c9d5da94 |
75 | tar jxf "${BINUTILS}.tar.bz2" |
8db4c50c |
76 | ) & |
77 | |
78 | (rm -rf "${GCC}" |
79 | tar jxf "${GCC}.tar.bz2" |
80 | ) & |
81 | |
82 | (rm -rf cygwin-snapshot-${CYGWIN_SNAP}-1/ |
83 | tar jxf cygwin-src-${CYGWIN_SNAP}.tar.bz2 |
84 | ) & |
85 | |
86 | wait |
87 | } |
88 | |
89 | CONF_SHELL="${CONF_SHELL:-/bin/bash}" |
90 | # CONF_SHELL="${CONF_SHELL:-echo}" |
91 | |
92 | # |
93 | # Build |
94 | # |
95 | build() { |
96 | for arch in $ARCHS |
97 | do ( |
98 | export targ=${arch}-tiano-pe |
99 | export pref=${PREFIX}${targ} |
100 | export PATH="${pref}/bin:$PATH" |
101 | |
102 | ( mkdir -p build-binutils-$targ |
103 | cd build-binutils-$targ |
104 | "${CONF_SHELL}" "../${BINUTILS}/configure" \ |
105 | --disable-nls "--target=${targ}" "--prefix=${pref}" |
106 | ${MAKE} -j5 -w all |
107 | ${MAKE} -w install |
108 | ) >> ${targ}.log 2>&1 |
109 | |
110 | ( |
111 | mkdir -p $pref/$targ/sys-include; |
112 | cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/newlib/libc/include/* $pref/$targ/sys-include |
113 | cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/winsup/cygwin/include/* $pref/$targ/sys-include |
114 | ) |
115 | |
116 | ( mkdir -p build-gcc-$targ |
117 | cd build-gcc-$targ |
118 | "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \ |
119 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
120 | --disable-libssp \ |
121 | --disable-nls --enable-languages=c |
122 | ${MAKE} -j5 -w all |
123 | ${MAKE} -w install |
124 | ) >> ${targ}.log 2>&1 |
125 | ) & |
126 | done |
127 | |
128 | wait |
129 | } |
130 | |
131 | |
132 | |
133 | # |
134 | # Do everything |
135 | # |
136 | # Comment out any activities you wish to omit |
137 | # |
138 | getSource |
139 | unpackSource |
140 | build |