]>
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 --enable-debug_flag \
143 --with-libjpeg=builtin \
144 --with-libpng=builtin \
145 --with-libtiff=builtin \
150 # Build wxWindows and wxPython
151 if [ -z "$skipbuild" ]; then
155 python
$PYVER setup.py \
157 WX_CONFIG
="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \
161 # Build wxrc (XRC resource tool) but don't use the makefiles since they expect
162 # a shared version of the xrc lib to have been built...
163 cd $WXDIR/contrib
/utils
/wxrc
164 WX_CONFIG
="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build"
165 wCC
=`$WX_CONFIG --cc`
166 wCXX
=`$WX_CONFIG --cxx`
168 for f
in wxrc.cpp ..
/..
/src
/xrc
/*.cpp
; do
170 $wCXX `$WX_CONFIG --cxxflags` -I ..
/..
/include
-I ..
/..
/src
/xrc
/expat
/xmlparse
-I ..
/..
/src
/xrc
/expat
/xmltok
-c $f
172 for f
in ..
/..
/src
/xrc
/expat
/xmlparse
/xmlparse.c ..
/..
/src
/xrc
/expat
/xmltok
/xmlrole.c ..
/..
/src
/xrc
/expat
/xmltok
/xmltok.c
; do
174 $wCC `$WX_CONFIG --cxxflags` -I ..
/..
/include
-I ..
/..
/src
/xrc
/expat
/xmlparse
-I ..
/..
/src
/xrc
/expat
/xmltok
-c $f
177 # the handlers are not needed
180 $wCXX `$WX_CONFIG --libs` *.o
-o wxrc
185 #----------------------------------------------------------------------
188 if [ -z "$skipinstall" ]; then
190 make prefix
=$INSTALLROOT/$PREFIX install
195 python
$PYVER setup.py \
197 WX_CONFIG
="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \
201 # install wxPython's tool scripts
202 cd $WXDIR/wxPython
/scripts
203 python
$PYVER CreateMacScripts.py
$INSTALLROOT $PREFIX/bin
206 cp $WXDIR/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$PREFIX/bin
209 # Move wxWindows devel files and save for a separate installer package
210 mkdir -p $INSTALLDEVEL$PREFIX
211 mkdir -p $INSTALLDEVEL$PREFIX/bin
212 mkdir -p $INSTALLDEVEL$PREFIX/lib
213 mv -f $INSTALLROOT$PREFIX/include
$INSTALLDEVEL$PREFIX
214 mv -f $INSTALLROOT$PREFIX/lib
/wx
$INSTALLDEVEL$PREFIX/lib
215 mv -f $INSTALLROOT$PREFIX/bin
/wx
* $INSTALLDEVEL$PREFIX/bin
217 # TODO for $INSTALLROOT and $INSTALLDEVEL ?
218 # chown -R root:admin
224 #----------------------------------------------------------------------
226 # Make the Installer packages and disk image
227 if [ -z "$skipdmg" ]; then
229 # Remove the .pyc/.pyo files they just take up space and can be recreated
230 # during the install.
231 python
$PROGDIR/..
/zappycfiles.py
$INSTALLROOT/Library
/Frameworks
/Python.framework
233 # Copy the demo, samples, and such to the Applications dir
234 APPDIR
=$INSTALLROOT/Applications
/wxPythonOSX
-$VERSION
236 cp -pR $WXDIR/wxPython
/demo
$APPDIR
237 cp -pR $WXDIR/wxPython
/samples
$APPDIR
239 # Move sample launchers to .pyw files.
240 # TODO: A better, more automated way to do this!!!
241 pushd $APPDIR/samples
242 for x
in StyleEditor
/STCStyleEditor \
246 wxProject
/wxProject
; do
251 # Make an app to launch the demo
252 cat > $APPDIR/demo
/RunDemo.pyw
<<EOF
254 sys.path.insert(0, "/Applications/wxPythonOSX-$VERSION/demo")
255 os.chdir("/Applications/wxPythonOSX-$VERSION/demo")
259 pythonw
$PROGDIR/..
/buildapp.py \
262 --mainprogram=$APPDIR/demo
/RunDemo.pyw \
263 --iconfile=$PROGDIR/RunDemo.icns \
266 # Make an app to launch PyShell
267 pythonw
$PROGDIR/..
/buildapp.py \
270 --mainprogram=$INSTALLROOT$PREFIX/bin
/pyshell.py \
271 --iconfile=$PROGDIR/PieShell.icns \
274 # Make an app to launch XRCed
275 pythonw
$PROGDIR/..
/buildapp.py \
278 --mainprogram=$INSTALLROOT$PREFIX/bin
/xrced.py \
279 --iconfile=$PROGDIR/XRCed.icns \
283 # Make the welcome message
284 cat > $RESOURCEDIR/Welcome.txt
<<EOF
287 This program will install wxPython $VERSION for MacPython-OSX $PYVER.
292 # make the preflight script
293 cat > $RESOURCEDIR/preflight
<<EOF
295 # Cleanup any old install of the wxPython package
296 rm -rf \$2$SITEPACKAGES/wxPython
299 chmod +x
$RESOURCEDIR/preflight
301 # make the postflight script
302 cat > $RESOURCEDIR/postflight
<<EOF
304 # Compile the .py files in the wxPython pacakge
305 /usr/local/bin/python \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
306 /usr/local/bin/python -O \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
309 /usr/local/bin/python \$2$SITEPACKAGES/../compileall.py /Applications/wxPythonOSX-$VERSION/demo
311 # Make the demo/data dir writable
312 chmod a+w /Applications/wxPythonOSX-$VERSION/demo/data
314 # and the wxPython pacakge should be group writable
315 chgrp -R admin \$2$SITEPACKAGES/wxPython
316 chgrp -R admin /Applications/wxPythonOSX-$VERSION
317 chmod -R g+w \$2$SITEPACKAGES/wxPython
318 chmod -R g+w /Applications/wxPythonOSX-$VERSION
322 chmod +x
$RESOURCEDIR/postflight
326 # Finally, build the main package...
327 rm -rf wxPythonOSX.pkg
328 python
$PROGDIR/..
/buildpkg.py \
329 --Title=wxPythonOSX \
331 --Description="wxPython $VERSION for MacPython-OSX $PYVER" \
332 --NeedsAuthorization="YES" \
334 --InstallOnly="YES" \
338 mv wxPythonOSX.pkg
$DMGDIR/root
341 # and the devel package
342 rm -rf wxPythonOSX
-devel.pkg
343 python
$PROGDIR/..
/buildpkg.py \
344 --Title=wxPythonOSX
-devel \
346 --Description="Headers and such that allow you to link with the same wxMac that wxPython does" \
347 --NeedsAuthorization="YES" \
349 --InstallOnly="YES" \
352 mv wxPythonOSX
-devel.pkg
$DMGDIR/root
355 # Make a README.txt to go on the disk image
356 cat > $DMGDIR/root
/README.txt
<<EOF
357 The files on this disk image are Installer packages for wxPythonOSX
358 $VERSION for MacPython-OSX $PVER. You must already have MacPython-OSX
361 The wxPython extension modules, library, demo and samples are
362 contained in the wxPythonOSX package. You should install at least this
363 package to use wxPython.
365 If you have any need to create applicaitons or extension modules that
366 link with the same wxMac that wxPython does, then you can also install
367 the wxPythonOSX-devel package to get the necessary header files and
368 such. Otherwise you don't need it.
374 # license files, etc.
375 cp -pR $WXDIR/wxPython
/licence
$DMGDIR/root
376 cp $WXDIR/wxPython
/CHANGES.txt
$DMGDIR/root
378 # and then finally make a disk image containing the packages and etc.
379 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-py$PYVER
381 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-py$PYVER.dmg to
$DESTDIR
382 mv $DMGDIR/wxPythonOSX
-$VERSION-py$PYVER.dmg
$DESTDIR
386 # Cleanup build/install dirs
387 if [ -z "$skipclean" ]; then
388 echo "Cleaning up..."
391 echo "Cleanup is disabled. You should remove $TMPDIR when finished"