#!/bin/sh source `dirname $0`/incBLD.sh function step_a() { echo "Switch to new i686-pc-mingw32..." junction -d ${new_mingw_mnt} >nul junction -d ${wrk_mingw_mnt} >nul junction ${wrk_mingw_mnt} ${new_mingw_dir} >nul junction ${new_mingw_mnt} ${new_mingw_dir} >nul echo "Switch to new i686-pc-mingw32 DONE" } function step_b() { rm -rf ${wrk_wrk}/binutils/64 mkdir -p ${wrk_wrk}/binutils/64 cd ${wrk_wrk}/binutils/64 CFLAGS="${c_c_opt32}" \ CPPFLAGS="${c_c_opt32}" \ CXXFLAGS="${c_c_opt32}" \ LDFLAGS="${c_l_opt}" \ # ../binutils-2.20/configure \ ../src/configure \ --prefix=${c_prefix} \ --build=${c_arch32} \ --target=${c_arch64} \ --libdir=${c_libdir64} \ --includedir=${c_incdir64} \ --with-sysroot=${c_prefix} \ --enable-targets=${c_arch64},${c_arch32} \ --enable-static \ --disable-shared \ --disable-nls \ --enable-64-bit-bfd # --with-build-sysroot=${c_prefix} \ # --with-gmp=${c_prefix}/${c_arch32} \ # --with-ppl=${c_prefix}/${c_arch32} \ # --with-cloog=${c_prefix}/${c_arch32} \ # --with-host-libstdcxx='-lstdc++' \ # --with-gnu-ld \ # --disable-rpath \ # --disable-werror \ make -j5 all make install rm -rf ${c_prefix}/include # rm -rf ${c_prefix}/lib/libiberty.a # echo "Stripping ${c_prefix}/bin/*.exe" # strip -p --strip-debug --strip-unneeded ${c_prefix}/bin/*.exe # echo "Stripping ${c_prefix}/${c_arch64}/bin/*.exe" # strip -p --strip-debug --strip-unneeded ${c_prefix}/${c_arch64}/bin/*.exe # cleanup cd ${wrk_wrk} rm -rf ${wrk_wrk}/binutils/64 } function step_c() { rm -rf ${wrk_wrk}/mingw-w64/h64 mkdir -p ${wrk_wrk}/mingw-w64/h64 cd ${wrk_wrk}/mingw-w64/h64 ../src/mingw-w64-headers/configure \ --prefix=${c_prefix} \ --enable-sdk=all \ --build=${c_arch32} \ --host=${c_arch64} # --with-sdk=all \ make install rm -rf ${c_prefix}/include # cleanup cd ${wrk_wrk} rm -rf ${wrk_wrk}/mingw-w64/h64 } function step_d() { ggg="gcc-4.4.3" rm -rf ${wrk_wrk}/${ggg}/64 mkdir -p ${wrk_wrk}/${ggg}/64 cd ${wrk_wrk}/${ggg}/64 junction -d ${new_mingw_mnt}/mingw junction ${new_mingw_mnt}/mingw ${new_mingw_mnt}/${c_arch64} mv -f ../src/gcc/version.c ../src/gcc/version.c.original brnd="(x86_64.${k_arch_alias}.${k_gcc_brand})" sed -e "s/DEVPHASE REVISION/DEVPHASE \" ${brnd}\" REVISION/" ../src/gcc/version.c.original >../src/gcc/version.c c_opt="${c_c_opt64}" l_opt="${c_l_opt}" CFLAGS="${c_opt}" \ LDFLAGS="${l_opt}" \ CPPFLAGS="${c_opt}" \ CXXFLAGS="${c_opt}" \ BOOT_CFLAGS="${c_opt}" \ BOOT_LDFLAGS="${l_opt}" \ BOOT_CPPFLAGS="${c_opt}" \ BOOT_CXXFLAGS="${c_opt}" \ CFLAGS_FOR_TARGET="${c_opt}" \ LDFLAGS_FOR_TARGET="${l_opt}" \ CPPFLAGS_FOR_TARGET="${c_opt}" \ CXXFLAGS_FOR_TARGET="${c_opt}" \ ../src/configure \ --prefix=${c_prefix} \ --build=${c_arch32} \ --target=${c_arch64} \ --with-sysroot=${c_prefix} \ --with-build-sysroot=${c_prefix} \ --with-mpfr=${c_prefix}/${c_arch32} \ --with-gmp=${c_prefix}/${c_arch32} \ --with-ppl=${c_prefix}/${c_arch32} \ --with-cloog=${c_prefix}/${c_arch32} \ --with-mpc=${c_prefix}/${c_arch32} \ --with-host-libstdcxx='-lstdc++ -lsupc++' \ --disable-shared \ --enable-static \ --enable-threads=win32 \ --enable-languages=c,c++ \ --disable-rpath \ --disable-win32-registry \ --enable-version-specific-runtime-libs \ --with-system-zlib \ --disable-werror \ --disable-nls \ --disable-bootstrap \ --disable-debug # --disable-libstdcxx-debug #AR_FLAGS="rcs" \ # --enable-wchar_t \ # --disable-sjlj-exceptions \ # --enable-decimal-float \ # --with-gnu-ld \ # --with-gnu-as \ # --with-ppl=${c_prefix}/${c_arch32} \ # --with-cloog=${c_prefix}/${c_arch32} \ # Build make -j5 all-gcc make install-gcc # junction -d ${new_mingw_mnt}/mingw # rm -rf ${c_prefix}/include } function step_e() { rm -rf ${wrk_wrk}/mingw-w64/64 mkdir -p ${wrk_wrk}/mingw-w64/64 cd ${wrk_wrk}/mingw-w64/64 # junction -d ${new_mingw_mnt}/mingw # junction ${new_mingw_mnt}/mingw ${new_mingw_mnt}/${c_arch64} c_opt="${c_c_opt64}" l_opt="${c_l_opt}" CFLAGS="${c_opt}" \ LDFLAGS="${l_opt}" \ CPPFLAGS="${c_opt}" \ CXXFLAGS="${c_opt}" \ ../src/mingw-w64-crt/configure \ --prefix=${c_prefix} \ --host=${c_arch64} \ --with-sysroot=${c_prefix} \ --enable-lib64 \ --disable-lib32 \ --disable-libce \ --disable-shared \ --enable-static \ --enable-warnings=2 #AR_FLAGS="rcs" \ # --with-gnu-ld make -j3 all make install # junction -d ${new_mingw_mnt}/mingw # ${c_arch64}-strip -p --strip-debug `find ${c_libdir64} -name "*.o"` # ss=`find ${c_libdir64} -name "*.a"` # for i in $ss # do # echo "sripping \"$i\"" # ${c_arch64}-strip -p --strip-debug "$i" # done # cleanup cd ${wrk_wrk} rm -rf ${wrk_wrk}/mingw-w64/64 } function step_f() { ggg="gcc-4.4.3" cd ${wrk_wrk}/${ggg}/64 # junction -d ${new_mingw_mnt}/mingw # junction ${new_mingw_mnt}/mingw ${new_mingw_mnt}/${c_arch64} make -j5 all make install junction -d ${new_mingw_mnt}/mingw # Stripping # ${c_arch64}-strip -p --strip-debug --strip-unneeded ${new_mingw_mnt}/bin/${c_arch64}-*.exe # ${c_arch64}-strip -p --strip-debug --strip-unneeded `find ${new_mingw_mnt}/libexec/gcc/${c_arch64} -name "*.exe"` # ${c_arch64}-strip -p --strip-debug `find ${new_mingw_mnt}/lib/gcc/${c_arch64} -name "*.o"` # ${c_arch64}-strip -p --strip-debug `find ${new_mingw_mnt}/lib/gcc/${c_arch64} -name "*.a"` mv ../src/gcc/version.c.original ../src/gcc/version.c rm -f ${new_mingw_mnt}/lib/libiberty.a rm -rf ${new_mingw_mnt}/include # cleanup cd ${wrk_wrk} rm -rf ${wrk_wrk}/${ggg}/64 } function step_g() { cd ${wrk_wrk}/zlib-1.2.3/src make distclean rm -f ./*.exe c_opt="${c_c_opt64}" l_opt="${c_l_opt}" CFLAGS="${c_opt}" \ CXXFLAGS="${c_opt}" \ LDFLAGS="${l_opt}" \ AR_FLAGS="rcs" \ CC=${c_arch64}-gcc \ LD=${c_arch64}-ld \ RANLIB=${c_arch64}-ranlib \ AR="${c_arch64}-ar rcs" \ ./configure \ --prefix=${c_prefix} \ --libdir=${c_libdir64} \ --includedir=${c_incdir64} make all install # echo "Stripping ${c_libdir64}/libz.a" # strip -p --strip-debug ${c_libdir64}/libz.a # cleanup make distclean rm -f ./*.exe } function step_g1() { cd ${wrk_wrk}/bzip2-1.0.5/src make distclean # rm -f ./*.exe c_opt="${c_c_opt64}" l_opt="${c_l_opt}" CFLAGS="${c_opt}" \ CXXFLAGS="${c_opt}" \ LDFLAGS="${l_opt}" \ AR_FLAGS="rcs" \ CC=${c_arch64}-gcc \ LD=${c_arch64}-ld \ RANLIB=${c_arch64}-ranlib \ AR="${c_arch64}-ar" \ ./configure \ --prefix=${c_prefix} \ --libdir=${c_libdir64} \ --includedir=${c_incdir64} make all-libs cp -f libbz2.a ${c_libdir64}/libbz2.a cp -f bzlib.h ${c_incdir64}/bzlib.h #install # cleanup make distclean # rm -f ./*.exe # cd ${wrk_wrk} } function step_g2() { cd ${wrk_wrk}/pthreads/src make \ KOPT="${c_c_opt64}" \ CROSS="${c_arch64}-" \ clean GC-static cp -f libpthreadGC2.a ${c_libdir64}/ cp -f sched.h semaphore.h ${c_incdir64}/ cat pthread.h | sed -e "$ss0" >${c_incdir64}/pthread.h rm -f ./libpthreadGC2.a ./libpthreadGC2.stamp # cleanup make clean # rm -f ./*.exe cd ${wrk_wrk} } function step_fix() { ggg='4.4.3' ss1="mingw_new" ss2="mingw" ss0="s/$ss1/$ss2/" lib_list='libssp.la libssp_nonshared.la libstdc++.la libsupc++.la' pth=${new_mingw_mnt}/lib/gcc/${c_arch64}/${ggg}/ for ll in ${lib_list}; do cat ${pth}/${ll} | sed -e $ss0 >${pth}/${ll}.fix mv -f ${pth}/${ll}.fix ${pth}/${ll} done } function step_h() { echo "cross x86/x86_64 MINGW32 for \"${k_arch_alias}\" platform created by ${k_gcc_brand}" >${new_mingw_mnt}/arch.tag echo "Unmount \"${wrk_mingw_mnt}\"" junction -d ${wrk_mingw_mnt} >nul echo "Unmount \"${new_mingw_mnt}\"" junction -d ${new_mingw_mnt} >nul } for i; do step_${i} done