6 make_flags
="-j$(nproc)"
9 export prefix
=/tools
/mingw32
10 export install_dir
=$root_dir$prefix
12 export PATH
=$PATH:$install_dir/bin
/
16 git clone
-n git
://git.code.sf.net
/p
/mingw-w64
/mingw-w64
18 git checkout
$mingw_version # Asserts the integrity of the checkout (Right?)
27 pushd $root_dir/gcc-source
34 # if binutils_configure_flags is not set at all, give it the default value
35 if [ -z "${binutils_configure_flags+xxx}" ];
37 # gold is disabled because we don't use it on automation, and also we ran into
38 # some issues with it using this script in build-clang.py.
40 # --enable-targets builds extra target support in ld.
41 # Enabling aarch64 support brings in arm support, so we don't need to specify that too.
43 # It is important to have the binutils --target and the gcc --target match,
44 # so binutils will install binaries in a place that gcc will look for them.
45 binutils_configure_flags
="--enable-targets=aarch64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu --disable-gold --enable-plugins --disable-nls --with-sysroot=/"
48 mkdir
$root_dir/binutils-objdir
49 pushd $root_dir/binutils-objdir
50 ..
/binutils-source
/configure
--prefix=${prefix-/tools/gcc}/ $binutils_configure_flags
52 make install $make_flags DESTDIR
=$root_dir
53 export PATH
=$root_dir/${prefix-/tools/gcc}/bin
:$PATH
58 # Be explicit about --build and --target so header and library install
59 # directories are consistent.
60 local target
="${1:-x86_64-unknown-linux-gnu}"
62 mkdir
$root_dir/gcc-objdir
63 pushd $root_dir/gcc-objdir
64 ..
/gcc-source
/configure
--prefix=${prefix-/tools/gcc} --build=x86_64-unknown-linux-gnu
--target="${target}" --enable-languages=c
,c
++ --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro
--with-sysroot=/
66 make $make_flags install DESTDIR
=$root_dir
71 tar caf
$root_dir/gcc.
tar.xz gcc
/
75 build_gcc_and_mingw
() {
78 ..
/gcc-source
/configure
--prefix=$install_dir --target=i686-w64-mingw32
--with-gnu-ld --with-gnu-as --disable-multilib --enable-threads=posix
79 make $make_flags all-gcc
80 make $make_flags install-gcc
83 mkdir mingw-w64-headers32
84 pushd mingw-w64-headers32
85 ..
/mingw-w64
/mingw-w64-headers
/configure
--host=i686-w64-mingw32
--prefix=$install_dir/i686-w64-mingw32
/ --enable-sdk=all
--enable-secure-api --enable-idl
86 make $make_flags install
91 ..
/mingw-w64
/mingw-w64-crt
/configure
--host=i686-w64-mingw32
--prefix=$install_dir/i686-w64-mingw32
/
96 mkdir mingw-w64-pthread
97 pushd mingw-w64-pthread
98 ..
/mingw-w64
/mingw-w64-libraries
/winpthreads
/configure
--host=i686-w64-mingw32
--prefix=$install_dir/i686-w64-mingw32
/
110 ..
/mingw-w64
/mingw-w64-tools
/widl
/configure
--prefix=$install_dir --target=i686-w64-mingw32
115 pushd $
(dirname $install_dir)
116 tar caf
$root_dir/mingw32.
tar.xz $
(basename $install_dir)/