Last active
February 27, 2018 16:57
-
-
Save tguillem/d27806213f96a2f220b447d4655e0a74 to your computer and use it in GitHub Desktop.
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/sh | |
ROOT=$HOME/tmp/mingw64/root | |
sudo apt-get update -qq && sudo apt-get install -qqy \ | |
git wget bzip2 file libwine-dev unzip libtool pkg-config cmake \ | |
build-essential automake texinfo ragel yasm p7zip-full autopoint \ | |
gettext dos2unix zip wine g++-mingw-w64-i686 gperf | |
\ | |
TARGET_TUPLE=x86_64-w64-mingw32 \ | |
TOOLCHAIN_PREFIX=$HOME/tmp/mingw64/out/gcc-$TARGET_TUPLE \ | |
MINGW_PREFIX=$TOOLCHAIN_PREFIX/$TARGET_TUPLE \ | |
PATH=$TOOLCHAIN_PREFIX/bin:$PATH \ | |
GCC_VERSION=6.4.0 \ | |
BINUTILS_VERSION=2.27 \ | |
MPFR_VERSION=3.1.6 \ | |
GMP_VERSION=6.1.1 \ | |
MPC_VERSION=1.0.3 && \ | |
\ | |
mkdir -p $MINGW_PREFIX && \ | |
mkdir -p $ROOT/build && cd $ROOT/build && \ | |
mkdir -p $TOOLCHAIN_PREFIX && \ | |
ln -s $MINGW_PREFIX $TOOLCHAIN_PREFIX/mingw && \ | |
wget -q http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.bz2 && \ | |
wget -q ftp://ftp.uvsq.fr/pub/gcc/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz && \ | |
git clone --depth=1 git://git.code.sf.net/p/mingw-w64/mingw-w64 && \ | |
tar xf gcc-$GCC_VERSION.tar.xz && \ | |
tar xf binutils-$BINUTILS_VERSION.tar.bz2 && \ | |
cd binutils-$BINUTILS_VERSION && mkdir build && cd build && \ | |
../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE \ | |
--disable-werror --disable-multilib && make -j4 && make install && \ | |
cd $ROOT/build/mingw-w64/mingw-w64-headers && mkdir build && cd build && \ | |
../configure --prefix=$MINGW_PREFIX \ | |
--host=$TARGET_TUPLE --enable-secure-api && make install && \ | |
cd $ROOT/build && \ | |
wget -q http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VERSION.tar.gz && \ | |
wget -q https://gmplib.org/download/gmp/gmp-$GMP_VERSION.tar.xz && \ | |
wget -q ftp://ftp.gnu.org/gnu/mpc/mpc-$MPC_VERSION.tar.gz && \ | |
tar xf mpfr-$MPFR_VERSION.tar.gz && \ | |
tar xf gmp-$GMP_VERSION.tar.xz && \ | |
tar xf mpc-$MPC_VERSION.tar.gz && \ | |
ln -s $ROOT/build/mpfr-$MPFR_VERSION gcc-$GCC_VERSION/mpfr && \ | |
ln -s $ROOT/build/gmp-$GMP_VERSION gcc-$GCC_VERSION/gmp && \ | |
ln -s $ROOT/build/mpc-$MPC_VERSION gcc-$GCC_VERSION/mpc && \ | |
sed -i '79i#define _GLIBCXX_USE_WEAK_REF 0' \ | |
gcc-$GCC_VERSION/libstdc++-v3/config/os/mingw32-w64/os_defines.h && \ | |
cd gcc-$GCC_VERSION && mkdir build && cd build && \ | |
../configure --prefix=$TOOLCHAIN_PREFIX \ | |
--target=$TARGET_TUPLE \ | |
--enable-languages=c,c++ \ | |
--enable-lto \ | |
--disable-shared \ | |
--disable-multilib && \ | |
make -j4 all-gcc && \ | |
make install-gcc && \ | |
cd $ROOT/build/mingw-w64/mingw-w64-crt && \ | |
mkdir build && cd build && \ | |
../configure --prefix=$MINGW_PREFIX \ | |
--host=$TARGET_TUPLE && \ | |
make -j4 && \ | |
make install && \ | |
cd $ROOT/build/gcc-$GCC_VERSION/build && \ | |
make -j4 && \ | |
make install && \ | |
cd $ROOT/build/mingw-w64/mingw-w64-tools/widl && \ | |
mkdir build && cd build && \ | |
../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE && \ | |
make -j4 && \ | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment