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 mkdir -p ../../../cross-tools
13 cd ../../../cross-tools
18 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"
19 baseopts="--prefix=$PF --with-sysroot=$PF --target=$TGT"
27 binutilsver=binutils-2.19
28 dlbinutils=http://ftp.gnu.org/gnu/binutils/$binutilsver.tar.bz2
30 dlgcc=http://ftp.gnu.org/gnu/gcc/$gccver/$gccver.tar.bz2
31 mingwver=mingw-w64-snapshot-20081115
32 dlmingw64=http://garr.dl.sourceforge.net/sourceforge/mingw-w64/$mingwver.tar.bz2
35 gmp=ftp://ftp.gnu.org/gnu/gmp/${gmpver}.tar.bz2
37 mpfr=http://www.mpfr.org/mpfr-current/${mpfrver}.tar.bz2
38 url=http://www.bacula.org/cross-tools
44 for i in $binutilsver $gccver $mpfrver $gmpver $mingwver
46 if [ ! -f $i.tar.bz2 ]; then
52 tar xf $mingwver.tar.bz2
54 tar cfj mingw-w64-crt.tar.bz2 mingw-w64-crt
55 tar cfj mingw-w64-headers.tar.bz2 mingw-w64-headers
56 rm -rf mingw-w64-crt mingw-w64-headers trunk
58 if [ $update = "true" ]; then
59 echo "Creating directory tree:"
60 echo "$PF -- sysroot directory tree"
61 echo "$BD -- build directory tree"
65 [ -d $i ] && echo "Warning: $i preexisting, skipping directory creation" || mkdir $i
67 [ -h $PF/mingw ] || ln -s $TGT $PF/mingw
69 echo "Downloading binutils.." && cd $BD/binutils
71 tar xf $SRC/binutils-2.19.tar.bz2
74 echo "Downloading gcc.." && cd $BD/gcc-svn
75 # svn -q checkout svn://gcc.gnu.org/svn/gcc/trunk gcc -r $gccrev
77 tar xf $SRC/gcc-4.3.2.tar.bz2
80 echo "Downloading additional required libraries for gcc.."
83 tar xf $SRC/gmp-4.2.4.tar.bz2
87 tar xf $SRC/mpfr-2.3.2.tar.bz2
91 echo "Downloading crt and headers.."
93 tar xf $SRC/mingw-w64-headers.tar.bz2
94 tar xf $SRC/mingw-w64-crt.tar.bz2
95 cp -prf mingw-w64-headers/include $PF/$TGT/include
97 echo "Root setup complete."
100 if [ $build = "true" ]; then
101 echo "Compiling binutils.." && cd $BD/binutils/build-$HST
102 ../src/configure $baseopts > $out && make -s $j > $out && make install > $out || exit 1
104 echo "Compiling bootstrap gcc.." && cd $BD/gcc-svn/build-$HST
105 ../gcc/configure $baseopts > $out && make -s $j all-gcc > $out && make install-gcc > $out || exit 1
106 export PATH=$PF/bin:$PATH
108 echo "Compiling crt.." && cd $BD/mingw/build-$HST
109 ../mingw-w64-crt/configure --prefix=$PF --with-sysroot=$PF --host=$TGT > $out && make -s $j > $out && make install > $out || exit 1
111 echo "Compiling full gcc.." && cd $BD/gcc-svn/build-$HST
112 make -s $j > $out && make install > $out || exit 1
115 echo "Done building."
119 for i in x86_64-pc-mingw32-*
121 ln -s $i ${i##x86_64-pc-}