From 551b955b8d7755ae24cb258a847e4be692b66228 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Sat, 2 Nov 2013 15:04:28 -0400 Subject: [PATCH] updated MinGW scripts --- .gitignore | 4 +++ BUILD-MINGW.sh => BUILD-MINGW32.sh | 43 +++++++++++++++++------------- BUILD-MINGW64.sh | 15 ++++++++--- 3 files changed, 40 insertions(+), 22 deletions(-) rename BUILD-MINGW.sh => BUILD-MINGW32.sh (62%) diff --git a/.gitignore b/.gitignore index a72addf..3e75b31 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.dSYM *.mex* *.oct +*.zip # generated code api/nlopt.f @@ -21,6 +22,9 @@ swig/nlopt-python.cpp swig/nlopt.py swig/nlopt.scm swig/nlopt.scm.in +README-WINDOWS +mingw32 +mingw64 # executables test/testopt diff --git a/BUILD-MINGW.sh b/BUILD-MINGW32.sh similarity index 62% rename from BUILD-MINGW.sh rename to BUILD-MINGW32.sh index 142ee57..1a3d18c 100755 --- a/BUILD-MINGW.sh +++ b/BUILD-MINGW32.sh @@ -1,20 +1,25 @@ #!/bin/sh -set -e +set -ev -rm -rf mingw +rm -rf mingw32 +make distclean || true -./configure --prefix=`pwd`/mingw --host=i586-mingw32msvc --enable-shared --disable-static --without-matlab --without-octave --without-python --without-guile --without-threadlocal && make -j4 && make install +echo "COMPILING..." -cd mingw/bin +./configure --prefix=`pwd`/mingw32 --host=i686-w64-mingw32 --enable-shared --disable-static --without-matlab --without-octave --without-python --without-guile --without-threadlocal && make -j4 && make install + +echo "POST-PROCESSING..." + +cd mingw32/bin for dll in *.dll; do def=`basename $dll .dll`.def echo "LIBRARY $dll" > $def echo EXPORTS >> $def - i586-mingw32msvc-nm $dll | grep ' T _' | sed 's/.* T _//' | egrep 'nlopt|nlo_' >> $def + i686-w64-mingw32-nm $dll | grep ' T _' | sed 's/.* T _//' | egrep 'nlopt|nlo_' >> $def done cd ../.. -perl -pi -e 's,^ * #define NLOPT_DLL,*/\n#define NLOPT_DLL\n/*,' mingw/include/nlopt.h +perl -pi -e 's,^ * #define NLOPT_DLL,*/\n#define NLOPT_DLL\n/*,' mingw32/include/nlopt.h cat > README-WINDOWS <> README-WINDOWS +i686-w64-mingw32-gcc --version |head -1 >> README-WINDOWS -# grep -v "nlopt-util.h" octave/nlopt_minimize_constrained-mex.c > mingw/nlopt_minimize_constrained.c +# grep -v "nlopt-util.h" octave/nlopt_minimize_constrained-mex.c > mingw32/nlopt_minimize_constrained.c nlopt_vers=`grep PACKAGE_VERSION config.h |cut -d" " -f3 |tr -d \"` -mkdir mingw/matlab +mkdir mingw32/matlab cd octave -cp `grep 'MFILES =' Makefile.am | cut -d= -f2` ../mingw/matlab -cp `grep 'm_DATA =' Makefile.am | cut -d\) -f2` ../mingw/matlab -cp nlopt_optimize-mex.c ../mingw/matlab/nlopt_optimize.c +cp `grep 'MFILES =' Makefile.am | cut -d= -f2` ../mingw32/matlab +cp `grep 'm_DATA =' Makefile.am | cut -d\) -f2` ../mingw32/matlab +cp nlopt_optimize-mex.c ../mingw32/matlab/nlopt_optimize.c cd .. -mkdir mingw/python -cp swig/nlopt.py swig/nlopt-python.cpp mingw/python -cat > mingw/python/setup.py < mingw32/python/setup.py < $def echo EXPORTS >> $def - amd64-mingw32msvc-nm $dll | grep ' T _' | sed 's/.* T _//' | egrep 'nlopt|nlo_' >> $def + x86_64-w64-mingw32-nm $dll | grep ' T ' | sed 's/.* T //' | egrep 'nlopt|nlo_' >> $def done cd ../.. @@ -35,7 +40,7 @@ installed), do: They were compiled by the GNU C compiler for MinGW, specifically: EOF -amd64-mingw32msvc-gcc --version |head -1 >> README-WINDOWS +x86_64-w64-mingw32-gcc --version |head -1 >> README-WINDOWS # grep -v "nlopt-util.h" octave/nlopt_minimize_constrained-mex.c > mingw64/nlopt_minimize_constrained.c @@ -73,6 +78,8 @@ rm -f $zip zip -vj $zip mingw64/bin/*.dll mingw64/bin/*.exe zip -vjgl $zip mingw64/bin/*.def mingw64/include/* mingw64/python/* README COPYING COPYRIGHT NEWS README-WINDOWS +echo "PACKAGING $zip..." + cd mingw64 zip -vgl ../$zip matlab/* cd .. -- 2.30.2