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