]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | function getpyver { | |
4 | if [ "$1" = "15" ]; then | |
5 | PYVER=1.5 | |
6 | elif [ "$1" = "20" ]; then | |
7 | PYVER=2.0 | |
8 | elif [ "$1" = "21" ]; then | |
9 | PYVER=2.1 | |
10 | elif [ "$1" = "22" ]; then | |
11 | PYVER=2.2 | |
12 | elif [ "$1" = "23" ]; then | |
13 | PYVER=2.3 | |
14 | else | |
15 | echo You must specify Python version as first parameter. | |
16 | exit | |
17 | fi | |
18 | } | |
19 | ||
20 | getpyver $1 | |
21 | shift | |
22 | ||
23 | python$PYVER -c "import sys;print '\n', sys.version, '\n'" | |
24 | ||
25 | ||
26 | SETUP="python$PYVER -u setup.py" | |
27 | FLAGS="USE_SWIG=1 SWIG=/opt/swig/bin/swig" | |
28 | OTHERFLAGS="" | |
29 | PORTFLAGS="" | |
30 | ||
31 | ||
32 | if [ "$1" = "gtk1" ]; then | |
33 | PORTFLAGS="" | |
34 | shift | |
35 | elif [ "$1" = "gtk2" ]; then | |
36 | PORTFLAGS="WXPORT=gtk2 UNICODE=1" | |
37 | shift | |
38 | fi | |
39 | ||
40 | FLAGS="$FLAGS $PORTFLAGS" | |
41 | ||
42 | ||
43 | ||
44 | ||
45 | # "c" --> clean | |
46 | if [ "$1" = "c" ]; then | |
47 | shift | |
48 | CMD="$SETUP $FLAGS $OTHERFLAGS clean $*" | |
49 | OTHERCMD="rm -f wx/*.so" | |
50 | ||
51 | # "d" --> clean extension modules only | |
52 | elif [ "$1" = "d" ]; then | |
53 | shift | |
54 | CMD="rm -f wx/*.so" | |
55 | ||
56 | # "t" --> touch *.i files | |
57 | elif [ "$1" = "t" ]; then | |
58 | shift | |
59 | CMD='find . -name "*.i" | xargs touch' | |
60 | ||
61 | # "i" --> install | |
62 | elif [ "$1" = "i" ]; then | |
63 | shift | |
64 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*" | |
65 | ||
66 | # "s" --> source dist | |
67 | elif [ "$1" = "s" ]; then | |
68 | shift | |
69 | CMD="$SETUP $OTHERFLAGS sdist $*" | |
70 | ||
71 | # "r" --> rpm dist | |
72 | elif [ "$1" = "r" ]; then | |
73 | WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"` | |
74 | for VER in 21 22; do | |
75 | getpyver $VER | |
76 | ||
77 | echo "*****************************************************************" | |
78 | echo "******* Building wxPython for Python $PYVER" | |
79 | echo "*****************************************************************" | |
80 | ||
81 | SETUP="python$PYVER -u setup.py" | |
82 | ||
83 | # save the original | |
84 | cp setup.py setup.py.save | |
85 | ||
86 | # fix up setup.py the way we want... | |
87 | sed "s/BUILD_GLCANVAS = /BUILD_GLCANVAS = 0 #/" < setup.py.save > setup.py.temp | |
88 | sed "s/GL_ONLY = /GL_ONLY = 1 #/" < setup.py.temp > setup.py | |
89 | ||
90 | # build wxPython-gl RPM | |
91 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER | |
92 | ### --requires=python$PYVER | |
93 | rm dist/wxPython-gl*.tar.gz | |
94 | ||
95 | # Build wxPython RPM | |
96 | cp setup.py setup.py.temp | |
97 | sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py | |
98 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER | |
99 | ### --requires=python$PYVER | |
100 | ||
101 | # put the oringal setup.py back | |
102 | cp setup.py.save setup.py | |
103 | rm setup.py.* | |
104 | ||
105 | # rename the binary RPM's | |
106 | mv dist/wxPython-$WXPYVER-1.i386.rpm dist/wxPython-$WXPYVER-1-Py$VER.i386.rpm | |
107 | mv dist/wxPython-gl-$WXPYVER-1.i386.rpm dist/wxPython-gl-$WXPYVER-1-Py$VER.i386.rpm | |
108 | ||
109 | done | |
110 | ||
111 | # rebuild the source dists without the munched up setup.py | |
112 | $SETUP $OTHERFLAGS bdist_rpm --source-only | |
113 | exit 0 | |
114 | ||
115 | ||
116 | # "f" --> FINAL (no debug) | |
117 | elif [ "$1" = "f" ]; then | |
118 | shift | |
119 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*" | |
120 | ||
121 | # (no command arg) --> normal build for development | |
122 | else | |
123 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*" | |
124 | fi | |
125 | ||
126 | ||
127 | echo $CMD | |
128 | eval $CMD | |
129 | RC=$? | |
130 | ||
131 | if [ "$RC" = "0" -a "$OTHERCMD" != "" ]; then | |
132 | echo $OTHERCMD | |
133 | $OTHERCMD | |
134 | RC=$? | |
135 | fi | |
136 | ||
137 | exit $RC |