add support for building native windows executable on cygwin

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10082 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2007-11-01 22:02:20 +00:00
commit 389576b755

View file

@ -1,12 +1,17 @@
#!/bin/sh #!/bin/sh
# Build Windows distribution (swigwin-1.3.x.zip) -- requires running in a MinGW environment or on Linux using MinGW cross compiler # Build Windows distribution (swigwin-1.3.x.zip) -- requires running in either:
# - MinGW environment
# - Linux using MinGW cross compiler
# - Cygwin using MinGW compiler
# path to zip program # path to zip program
zip= zip=
# special options for configure # options for configure
configureoptions= extraconfigureoptions=
compileflags="-O2"
extracompileflags=
if test x$1 != x; then if test x$1 != x; then
version=$1 version=$1
@ -24,19 +29,30 @@ fi
uname=`uname -a` uname=`uname -a`
mingw=`echo "$uname" | grep -i mingw` mingw=`echo "$uname" | grep -i mingw`
linux=`echo "$uname" | grep -i linux` linux=`echo "$uname" | grep -i linux`
cygwin=`echo "$uname" | grep -i cygwin`
if test "$mingw"; then if test "$mingw"; then
echo "Building on MinGW"; echo "Building native Windows executable on MinGW";
zip=/c/cygwin/bin/zip if test x$zip = x; then
zip=/c/cygwin/bin/zip
fi
else else
if test "$linux"; then if test "$linux"; then
echo "Building on Linux" echo "Building native Windows executable on Linux"
if test x$zip = x; then if test x$zip = x; then
zip=zip zip=zip
configureoptions="--host=i586-mingw32msvc --build=i686-linux"
fi fi
extraconfigureoptions="--host=i586-mingw32msvc --build=i686-linux CXXFLAGS=-O2 CFLAGS=-O2"
else else
echo "Unknown platform. Requires either Linux or MinGW." if test "$cygwin"; then
exit 1; echo "Building native Windows executable on Cygwin"
if test x$zip = x; then
zip=zip
fi
compileflags="-O2 -mno-cygwin"
else
echo "Unknown platform. Requires either Linux or MinGW."
exit 1;
fi
fi fi
fi fi
@ -59,14 +75,13 @@ if test -f "$tarball"; then
if test -d $swigbasename; then if test -d $swigbasename; then
mv $swigbasename $swigwinbasename mv $swigbasename $swigwinbasename
tar -zxf ../$tarball tar -zxf ../$tarball
confoptions="$configureoptions CXXFLAGS=-O2 CFLAGS=-O2"
echo Running configure $confoptions
cd $swigbasename cd $swigbasename
./configure $confoptions echo Running: ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
echo "Compiling (quietly)..." echo "Compiling (quietly)..."
make > build.log make > build.log
echo "Simple check to see if swig.exe runs..." echo "Simple check to see if swig.exe runs..."
./swig.exe -version env LD_LIBRARY_PATH= PATH= ./swig.exe -version
echo "Creating $swigwinbasename.zip..." echo "Creating $swigwinbasename.zip..."
cd .. cd ..
cp $swigbasename/swig.exe $swigwinbasename cp $swigbasename/swig.exe $swigwinbasename