comparison lib/swig/swigwin-2.0.11/Tools/mkwindows.sh @ 1899:b3009adc0e2f

Adding swig, gitignore, hgignore
author Nomad
date Mon, 21 Oct 2013 10:42:27 +0200
parents
children
comparison
equal deleted inserted replaced
1867:eb580660bbbb 1899:b3009adc0e2f
1 #!/bin/sh
2
3 # Build Windows distribution (swigwin-2.0.x.zip) from source tarball (swig-2.0.x.tar.gz)
4 # Requires running in either:
5 # - MinGW environment
6 # - Linux using MinGW cross compiler
7 # - Cygwin using MinGW compiler
8
9 # path to zip program
10 zip=
11
12 # options for configure
13 extraconfigureoptions=
14 compileflags="-O2"
15 extracompileflags=
16
17 if test x$1 != x; then
18 version=$1
19 if test x$2 != x; then
20 zip=$2;
21 echo zip: $zip;
22 fi
23 else
24 echo "Usage: mkwindows.sh version [zip]"
25 echo " Build SWIG Windows distribution from source tarball. Works on Cygwin, MinGW or Linux"
26 echo " version should be 2.0.x"
27 echo " zip is full path to zip program - default is /c/cygwin/bin/zip on MinGW, zip on Linux and Cygwin"
28 exit 1
29 fi
30
31 uname=`uname -a`
32 mingw=`echo "$uname" | grep -i mingw`
33 linux=`echo "$uname" | grep -i linux`
34 cygwin=`echo "$uname" | grep -i cygwin`
35 if test "$mingw"; then
36 echo "Building native Windows executable on MinGW";
37 if test x$zip = x; then
38 zip=/c/cygwin/bin/zip
39 fi
40 else
41 if test "$linux"; then
42 echo "Building native Windows executable on Linux"
43 if test x$zip = x; then
44 zip=zip
45 fi
46 extraconfigureoptions="--host=i586-mingw32msvc --build=i686-linux"
47 else
48 if test "$cygwin"; then
49 echo "Building native Windows executable on Cygwin"
50 if test x$zip = x; then
51 zip=zip
52 fi
53 compileflags="-O2 -mno-cygwin"
54 else
55 echo "Unknown platform. Requires either Linux or MinGW."
56 exit 1;
57 fi
58 fi
59 fi
60
61 swigbasename=swig-$version
62 swigwinbasename=swigwin-$version
63 tarball=$swigbasename.tar.gz
64 pcre_tarball=`ls pcre-*.tar.*`
65
66 if ! test -f "$pcre_tarball"; then
67 echo "Could not find PCRE tarball. Please download a PCRE source tarball from http://www.pcre.org"
68 echo "and place in the same directory as the SWIG tarball."
69 exit 1
70 fi
71
72 if test -f "$tarball"; then
73 builddir=build-$version
74 if test -e $builddir; then
75 echo "Deleting directory $builddir..."
76 rm -rf $builddir
77 fi
78 echo "Creating directory $builddir..."
79 mkdir $builddir
80 cd $builddir
81 echo "Unzipping tarball..."
82 tar -zxf ../$tarball
83 sleep 2 # fix strange not finding newly created directory
84 if test -d $swigbasename; then
85 mv $swigbasename $swigwinbasename
86 tar -zxf ../$tarball
87 cd $swigbasename
88 (cd ../.. && cp $pcre_tarball $builddir/$swigbasename)
89 echo Running: Tools/pcre-build.sh $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
90 ./Tools/pcre-build.sh $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags" || exit 1
91 echo Running: ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
92 ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags" || exit 1
93 echo "Compiling (quietly)..."
94 make > build.log
95 echo "Simple check to see if swig.exe runs..."
96 env LD_LIBRARY_PATH= PATH= ./swig.exe -version || exit 1
97 echo "Simple check to see if ccache-swig.exe runs..."
98 env LD_LIBRARY_PATH= PATH= ./CCache/ccache-swig.exe -V || exit 1
99 echo "Creating $swigwinbasename.zip..."
100 cd ..
101 cp $swigbasename/swig.exe $swigwinbasename
102 cp $swigbasename/CCache/ccache-swig.exe $swigwinbasename/CCache
103 cp $swigbasename/Lib/swigwarn.swg $swigwinbasename/Lib
104 sleep 2 # fix strange not finding swig.exe
105 echo "Unzip into a directory of your choice. Please read the README file as well as Doc\Manual\Windows.html for installation instructions." > swig_windows_zip_comments.txt
106 rm -f ../$swigwinbasename.zip
107 $zip -q -r -9 -z < swig_windows_zip_comments.txt ../$swigwinbasename.zip $swigwinbasename
108 rm -f swig_windows_zip_comments.txt
109 echo "Cleaning up..."
110 cd ..
111 rm -rf $builddir
112 echo "Finished building $swigwinbasename.zip"
113 else
114 echo "Expecting tarball to create directory: $swigbasename but it does not exist"
115 exit 1
116 fi
117 else
118 echo tarball missing: $tarball
119 exit 1
120 fi
121
122 exit 0