annotate lib/swig/swigwin-2.0.11/Tools/mkwindows.sh @ 1983:5cd26f2c6904

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