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