]>
Commit | Line | Data |
---|---|---|
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 | 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 | ||
50 | ||
51 | ||
52 | # "c" --> clean | |
53 | if [ "$1" = "c" ]; then | |
54 | shift | |
55 | CMD="$SETUP $FLAGS $OTHERFLAGS clean $*" | |
56 | OTHERCMD="rm -f wx/*.so" | |
57 | ||
58 | # "d" --> clean extension modules only | |
59 | elif [ "$1" = "d" ]; then | |
60 | shift | |
61 | CMD="rm -f wx/*.so" | |
62 | ||
63 | # "t" --> touch *.i files | |
64 | elif [ "$1" = "t" ]; then | |
65 | shift | |
66 | CMD='find . -name "*.i" | xargs touch' | |
67 | ||
68 | # "i" --> install | |
69 | elif [ "$1" = "i" ]; then | |
70 | shift | |
71 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*" | |
72 | ||
73 | # "s" --> source dist | |
74 | elif [ "$1" = "s" ]; then | |
75 | shift | |
76 | CMD="$SETUP $OTHERFLAGS sdist $*" | |
77 | ||
78 | # "r" --> rpm dist | |
79 | elif [ "$1" = "r" ]; then | |
80 | WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"` | |
81 | for VER in 21 22; do | |
82 | getpyver $VER | |
83 | ||
84 | echo "*****************************************************************" | |
85 | echo "******* Building wxPython for Python $PYVER" | |
86 | echo "*****************************************************************" | |
87 | ||
88 | SETUP="python$PYVER -u setup.py" | |
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 | |
96 | ||
97 | # build wxPython-gl RPM | |
98 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER | |
99 | ### --requires=python$PYVER | |
100 | rm dist/wxPython-gl*.tar.gz | |
101 | ||
102 | # Build wxPython RPM | |
103 | cp setup.py setup.py.temp | |
104 | sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py | |
105 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER | |
106 | ### --requires=python$PYVER | |
107 | ||
108 | # put the oringal setup.py back | |
109 | cp setup.py.save setup.py | |
110 | rm setup.py.* | |
111 | ||
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 | |
115 | ||
116 | done | |
117 | ||
118 | # rebuild the source dists without the munched up setup.py | |
119 | $SETUP $OTHERFLAGS bdist_rpm --source-only | |
120 | exit 0 | |
121 | ||
122 | ||
123 | # "f" --> FINAL (no debug) | |
124 | elif [ "$1" = "f" ]; then | |
125 | shift | |
126 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*" | |
127 | ||
128 | # (no command arg) --> normal build for development | |
129 | else | |
130 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*" | |
131 | fi | |
132 | ||
133 | ||
134 | echo $CMD | |
135 | eval $CMD | |
136 | RC=$? | |
137 | ||
138 | if [ "$RC" = "0" -a "$OTHERCMD" != "" ]; then | |
139 | echo $OTHERCMD | |
140 | $OTHERCMD | |
141 | RC=$? | |
142 | fi | |
143 | ||
144 | exit $RC |