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