Code

Set the xml:space attribute on <svg> once rather than on every <text>
[inkscape.git] / packaging / macosx / osx-build.sh
index ad7a2eff642fa54627a8047ee83ffc71da416956..15af2589ff791d4cfba9438117d5e867ced23f56 100755 (executable)
@@ -56,20 +56,23 @@ Compilation script for Inkscape on Mac OS X.
     install the build products locally, inside the source
     directory (run make install)
   \033[1mp,pack,package\033[0m
-    package Inkscape in a double clickable .app bundle and
-    store it in a .dmg image for distribution
+    package Inkscape in a double clickable .app bundle 
     \033[1m-s,--strip\033[0m   remove debugging information in Inkscape package
+  \033[1md,dist,distrib\033[0m
+    store Inkscape.app in a disk image (dmg) for distribution
     \033[1m-py,--with-python\033[0m    specify python packages path for inclusion into the dmg image
-       
+  \033[1mall\033[0m
+    do everything (update, configure, build, install, package, distribute)
+
 \033[1mEXAMPLES\033[0m
   \033[1m$0 conf build install\033[0m
     configure, build and install a dowloaded version of Inkscape in the default
     directory, keeping debugging information.  
-  \033[1m$0 -p ~ -s -py ~/pyxml/ u a c b i p\033[0m
+  \033[1m$0 u a c b -p ~ i -s p -py ~/pyxml/ d\033[0m
     update an svn checkout, prepare configure script, configure,
-    build and install Inkscape in the user home directory.     
+    build and install Inkscape in the user home directory (~).         
     Then package Inkscape withouth debugging information,
-    with python packages from ~/pyxml/ and prepare it for   
+    with python packages from ~/pyxml/ and prepare a dmg for   
     distribution."
 }
 
@@ -80,13 +83,17 @@ HERE=`pwd`
 SRCROOT=$HERE/../..            # we are currently in packaging/macosx
 
 # Defaults
-INSTALLPREFIX=$SRCROOT/Build/
+if [ "$INSTALLPREFIX" = "" ]
+then
+       INSTALLPREFIX=$SRCROOT/Build/
+fi
 SVNUPDATE="f"
 AUTOGEN="f"
 CONFIGURE="f"
 BUILD="f"
 INSTALL="f"
 PACKAGE="f"
+DISTRIB="f"
 
 STRIP="f"
 PYTHON="f"
@@ -99,9 +106,17 @@ do
        h|help)
                help 
                exit 1 ;;
-       u|up|update)
+       all)            
+               SVNUPDATE="t"
+               AUTOGEN="t"
+               CONFIGURE="t"
+               BUILD="t" 
+               INSTALL="t"
+               PACKAGE="t"
+               DISTRIB="t" ;;
+   u|up|update)
                SVNUPDATE="t" ;;
-       a|auto|autogen)
+   a|auto|autogen)
                AUTOGEN="t" ;;
        c|conf|configure)
                CONFIGURE="t" ;;
@@ -111,14 +126,16 @@ do
                INSTALL="t" ;;
        p|pack|package)
                PACKAGE="t" ;;
-       # -p|--prefix)
-               #INSTALLPREFIX=$2
-               #shift 1 ;;
+       d|dist|distrib)
+               DISTRIB="t" ;;
+       -p|--prefix)
+               INSTALLPREFIX=$2
+               shift 1 ;;
        -s|-strip)
                STRIP="t" ;;
        -py|--with-python)
                PYTHON="t" 
-               PYTHONDIR=$2
+               PYTHONDIR="$2"
                shift 1 ;;
        esac
        shift 1
@@ -151,6 +168,11 @@ if [[ "$SVNUPDATE" == "t" ]]
 then
        cd $SRCROOT
        svn up
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nSVN update failed"
+               exit $status
+       fi
        cd $HERE
 fi
 
@@ -158,6 +180,11 @@ if [[ "$AUTOGEN" == "t" ]]
 then
        cd $SRCROOT
        ./autogen.sh
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nautogen failed"
+               exit $status
+       fi
        cd $HERE
 fi
 
@@ -165,7 +192,17 @@ if [[ "$CONFIGURE" == "t" ]]
 then
        ALLCONFFLAGS=`echo "$CONFFLAGS --prefix=$INSTALLPREFIX"`
        cd $SRCROOT
+       if [ ! -f configure ]
+       then
+               echo "Configure script not found in $SRCROOT. Run autogen.sh first"
+               exit 1
+       fi
        ./configure $ALLCONFFLAGS
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nConfigure failed"
+               exit $status
+       fi
        cd $HERE
 fi
 
@@ -173,6 +210,11 @@ if [[ "$BUILD" == "t" ]]
 then
        cd $SRCROOT
        make
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nBuild failed"
+               exit $status
+       fi
        cd $HERE
 fi
 
@@ -180,30 +222,71 @@ if [[ "$INSTALL" == "t" ]]
 then
        cd $SRCROOT
        make install
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nInstall failed"
+               exit $status
+       fi
        cd $HERE
 fi
 
-if [[ "$PACKAGE" == "t" ]]; then
+if [[ "$PACKAGE" == "t" ]]
+then
+       
+       # Detect strip parameter
        if [[ "$STRIP" == "t" ]]; then
                STRIPPARAM="-s"
        else
                STRIPPARAM=""
        fi
+       
+       # Test the existence of required files
+       if [ ! -e $INSTALLPREFIX/bin/inkscape ]
+       then
+               echo "The inkscape executable \"$INSTALLPREFIX/bin/inkscape\" cound not be found."
+               exit 1
+       fi
+       if [ ! -e $SRCROOT/Info.plist ]
+       then
+               echo "The file \"$SRCROOT/Info.plist\" could not be found, please re-run configure."
+               exit 1
+       fi
+       
+       # Create app bundle
        ./osx-app.sh $STRIPPARAM $INSTALLPREFIX/bin/inkscape $SRCROOT/Info.plist
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nApplication bundle creation failed"
+               exit $status
+       fi
+fi
+
+if [[ "$DISTRIB" == "t" ]]
+then   
+       REVISION=`head -n 4 ../../.svn/entries | tail -n 1`
+       ARCH=`arch | tr [p,c] [P,C]`
+       NEWNAME="Inkscape-$REVISION-$ARCH"
+       DMGFILE="$NEWNAME.dmg"
+       INFOFILE="$NEWNAME-info.txt"
 
+       # Create dmg bundle
        if [[ "$PYTHON" == "t" ]]; then
                ./osx-dmg.sh -py "$PYTHONDIR"
        else
                ./osx-dmg.sh
        fi
+       status=$?
+       if [[ $status -ne 0 ]]; then
+               echo -e "\nDisk image creation failed"
+               exit $status
+       fi
 
-       DATE=`date "+%Y%m%d"`
-       mv Inkscape.dmg Inkscape_$DATE.dmg
+       mv Inkscape.dmg $DMGFILE
        
        # Prepare information file
-       INFOFILE=Inkscape_$DATE-info.txt
        echo "Version information on $DATE for `whoami`:
        OS X      `/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d \:`
+       Architecture $ARCH
        DarwinPorts  `port version | cut -f2 -d \ `
        GCC          `gcc --version | grep GCC`
        GTK          `pkg-config --modversion gtk+-2.0`
@@ -214,7 +297,6 @@ if [[ "$PACKAGE" == "t" ]]; then
        Pango        `pkg-config --modversion pango`
 Configure options:
        $CONFFLAGS" > $INFOFILE
-
        if [[ "$STRIP" == "t" ]]; then
                echo "Debug info
        no" >> $INFOFILE
@@ -228,4 +310,3 @@ Configure options:
 fi
 
 exit 0
-