]>
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  [panther|jaguar]  [command flags...]" 
  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" 
  23     echo "optional command flags:" 
  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 wxWidgets 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" 
  42     panther
)    PYTHON
=/usr
/bin
/python 
;; 
  43     jaguar
)     PYTHON
=/usr
/local
/bin
/python 
;; 
  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               ;; 
  58         skipclean
)   skipclean
=1                 ;; 
  60         *)  echo "Unknown flag \"${flag}\"" 
  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"` 
  70 PYLIB
=$PYPREFIX/lib
/python
$PYVER 
  71 SITEPACKAGES
=$PYLIB/site
-packages 
  73 TARBALLDIR
=/stuff
/Development
/wxPython
/dist
/$VERSION 
  74 TARBALL
=$TARBALLDIR/wxPythonSrc
-$VERSION.
tar.gz
 
  76 PREFIX
=/usr
/lib
/wxPython
-$VERSION 
  80 PROGDIR
="`dirname \"$0\"`" 
  81 TMPDIR
=$PWD/_build_dmg
 
  83 BUILDROOT
=$TMPDIR/build
 
  84 INSTALLROOT
=$TMPDIR/install 
  85 INSTALLDEVEL
=$TMPDIR/install-devel 
  87 RESOURCEDIR
=$PROGDIR/resources
 
  89 SRCROOT
=$BUILDROOT/wxPythonSrc
-$VERSION 
  92 #---------------------------------------------------------------------- 
  97 #mkdir -p $INSTALLDEVEL 
  99 mkdir -p $DMGDIR/root
/Apps
 
 100 mkdir -p $DMGDIR/root
/Docs
 
 101 mkdir -p $DMGDIR/root
/Samples
 
 107 #---------------------------------------------------------------------- 
 110 if [ -z "$skiptar" ]; then 
 111     echo Unarchiving tarball...
 
 115 if [ "$use_cvs" = 1 ]; then 
 116     # copy the cvs workspace, except for build dirs 
 118     mkdir -p wxPythonSrc
-$VERSION 
 120     echo Finding updated files...
 
 121     if [ -e .last_copy 
]; then 
 122         FEXPR
="-cnewer .last_copy" 
 125     find $WXROOT $FEXPR -print \
 
 126         | grep -v $WXROOT/bld \
 
 127         | grep -v wxPython
/build \
 
 128         | grep -v wxPython
/_build \
 
 131         | cut 
-b ${#MEASURE}- > filelist
 
 133     for x 
in `cat filelist`; do 
 134         if [ -d "$WXROOT/$x" ]; then 
 135             mkdir -p "wxPythonSrc-$VERSION/$x" 
 138             cp -p "$WXROOT/$x" "wxPythonSrc-$VERSION/$x" 
 146 cd wxPythonSrc
-$VERSION 
 151 #---------------------------------------------------------------------- 
 154 # Configure wxWidgets 
 155 if [ -z "$skipconfig" ]; then 
 159         --disable-monolithic \
 
 164         --enable-precomp=no \
 
 167 ##      --enable-optimise \ 
 168 ##      --with-libjpeg=builtin \ 
 169 ##      --with-libpng=builtin \ 
 170 ##      --with-libtiff=builtin \ 
 171 ##      --with-zlib=builtin \ 
 175 # Build wxWidgets and wxPython 
 176 if [ -z "$skipbuild" ]; then 
 178     # Make wxWidgets and some contribs 
 180     make -C contrib
/src
/gizmos 
 
 181     make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" 
 182     make -C contrib
/src
/stc
 
 183     make -C contrib
/src
/xrc
 
 185     if [ ! -e $WXDIR/include
/wx
/gizmos 
]; then 
 186         # Make some links so the wxPython build can find all the headers it needs 
 187         pushd $WXDIR/include
/wx
 
 188         ln -s ..
/..
/contrib
/include
/wx
/* .
 
 196         WX_CONFIG
="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \
 
 200     # Build wxrc (XRC resource tool)  
 201     cd $WXDIR/bld
/contrib
/utils
/wxrc
 
 207 #---------------------------------------------------------------------- 
 209 if [ -z "$skipinstall" ]; then 
 212     make prefix
=$INSTALLROOT$PREFIX install 
 213     make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install 
 214     make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install 
 215     make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install 
 216     make -C contrib
/src
/xrc prefix
=$INSTALLROOT$PREFIX install 
 223         WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
 
 228     # Apple's Python (on Panther) sym-links the site-packages dir to 
 229     # /Library/Python/$PYVER so we need to move the files so they are 
 230     # installed in the physical location, not the virtual one. 
 231     if [ "$KIND" = "panther" ]; then 
 232         mkdir -p $INSTALLROOT/Library
/Python
/$PYVER 
 233         mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER 
 234         rm -r $INSTALLROOT/System
 
 235         SITEPACKAGES
=/Library
/Python
/$PYVER 
 239     # install wxPython's tool scripts 
 240     mkdir -p $INSTALLROOT$BINPREFIX 
 241     cd $WXDIR/wxPython
/scripts
 
 242     python
$PYVER CreateMacScripts.py 
$INSTALLROOT $BINPREFIX 
 246     cp $WXDIR/bld
/contrib
/utils
/wxrc
/wxrc 
$INSTALLROOT$BINPREFIX 
 249     # install the wxPython headers 
 251     cp -R include 
$INSTALLROOT$PREFIX 
 252     mkdir -p      $INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
 
 253     cp src
/*.i    
$INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
 
 256     # Set premissions for files in $INSTALLROOT  
 257     chown 
-R root
:admin 
$INSTALLROOT 
 258     chmod -R g
+w        
$INSTALLROOT 
 263 #---------------------------------------------------------------------- 
 265 # Make the Installer packages and disk image 
 266 if [ -z "$skipdmg" ]; then 
 268     # Remove the .pyc/.pyo files they just take up space and can be recreated 
 269     # during the install. 
 270     $PYTHON $PROGDIR/..
/zappycfiles.py 
$INSTALLROOT 
 273     # Make the welcome message 
 275         panther
)  W_MSG
="the Panther (OS X 10.3.x) version of" ;; 
 276         jaguar
)   W_MSG
="the Jaguar (OS X 10.2.x) version of" ;; 
 278     cat > $RESOURCEDIR/Welcome.txt 
<<EOF 
 281 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. 
 283 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work. 
 288     # make the preflight script 
 289     cat > $RESOURCEDIR/preflight 
<<EOF 
 291 # Cleanup any old install of the wxPython package 
 292 rm -rf \$2$SITEPACKAGES/wxPython 
 293 rm -rf \$2$SITEPACKAGES/wx 
 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 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython 
 303 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx 
 304 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython 
 305 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx 
 308 # and all of the wxPython pacakge should be group writable 
 309 chgrp -R admin \$2$SITEPACKAGES/wxPython 
 310 chmod -R g+w \$2$SITEPACKAGES/wxPython 
 311 chgrp -R admin \$2$SITEPACKAGES/wx 
 312 chmod -R g+w \$2$SITEPACKAGES/wx 
 316     chmod +x 
$RESOURCEDIR/postflight
 
 320     # Build the main Installer Package... 
 321     rm -rf wxPythonOSX
-$KIND.pkg
 
 322     python 
$PROGDIR/..
/buildpkg.py \
 
 323         --Title=wxPythonOSX
-$KIND \
 
 325         --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
 
 326         --NeedsAuthorization="YES" \
 
 328         --InstallOnly="YES" \
 
 332     mv wxPythonOSX
-$KIND.pkg 
$DMGDIR/root
 
 336     # Make a README.txt to go on the disk image 
 337     cat > "$DMGDIR/root/README 1st.txt" <<EOF 
 340 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.  MacPython-OSX is not included.   
 342    wxPython-$KIND.pkg   The installer package.  It contains the wxPython  
 343                         extension modules, wxMac dynamic libraries and 
 344                         headers, and some scripts for the command-line  
 347 Everything else here is optional and you can drag them out of the disk  
 348 image and drop them whereever you want.  You do need to install the above 
 349 package before you can use any of the items below. 
 352    Apps/wxPython Demo   An application bundle version of the demo. 
 353                         (This has it's own copy of the sources within 
 356    Apps/XRCed           An application for editing wxPython resource 
 359    Apps/PyCrust         An application that provides an interactive  
 360                         Python shell and also namespace inspectors. 
 364    Docs/wxDocs          A folder containing the wxWidgets documentation 
 365                         bundled in .zip files, and a small wxPython 
 366                         application that can be used to view the docs. 
 369    Docs/licence         License files. 
 371    Docs/other           A few readmes, change log, etc.  The full  
 372                         documentation is downloadable separately.  
 375    Samples/samples      Several small sample applications that  
 376                         demonstrate how to use wxPython. 
 378    Samples/demo         A copy of the wxPython demo source code,  
 379                         just open the folder and run demo.pyw. 
 384 #   PyAlaMode            An extension of PyCrust that includes source  
 385 #                        file editing capabilities. 
 389     pushd $DMGDIR/root
/Docs
 
 390     tar xzvf 
$TARBALLDIR/wxPythonDocs
-$VERSION.
tar.gz
 
 391     mv wxPython
-$VERSION/docs  wxDocs
 
 392     rm -r wxPython
-$VERSION 
 393     mv wxDocs
/viewdocs.py wxDocs
/viewdocs.pyw
 
 395     # license files, docs, etc. 
 396     cp -pR $SRCROOT/wxPython
/licence   .
 
 397     cp -pR $SRCROOT/wxPython
/docs      .
 
 403     # Copy the demo and samples to the disk image from the tarball 
 404     pushd $DMGDIR/root
/Samples
 
 405     tar xzvf 
$TARBALLDIR/wxPythonDemo
-$VERSION.
tar.gz
 
 406     mv wxPython
-$VERSION/* .
 
 407     rm -rf wxPython
-$VERSION 
 408     rm demo
/b demo
/.setup.sh
 
 409     mv demo
/demo.py demo
/demo.pyw
 
 413     # Make an app bundle to launch PyCrust 
 414     $PYTHONW $PROGDIR/..
/buildapp.py \
 
 415         --builddir=$DMGDIR/root
/Apps \
 
 417         --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
 
 418         --iconfile=$PROGDIR/PieShell.icns \
 
 422 #     $PYTHONW $PROGDIR/../buildapp.py \ 
 423 #       --builddir=$DMGDIR/root \ 
 425 #       --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \ 
 426 #       --iconfile=$PROGDIR/PieShell.icns \ 
 429     # Make an app to launch XRCed 
 430     $PYTHONW $PROGDIR/..
/buildapp.py \
 
 431         --builddir=$DMGDIR/root
/Apps \
 
 433         --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
 
 434         --iconfile=$PROGDIR/XRCed.icns \
 
 437     # Make an app bundle to run the demo 
 438     $PYTHONW $PROGDIR/..
/buildapp.py \
 
 439         --builddir=$DMGDIR/root
/Apps \
 
 440         --name="wxPython Demo" \
 
 441         --mainprogram=$DMGDIR/root
/Samples
/demo
/demo.pyw \
 
 442         --iconfile=$PROGDIR/RunDemo.icns \
 
 444     cp -pR $DMGDIR/root
/Samples
/demo
/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources" 
 447     # and then finally make a disk image containing the packages and etc. 
 448     $PROGDIR/..
/makedmg 
$DMGDIR/root 
$DMGDIR wxPythonOSX
-$VERSION-$KIND-Py$PYVER 
 450     echo Moving 
$DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg to 
$DESTDIR 
 451     mv $DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg  
$DESTDIR 
 455 # Cleanup build/install dirs 
 456 if [ -z "$skipclean" ]; then 
 457     echo "Cleaning up..." 
 460     echo "Cleanup is disabled.  You should remove $TMPDIR when finished"