]>
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
221 #----------------------------------------------------------------------
223 # Make the Installer packages and disk image
224 if [ -z "$skipdmg" ]; then
226 # Remove the .pyc/.pyo files they just take up space and can be recreated
227 # during the install.
228 python
$PROGDIR/..
/zappycfiles.py
$INSTALLROOT/Library
/Frameworks
/Python.framework
230 # Copy the demo, samples, and such to the Applications dir
231 APPDIR
=$INSTALLROOT/Applications
/wxPythonOSX
-$VERSION
233 cp -pR $WXDIR/wxPython
/demo
$APPDIR
234 cp -pR $WXDIR/wxPython
/samples
$APPDIR
236 # Move sample launchers to .pyw files.
237 # TODO: A better, more automated way to do this!!!
238 pushd $APPDIR/samples
239 for x
in StyleEditor
/STCStyleEditor \
243 wxProject
/wxProject
; do
248 # Make an app to launch the demo
249 cat > $APPDIR/demo
/RunDemo.pyw
<<EOF
251 sys.path.insert(0, "/Applications/wxPythonOSX-$VERSION/demo")
252 os.chdir("/Applications/wxPythonOSX-$VERSION/demo")
256 pythonw
$PROGDIR/..
/buildapp.py \
259 --mainprogram=$APPDIR/demo
/RunDemo.pyw \
260 --iconfile=$PROGDIR/RunDemo.icns \
263 # Make an app to launch PyShell
264 pythonw
$PROGDIR/..
/buildapp.py \
267 --mainprogram=$INSTALLROOT$PREFIX/bin
/pyshell.py \
268 --iconfile=$PROGDIR/PieShell.icns \
271 # Make an app to launch XRCed
272 pythonw
$PROGDIR/..
/buildapp.py \
275 --mainprogram=$INSTALLROOT$PREFIX/bin
/xrced.py \
276 --iconfile=$PROGDIR/XRCed.icns \
280 # Make the welcome message
281 cat > $RESOURCEDIR/Welcome.txt
<<EOF
284 This program will install wxPython $VERSION for MacPython-OSX $PYVER.
289 # make the preflight script
290 cat > $RESOURCEDIR/preflight
<<EOF
292 # Cleanup any old install of the wxPython package
293 rm -rf \$2$SITEPACKAGES/wxPython
296 chmod +x
$RESOURCEDIR/preflight
298 # make the postflight script
299 cat > $RESOURCEDIR/postflight
<<EOF
301 # Compile the .py files in the wxPython pacakge
302 /usr/local/bin/python \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
303 /usr/local/bin/python -O \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
306 /usr/local/bin/python \$2$SITEPACKAGES/../compileall.py /Applications/wxPythonOSX-$VERSION/demo
308 # Make the demo/data dir writable
309 chmod a+w /Applications/wxPythonOSX-$VERSION/demo/data
311 # and the wxPython pacakge should be group writable
312 chgrp -R admin \$2$SITEPACKAGES/wxPython
313 chgrp -R admin /Applications/wxPythonOSX-$VERSION
314 chmod -R g+w \$2$SITEPACKAGES/wxPython
315 chmod -R g+w /Applications/wxPythonOSX-$VERSION
319 chmod +x
$RESOURCEDIR/postflight
323 # Finally, build the main package...
324 rm -rf wxPythonOSX.pkg
325 python
$PROGDIR/..
/buildpkg.py \
326 --Title=wxPythonOSX \
328 --Description="wxPython $VERSION for MacPython-OSX $PYVER" \
329 --NeedsAuthorization="YES" \
331 --InstallOnly="YES" \
335 mv wxPythonOSX.pkg
$DMGDIR/root
338 # and the devel package
339 rm -rf wxPythonOSX
-devel.pkg
340 python
$PROGDIR/..
/buildpkg.py \
341 --Title=wxPythonOSX
-devel \
343 --Description="Headers and such that allow you to link with the same wxMac that wxPython does" \
344 --NeedsAuthorization="YES" \
346 --InstallOnly="YES" \
349 mv wxPythonOSX
-devel.pkg
$DMGDIR/root
352 # Make a README.txt to go on the disk image
353 cat > $DMGDIR/root
/README.txt
<<EOF
354 The files on this disk image are Installer packages for wxPythonOSX
355 $VERSION for MacPython-OSX $PVER. You must already have MacPython-OSX
358 The wxPython extension modules, library, demo and samples are
359 contained in the wxPythonOSX package. You should install at least this
360 package to use wxPython.
362 If you have any need to create applicaitons or extension modules that
363 link with the same wxMac that wxPython does, then you can also install
364 the wxPythonOSX-devel package to get the necessary header files and
365 such. Otherwise you don't need it.
371 # license files, etc.
372 cp -pR $WXDIR/wxPython
/licence
$DMGDIR/root
373 cp $WXDIR/wxPython
/CHANGES.txt
$DMGDIR/root
375 # and then finally make a disk image containing the packages and etc.
376 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-py$PYVER
378 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-py$PYVER.dmg to
$DESTDIR
379 mv $DMGDIR/wxPythonOSX
-$VERSION-py$PYVER.dmg
$DESTDIR
383 # Cleanup build/install dirs
384 if [ -z "$skipclean" ]; then
385 echo "Cleaning up..."
388 echo "Cleanup is disabled. You should remove $TMPDIR when finished"