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