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