]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/mac/wxPythonOSX/build
2 #----------------------------------------------------------------------
3 # Build wxMac and wxPythonOSX from the tarball and then make an
4 # Installer package out of it.
6 spectemplate
=distrib
/wxPythonFull.spec.
in
8 if [ ! -d wxPython
-o ! -e ${spectemplate} ]; then
9 echo "Please run this script from the root wxPython directory."
13 #----------------------------------------------------------------------
18 echo "Usage: $0 wx_version py_version [command flags...]"
19 echo " wx_version String to use for version in filenames, etc."
20 echo " py_version String to append to python (which python version to use.)"
23 echo " skiptar Don't unpack the tarball"
24 echo " use_cvs Use the CVS workspace instead of a tarfile"
25 echo " skipconfig Don't run configure"
26 echo " skipbuild Don't build wxWindows or wxPython"
27 echo " skipinstall Don't do the installation step"
28 echo " skipdmg Don't make the package or diskimage"
29 echo " skipclean Don't do the cleanup at the end"
46 use_cvs
) skiptar
=1; use_cvs
=1 ;;
47 skipconfig
) skipconfig
=1; skiptar
=1 ;;
48 skipbuild
) skipbuild
=1; skipconfig
=1; skiptar
=1 ;;
49 skipinstall
) skipinstall
=1 ;;
51 skipclean
) skipclean
=1 ;;
53 *) echo "Unknown flag \"${flag}\""
60 SRCDIR
=/Volumes
/Gate.Stuff
/Development
/wxPython
/dist
/$VERSION
61 TARBALL
=$SRCDIR/wxPythonSrc
-$VERSION.
tar.gz
62 SITEPACKAGES
=/Library
/Frameworks
/Python.framework
/Versions
/$PYVER/lib
/python
$PYVER/site
-packages
64 # TODO: Should I change the prefix to /usr?
67 PROGDIR
="`dirname \"$0\"`"
68 TMPDIR
=$PWD/_build_dmg
70 BUILDROOT
=$TMPDIR/build
71 INSTALLROOT
=$TMPDIR/install
72 INSTALLDEVEL
=$TMPDIR/install-devel
74 RESOURCEDIR
=$PROGDIR/resources
79 #----------------------------------------------------------------------
84 mkdir -p $INSTALLDEVEL
91 #----------------------------------------------------------------------
94 if [ -z "$skiptar" ]; then
98 if [ "$use_cvs" = 1 ]; then
99 # copy the cvs workspace, except for build dirs
101 mkdir -p wxPythonSrc
-$VERSION
103 echo Finding updated files...
104 if [ -e .last_copy
]; then
105 FEXPR
="-cnewer .last_copy"
107 find /projects
/wx
$FEXPR -print \
109 | grep -v wxPython
/build \
110 | grep -v wxPython
/_build \
112 | cut
-b 14- > filelist
114 for x
in `cat filelist`; do
115 if [ -d "/projects/wx/$x" ]; then
116 mkdir -p "wxPythonSrc-$VERSION/$x"
119 cp -p "/projects/wx/$x" "wxPythonSrc-$VERSION/$x"
127 cd wxPythonSrc
-$VERSION
129 mkdir -p $WXDIR/build
132 #----------------------------------------------------------------------
135 # Configure wxWindows
136 if [ -z "$skipconfig" ]; then
137 ..
/configure
--with-mac --prefix=$PREFIX \
139 --enable-precomp=no \
142 --with-libjpeg=builtin \
143 --with-libpng=builtin \
144 --with-libtiff=builtin \
147 # --with-zlib=builtin
148 # --enable-debug_flag
152 # Build wxWindows and wxPython
153 if [ -z "$skipbuild" ]; then
157 python
$PYVER setup.py \
159 WX_CONFIG
="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \
163 # Build wxrc (XRC resource tool) but don't use the makefiles since they expect
164 # a shared version of the xrc lib to have been built...
165 cd $WXDIR/contrib
/utils
/wxrc
166 WX_CONFIG
="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build"
167 wCC
=`$WX_CONFIG --cc`
168 wCXX
=`$WX_CONFIG --cxx`
170 for f
in wxrc.cpp ..
/..
/src
/xrc
/*.cpp
; do
172 $wCXX `$WX_CONFIG --cxxflags` -I ..
/..
/include
-I ..
/..
/src
/xrc
/expat
/xmlparse
-I ..
/..
/src
/xrc
/expat
/xmltok
-c $f
174 for f
in ..
/..
/src
/xrc
/expat
/xmlparse
/xmlparse.c ..
/..
/src
/xrc
/expat
/xmltok
/xmlrole.c ..
/..
/src
/xrc
/expat
/xmltok
/xmltok.c
; do
176 $wCC `$WX_CONFIG --cxxflags` -I ..
/..
/include
-I ..
/..
/src
/xrc
/expat
/xmlparse
-I ..
/..
/src
/xrc
/expat
/xmltok
-c $f
179 # the handlers are not needed
182 $wCXX `$WX_CONFIG --libs` *.o
-o wxrc
187 #----------------------------------------------------------------------
190 if [ -z "$skipinstall" ]; then
192 make prefix
=$INSTALLROOT/$PREFIX install
197 python
$PYVER setup.py \
199 WX_CONFIG
="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \
203 # install wxPython's tool scripts
204 cd $WXDIR/wxPython
/scripts
205 python
$PYVER CreateMacScripts.py
$INSTALLROOT $PREFIX/bin
208 cp $WXDIR/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$PREFIX/bin
211 # Move wxWindows devel files and save for a separate installer package
212 mkdir -p $INSTALLDEVEL$PREFIX
213 mkdir -p $INSTALLDEVEL$PREFIX/bin
214 mkdir -p $INSTALLDEVEL$PREFIX/lib
215 mv -f $INSTALLROOT$PREFIX/include
$INSTALLDEVEL$PREFIX
216 mv -f $INSTALLROOT$PREFIX/lib
/wx
$INSTALLDEVEL$PREFIX/lib
217 mv -f $INSTALLROOT$PREFIX/bin
/wx
* $INSTALLDEVEL$PREFIX/bin
219 # TODO for $INSTALLROOT and $INSTALLDEVEL ?
220 # chown -R root:admin
226 #----------------------------------------------------------------------
228 # Make the Installer packages and disk image
229 if [ -z "$skipdmg" ]; then
231 # Remove the .pyc/.pyo files they just take up space and can be recreated
232 # during the install.
233 python
$PROGDIR/..
/zappycfiles.py
$INSTALLROOT/Library
/Frameworks
/Python.framework
235 # Copy the demo, samples, and such to the Applications dir
236 APPDIR
=$INSTALLROOT/Applications
/wxPythonOSX
-$VERSION
238 cp -pR $WXDIR/wxPython
/demo
$APPDIR
239 cp -pR $WXDIR/wxPython
/samples
$APPDIR
241 # Move sample launchers to .pyw files.
242 # TODO: A better, more automated way to do this!!!
243 pushd $APPDIR/samples
244 for x
in StyleEditor
/STCStyleEditor \
248 wxProject
/wxProject
; do
253 # Make an app to launch the demo
254 cat > $APPDIR/demo
/RunDemo.pyw
<<EOF
256 sys.path.insert(0, "/Applications/wxPythonOSX-$VERSION/demo")
257 os.chdir("/Applications/wxPythonOSX-$VERSION/demo")
261 pythonw
$PROGDIR/..
/buildapp.py \
264 --mainprogram=$APPDIR/demo
/RunDemo.pyw \
265 --iconfile=$PROGDIR/RunDemo.icns \
268 # Make an app to launch PyShell
269 pythonw
$PROGDIR/..
/buildapp.py \
272 --mainprogram=$INSTALLROOT$PREFIX/bin
/pyshell.py \
273 --iconfile=$PROGDIR/PieShell.icns \
276 # Make an app to launch XRCed
277 pythonw
$PROGDIR/..
/buildapp.py \
280 --mainprogram=$INSTALLROOT$PREFIX/bin
/xrced.py \
281 --iconfile=$PROGDIR/XRCed.icns \
285 # Make the welcome message
286 cat > $RESOURCEDIR/Welcome.txt
<<EOF
289 This program will install wxPython $VERSION for MacPython-OSX $PYVER.
294 # make the preflight script
295 cat > $RESOURCEDIR/preflight
<<EOF
297 # Cleanup any old install of the wxPython package
298 rm -rf \$2$SITEPACKAGES/wxPython
301 chmod +x
$RESOURCEDIR/preflight
303 # make the postflight script
304 cat > $RESOURCEDIR/postflight
<<EOF
306 # Compile the .py files in the wxPython pacakge
307 /usr/local/bin/python \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
308 /usr/local/bin/python -O \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
311 /usr/local/bin/python \$2$SITEPACKAGES/../compileall.py /Applications/wxPythonOSX-$VERSION/demo
313 # Make the demo/data dir writable
314 chmod a+w /Applications/wxPythonOSX-$VERSION/demo/data
316 # and the wxPython pacakge should be group writable
317 chgrp -R admin \$2$SITEPACKAGES/wxPython
318 chgrp -R admin /Applications/wxPythonOSX-$VERSION
319 chmod -R g+w \$2$SITEPACKAGES/wxPython
320 chmod -R g+w /Applications/wxPythonOSX-$VERSION
324 chmod +x
$RESOURCEDIR/postflight
328 # Finally, build the main package...
329 rm -rf wxPythonOSX.pkg
330 python
$PROGDIR/..
/buildpkg.py \
331 --Title=wxPythonOSX \
333 --Description="wxPython $VERSION for MacPython-OSX $PYVER" \
334 --NeedsAuthorization="YES" \
336 --InstallOnly="YES" \
340 mv wxPythonOSX.pkg
$DMGDIR/root
343 # and the devel package
344 rm -rf wxPythonOSX
-devel.pkg
345 python
$PROGDIR/..
/buildpkg.py \
346 --Title=wxPythonOSX
-devel \
348 --Description="Headers and such that allow you to link with the same wxMac that wxPython does" \
349 --NeedsAuthorization="YES" \
351 --InstallOnly="YES" \
354 mv wxPythonOSX
-devel.pkg
$DMGDIR/root
357 # Make a README.txt to go on the disk image
358 cat > $DMGDIR/root
/README.txt
<<EOF
359 The files on this disk image are Installer packages for wxPythonOSX
360 $VERSION for MacPython-OSX $PVER. You must already have MacPython-OSX
363 The wxPython extension modules, library, demo and samples are
364 contained in the wxPythonOSX package. You should install at least this
365 package to use wxPython.
367 If you have any need to create applicaitons or extension modules that
368 link with the same wxMac that wxPython does, then you can also install
369 the wxPythonOSX-devel package to get the necessary header files and
370 such. Otherwise you don't need it.
376 # license files, etc.
377 cp -pR $WXDIR/wxPython
/licence
$DMGDIR/root
378 cp $WXDIR/wxPython
/CHANGES.txt
$DMGDIR/root
380 # and then finally make a disk image containing the packages and etc.
381 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-py$PYVER
383 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-py$PYVER.dmg to
$DESTDIR
384 mv $DMGDIR/wxPythonOSX
-$VERSION-py$PYVER.dmg
$DESTDIR
388 # Cleanup build/install dirs
389 if [ -z "$skipclean" ]; then
390 echo "Cleaning up..."
393 echo "Cleanup is disabled. You should remove $TMPDIR when finished"