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