#!/bin/bash -x ### ## [snip] a bunch of information concerning mingw prereqs and system ## setup; default cygwin should be okay as long as the following ## are installed: ## libiconv, gettext, zlib, flex, bison, autoconf25, autoconf21, ## automake19, automake18, automake17, libtool, gcc-3.4.x, gmp, ## mpfr ## ## [M] means mingw-specific ## ## GCC CONFIGURE: ## ## NOTES: ## [M] (1) must use relative path to configure (PR24382) ## [M] (2) must specify --with-as=/path/to/as.exe and --with-ld=/path/to/ld.exe (PR24382) ## [M] (3) if --prefix is not /mingw, then you need to extract w32api and mingw-runtime ## packages into the prefix tree. ## (4) --disable-werror is required on mingw due to PR25502 ## (5) Java screwed up ## (a) libjava must be compiled with -fno-omit-frame-pointer ; unfortunately, ## passing the variables in to configure (c.f. BOOT_CFLAGS) does not propagate ## them to the libjava configury. So, we have to put them in the environment ## instead -- and that includes plain old "LDFLAGS" because libjava has no ## GCJ-specific LD var AND doesn't get its value passed in. ## The patch to libjava/configure.host MAY fix this problem without requiring ## the environment variables to be set -- but we ALSO need them set so that ## libiconv and libintl are found! ## *** BUT --- even that won't work, because libjava is "horribly broken" on mingw. ## so, we do not build the java frontend. ## (b) libjava with SJLJ requires this patch http://gcc.gnu.org/ml/java/2006-04/msg00025.html ## but given #5 it's a moot point. ## (c) Even so, get a wierd error building libjava classpath: ## ../../../../../gcc-4.1.0-svn/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java:0: ## fatal error: can't open /usr/local/src/gcc/gcc-4.1.0-svn/libjava/gnu/CORBA/DynAn/gnuDynValue.java: ## No such file or directory ## when the file in question DOES in fact exist. (c.f. http://gcc.gnu.org/ml/java/2006-03/msg00043.html) ## There are also oddities in the .deps files in that they include relative paths with backslashes, ## which *does not work* with msys's path conversion stuff: ## C:\foo\bar is okay. /foo/bar or ../../foo/bar is okay. ## NONE OF ..\..\foo\bar nor foo\bar nor \foo\bar work. ## But again, given 5a...it's moot. ## (d) see http://tjlaurenzo.blogspot.com/2005/08/building-libgcjdll-for-mingw-with-gcc.html ## http://rmathew.com/articles/gcj/bldgcj.html ## + http://gcc.gnu.org/ml/java/2006-04/msg00057.html ## http://gcc.gnu.org/ml/java/2006-02/msg00047.html && thread ## http://gcc.gnu.org/ml/java/2006-04/msg00025.html && thread ## ## (6) both java and ada would probably work better with DWARF2 instead of SJLJ (except gcj ## needs a little more work to properly support DWARF2/mingw). C++ would be ## a lot faster with DWARF2. But then you can't catch exceptions thrown by your ## methods when they are passed as callbacks to Win32API functions -- a very common ## paradigm in win32 GUI programming. ## ## set up some environment variables. CPPFLAGS must be ## handled special, because it is not passed down to subconfigures export PATH=.:/usr/local/bin:/gnuwin32/bin:/mingw/bin:/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Util/python24:/c/Util/Subversion/bin export IP="-I/usr/local/include" export LP="-L/usr/local/lib" export CPPFLAGS="${IP}" ## export LIBGCJ_CFLAGS="-ffloat-store -fno-omit-frame-pointer ${IP}" ## export LIBGCJ_CXXFLAGS="-ffloat-store -fno-omit-frame-pointer ${IP}" ## export LIBGCJ_JAVAFLAGS="-ffloat-store -fno-omit-frame-pointer ${IP}" ## export GCJFLAGS="-g -O2 -fno-omit-frame-pointer ${IP}" ## export LDFLAGS="${LP}" srcdir=../gcc-4.1.0-svn srcdir_abs=$(cd ${srcdir} ; pwd) instdir=/usr/local/src/gcc/gcc-4.1.0-inst-release builddir=/usr/local/src/gcc/gcc-4.1.0-build-release buildlog=/usr/local/src/gcc/gcc-4.1.0-make-bootstrap.log instlog=/usr/local/src/gcc/gcc-4.1.0-make-install.log # CFLAGS="-O2 -g ${IP}" CXXFLAGS="-O2 -g ${IP}" LDFLAGS="${LP}" \ # BOOT_CFLAGS="-O2 -g ${IP}" BOOT_CXXFLAGS="-O2 -g ${IP}" BOOT_LDFLAGS="${LP}" \ # /bin/sh ${srcdir}/configure \ # --with-gcc --with-gnu-ld --with-gnu-as \ # --with-as=/mingw/bin/as.exe --with-ld=/mingw/bin/ld.exe \ # --with-gmp=/usr/local --with-mpfr=/usr/local \ # --without-included-gettext --with-libintl-prefix=/usr/local --enable-nls \ # --with-libiconv-prefix=/usr/local \ # --host=mingw32 --target=mingw32 --prefix=/mingw \ # --enable-threads --enable-languages=c,c++,fortran \ # --enable-version-specific-runtime-libs \ # --disable-win32-registry --disable-shared --enable-sjlj-exceptions \ # --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm \ # --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization \ # --enable-libstdcxx-debug \ # --enable-bootstrap --disable-werror # # #make bootstrap | tee ${buildlog} 2>&1 ## ## OR (takes longer but get a faster compiler) ## EXCEPT that it is currently (4.1.0) broken on mingw ## http://spaces.msn.com/yaekees/blog/cns!1955EE8C6707277A!174.entry?_c11_blogpart_blogpart=blogview&_c=blogpart#permalink ## # make profiledbootstrap ## need the following to avoid a bug in make install # make stage3-start # make install DESTDIR=${instdir} | tee ${instlog} 2>&1 pushd ${instdir}/mingw/lib/gcc/mingw32/4.1.0 dlltool --output-def libstdc++.def --export-all libstdc++.a dlltool --output-def libsupc++.def --export-all libsupc++.a dlltool --output-def libgcc.def --export-all libgcc.a cd debug dlltool --output-def libstdc++.def --export-all libstdc++.a cd .. LIBVER=$(grep libtool_VERSION= ${srcdir}/libstdc++-v3/configure | sed -e 's/libtool_VERSION=//') LIBVER_c=$(echo $LIBVER | awk -F: '{print $1}') LIBVER_r=$(echo $LIBVER | awk -F: '{print $2}') LIBVER_a=$(echo $LIBVER | awk -F: '{print $3}') LIBSTDCPP_DLLVER=$(($LIBVER_c - $LIBVER_a)) ## no need for a DLLVER for libgcc; it's guaranteed to only add functions, ## never remove or change thier signature. So it'll always be backwards-compatible. ## It's probably not necessary, but we'll use the LIBSTDCPP_DLLVER for ## libsupc++ as well (after all, all of libsupc++ appears IN libstdc++ ## so if libsupc++ changes in a backwards-non-compatible way, then libstdc++ ## will, too -- and the gcc folks will modify its LIBVER. The downside here ## is that if libsupc++ is unchanged or remains backwards compatible, but ## some other part of libstdc++ changes badly -- we will unnecessarily bump ## libsupc++'s DLLNUM. 'sokay. ${builddir}/stage3-gcc/xgcc -shared -olibstdc++-${LIBSTDCPP_DLLVER}.dll \ -Wl,--out-implib,libstdc++-${LIBSTDCPP_DLLVER}.dll.a \ ./libstdc++.def ./libstdc++.a ln libstdc++-${LIBSTDCPP_DLLVER}.dll.a libstdc++.dll.a ${builddir}/stage3-gcc/xgcc -shared -olibsupc++-${LIBSTDCPP_DLLVER}.dll \ -Wl,--out-implib,libsupc++-${LIBSTDCPP_DLLVER}.dll.a \ ./libsupc++.def ./libsupc++.a ln libsupc++-${LIBSTDCPP_DLLVER}.dll.a libsupc++.dll.a ${builddir}/stage3-gcc/xgcc -shared -olibgcc.dll \ -Wl,--out-implib,libgcc.dll.a \ ./libgcc.def ./libgcc.a #no versioned implib, no need to ln cd debug ${builddir}/stage3-gcc/xgcc -shared -olibstdc++-${LIBSTDCPP_DLLVER}.dll \ -Wl,--out-implib,libstdc++-${LIBSTDCPP_DLLVER}.dll.a \ ./libstdc++.def ./libstdc++.a ln libstdc++-${LIBSTDCPP_DLLVER}.dll.a libstdc++.dll.a cd .. ## for shared fortran, go here (and you'll need your intact build directory! ## http://www.g95.org/src.html#Support ## MUNGE the .la files mv libstdc++.la libstdc++.la.SAVE cat libstdc++.la.SAVE |\ sed -e "s/^dlname=.*\$/dlname='libstdc++-${LIBSTDCPP_DLLVER}.dll'/" \ -e "s/^library_names=.*\$/library_names='libstdc++.dll.a'/" >\ libstdc++.la mv libsupc++.la libsupc++.la.SAVE cat libsupc++.la.SAVE |\ sed -e "s/^dlname=.*\$/dlname='libsupc++-${LIBSTDCPP_DLLVER}.dll'/" \ -e "s/^library_names=.*\$/library_names='libsupc++.dll.a'/" >\ libsupc++.la cd debug mv libstdc++.la libstdc++.la.SAVE cat libstdc++.la.SAVE |\ sed -e "s/^dlname=.*\$/dlname='libstdc++-${LIBSTDCPP_DLLVER}.dll'/" \ -e "s/^library_names=.*\$/library_names='libstdc++.dll.a'/" >\ libstdc++.la cd .. ## And create the links (curdir is ${instdir}/mingw/gcc/mingw32/4.1.0) pushd ${instdir}/mingw/bin ln ../lib/gcc/mingw32/4.1.0/libstdc++-${LIBSTDCPP_DLLVER}.dll . ln ../lib/gcc/mingw32/4.1.0/libsupc++-${LIBSTDCPP_DLLVER}.dll . ln ../lib/gcc/mingw32/4.1.0/libgcc.dll . popd popd