]>
Commit | Line | Data |
---|---|---|
bdac31ba RD |
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 | ||
c368d904 | 9 | |
cfe766c3 RD |
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 | |
e6056257 RD |
17 | elif [ "$1" = "22" ]; then |
18 | PYVER=2.2 | |
1e4a197e RD |
19 | elif [ "$1" = "23" ]; then |
20 | PYVER=2.3 | |
dd06808a RD |
21 | elif [ "$1" = "24" ]; then |
22 | PYVER=2.4 | |
cfe766c3 RD |
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 | ||
b6e5c445 | 34 | |
c368d904 | 35 | SETUP="python$PYVER -u setup.py" |
1c2accfc | 36 | FLAGS="USE_SWIG=1 SWIG=/opt/swig/bin/swig" |
c368d904 | 37 | OTHERFLAGS="" |
3eac0818 | 38 | PORTFLAGS="" |
0453da62 | 39 | |
1c2accfc RD |
40 | |
41 | ||
5924e48d RD |
42 | if [ "$1" = "gtk1" -o "$1" = "gtk" ]; then |
43 | PORTFLAGS="WXPORT=gtk UNICODE=0" | |
1c2accfc RD |
44 | shift |
45 | elif [ "$1" = "gtk2" ]; then | |
46 | PORTFLAGS="WXPORT=gtk2 UNICODE=1" | |
47 | shift | |
48 | fi | |
49 | ||
50 | FLAGS="$FLAGS $PORTFLAGS" | |
51 | ||
52 | ||
c368d904 RD |
53 | |
54 | ||
c368d904 RD |
55 | # "c" --> clean |
56 | if [ "$1" = "c" ]; then | |
57 | shift | |
1e4a197e | 58 | CMD="$SETUP $FLAGS $OTHERFLAGS clean $*" |
d14a1e28 | 59 | OTHERCMD="rm -f wx/*.so" |
c368d904 | 60 | |
9e689c06 RD |
61 | # "d" --> clean extension modules only |
62 | elif [ "$1" = "d" ]; then | |
63 | shift | |
d14a1e28 | 64 | CMD="rm -f wx/*.so" |
9e689c06 | 65 | |
4dfaa61e RD |
66 | # "t" --> touch *.i files |
67 | elif [ "$1" = "t" ]; then | |
68 | shift | |
ca31b3da | 69 | CMD='find . -name "*.i" | xargs touch' |
4dfaa61e | 70 | |
c368d904 RD |
71 | # "i" --> install |
72 | elif [ "$1" = "i" ]; then | |
73 | shift | |
1e4a197e | 74 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*" |
c368d904 RD |
75 | |
76 | # "s" --> source dist | |
77 | elif [ "$1" = "s" ]; then | |
78 | shift | |
1e4a197e | 79 | CMD="$SETUP $OTHERFLAGS sdist $*" |
c368d904 RD |
80 | |
81 | # "r" --> rpm dist | |
82 | elif [ "$1" = "r" ]; then | |
b6e5c445 | 83 | WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"` |
52ad59c2 | 84 | for VER in 21 22; do |
cfe766c3 RD |
85 | getpyver $VER |
86 | ||
87 | echo "*****************************************************************" | |
88 | echo "******* Building wxPython for Python $PYVER" | |
89 | echo "*****************************************************************" | |
90 | ||
52ad59c2 | 91 | SETUP="python$PYVER -u setup.py" |
cfe766c3 RD |
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 | |
1b62f00d | 99 | |
cfe766c3 | 100 | # build wxPython-gl RPM |
52ad59c2 RD |
101 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER |
102 | ### --requires=python$PYVER | |
cfe766c3 | 103 | rm dist/wxPython-gl*.tar.gz |
1b62f00d | 104 | |
cfe766c3 RD |
105 | # Build wxPython RPM |
106 | cp setup.py setup.py.temp | |
107 | sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py | |
52ad59c2 RD |
108 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER |
109 | ### --requires=python$PYVER | |
1b62f00d | 110 | |
cfe766c3 RD |
111 | # put the oringal setup.py back |
112 | cp setup.py.save setup.py | |
113 | rm setup.py.* | |
1b62f00d | 114 | |
cfe766c3 RD |
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 | |
1b62f00d | 118 | |
cfe766c3 | 119 | done |
52ad59c2 | 120 | |
cfe766c3 | 121 | # rebuild the source dists without the munched up setup.py |
cfe766c3 | 122 | $SETUP $OTHERFLAGS bdist_rpm --source-only |
1b62f00d RD |
123 | exit 0 |
124 | ||
c368d904 | 125 | |
8366ae93 RD |
126 | # "f" --> FINAL (no debug) |
127 | elif [ "$1" = "f" ]; then | |
128 | shift | |
129 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*" | |
130 | ||
c368d904 RD |
131 | # (no command arg) --> normal build for development |
132 | else | |
8366ae93 | 133 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*" |
c368d904 RD |
134 | fi |
135 | ||
136 | ||
137 | echo $CMD | |
0e947004 | 138 | eval $CMD |
0b9c9522 | 139 | RC=$? |
c368d904 | 140 | |
0b9c9522 | 141 | if [ "$RC" = "0" -a "$OTHERCMD" != "" ]; then |
c368d904 RD |
142 | echo $OTHERCMD |
143 | $OTHERCMD | |
0b9c9522 | 144 | RC=$? |
c368d904 RD |
145 | fi |
146 | ||
0b9c9522 | 147 | exit $RC |