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