osx-app.sh revision b1c30ca7f7435f24e895f44763dcac60b1aa5cba
#
# Usage: osx-app [-s] /path/to/bin/inkscape Info.plist
#
# This script attempts to build an Inkscape.app package for OS X, resolving
# dynamic libraries, etc. It strips the executable and libraries if
# '-s' is given.
#
#
# Authors:
# Kees Cook <kees@outflux.net>
# Michael Wybrow <mjwybrow@users.sourceforge.net>
# Jean-Olivier Irisson <jo.irisson@gmail.com>
#
# Copyright (C) 2005 Kees Cook
# Copyright (C) 2005-2007 Michael Wybrow
# Copyright (C) 2007 Jean-Olivier Irisson
#
#
# Released under GNU GPL, read the file 'COPYING' for more information
#
# Thanks to GNUnet's "build_app" script for help with library dep resolution.
#
#
# Notes:
# The Info.plist file can be found in the base inkscape directory once
# configure has been run.
#
# When packaging Inkscape for OS X, configure should be run with the
# "--enable-osxapp" option which sets the correct paths for support
# files inside the app bundle.
#
# Thus, the usual use of this file would be to run it from the within the
# ./osx-app.sh /path/to/bin/inkscape ../../Info.plist
# Handle some version specific details.
# We're on Tiger (10.4) or later.
# XCode behaves a little differently in Tiger and later.
XCODEFLAGS="-configuration Deployment"
# libXinerama.1.dylib is not installed as part of X11 on Panther but
# is introduced as a dependency if Inkscape is compiled on Tiger or
# later. Thus, add the library to the bundle for Panther users
# Building on Tiger gives app bundles incompatible with Panther anyway
# so we do not need to add this now
# EXTRALIBS="/usr/X11R6/lib/libXinerama.1.dylib"
EXTRALIBS=""
else
# Panther (10.3) or earlier.
XCODEFLAGS="-buildstyle Deployment"
EXTRALIBS=""
fi
# set LIBPREFIX only if it has not been set before
# (by osx-build.sh for example)
if [ -z $LIBPREFIX ]
then
fi
# Package always has the same name. Version information is stored in
# the Info.plist file which is filled in by the configure script.
strip=false
while getopts 's' flag; do
s) strip=true ;;
\?) echo "Invalid command line option."; exit 1 ;;
*) echo "Internal error in getopts."; exit 2 ;;
esac
done
binary="$1"
if [ ! -x "$binary" ]; then
echo "Not executable: $binary" >&2
exit 1
fi
plist="$2"
if [ ! -f "$plist" ]; then
echo "Need plist file" >&2
exit 1
fi
# Set the 'macosx' directory, usually the current directory.
resdir=`pwd`
# Fix a given executable or library to be relocatable
if [ ! -d "$1" ]; then
echo $1
echo " $lib"
to=@executable_path/../lib/$base
to=@executable_path/../lib/$base
fi
done
fi
fi
done
fi
}
# Build and add the launcher.
(
# Build fails if CC happens to be set (to anything other than CompileC)
unset CC
cd "$resdir/ScriptExec"
)
# Pull down all the share files
# PkgInfo must match bundle type and creator code from Info.plist
# Pull in extra requirements.
# Need to adjust path and quote incase of spaces in path.
sed -e "s,$LIBPREFIX,\"\${CWD},g" -e 's,\.so ,.so" ,g' $LIBPREFIX/etc/pango/pango.modules > $pkgetc/pango/pango.modules
[Pango]
ModuleFiles=\${HOME}/.inkscape-etc/pango.modules
[PangoX]
AliasFiles=\${HOME}/.inkscape-etc/pangox.aliases
END_PANGO
# We use a modified fonts.conf file so only need the dtd
sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/etc/gtk-2.0/gdk-pixbuf.loaders > $pkgetc/gtk-2.0/gdk-pixbuf.loaders
sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/etc/gtk-2.0/gtk.immodules > $pkgetc/gtk-2.0/gtk.immodules
do
done
pangover=`ls $LIBPREFIX/lib/pango/`
# Find out libs we need from fink, darwinports, or from a custom install
# (e.g. $LIBPREFIX), then loop until no changes.
a=1
nfiles=0
endl=true
while $endl; do
echo "Looking for dependencies. Round " $a
libs="`otool -L $pkglib/gtk-2.0/$gtkver/loaders/* $pkglib/gtk-2.0/$gtkver/immodules/* $pkglib/gtk-2.0/$gtkver/engines/*.so $pkglib/pango/$pangover/modules/* $pkglib/gnome-vfs-2.0/modules/* $package/Contents/Resources/lib/* $binary 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $LIBPREFIX | sort | uniq`"
let "a+=1"
endl=false
else
fi
done
do
done
if [ "$strip" = "true" ]; then
fi
# NOTE: This works for all the dylibs but causes GTK to crash at startup.
# Instead we leave them with their original install_names and set
# DYLD_LIBRARY_PATH within the app bundle before running Inkscape.
#
# Fix package deps
# for file in *; do
# fixlib "$file"
# done
# cd ../lib
# for file in *; do
# fixlib "$file"
# done)
# Get all the icons and the rest of the script framework
# Make an image
# ./osx-dmg.sh