]>
Commit | Line | Data |
---|---|---|
1e4a197e RD |
1 | #!/bin/sh -e |
2 | #---------------------------------------------------------------------- | |
3 | # Build wxMac and wxPythonOSX from the tarball and then make an | |
4 | # Installer package out of it. | |
5 | ||
6 | spectemplate=distrib/wxPythonFull.spec.in | |
7 | ||
8 | if [ ! -d wxPython -o ! -e ${spectemplate} ]; then | |
9 | echo "Please run this script from the root wxPython directory." | |
10 | exit 1 | |
11 | fi | |
12 | ||
13 | #---------------------------------------------------------------------- | |
14 | # Check Parameters | |
15 | ||
16 | function usage { | |
17 | echo "" | |
dd35b09a | 18 | echo "Usage: $0 [panther|jaguar] [command flags...]" |
1e4a197e | 19 | echo "" |
c6387bc1 RD |
20 | echo " panther Build for Apple's python in /usr/bin, such as on Panther" |
21 | echo " jaguar Build for a python in /usr/local/bin, such as on Jaguar" | |
46456f61 RD |
22 | echo "" |
23 | echo "optional command flags:" | |
1e4a197e RD |
24 | echo " skiptar Don't unpack the tarball" |
25 | echo " use_cvs Use the CVS workspace instead of a tarfile" | |
26 | echo " skipconfig Don't run configure" | |
27 | echo " skipbuild Don't build wxWindows or wxPython" | |
28 | echo " skipinstall Don't do the installation step" | |
29 | echo " skipdmg Don't make the package or diskimage" | |
30 | echo " skipclean Don't do the cleanup at the end" | |
46456f61 | 31 | echo "" |
1e4a197e RD |
32 | } |
33 | ||
34 | ||
46456f61 | 35 | if [ $# -lt 1 ]; then |
1e4a197e RD |
36 | usage |
37 | exit 1 | |
38 | fi | |
39 | ||
46456f61 RD |
40 | KIND=$1 |
41 | case $KIND in | |
c6387bc1 RD |
42 | panther) PYTHON=/usr/bin/python ;; |
43 | jaguar) PYTHON=/usr/local/bin/python ;; | |
44 | *) usage; exit 1 ;; | |
46456f61 RD |
45 | esac |
46 | PYTHONW=${PYTHON}w | |
47 | shift | |
1e4a197e RD |
48 | |
49 | ||
50 | for flag in $*; do | |
51 | case ${flag} in | |
52 | skiptar) skiptar=1 ;; | |
53 | use_cvs) skiptar=1; use_cvs=1 ;; | |
54 | skipconfig) skipconfig=1; skiptar=1 ;; | |
55 | skipbuild) skipbuild=1; skipconfig=1; skiptar=1 ;; | |
56 | skipinstall) skipinstall=1 ;; | |
57 | skipdmg) skipdmg=1 ;; | |
58 | skipclean) skipclean=1 ;; | |
59 | ||
60 | *) echo "Unknown flag \"${flag}\"" | |
61 | usage | |
62 | exit 1 | |
63 | esac | |
64 | done | |
65 | ||
66 | ||
46456f61 RD |
67 | VERSION=`$PYTHON -c "import setup;print setup.VERSION"` |
68 | PYVER=`$PYTHON -c "import sys; print sys.version[:3]"` | |
69 | PYPREFIX=`$PYTHON -c "import sys; print sys.exec_prefix"` | |
c6387bc1 RD |
70 | PYLIB=$PYPREFIX/lib/python$PYVER |
71 | SITEPACKAGES=$PYLIB/site-packages | |
46456f61 RD |
72 | |
73 | SRCDIR=/stuff/Development/wxPython/dist/$VERSION | |
1e4a197e | 74 | TARBALL=$SRCDIR/wxPythonSrc-$VERSION.tar.gz |
1e4a197e | 75 | |
46456f61 RD |
76 | PREFIX=/usr/lib/wxPython-$VERSION |
77 | BINPREFIX=/usr/bin | |
1e4a197e | 78 | |
46456f61 | 79 | WXROOT=`dirname $PWD` |
1e4a197e RD |
80 | PROGDIR="`dirname \"$0\"`" |
81 | TMPDIR=$PWD/_build_dmg | |
82 | ||
83 | BUILDROOT=$TMPDIR/build | |
84 | INSTALLROOT=$TMPDIR/install | |
85 | INSTALLDEVEL=$TMPDIR/install-devel | |
86 | DMGDIR=$TMPDIR/dmg | |
87 | RESOURCEDIR=$PROGDIR/resources | |
88 | DESTDIR=$PWD/dist | |
89 | ||
90 | ||
91 | ||
92 | #---------------------------------------------------------------------- | |
93 | # Setup builddirs | |
94 | ||
95 | mkdir -p $BUILDROOT | |
96 | mkdir -p $INSTALLROOT | |
46456f61 | 97 | #mkdir -p $INSTALLDEVEL |
1e4a197e RD |
98 | rm -rf $DMGDIR |
99 | mkdir -p $DMGDIR/root | |
100 | ||
101 | pushd $BUILDROOT | |
102 | ||
103 | ||
104 | #---------------------------------------------------------------------- | |
105 | # Unpack the tarball | |
106 | ||
107 | if [ -z "$skiptar" ]; then | |
46456f61 RD |
108 | echo Unarchiving tarball... |
109 | tar xzf $TARBALL | |
1e4a197e RD |
110 | fi |
111 | ||
112 | if [ "$use_cvs" = 1 ]; then | |
113 | # copy the cvs workspace, except for build dirs | |
114 | ||
115 | mkdir -p wxPythonSrc-$VERSION | |
116 | ||
117 | echo Finding updated files... | |
118 | if [ -e .last_copy ]; then | |
119 | FEXPR="-cnewer .last_copy" | |
120 | fi | |
46456f61 RD |
121 | MEASURE=$WXROOT// |
122 | find $WXROOT $FEXPR -print \ | |
123 | | grep -v $WXROOT/bld \ | |
1e4a197e RD |
124 | | grep -v wxPython/build \ |
125 | | grep -v wxPython/_build \ | |
126 | | grep -v CVS \ | |
46456f61 RD |
127 | | grep -v .pyc \ |
128 | | cut -b ${#MEASURE}- > filelist | |
1e4a197e RD |
129 | |
130 | for x in `cat filelist`; do | |
46456f61 | 131 | if [ -d "$WXROOT/$x" ]; then |
1e4a197e RD |
132 | mkdir -p "wxPythonSrc-$VERSION/$x" |
133 | else | |
134 | echo $x | |
46456f61 | 135 | cp -p "$WXROOT/$x" "wxPythonSrc-$VERSION/$x" |
1e4a197e RD |
136 | fi |
137 | done | |
138 | ||
139 | touch .last_copy | |
140 | fi | |
141 | ||
142 | ||
143 | cd wxPythonSrc-$VERSION | |
144 | WXDIR=`pwd` | |
46456f61 RD |
145 | mkdir -p $WXDIR/bld |
146 | cd $WXDIR/bld | |
1e4a197e RD |
147 | |
148 | #---------------------------------------------------------------------- | |
149 | ||
150 | ||
151 | # Configure wxWindows | |
152 | if [ -z "$skipconfig" ]; then | |
46456f61 RD |
153 | ../configure \ |
154 | --prefix=$PREFIX \ | |
155 | --with-mac \ | |
156 | --disable-monolithic \ | |
1e4a197e | 157 | --with-opengl \ |
1e4a197e RD |
158 | --enable-geometry \ |
159 | --enable-optimise \ | |
ec656cfe RD |
160 | --enable-sound \ |
161 | --enable-display \ | |
46456f61 RD |
162 | --enable-precomp=no \ |
163 | \ | |
1e4a197e RD |
164 | --with-libjpeg=builtin \ |
165 | --with-libpng=builtin \ | |
166 | --with-libtiff=builtin \ | |
46456f61 RD |
167 | --with-zlib=builtin \ |
168 | \ | |
169 | --enable-debug_flag | |
1e4a197e RD |
170 | |
171 | fi | |
172 | ||
173 | # Build wxWindows and wxPython | |
174 | if [ -z "$skipbuild" ]; then | |
1e4a197e | 175 | |
46456f61 RD |
176 | # Make wxWindows and some contribs |
177 | make | |
178 | make -C contrib/src/gizmos | |
179 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" | |
180 | make -C contrib/src/stc | |
181 | make -C contrib/src/xrc | |
182 | ||
183 | if [ ! -e $WXDIR/include/wx/gizmos ]; then | |
184 | # Make some links so the wxPython build can find all the headers it needs | |
185 | pushd $WXDIR/include/wx | |
186 | ln -s ../../contrib/include/wx/* . | |
187 | popd | |
188 | fi | |
189 | ||
190 | # Build wxPython | |
1e4a197e | 191 | cd $WXDIR/wxPython |
46456f61 RD |
192 | $PYTHON setup.py \ |
193 | NO_SCRIPTS=1 \ | |
194 | WX_CONFIG="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \ | |
1e4a197e RD |
195 | build |
196 | ||
197 | ||
46456f61 RD |
198 | # Build wxrc (XRC resource tool) |
199 | cd $WXDIR/bld/contrib/utils/wxrc | |
200 | make | |
1e4a197e RD |
201 | strip wxrc |
202 | ||
203 | fi | |
204 | ||
205 | #---------------------------------------------------------------------- | |
1e4a197e RD |
206 | |
207 | if [ -z "$skipinstall" ]; then | |
c6387bc1 | 208 | # Install wxWindows |
46456f61 RD |
209 | cd $WXDIR/bld |
210 | make prefix=$INSTALLROOT$PREFIX install | |
211 | make -C contrib/src/gizmos prefix=$INSTALLROOT$PREFIX install | |
212 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$INSTALLROOT/$PREFIX install | |
213 | make -C contrib/src/stc prefix=$INSTALLROOT$PREFIX install | |
214 | make -C contrib/src/xrc prefix=$INSTALLROOT$PREFIX install | |
1e4a197e RD |
215 | |
216 | ||
217 | # and wxPython | |
218 | cd $WXDIR/wxPython | |
46456f61 RD |
219 | $PYTHON setup.py \ |
220 | NO_SCRIPTS=1 \ | |
221 | WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \ | |
1e4a197e RD |
222 | install \ |
223 | --root=$INSTALLROOT | |
224 | ||
46456f61 | 225 | |
c6387bc1 RD |
226 | # Apple's Python (on Panther) sym-links the site-packages dir to |
227 | # /Library/Python/$PYVER so we need to move the files so they are | |
228 | # installed in the physical location, not the virtual one. | |
229 | if [ "$KIND" = "panther" ]; then | |
230 | mkdir -p $INSTALLROOT/Library/Python/$PYVER | |
231 | mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library/Python/$PYVER | |
232 | rm -r $INSTALLROOT/System | |
233 | SITEPACKAGES=/Library/Python/$PYVER | |
234 | fi | |
235 | ||
236 | ||
1e4a197e | 237 | # install wxPython's tool scripts |
46456f61 | 238 | mkdir -p $INSTALLROOT$BINPREFIX |
1e4a197e | 239 | cd $WXDIR/wxPython/scripts |
46456f61 | 240 | python$PYVER CreateMacScripts.py $INSTALLROOT $BINPREFIX |
1e4a197e | 241 | |
c6387bc1 | 242 | |
1e4a197e | 243 | # Install wxrc |
46456f61 | 244 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $INSTALLROOT$BINPREFIX |
1e4a197e RD |
245 | |
246 | ||
46456f61 RD |
247 | # install the wxPython headers |
248 | cd $WXDIR/wxPython | |
249 | cp -R include $INSTALLROOT$PREFIX | |
250 | mkdir -p $INSTALLROOT$PREFIX/include/wx/wxPython/i_files | |
251 | cp src/*.i $INSTALLROOT$PREFIX/include/wx/wxPython/i_files | |
252 | ||
1e4a197e | 253 | |
c6387bc1 | 254 | # Set premissions for files in $INSTALLROOT |
7a72b62e RD |
255 | chown -R root:admin $INSTALLROOT |
256 | chmod -R g+w $INSTALLROOT | |
1e4a197e RD |
257 | fi |
258 | ||
259 | popd | |
260 | ||
261 | #---------------------------------------------------------------------- | |
262 | ||
263 | # Make the Installer packages and disk image | |
264 | if [ -z "$skipdmg" ]; then | |
265 | ||
266 | # Remove the .pyc/.pyo files they just take up space and can be recreated | |
267 | # during the install. | |
46456f61 | 268 | $PYTHON $PROGDIR/../zappycfiles.py $INSTALLROOT |
1e4a197e RD |
269 | |
270 | ||
271 | # Make the welcome message | |
46456f61 | 272 | case $KIND in |
c6387bc1 RD |
273 | panther) W_MSG="the Panther (OS X 10.3.x) version of" ;; |
274 | jaguar) W_MSG="the Jaguar (OS X 10.2.x) version of" ;; | |
46456f61 | 275 | esac |
1e4a197e RD |
276 | cat > $RESOURCEDIR/Welcome.txt <<EOF |
277 | Welcome! | |
278 | ||
46456f61 | 279 | This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. |
1e4a197e | 280 | |
c6387bc1 RD |
281 | You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work. |
282 | ||
1e4a197e RD |
283 | Build date: `date` |
284 | EOF | |
285 | ||
286 | # make the preflight script | |
287 | cat > $RESOURCEDIR/preflight <<EOF | |
288 | #!/bin/sh | |
289 | # Cleanup any old install of the wxPython package | |
290 | rm -rf \$2$SITEPACKAGES/wxPython | |
46456f61 | 291 | rm -rf \$2$SITEPACKAGES/wx |
1e4a197e RD |
292 | exit 0 |
293 | EOF | |
294 | chmod +x $RESOURCEDIR/preflight | |
295 | ||
296 | # make the postflight script | |
297 | cat > $RESOURCEDIR/postflight <<EOF | |
298 | #!/bin/sh -e | |
299 | # Compile the .py files in the wxPython pacakge | |
c6387bc1 RD |
300 | $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython |
301 | $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx | |
302 | $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython | |
303 | $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx | |
1e4a197e | 304 | |
1e4a197e | 305 | |
c6387bc1 | 306 | # and all of the wxPython pacakge should be group writable |
1e4a197e | 307 | chgrp -R admin \$2$SITEPACKAGES/wxPython |
1e4a197e | 308 | chmod -R g+w \$2$SITEPACKAGES/wxPython |
46456f61 RD |
309 | chgrp -R admin \$2$SITEPACKAGES/wx |
310 | chmod -R g+w \$2$SITEPACKAGES/wx | |
1e4a197e RD |
311 | |
312 | exit 0 | |
313 | EOF | |
314 | chmod +x $RESOURCEDIR/postflight | |
315 | ||
316 | ||
317 | ||
c6387bc1 | 318 | # Build the main Installer Package... |
46456f61 | 319 | rm -rf wxPythonOSX-$KIND.pkg |
1e4a197e | 320 | python $PROGDIR/../buildpkg.py \ |
46456f61 | 321 | --Title=wxPythonOSX-$KIND \ |
1e4a197e | 322 | --Version=$VERSION \ |
46456f61 | 323 | --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \ |
1e4a197e RD |
324 | --NeedsAuthorization="YES" \ |
325 | --Relocatable="NO" \ | |
326 | --InstallOnly="YES" \ | |
327 | $INSTALLROOT \ | |
328 | $RESOURCEDIR | |
329 | ||
46456f61 | 330 | mv wxPythonOSX-$KIND.pkg $DMGDIR/root |
1e4a197e RD |
331 | |
332 | ||
1e4a197e RD |
333 | |
334 | # Make a README.txt to go on the disk image | |
c6387bc1 | 335 | cat > "$DMGDIR/root/README 1st.txt" <<EOF |
46456f61 RD |
336 | Welcome to wxPython! |
337 | ||
c6387bc1 | 338 | On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included. |
46456f61 RD |
339 | |
340 | wxPython-$KIND.pkg The installer package. It contains the wxPython | |
341 | extension modules, wxMac dynamic libraries and | |
342 | headers, and some scripts for the command-line | |
343 | tools. | |
1e4a197e | 344 | |
46456f61 | 345 | Everything else here is optional and you can drag them out of the disk |
c6387bc1 RD |
346 | image and drop them whereever you want. You do need to install the above |
347 | package before you can use any of the items below. | |
1e4a197e | 348 | |
46456f61 RD |
349 | docs/ A few readmes, change log, etc. The full |
350 | documentation is downloadable separately. | |
351 | ||
352 | licence/ License docs. | |
353 | ||
c6387bc1 RD |
354 | demo/ A copy of the wxPython demo source code, |
355 | just open the folder and run demo.py. | |
46456f61 RD |
356 | |
357 | samples/ Several small sample applications that | |
358 | demonstrate how to use wxPython. | |
1e4a197e | 359 | |
c6387bc1 RD |
360 | wxPython Demo An application bundle version of the demo. |
361 | (This has it's own copy of the sources within | |
362 | the bundle.) | |
363 | ||
364 | XRCed An application for editing wxPython resource | |
365 | files (XRC files.) | |
366 | ||
367 | PyCrust An application that provides an interactive | |
368 | Python shell and also namespace inspectors. | |
369 | ||
1e4a197e RD |
370 | Happy Hacking! |
371 | EOF | |
372 | ||
c6387bc1 RD |
373 | # PyAlaMode An extension of PyCrust that includes source |
374 | # file editing capabilities. | |
375 | ||
1e4a197e | 376 | |
46456f61 | 377 | # license files, docs, etc. |
1e4a197e | 378 | cp -pR $WXDIR/wxPython/licence $DMGDIR/root |
46456f61 RD |
379 | rm -rf $WXDIR/wxPython/docs/xml-raw |
380 | cp -pR $WXDIR/wxPython/docs $DMGDIR/root | |
381 | rm -rf $DMGDIR/root/docs/bin | |
382 | ||
383 | # Copy the demo and samples to the disk image | |
384 | cp -pR $WXDIR/wxPython/demo $DMGDIR/root | |
385 | cp -pR $WXDIR/wxPython/samples $DMGDIR/root | |
386 | rm $DMGDIR/root/demo/b | |
387 | ||
388 | ||
389 | # Make an app bundle to launch PyCrust | |
390 | $PYTHONW $PROGDIR/../buildapp.py \ | |
391 | --builddir=$DMGDIR/root \ | |
392 | --name=PyCrust \ | |
393 | --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \ | |
394 | --iconfile=$PROGDIR/PieShell.icns \ | |
395 | build | |
396 | ||
c6387bc1 RD |
397 | # # and PyAlaMode |
398 | # $PYTHONW $PROGDIR/../buildapp.py \ | |
399 | # --builddir=$DMGDIR/root \ | |
400 | # --name=PyAlaMode \ | |
401 | # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \ | |
402 | # --iconfile=$PROGDIR/PieShell.icns \ | |
403 | # build | |
404 | ||
46456f61 RD |
405 | # Make an app to launch XRCed |
406 | $PYTHONW $PROGDIR/../buildapp.py \ | |
407 | --builddir=$DMGDIR/root \ | |
408 | --name=XRCed \ | |
409 | --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \ | |
410 | --iconfile=$PROGDIR/XRCed.icns \ | |
411 | build | |
412 | ||
413 | # Make an app bundle to run the demo | |
414 | $PYTHONW $PROGDIR/../buildapp.py \ | |
415 | --builddir=$DMGDIR/root \ | |
416 | --name="wxPython Demo" \ | |
417 | --mainprogram=$DMGDIR/root/demo/demo.py \ | |
418 | --iconfile=$PROGDIR/RunDemo.icns \ | |
419 | build | |
420 | cp -pR $DMGDIR/root/demo/* "$DMGDIR/root/wxPython Demo.app/Contents/Resources" | |
421 | ||
1e4a197e RD |
422 | |
423 | # and then finally make a disk image containing the packages and etc. | |
46456f61 | 424 | $PROGDIR/../makedmg $DMGDIR/root $DMGDIR wxPythonOSX-$VERSION-$KIND-Py$PYVER |
1e4a197e | 425 | |
46456f61 RD |
426 | echo Moving $DMGDIR/wxPythonOSX-$VERSION-$KIND-Py$PYVER.dmg to $DESTDIR |
427 | mv $DMGDIR/wxPythonOSX-$VERSION-$KIND-Py$PYVER.dmg $DESTDIR | |
1e4a197e RD |
428 | fi |
429 | ||
430 | ||
431 | # Cleanup build/install dirs | |
432 | if [ -z "$skipclean" ]; then | |
433 | echo "Cleaning up..." | |
434 | rm -rf $TMPDIR | |
435 | else | |
436 | echo "Cleanup is disabled. You should remove $TMPDIR when finished" | |
437 | fi | |
438 |