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