osx-build.sh revision 36994ed8917288bc5710d2ba3313312e3005fec6
#
# Inkscape compilation and packaging script for Mac OS X
#
# Please see
# for more complete information
#
# Author:
# Jean-Olivier Irisson <jo.irisson@gmail.com>
# with information from
# Kees Cook
# Michael Wybrow
#
# Copyright (C) 2006-2007
# Released under GNU GPL, read the file 'COPYING' for more information
#
############################################################
# User modifiable parameters
#----------------------------------------------------------
# Configure flags
CONFFLAGS="--disable-static --enable-shared --enable-osxapp"
# Libraries prefix (Warning: NO trailing slash)
# User name on Modevia
MODEVIA_USER=""
############################################################
# Help message
#----------------------------------------------------------
help()
{
echo -e "
Compilation script for Inkscape on Mac OS X.
\033[1mUSAGE\033[0m
$0 [options] action[s]
\033[1mACTIONS & OPTIONS\033[0m
\033[1mh,help\033[0m
display this help message
\033[1mu,up,update\033[0m
update an existing checkout from svn (run svn up)
\033[1ma,auto,autogen\033[0m
prepare configure script (run autogen.sh). This is only necessary
for a fresh svn checkout or after make distclean.
\033[1mc,conf,configure\033[0m
configure the build (run configure). Edit your configuration
options in $0
\033[1m-p,--prefix\033[0m specify install prefix (configure step only)
\033[1mb,build\033[0m
build Inkscape (run make)
\033[1mi,install\033[0m
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
\033[1m-s,--strip\033[0m remove debugging information in Inkscape package
\033[1m-py,--with-python\033[0m specify python modules path for inclusion into the app bundle
\033[1md,dist,distrib\033[0m
store Inkscape.app in a disk image (dmg) for distribution
\033[1mput,upload\033[0m
upload the dmg and the associate info file on Modevia server
\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 u a c b -p ~ i -s -py ~/site-packages/ p d\033[0m
update an svn checkout, prepare configure script, configure,
build and install Inkscape in the user home directory (~).
Then package Inkscape without debugging information,
with python packages from ~/site-packages/ and prepare
a dmg for distribution."
}
# Parameters
#----------------------------------------------------------
# Paths
HERE=`pwd`
# Defaults
if [ "$INSTALLPREFIX" = "" ]
then
fi
SVNUPDATE="f"
AUTOGEN="f"
CONFIGURE="f"
BUILD="f"
INSTALL="f"
PACKAGE="f"
DISTRIB="f"
UPLOAD="f"
STRIP=""
# Parse command line options
#----------------------------------------------------------
while [ "$1" != "" ]
do
case $1 in
h|help)
exit 1 ;;
all)
SVNUPDATE="t"
CONFIGURE="t"
BUILD="t"
INSTALL="t"
PACKAGE="t"
DISTRIB="t" ;;
SVNUPDATE="t" ;;
AUTOGEN="t" ;;
CONFIGURE="t" ;;
b|build)
BUILD="t" ;;
i|install)
INSTALL="t" ;;
PACKAGE="t" ;;
DISTRIB="t" ;;
UPLOAD="t" ;;
-p|--prefix)
shift 1 ;;
-s|-strip)
STRIP="-s" ;;
PYTHON_MODULES="$2"
shift 1 ;;
*)
echo "Invalid command line option"
exit 2 ;;
esac
shift 1
done
# Set environment variables
# ----------------------------------------------------------
export LIBPREFIX
# Specific environment variables
# automake seach path
export CPATH="$LIBPREFIX/include"
# configure search path
export CPPFLAGS="-I$LIBPREFIX/include"
# export CPPFLAGS="-I$LIBPREFIX/include -I /System/Library/Frameworks/Carbon.framework/Versions/Current/Headers"
export LDFLAGS="-L$LIBPREFIX/lib"
# compiler arguments
export CFLAGS="-O3 -Wall"
# Actions
# ----------------------------------------------------------
if [[ "$SVNUPDATE" == "t" ]]
then
cd $SRCROOT
status=$?
echo -e "\nSVN update failed"
exit $status
fi
cd $HERE
fi
if [[ "$AUTOGEN" == "t" ]]
then
cd $SRCROOT
status=$?
echo -e "\nautogen failed"
exit $status
fi
cd $HERE
fi
if [[ "$CONFIGURE" == "t" ]]
then
cd $SRCROOT
if [ ! -f configure ]
then
echo "Configure script not found in $SRCROOT. Run '$0 autogen' first"
exit 1
fi
status=$?
echo -e "\nConfigure failed"
exit $status
fi
cd $HERE
fi
if [[ "$BUILD" == "t" ]]
then
cd $SRCROOT
status=$?
echo -e "\nBuild failed"
exit $status
fi
cd $HERE
fi
if [[ "$INSTALL" == "t" ]]
then
cd $SRCROOT
status=$?
echo -e "\nInstall failed"
exit $status
fi
cd $HERE
fi
if [[ "$PACKAGE" == "t" ]]
then
# Test the existence of required files
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
# Set python command line option (if PYTHON_MODULES location is not empty, then add the python call to the command line, otherwise, stay empty)
if [[ "$PYTHON_MODULES" != "" ]]; then
PYTHON_MODULES="-py '$PYTHON_MODULES'"
fi
# Create app bundle
status=$?
echo -e "\nApplication bundle creation failed"
exit $status
fi
fi
# Fetch some information
if [[ "$DISTRIB" == "t" ]]
then
# Create dmg bundle
./osx-dmg.sh -p "Inkscape.app"
status=$?
echo -e "\nDisk image creation failed"
exit $status
fi
# Prepare information file
Architecture $ARCH
GTK `pkg-config --modversion gtk+-2.0`
GTKmm `pkg-config --modversion gtkmm-2.4`
Cairo `pkg-config --modversion cairo`
Cairomm `pkg-config --modversion cairomm-1.0`
CairoPDF `pkg-config --modversion cairo-pdf`
Pango `pkg-config --modversion pango`
Configure options:
if [[ "$STRIP" == "t" ]]; then
echo "Debug info
no" >> $INFOFILE
else
echo "Debug info
yes" >> $INFOFILE
fi
fi
if [[ "$UPLOAD" == "t" ]]
then
status=$?
echo -e "\nUpload failed"
exit $status
fi
fi
# open a Finder window here to admire what we just produced
open .
fi
exit 0