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-mingw32}"
19 # If any thing goes wrong, we'll bail out.
23 # Specify the versions
25 GCC_VERSION
=4.3-20071207
26 BINUTILS_VERSION
=2.17.50.0.18
27 MINGW_HEADERS_VERSION
=20070802
29 _GCC_
=gcc-
${GCC_VERSION}
30 _BINUTILS_
=binutils-
${BINUTILS_VERSION}
31 _MINGW_HEADERS_
=mingw-w64-headers-
${MINGW_HEADERS_VERSION}
33 export PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
38 PREFIX
="${PREFIX:-/opt/tiano/}"
41 # Where to get the GNU tools
43 BINUTILS_URL
=http
://www.kernel.org
/pub
/linux
/devel
/binutils
/${_BINUTILS_}.
tar.bz2
44 GCC_URL
=ftp://gd.tuwien.ac.at
/gnu
/gcc
/snapshots
/${GCC_VERSION}/${_GCC_}.
tar.bz2
45 MINGW_HEADERS_URL
=http
://superb-west.dl.sourceforge.net
/sourceforge
/mingw
/${_MINGW_HEADERS_}.
tar.bz2
48 # Uncomment one of the following depending upon which your system provides
50 #GET_COMMAND="curl --remote-name"
51 GET_COMMAND
="wget -c -nc --no-directories --retr-symlinks "
54 # Allow environment to override some programs
58 SHELL
="${SHELL:-/bin/sh}"
63 # If you don't have curl on your machine, try using
64 # wget --passive-ftp --no-directories --retr-symlinks <<url>>
65 # If that doesn't work, try without the --passive-ftp option.
68 ${GET_COMMAND} "${BINUTILS_URL}"
69 ${GET_COMMAND} "${GCC_URL}"
70 ${GET_COMMAND} "${MINGW_HEADERS_URL}"
78 (rm -rf "${_BINUTILS_}"
79 tar jxf
"${_BINUTILS_}.tar.bz2"
83 tar jxf
"${_GCC_}.tar.bz2"
87 tar jxf
"${_MINGW_HEADERS_}.tar.bz2"
93 CONF_SHELL
="${CONF_SHELL:-/bin/bash}"
94 # CONF_SHELL="${CONF_SHELL:-echo}"
102 export pref
=${PREFIX}${targ}
103 export PATH
="${pref}/bin:$PATH"
107 rm -rf build-binutils-
$targ
108 mkdir
-p build-binutils-
$targ
109 cd build-binutils-
$targ
110 "${CONF_SHELL}" "../${_BINUTILS_}/configure" \
111 --disable-nls "--target=${targ}" "--prefix=${pref}"
114 ) >> ${targ}.log
2>&1
117 mkdir
-p $pref/$targ/include
;
118 cp -fr include
/* $pref/$targ/include
119 ln -s $pref/$targ $pref/mingw
120 ln -s $pref/$targ/include
$pref/$targ/sys-include
125 rm -rf build-gcc-
$targ
126 mkdir
-p build-gcc-
$targ
128 "${CONF_SHELL}" "../${_GCC_}/configure" "--target=${targ}" \
130 --without-headers --with-newlib --verbose \
131 --disable-libssp --disable-nls --enable-languages=c
134 ) >> ${targ}.log
2>&1
136 # GCC 4.3 needs the symbol links for the gcc and binutils. Otherwise
137 # the cc1 and as, ld etc can not be found by gcc.
139 rm -f $pref/$targ/bin
/*
140 ln -s $pref/bin
/$targ-ar $pref/$targ/bin
/ar
141 ln -s $pref/bin
/$targ-as $pref/$targ/bin
/as
142 ln -s $pref/bin
/$targ-dlltool $pref/$targ/bin
/dlltool
143 ln -s $pref/bin
/$targ-gcc $pref/$targ/bin
/gcc
144 ln -s $pref/bin
/$targ-ld $pref/$targ/bin
/ld
145 ln -s $pref/bin
/$targ-nm $pref/$targ/bin
/nm
146 ln -s $pref/bin
/$targ-objcopy $pref/$targ/bin
/objcopy
147 ln -s $pref/bin
/$targ-objdump $pref/$targ/bin
/objdump
148 ln -s $pref/bin
/$targ-ranlib $pref/$targ/bin
/ranlib
149 ln -s $pref/bin
/$targ-strip $pref/$targ/bin
/strip
162 # Comment out any activities you wish to omit