4 # Build a mingw64 compiler for doing x64 compiles.
8 ### CYGWIN :: Make sure that cygwin is mouting its file systems in binmode.
12 # Specify the architectures for which the tools are to be built
14 TARGS
="${TARGS:-x86_64-pc-mingw64 }"
19 # If any thing goes wrong, we'll bail out.
23 # Specify the versions
26 BINUTILS
=binutils-2.17
28 # BINUTILS=binutils-2.16.91-20060119-1
29 CYGWIN_SNAP
=20060403 # You may need to find a more recent one.
30 export PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
35 # PREFIX="${PREFIX:-~/tiano/}"
36 PREFIX
="${PREFIX:-/opt/tiano/}"
39 # Where to get the GNU tools
41 BINUTILS_URL
=ftp://ftp.ibiblio.org
/pub
/mirrors
/gnu
/ftp
/gnu
/binutils
/${BINUTILS}.
tar.bz2
42 GCC_URL
=ftp://mirrors.kernel.org
/gnu
/gcc
/$GCC/$GCC.
tar.bz2
43 CYG_LOC
=http
://cygwin.com
/snapshots
/cygwin-src-
${CYGWIN_SNAP}.
tar.bz2
44 W32API_LOC
=http
://superb-west.dl.sourceforge.net
/sourceforge
/mingw
/${W32API}-src.
tar.gz
45 # export http_proxy=http://proxy.dp.intel.com:911
46 # export ftp_proxy=http://proxy.dp.intel.com:911
49 # Uncomment one of the following depending upon which your system provides
51 #GET_COMMAND="curl --remote-name"
52 GET_COMMAND
="wget -nc --no-directories --retr-symlinks "
55 # Allow environment to override some programs
59 SHELL
="${SHELL:-/bin/sh}"
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.
69 ${GET_COMMAND} "${BINUTILS_URL}" &
70 ${GET_COMMAND} "${GCC_URL}" &
71 ${GET_COMMAND} "${CYG_LOC}" &
72 ${GET_COMMAND} "${W32API_LOC}" &
81 tar jxf
"${BINUTILS}.tar.bz2"
85 tar jxf
"${GCC}.tar.bz2"
88 (rm -rf cygwin-snapshot-
${CYGWIN_SNAP}-1/
89 tar jxf cygwin-src-
${CYGWIN_SNAP}.
tar.bz2
93 tar zxf
${W32API}-src.
tar.gz
99 (cd ${GCC}; patch -p1 < ..
/gcc_4.1
.1.x86_64.061113.
diff
102 (cd ${BINUTILS}; patch -p1 < ..
/binutils.
diff
108 CONF_SHELL
="${CONF_SHELL:-/bin/bash}"
109 # CONF_SHELL="${CONF_SHELL:-echo}"
117 export pref
=${PREFIX}${targ}
118 export PATH
="${pref}/bin:$PATH"
120 ( mkdir
-p build-binutils-
$targ
121 cd build-binutils-
$targ
122 "${CONF_SHELL}" "../${BINUTILS}/configure" \
123 --disable-nls "--target=${targ}" "--prefix=${pref}"
126 ) >> ${targ}.log
2>&1
129 mkdir
-p $pref/$targ/sys-include
;
130 cp -fr cygwin-snapshot-
${CYGWIN_SNAP}-1/newlib
/libc
/include
/* $pref/$targ/sys-include
131 cp -fr cygwin-snapshot-
${CYGWIN_SNAP}-1/winsup
/cygwin
/include
/* $pref/$targ/sys-include
135 mkdir
-p $pref/$targ/include
;
136 cp -fr ${W32API}/include
/* $pref/$targ/sys-include
;
139 ( mkdir
-p build-gcc-
$targ
141 "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \
142 --with-gnu-as --with-gnu-ld --without-headers --with-newlib --verbose \
144 --disable-nls --enable-languages=c
147 ) >> ${targ}.log
2>&1
159 # Comment out any activities you wish to omit