3 # Script to help build the mingw cross compile tool chain for Win64
4 # This typically needs a lot of hand tweaking to get everything to
5 # work. We build this only on Ubuntu Hardy, and it is unlikely
6 # to work on any other Linux version without significant changes
7 # to the patch files... You are on your own here.
12 # Directory where cross-tools directory will be placed
14 # Cross tools directory name under TOPDIR
15 CROSSTOOLS=cross-tools
19 # Make TOPDIR absolute
21 TOPDIR=${DEPKGS:-${TOPDIR}}
23 mkdir -p ${TOPDIR}/cross-tools
24 cd ${TOPDIR}/cross-tools
25 echo "Buiding in ${TOPDIR}/cross-tools"
30 DIRS="$SRC $PF $PF/$TGT $BD $BD/binutils $BD/binutils/build-$HST $BD/gcc-svn $BD/gcc-svn/build-$HST $BD/mingw $BD/mingw/build-$HST"
31 baseopts="--prefix=$PF --with-sysroot=$PF --target=$TGT"
39 binutilsver=binutils-2.19
40 dlbinutils=http://ftp.gnu.org/gnu/binutils/$binutilsver.tar.bz2
42 dlgcc=http://ftp.gnu.org/gnu/gcc/$gccver/$gccver.tar.bz2
43 mingwver=mingw-w64-snapshot-20081115
44 dlmingw64=http://garr.dl.sourceforge.net/sourceforge/mingw-w64/$mingwver.tar.bz2
47 gmp=ftp://ftp.gnu.org/gnu/gmp/${gmpver}.tar.bz2
49 mpfr=http://www.mpfr.org/mpfr-current/${mpfrver}.tar.bz2
50 url=http://www.bacula.org/cross-tools
56 for i in $binutilsver $gccver $mpfrver $gmpver $mingwver
58 if [ ! -f $i.tar.bz2 ]; then
64 tar xf $mingwver.tar.bz2
66 tar cfj mingw-w64-crt.tar.bz2 mingw-w64-crt
67 tar cfj mingw-w64-headers.tar.bz2 mingw-w64-headers
68 rm -rf mingw-w64-crt mingw-w64-headers trunk
70 if [ $update = "true" ]; then
71 echo "Creating directory tree:"
72 echo "$PF -- sysroot directory tree"
73 echo "$BD -- build directory tree"
77 [ -d $i ] && echo "Warning: $i preexisting, skipping directory creation" || mkdir $i
79 [ -h $PF/mingw ] || ln -s $TGT $PF/mingw
81 echo "Downloading binutils.." && cd $BD/binutils
83 tar xf $SRC/binutils-2.19.tar.bz2
86 echo "Downloading gcc.." && cd $BD/gcc-svn
87 # svn -q checkout svn://gcc.gnu.org/svn/gcc/trunk gcc -r $gccrev
89 tar xf $SRC/gcc-4.3.2.tar.bz2
92 echo "Downloading additional required libraries for gcc.."
95 tar xf $SRC/gmp-4.2.4.tar.bz2
99 tar xf $SRC/mpfr-2.3.2.tar.bz2
103 echo "Downloading crt and headers.."
105 tar xf $SRC/mingw-w64-headers.tar.bz2
106 tar xf $SRC/mingw-w64-crt.tar.bz2
107 cp -prf mingw-w64-headers/include $PF/$TGT/include
109 echo "Root setup complete."
112 if [ $build = "true" ]; then
113 echo "Compiling binutils.." && cd $BD/binutils/build-$HST
114 ../src/configure $baseopts > $out && make -s $j > $out && make install > $out || exit 1
116 echo "Compiling bootstrap gcc.." && cd $BD/gcc-svn/build-$HST
117 ../gcc/configure $baseopts > $out && make -s $j all-gcc > $out && make install-gcc > $out || exit 1
118 export PATH=$PF/bin:$PATH
120 echo "Compiling crt.." && cd $BD/mingw/build-$HST
121 ../mingw-w64-crt/configure --prefix=$PF --with-sysroot=$PF --host=$TGT > $out && make -s $j > $out && make install > $out || exit 1
123 echo "Compiling full gcc.." && cd $BD/gcc-svn/build-$HST
124 make -s $j > $out && make install > $out || exit 1
127 echo "Done building."
131 for i in x86_64-pc-mingw32-*
133 ln -s $i ${i##x86_64-pc-}