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