Last active
August 29, 2015 14:27
-
-
Save stavinsky/075d7e3383c5cc6df9f4 to your computer and use it in GitHub Desktop.
os x mingw64 32 OS X mingw crosscompile toolchain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
###### | |
# here last version of all package. | |
# Please change constants at the top of this file before use!!! | |
# | |
# usage: sh -e build.sh all # to build all in a right sequence | |
# | |
# | |
###### | |
TARGET=i686-w64-mingw32 | |
SRC=/Users/user/mingw-cross/src | |
PREFIX=/Users/user/mingw64_32 | |
COMPILERS="CC=gcc-5 CXX=g++-5 CPP=cpp-5 LD=gcc-5" | |
# | |
# needed packages | |
# isl-0.15 | |
# cloog-0.18.4 | |
# libiconv-1.14 | |
# gmp-6.0.0a | |
# mpfr-3.1.3 | |
# mpc-1.0.3 | |
# gcc-5.2.0 | |
# mingw-w64-v4.0.4 | |
function download | |
{ | |
curl http://isl.gforge.inria.fr/isl-0.15.tar.xz -O | |
curl http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz -O | |
curl http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -O | |
curl https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 -O | |
curl http://www.mpfr.org/mpfr-current/mpfr-3.1.3.tar.bz2 -O | |
curl ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz -O | |
curl http://mirrors-ru.go-parts.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.bz2 -O | |
curl -o mingw-w64-v3.1.0.tar.bz2 -L http://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v4.0.4.tar.bz2 | |
git clone git://sourceware.org/git/binutils-gdb.git | |
#i took binutils from git because last version cant build with this confiburation | |
} | |
function extract | |
{ | |
tar -xJf isl-0.15.tar.xz | |
tar -xvzf cloog-0.18.4.tar.gz | |
tar -xvzf libiconv-1.14.tar.gz | |
tar -xvjf gmp-6.0.0a.tar.bz2 | |
tar -xvjf mpfr-3.1.3.tar.bz2 | |
tar -xvzf mpc-1.0.3.tar.gz | |
tar -xvjf gcc-5.2.0.tar.bz2 | |
tar -xvjf mingw-w64-v4.0.4.tar.bz2 | |
} | |
function gmp | |
{ | |
cd $SRC/gmp-6.0.0 | |
rm -rf build | |
mkdir build | |
cd build | |
export $COMPILERS | |
../configure | |
make -j4 | |
} | |
function isl | |
{ | |
cd $SRC/isl-0.15 | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS=" --with-gmp-builddir=$SRC/gmp-6.0.0/build" | |
export $COMPILERS | |
../configure $FLAGS | |
make -j4 | |
} | |
function cloog | |
{ | |
cd $SRC/cloog-0.18.4 | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--with-gmp-builddir=$SRC/gmp-6.0.0/build " | |
FLAGS+="--with-isl-builddir=$SRC/isl-0.15/build " | |
export $COMPILERS | |
../configure $FLAGS | |
make -j4 | |
} | |
function libiconv | |
{ | |
cd $SRC/libiconv-1.14 | |
rm -rf build | |
mkdir build | |
cd build | |
export $COMPILERS | |
../configure | |
make -j4 | |
} | |
function mpfr | |
{ | |
cd $SRC/mpfr-3.1.3 | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--with-gmp-lib=$SRC/gmp-6.0.0/build " | |
export $COMPILERS | |
../configure $FLAGS | |
make -j4 | |
} | |
function mpc | |
{ | |
cd $SRC/mpc-1.0.3 | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--with-gmp-lib=$SRC/gmp-6.0.0/build " | |
FLAGS+="--with-mpfr-lib=$SRC/mpfr-3.1.3/build" | |
export $COMPILERS | |
../configure $FLAGS | |
make -j4 | |
} | |
function binutil | |
{ | |
cd $SRC/binutils-gdb/ | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--with-mpc=$SRC/mpc-1.0.2/buiild " | |
FLAGS+="--with-mpfr=$SRC/mpfr-3.1.3/build " | |
FLAGS+="--with-isl=$SRC/isl-0.15/build " | |
FLAGS+="--with-gmp=$SRC/gmp-6.0.0/build " | |
FLAGS+="--with-cloog=$SRC/cloog-0.18.4/build " | |
FLAGS+="--with-sysroot=$PREFIX " | |
FLAGS+="--disable-nls " | |
FLAGS+="--disable-werror " | |
FLAGS+="--disable-nls " | |
FLAGS+="--prefix=$PREFIX " | |
FLAGS+="--target=$TARGET " | |
export $COMPILERS | |
../configure $FLAGS | |
make -j4 | |
make install | |
} | |
function mingw_headers | |
{ | |
cd $PREFIX/$TARGET | |
ln -s lib lib32 | |
cd $SRC/mingw-w64-v4.0.4 | |
rm -rf build-headers | |
mkdir build-headers | |
cd build-headers | |
export $COMPILERS | |
FLAGS="--host=$TARGET --prefix=$PREFIX/$TARGET" | |
../mingw-w64-headers/configure $FLAGS | |
make | |
make install | |
} | |
function gcc_core | |
{ | |
# at the moment of compiling gcc-core, it look for libs in mingw dir | |
cd $PREFIX | |
ln -s $TARGET mingw | |
# it will be great if someone say me why happend | |
cd $SRC/gcc-5.2.0 | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--target=$TARGET " | |
FLAGS+="--prefix=$PREFIX " | |
FLAGS+="--with-iconv=$SRC/libiconv-1.14/build " | |
FLAGS+="--with-gmp=$SRC/gmp-6.0.0/build " | |
FLAGS+="--with-mpfr=$SRC/mpfr-3.1.3/build " | |
FLAGS+="--with-mpc=$SRC/mpc-1.0.2/buiild " | |
FLAGS+="--with-isl=$SRC/isl-0.15/build " | |
FLAGS+="--with-cloog=$SRC/cloog-0.18.4/build " | |
FLAGS+="--disable-multilib " | |
FLAGS+="--with-sysroot=$PREFIX " | |
FLAGS+="--enable-languages=c,c++ " | |
FLAGS+="--without-headers " | |
FLAGS+="--enable-threads=posix " | |
export $COMPILERS | |
../configure $FLAGS | |
PATH="$PREFIX/bin:$PATH " | |
export PATH | |
make -j2 all-gcc | |
make install-gcc | |
} | |
function mingw | |
{ | |
cd $SRC/mingw-w64-v4.0.4 | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--host=$TARGET " | |
FLAGS+="--prefix=$PREFIX/$TARGET " | |
FLAGS+="--with-sysroot=$PREFIX " | |
FLAGS+="--enable-threads=winpthreads " | |
PATH="$PREFIX/bin:$PATH " | |
export PATH | |
../configure $FLAGS | |
make -j2 | |
make install | |
} | |
function gcc | |
{ | |
cd $SRC/gcc-5.2.0 | |
cd build | |
PATH="$PREFIX/bin:$PATH " | |
export PATH | |
export COMPILERS | |
make -j2 | |
make install | |
} | |
function winpthreads | |
{ | |
cd $SRC/mingw-w64-v4.0.4/mingw-w64-libraries/winpthreads | |
rm -rf build | |
mkdir build | |
cd build | |
FLAGS="--host=$TARGET " | |
FLAGS+="--prefix=$PREFIX/$TARGET" | |
PATH="$PREFIX/bin:$PATH " | |
export PATH | |
../configure $FLAGS | |
make | |
make install | |
} | |
function all | |
{ | |
download | |
extract | |
gmp | |
isl | |
cloog | |
libiconv | |
mpfr | |
mpc | |
binutil | |
mingw_headers | |
gcc_core | |
mingw | |
winpthreads | |
gcc | |
} | |
case "$1" in | |
"") echo "use build.sh with command as argument";; | |
"isl") isl;; | |
"cloog") cloog;; | |
"libiconv") libiconv;; | |
"gmp") gmp;; | |
"mpfr") mpfr;; | |
"mpc") mpc;; | |
"binutil") binutil;; | |
"download") download;; | |
"extract") extract;; | |
"mingw_headers") mingw_headers;; | |
"gcc_core") gcc_core;; | |
"mingw") mingw;; | |
"gcc") gcc;; | |
"winpthreads") winpthreads;; | |
"all") all;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment