]> git.saurik.com Git - wxWidgets.git/blame - wxPython/b
reSWIGged
[wxWidgets.git] / wxPython / b
CommitLineData
bdac31ba
RD
1#!/bin/bash
2
3# Are we using bash on win32? If so source that file and then exit.
4if [ "$OSTYPE" = "cygwin" ]; then
5 source b.win32
6 exit
7fi
8
c368d904 9
cfe766c3
RD
10function getpyver {
11 if [ "$1" = "15" ]; then
12 PYVER=1.5
13 elif [ "$1" = "20" ]; then
14 PYVER=2.0
15 elif [ "$1" = "21" ]; then
16 PYVER=2.1
e6056257
RD
17 elif [ "$1" = "22" ]; then
18 PYVER=2.2
1e4a197e
RD
19 elif [ "$1" = "23" ]; then
20 PYVER=2.3
dd06808a
RD
21 elif [ "$1" = "24" ]; then
22 PYVER=2.4
cfe766c3
RD
23 else
24 echo You must specify Python version as first parameter.
25 exit
26 fi
27}
28
29getpyver $1
30shift
31
32python$PYVER -c "import sys;print '\n', sys.version, '\n'"
33
b6e5c445 34
c368d904 35SETUP="python$PYVER -u setup.py"
1c2accfc 36FLAGS="USE_SWIG=1 SWIG=/opt/swig/bin/swig"
c368d904 37OTHERFLAGS=""
3eac0818 38PORTFLAGS=""
1efe3523 39UNIFLAG="UNICODE=1"
0453da62 40
1c2accfc
RD
41
42
5924e48d 43if [ "$1" = "gtk1" -o "$1" = "gtk" ]; then
1efe3523
RD
44 PORTFLAGS="WXPORT=gtk"
45 UNIFLAG="UNICODE=0"
1c2accfc
RD
46 shift
47elif [ "$1" = "gtk2" ]; then
1efe3523
RD
48 PORTFLAGS="WXPORT=gtk2"
49 UNIFLAG="UNICODE=1"
1c2accfc
RD
50 shift
51fi
52
1efe3523
RD
53for p in $*; do
54 if [ "$p" = "UNICODE=0" -o "$p" = "UNICODE=1" ]; then
55 UNIFLAG=""
56 break
57 fi
58done
59
60FLAGS="$FLAGS $PORTFLAGS $UNIFLAG"
1c2accfc
RD
61
62
c368d904
RD
63
64
c368d904
RD
65# "c" --> clean
66if [ "$1" = "c" ]; then
67 shift
1e4a197e 68 CMD="$SETUP $FLAGS $OTHERFLAGS clean $*"
d14a1e28 69 OTHERCMD="rm -f wx/*.so"
c368d904 70
9e689c06
RD
71# "d" --> clean extension modules only
72elif [ "$1" = "d" ]; then
73 shift
d14a1e28 74 CMD="rm -f wx/*.so"
9e689c06 75
4dfaa61e
RD
76# "t" --> touch *.i files
77elif [ "$1" = "t" ]; then
78 shift
ca31b3da 79 CMD='find . -name "*.i" | xargs touch'
4dfaa61e 80
c368d904
RD
81# "i" --> install
82elif [ "$1" = "i" ]; then
83 shift
1e4a197e 84 CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*"
c368d904
RD
85
86# "s" --> source dist
87elif [ "$1" = "s" ]; then
88 shift
1e4a197e 89 CMD="$SETUP $OTHERFLAGS sdist $*"
c368d904
RD
90
91# "r" --> rpm dist
92elif [ "$1" = "r" ]; then
b6e5c445 93 WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"`
52ad59c2 94 for VER in 21 22; do
cfe766c3
RD
95 getpyver $VER
96
97 echo "*****************************************************************"
98 echo "******* Building wxPython for Python $PYVER"
99 echo "*****************************************************************"
100
52ad59c2 101 SETUP="python$PYVER -u setup.py"
cfe766c3
RD
102
103 # save the original
104 cp setup.py setup.py.save
105
106 # fix up setup.py the way we want...
107 sed "s/BUILD_GLCANVAS = /BUILD_GLCANVAS = 0 #/" < setup.py.save > setup.py.temp
108 sed "s/GL_ONLY = /GL_ONLY = 1 #/" < setup.py.temp > setup.py
1b62f00d 109
cfe766c3 110 # build wxPython-gl RPM
52ad59c2
RD
111 $SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER
112 ### --requires=python$PYVER
cfe766c3 113 rm dist/wxPython-gl*.tar.gz
1b62f00d 114
cfe766c3
RD
115 # Build wxPython RPM
116 cp setup.py setup.py.temp
117 sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py
52ad59c2
RD
118 $SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER
119 ### --requires=python$PYVER
1b62f00d 120
cfe766c3
RD
121 # put the oringal setup.py back
122 cp setup.py.save setup.py
123 rm setup.py.*
1b62f00d 124
cfe766c3
RD
125 # rename the binary RPM's
126 mv dist/wxPython-$WXPYVER-1.i386.rpm dist/wxPython-$WXPYVER-1-Py$VER.i386.rpm
127 mv dist/wxPython-gl-$WXPYVER-1.i386.rpm dist/wxPython-gl-$WXPYVER-1-Py$VER.i386.rpm
1b62f00d 128
cfe766c3 129 done
52ad59c2 130
cfe766c3 131 # rebuild the source dists without the munched up setup.py
cfe766c3 132 $SETUP $OTHERFLAGS bdist_rpm --source-only
1b62f00d
RD
133 exit 0
134
c368d904 135
8366ae93
RD
136# "f" --> FINAL (no debug)
137elif [ "$1" = "f" ]; then
138 shift
139 CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*"
140
c368d904
RD
141# (no command arg) --> normal build for development
142else
8366ae93 143 CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*"
c368d904
RD
144fi
145
146
147echo $CMD
0e947004 148eval $CMD
0b9c9522 149RC=$?
c368d904 150
0b9c9522 151if [ "$RC" = "0" -a "$OTHERCMD" != "" ]; then
c368d904
RD
152 echo $OTHERCMD
153 $OTHERCMD
0b9c9522 154 RC=$?
c368d904
RD
155fi
156
0b9c9522 157exit $RC