3
# Inkscape compilation and packaging script for Mac OS X
6
# http://wiki.inkscape.org/wiki/index.php?title=CompilingMacOsX
7
# for more complete information
10
# Jean-Olivier Irisson <jo.irisson@gmail.com>
11
# with information from
15
# Copyright (C) 2006-2007
16
# Released under GNU GPL, read the file 'COPYING' for more information
19
############################################################
21
# User modifiable parameters
22
#----------------------------------------------------------
24
CONFFLAGS="--disable-static --enable-shared --enable-osxapp"
25
# Libraries prefix (Warning: NO trailing slash)
26
LIBPREFIX="/opt/local"
27
# User name on Modevia
30
############################################################
33
#----------------------------------------------------------
38
Compilation script for Inkscape on Mac OS X.
41
$0 [options] action[s]
43
\033[1mACTIONS & OPTIONS\033[0m
45
display this help message
46
\033[1mu,up,update\033[0m
47
update an existing checkout from svn (run svn up)
48
\033[1ma,auto,autogen\033[0m
49
prepare configure script (run autogen.sh). This is only necessary
50
for a fresh svn checkout or after make distclean.
51
\033[1mc,conf,configure\033[0m
52
configure the build (run configure). Edit your configuration
54
\033[1m-p,--prefix\033[0m specify install prefix (configure step only)
56
build Inkscape (run make)
57
\033[1mi,install\033[0m
58
install the build products locally, inside the source
59
directory (run make install)
60
\033[1mp,pack,package\033[0m
61
package Inkscape in a double clickable .app bundle
62
\033[1m-s,--strip\033[0m remove debugging information in Inkscape package
63
\033[1m-py,--with-python\033[0m specify python modules path for inclusion into the app bundle
64
\033[1md,dist,distrib\033[0m
65
store Inkscape.app in a disk image (dmg) for distribution
66
\033[1mput,upload\033[0m
67
upload the dmg and the associate info file on Modevia server
69
do everything (update, configure, build, install, package, distribute)
71
\033[1mEXAMPLES\033[0m
72
\033[1m$0 conf build install\033[0m
73
configure, build and install a dowloaded version of Inkscape in the default
74
directory, keeping debugging information.
75
\033[1m$0 u a c b -p ~ i -s -py ~/site-packages/ p d\033[0m
76
update an svn checkout, prepare configure script, configure,
77
build and install Inkscape in the user home directory (~).
78
Then package Inkscape without debugging information,
79
with python packages from ~/site-packages/ and prepare
80
a dmg for distribution."
84
#----------------------------------------------------------
87
SRCROOT=$HERE/../.. # we are currently in packaging/macosx
90
if [ "$INSTALLPREFIX" = "" ]
92
INSTALLPREFIX=$SRCROOT/Build/
106
# Parse command line options
107
#----------------------------------------------------------
146
echo "Invalid command line option: $1"
153
# Set environment variables
154
# ----------------------------------------------------------
157
# Specific environment variables
158
# automake seach path
159
export CPATH="$LIBPREFIX/include"
160
# configure search path
161
export CPPFLAGS="-I$LIBPREFIX/include"
162
# export CPPFLAGS="-I$LIBPREFIX/include -I /System/Library/Frameworks/Carbon.framework/Versions/Current/Headers"
163
export LDFLAGS="-L$LIBPREFIX/lib"
165
export CFLAGS="-O3 -Wall"
166
export CXXFLAGS="$CFLAGS"
170
# ----------------------------------------------------------
171
if [[ "$SVNUPDATE" == "t" ]]
176
if [[ $status -ne 0 ]]; then
177
echo -e "\nSVN update failed"
183
if [[ "$AUTOGEN" == "t" ]]
188
if [[ $status -ne 0 ]]; then
189
echo -e "\nautogen failed"
195
if [[ "$CONFIGURE" == "t" ]]
197
ALLCONFFLAGS=`echo "$CONFFLAGS --prefix=$INSTALLPREFIX"`
199
if [ ! -f configure ]
201
echo "Configure script not found in $SRCROOT. Run '$0 autogen' first"
204
./configure $ALLCONFFLAGS
206
if [[ $status -ne 0 ]]; then
207
echo -e "\nConfigure failed"
213
if [[ "$BUILD" == "t" ]]
218
if [[ $status -ne 0 ]]; then
219
echo -e "\nBuild failed"
225
if [[ "$INSTALL" == "t" ]]
230
if [[ $status -ne 0 ]]; then
231
echo -e "\nInstall failed"
237
if [[ "$PACKAGE" == "t" ]]
240
# Test the existence of required files
241
if [ ! -e $INSTALLPREFIX/bin/inkscape ]
243
echo "The inkscape executable \"$INSTALLPREFIX/bin/inkscape\" cound not be found."
246
if [ ! -e $SRCROOT/Info.plist ]
248
echo "The file \"$SRCROOT/Info.plist\" could not be found, please re-run configure."
252
# Set python command line option (if PYTHON_MODULES location is not empty, then add the python call to the command line, otherwise, stay empty)
253
if [[ "$PYTHON_MODULES" != "" ]]; then
254
PYTHON_MODULES="-py $PYTHON_MODULES"
255
# TODO: fix this: it does not allow for spaces in the PATH under this form and cannot be quoted
259
./osx-app.sh $STRIP -b $INSTALLPREFIX/bin/inkscape -p $SRCROOT/Info.plist $PYTHON_MODULES
261
if [[ $status -ne 0 ]]; then
262
echo -e "\nApplication bundle creation failed"
267
# Fetch some information
268
REVISION=`head -n 4 ../../.svn/entries | tail -n 1`
269
ARCH=`arch | tr [p,c] [P,C]`
270
MINORVERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d \.`
271
NEWNAME="Inkscape-$REVISION-10.$MINORVERSION-$ARCH"
272
DMGFILE="$NEWNAME.dmg"
273
INFOFILE="$NEWNAME-info.txt"
275
if [[ "$DISTRIB" == "t" ]]
278
./osx-dmg.sh -p "Inkscape.app"
280
if [[ $status -ne 0 ]]; then
281
echo -e "\nDisk image creation failed"
285
mv Inkscape.dmg $DMGFILE
287
# Prepare information file
288
echo "Version information on $DATE for `whoami`:
289
OS X `/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d \:`
291
DarwinPorts `port version | cut -f2 -d \ `
292
GCC `gcc --version | grep GCC`
293
GTK `pkg-config --modversion gtk+-2.0`
294
GTKmm `pkg-config --modversion gtkmm-2.4`
295
Cairo `pkg-config --modversion cairo`
296
Cairomm `pkg-config --modversion cairomm-1.0`
297
CairoPDF `pkg-config --modversion cairo-pdf`
298
Pango `pkg-config --modversion pango`
300
$CONFFLAGS" > $INFOFILE
301
if [[ "$STRIP" == "t" ]]; then
310
if [[ "$UPLOAD" == "t" ]]
312
# Provide default for user name on modevia
313
if [[ "$MODEVIA_NAME" == "" ]]; then
317
scp $DMGFILE $INFOFILE "$MODEVIA_NAME"@inkscape.modevia.com:inkscape/docs/macosx-snap/
319
if [[ $status -ne 0 ]]; then
320
echo -e "\nUpload failed"
325
if [[ "$PACKAGE" == "t" || "$DISTRIB" == "t" ]]; then
326
# open a Finder window here to admire what we just produced