compile script for mingw64

#! /bin/sh

#cd /d/opensource
#wget mingw-w64
#wget gcc
#wget binutils

#make -p /d/opensource
#cd /d/opensource/
#cvs -z9 -d:pserver:[email protected]:/cvs/src co binutils
#svn co svn://gcc.gnu.org/svn/gcc/trunk gcc-trunk
#svn co https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/trunk mingw-w64-trunk

mkdir /d/portable/sysroot
mkdir -p /d/build/binutils-build
mkdir -p /d/build/mingw-w64-headers-build
mkdir -p /d/build/mingw-w64-crt-build
mkdir -p /d/build/gcc-build

cd /d/build/binutils-build
../../opensource/binutils-src/configure    \
    --target=x86_64-w64-mingw32 \
    --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 \
    --with-sysroot=/d/portable/sysroot --prefix=/d/portable/sysroot
make
make install
export PATH="$PATH:/d/portable/sysroot/bin"

cd ../mingw-w64-headers-build
../../opensource/mingw-w64-trunk/mingw-w64-headers/configure \
    --build=i686-pc-mingw32 --host=x86_64-w64-mingw32 \
    --prefix=/d/portable/sysroot
make install
#copy include
cp -a /d/portable/sysroot/include             /d/portable/sysroot/x86_64-w64-mingw32
mkdir -p /d/portable/sysroot/x86_64-w64-mingw32/lib
cp -a /d/portable/sysroot/x86_64-w64-mingw32/lib    /d/portable/sysroot/x86_64-w64-mingw32/lib64
cp -a /d/portable/sysroot/x86_64-w64-mingw32        /d/portable/sysroot/mingw

cd ../gcc-build
../../opensource/gcc-4.7.2-src/configure \
    --target=x86_64-w64-mingw32 --enable-targets=all \
    --with-sysroot=/d/portable/sysroot --prefix=/d/portable/sysroot
make all-gcc
make install-gcc

cd ../mingw-w64-crt-build
../../opensource/mingw-w64-trunk/mingw-w64-crt/configure \
    --host=x86_64-w64-mingw32 --enable-lib32 \
    --with-sysroot=/d/portable/sysroot --prefix=/d/portable/sysroot
make
make install

cp -a /d/portable/sysroot/lib                /d/portable/sysroot/x86_64-w64-mingw32
cp -a /d/portable/sysroot/lib32                /d/portable/sysroot/x86_64-w64-mingw32
cp -a /d/portable/sysroot/x86_64-w64-mingw32/lib/*    /d/portable/sysroot/x86_64-w64-mingw32/lib64
cp -a /d/portable/sysroot/x86_64-w64-mingw32/*        /d/portable/sysroot/mingw

cd ../gcc-build
make
make install
 

猜你喜欢

转载自chenqi210.iteye.com/blog/1704733