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