From: jiho-sf Date: Sat, 3 Nov 2007 22:30:48 +0000 (+0000) Subject: osx-app.sh X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=36994ed8917288bc5710d2ba3313312e3005fec6;p=inkscape.git osx-app.sh - added an help message - changed the calling syntax to make it more robust and allow to specify the directory containing python modules - removed the reference to libXinerama on Tiger. libXinerama caused many issues but they seem to be all related to people installing x11 in strange ways - use pkg-config to get pango and gtk version rather thn relying on clucky ls+sed workarounds - code reorganization and added comments - spaces to tabs osx-dmg.sh - removed python related stuff - added a command line option to get Inkscape package (the package does not have to be in the same directory now) osx-build.sh - modified according to the changes in the two other files - removed referece to X11 libraries ad such. these were commented for a while and nothing broke - added an upload commnt to send the file to modevia removed inkscape_python.ds_store modified inkscape.ds_store (larger window) dmg_background.*** - removed Python arrow - remove the word Inkscape from the arrow (useless now) and make this arrow glow green a little, as the rest of the picture - removed absolute paths to my computer --- diff --git a/packaging/macosx/dmg_background.png b/packaging/macosx/dmg_background.png index 65b7964f8..94228b60d 100644 Binary files a/packaging/macosx/dmg_background.png and b/packaging/macosx/dmg_background.png differ diff --git a/packaging/macosx/dmg_background.svg b/packaging/macosx/dmg_background.svg index 8bd97119e..c045e6486 100644 --- a/packaging/macosx/dmg_background.svg +++ b/packaging/macosx/dmg_background.svg @@ -2,7 +2,7 @@ + + + + id="filter9015"> + stdDeviation="1.755523" + id="feGaussianBlur9017" /> This tutorial covers copy/paste, node editing, freehand and bezier drawing, path manipulation, booleans, offsets, simplification, and text tool. + transform="translate(0,-6.7202624)" + style="opacity:0.8258427"> + - Inkscape - Inkscape - - - Python - Python - - diff --git a/packaging/macosx/dmg_set_style.scpt b/packaging/macosx/dmg_set_style.scpt index c18f57154..7c010d102 100755 Binary files a/packaging/macosx/dmg_set_style.scpt and b/packaging/macosx/dmg_set_style.scpt differ diff --git a/packaging/macosx/inkscape.ds_store b/packaging/macosx/inkscape.ds_store index 25cb6d7ef..c4bc9e32d 100644 Binary files a/packaging/macosx/inkscape.ds_store and b/packaging/macosx/inkscape.ds_store differ diff --git a/packaging/macosx/inkscape_python.ds_store b/packaging/macosx/inkscape_python.ds_store deleted file mode 100644 index 4851ceed7..000000000 Binary files a/packaging/macosx/inkscape_python.ds_store and /dev/null differ diff --git a/packaging/macosx/osx-app.sh b/packaging/macosx/osx-app.sh index fe093d18b..4c0927001 100755 --- a/packaging/macosx/osx-app.sh +++ b/packaging/macosx/osx-app.sh @@ -1,173 +1,235 @@ -#! /bin/bash +#!/bin/bash # -# Usage: osx-app [-s] /path/to/bin/inkscape Info.plist +# USAGE +# osx-app [-s] [-py /path/to/python/modules] [-l /path/to/libraries] -b /path/to/bin/inkscape -p /path/to/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. -# +# dynamic libraries, etc. +# It strips the executable and libraries if '-s' is given. +# It adds python modules if the '-py option' is given +# The Info.plist file can be found in the base inkscape directory once +# configure has been run. # -# Authors: -# Kees Cook -# Michael Wybrow -# Jean-Olivier Irisson +# AUTHORS +# Kees Cook +# Michael Wybrow +# Jean-Olivier Irisson # # 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. -# https://gnunet.org/svn/GNUnet/contrib/OSX/build_app +# https://gnunet.org/svn/GNUnet/contrib/OSX/build_app # -# -# Notes: -# The Info.plist file can be found in the base inkscape directory once -# configure has been run. -# +# NB: # 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 -# inkscape/packaging/macosx directory, substituting in the inkscape binary path: -# ./osx-app.sh /path/to/bin/inkscape ../../Info.plist - +# Defaults +strip=false +add_python=false +python_dir="" -# Handle some version specific details. -VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'` -if [ "$VERSION" -ge "4" ]; then - # We're on Tiger (10.4) or later. - # XCode behaves a little differently in Tiger and later. - XCODEFLAGS="-configuration Deployment" - SCRIPTEXECDIR="ScriptExec/build/Deployment/ScriptExec.app/Contents/MacOS" - # 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" - SCRIPTEXECDIR="ScriptExec/build/ScriptExec.app/Contents/MacOS" - EXTRALIBS="" -fi - -# set LIBPREFIX only if it has not been set before -# (by osx-build.sh for example) -if [ -z $LIBPREFIX ] -then - export LIBPREFIX="$HOME/ws-fat" +# If LIBPREFIX is not already set (by osx-build.sh for example) set it to blank (one should use the command line argument to set it correctly) +if [ -z $LIBPREFIX ]; then + LIBPREFIX="" fi -# Package always has the same name. Version information is stored in -# the Info.plist file which is filled in by the configure script. -pkg=Inkscape -package="$pkg.app" +# Help message +#---------------------------------------------------------- +help() +{ +echo -e " +Create an app bundle for OS X + +\033[1mUSAGE\033[0m + $0 [-s] [-py /path/to/python/modules] [-l /path/to/libraries] -b /path/to/bin/inkscape -p /path/to/Info.plist + +\033[1mOPTIONS\033[0m + \033[1m-h,--help\033[0m + display this help message + \033[1m-s\033[0m + strip the libraries and executables from debugging symbols + \033[1m-py,--with-python\033[0m + add python modules (numpy, lxml) from given directory + inside the app bundle + \033[1m-l,--libraries\033[0m + specify the path to the librairies Inkscape depends on + (typically /sw or /opt/local) + \033[1m-b--binary\033[0m + specify the path to Inkscape's binary. By default it is in + Build/bin/ at the base of the source code directory + \033[1m-p,--plist\033[0m + specify the path to Info.plist. Info.plist can be found + in the base directory of the source code once configure + has been run + +\033[1mEXAMPLE\033[0m + $0 -s -py /Library/Python/2.3/site-packages/ -l /opt/local -b ../../Build/bin/inkscape -p ../../Info.plist +" +} -# Remove a previously existing package -if [ -d $package ]; then - echo "Removing previous Inkscape.app" - rm -Rf $package -fi -strip=false -while getopts 's' flag; do - case $flag in - s) strip=true ;; - \?) echo "Invalid command line option."; exit 1 ;; - *) echo "Internal error in getopts."; exit 2 ;; +# Parse command line arguments +#---------------------------------------------------------- +while [ "$1" != "" ] +do + case $1 in + -py|--with-python) + add_python=true + python_dir="$2" + shift 1 ;; + -s) + strip=true ;; + -l|--libraries) + LIBPREFIX="$2" + shift 1 ;; + -b|--binary) + binary="$2" + shift 1 ;; + -p|--plist) + plist="$2" + shift 1 ;; + -h|--help) + help + exit 0 ;; + *) + echo "Invalid command line option" + exit 2 ;; esac + shift 1 done -shift `expr $OPTIND - 1`; +echo -e "\n\033[1mCREATE INKSCAPE APP BUNDLE\033[0m\n" -binary="$1" -if [ ! -x "$binary" ]; then - echo "Not executable: $binary" >&2 - exit 1 +# Safety tests +if [ ${add_python} = "true" ]; then + if [ ! -e "$python_dir" ]; then + echo "Cannot find the directory containing python modules: $python_dir" >&2 + exit 1 + fi +fi + +if [ ! -e "$LIBPREFIX" ]; then + echo "Cannot find the directory containing the libraires: $LIBPREFIX" >&2 + exit 1 +fi + +if [ ! -f "$binary" ]; then + echo "Need Inkscape 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` +if [ ! -x "$binary" ]; then + echo "Not executable: $binary" >&2 + exit 1 +fi + -# Fix a given executable or library to be relocatable -fixlib () { -if [ ! -d "$1" ]; then - echo $1 - libs="`otool -L $1 | fgrep compatibility | cut -d\( -f1`" - for lib in $libs; do - echo " $lib" - base=`echo $lib | awk -F/ '{print $NF}'` - first=`echo $lib | cut -d/ -f1-3` - to=@executable_path/../lib/$base - if [ $first != /usr/lib -a $first != /usr/X11R6 ]; then - /usr/bin/install_name_tool -change $lib $to $1 - if [ "`echo $lib | fgrep libcrypto`" = "" ]; then - /usr/bin/install_name_tool -id $to ../lib/$base - for ll in $libs; do - base=`echo $ll | awk -F/ '{print $NF}'` - first=`echo $ll | cut -d/ -f1-3` - to=@executable_path/../lib/$base - if [ $first != /usr/lib -a $first != /usr/X11R6 -a "`echo $ll | fgrep libcrypto`" = "" ]; then - /usr/bin/install_name_tool -change $ll $to ../lib/$base - fi - done - fi - fi - done +# Handle some version specific details. +VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'` +if [ "$VERSION" -ge "4" ]; then + # We're on Tiger (10.4) or later. + # XCode behaves a little differently in Tiger and later. + XCODEFLAGS="-configuration Deployment" + SCRIPTEXECDIR="ScriptExec/build/Deployment/ScriptExec.app/Contents/MacOS" + EXTRALIBS="" +else + # Panther (10.3) or earlier. + XCODEFLAGS="-buildstyle Deployment" + SCRIPTEXECDIR="ScriptExec/build/ScriptExec.app/Contents/MacOS" + EXTRALIBS="" +fi + + +# Package always has the same name. Version information is stored in +# the Info.plist file which is filled in by the configure script. +package="Inkscape.app" + +# Remove a previously existing package if necessary +if [ -d $package ]; then + echo "Removing previous Inkscape.app" + rm -Rf $package fi -} +# Set the 'macosx' directory, usually the current directory. +resdir=`pwd` -mkdir -p "$package"/Contents/MacOS -mkdir -p "$package"/Contents/Resources/bin -mkdir -p "$package"/Contents/Resources/lib -mkdir -p "$package"/Contents/Resources/locale -binname=`basename "$binary"` -binpath="$package/Contents/Resources/bin/inkscape-bin" +# Prepare Package +#---------------------------------------------------------- +pkgexec="$package/Contents/MacOS" +pkgbin="$package/Contents/Resources/bin" +pkglib="$package/Contents/Resources/lib" +pkglocale="$package/Contents/Resources/locale" +pkgpython="$package/Contents/Resources/python/site-packages/" -cp "$binary" "$binpath" +mkdir -p "$pkgexec" +mkdir -p "$pkgbin" +mkdir -p "$pkglib" +mkdir -p "$pkglocale" +mkdir -p "$pkgpython" -# Build and add the launcher. +# Build and add the launcher +#---------------------------------------------------------- ( - # Build fails if CC happens to be set (to anything other than CompileC) - unset CC - - cd "$resdir/ScriptExec" - xcodebuild $XCODEFLAGS clean build + # Build fails if CC happens to be set (to anything other than CompileC) + unset CC + + cd "$resdir/ScriptExec" + echo -e "\033[1mBuilding launcher...\033[0m\n" + xcodebuild $XCODEFLAGS clean build ) -cp "$resdir/$SCRIPTEXECDIR/ScriptExec" "$package/Contents/MacOS/Inkscape" +cp "$resdir/$SCRIPTEXECDIR/ScriptExec" "$pkgexec/Inkscape" -# Pull down all the share files + +# Copy all files into the bundle +#---------------------------------------------------------- +echo -e "\n\033[1mFilling app bundle...\033[0m\n" + +binary_name=`basename "$binary"` binary_dir=`dirname "$binary"` -rsync -av "$binary_dir/../share/$binname"/* "$package/Contents/Resources/" + +# Inkscape's binary +binpath="$pkgbin/inkscape-bin" +cp -v "$binary" "$binpath" +# TODO Add a "$verbose" variable and command line switch, which sets wether these commands are verbose or not + +# Share files +rsync -av "$binary_dir/../share/$binary_name"/* "$package/Contents/Resources/" cp "$plist" "$package/Contents/Info.plist" rsync -av "$binary_dir/../share/locale"/* "$package/Contents/Resources/locale" +# Icons and the rest of the script framework +rsync -av --exclude ".svn" "$resdir"/Resources/* "$package"/Contents/Resources/ + +# Add python modules if requested +if [ ${add_python} = "true" ]; then + # copy python site-packages + cp -rvf "$python_dir"/* "$pkgpython" +fi + # PkgInfo must match bundle type and creator code from Info.plist echo "APPLInks" > $package/Contents/PkgInfo -# Pull in extra requirements. +# Pull in extra requirements for Pango and GTK pkgetc="$package/Contents/Resources/etc" mkdir -p $pkgetc/pango cp $LIBPREFIX/etc/pango/pangox.aliases $pkgetc/pango/ -# Need to adjust path and quote incase of spaces in path. +# Need to adjust path and quote in case of spaces in path. sed -e "s,$LIBPREFIX,\"\${CWD},g" -e 's,\.so ,.so" ,g' $LIBPREFIX/etc/pango/pango.modules > $pkgetc/pango/pango.modules cat > $pkgetc/pango/pangorc < $pkgetc/g for item in gnome-vfs-mime-magic gnome-vfs-2.0 do - cp -r $LIBPREFIX/etc/$item $pkgetc/ + cp -r $LIBPREFIX/etc/$item $pkgetc/ done +pango_version=`pkg-config --variable=pango_module_version pango` +mkdir -p $pkglib/pango/$pango_version/modules +cp $LIBPREFIX/lib/pango/$pango_version/modules/*.so $pkglib/pango/$pango_version/modules/ -pkglib="$package/Contents/Resources/lib" -pangover=`ls $LIBPREFIX/lib/pango/` -mkdir -p $pkglib/pango/$pangover/modules -cp $LIBPREFIX/lib/pango/$pangover/modules/*.so $pkglib/pango/$pangover/modules/ - -gtkver=`ls $LIBPREFIX/lib/gtk-2.0/ | grep "2\."` -mkdir -p $pkglib/gtk-2.0/$gtkver/{engines,immodules,loaders} -cp -r $LIBPREFIX/lib/gtk-2.0/$gtkver/engines/* $pkglib/gtk-2.0/$gtkver/engines/ -cp $LIBPREFIX/lib/gtk-2.0/$gtkver/immodules/*.so $pkglib/gtk-2.0/$gtkver/immodules/ -cp $LIBPREFIX/lib/gtk-2.0/$gtkver/loaders/*.so $pkglib/gtk-2.0/$gtkver/loaders/ +gtk_version=`pkg-config --variable=gtk_binary_version gtk+-2.0` +mkdir -p $pkglib/gtk-2.0/$gtk_version/{engines,immodules,loaders} +cp -r $LIBPREFIX/lib/gtk-2.0/$gtk_version/engines/* $pkglib/gtk-2.0/$gtk_version/engines/ +cp $LIBPREFIX/lib/gtk-2.0/$gtk_version/immodules/*.so $pkglib/gtk-2.0/$gtk_version/immodules/ +cp $LIBPREFIX/lib/gtk-2.0/$gtk_version/loaders/*.so $pkglib/gtk-2.0/$gtk_version/loaders/ mkdir -p $pkglib/gnome-vfs-2.0/modules cp $LIBPREFIX/lib/gnome-vfs-2.0/modules/*.so $pkglib/gnome-vfs-2.0/modules/ # Find out libs we need from fink, darwinports, or from a custom install -# (e.g. $LIBPREFIX), then loop until no changes. +# (i.e. $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`" - cp -f $libs $package/Contents/Resources/lib - let "a+=1" - nnfiles=`ls $package/Contents/Resources/lib | wc -l` - if [ $nnfiles = $nfiles ]; then - endl=false - else - nfiles=$nnfiles - fi + echo -e "\033[1mLooking for dependencies.\033[0m Round" $a + libs="`otool -L $pkglib/gtk-2.0/$gtk_version/loaders/* $pkglib/gtk-2.0/$gtk_version/immodules/* $pkglib/gtk-2.0/$gtk_version/engines/*.so $pkglib/pango/$pango_version/modules/* $pkglib/gnome-vfs-2.0/modules/* $package/Contents/Resources/lib/* $binary 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $LIBPREFIX | sort | uniq`" + cp -f $libs $package/Contents/Resources/lib + let "a+=1" + nnfiles=`ls $package/Contents/Resources/lib | wc -l` + if [ $nnfiles = $nfiles ]; then + endl=false + else + nfiles=$nnfiles + fi done +# Add extra libraries of necessary for libfile in $EXTRALIBS do - cp -f $libfile $package/Contents/Resources/lib + cp -f $libfile $package/Contents/Resources/lib done + +# Strip libraries and executables if requested +#---------------------------------------------------------- if [ "$strip" = "true" ]; then - chmod +w "$package"/Contents/Resources/lib/*.dylib - strip -x "$package"/Contents/Resources/lib/*.dylib - strip -ur "$binpath" + echo -e "\n\033[1mStripping debugging symbols...\033[0m\n" + chmod +w "$pkglib"/*.dylib + strip -x "$pkglib"/*.dylib + strip -ur "$binpath" 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. +# Instead we leave them with their original install_names and set +# DYLD_LIBRARY_PATH within the app bundle before running Inkscape. # +# fixlib () { +# # Fix a given executable or library to be relocatable +# if [ ! -d "$1" ]; then +# echo $1 +# libs="`otool -L $1 | fgrep compatibility | cut -d\( -f1`" +# for lib in $libs; do +# echo " $lib" +# base=`echo $lib | awk -F/ '{print $NF}'` +# first=`echo $lib | cut -d/ -f1-3` +# to=@executable_path/../lib/$base +# if [ $first != /usr/lib -a $first != /usr/X11R6 ]; then +# /usr/bin/install_name_tool -change $lib $to $1 +# if [ "`echo $lib | fgrep libcrypto`" = "" ]; then +# /usr/bin/install_name_tool -id $to ../lib/$base +# for ll in $libs; do +# base=`echo $ll | awk -F/ '{print $NF}'` +# first=`echo $ll | cut -d/ -f1-3` +# to=@executable_path/../lib/$base +# if [ $first != /usr/lib -a $first != /usr/X11R6 -a "`echo $ll | fgrep libcrypto`" = "" ]; then +# /usr/bin/install_name_tool -change $ll $to ../lib/$base +# fi +# done +# fi +# fi +# done +# fi +# } +# # Fix package deps #(cd "$package/Contents/MacOS/bin" # for file in *; do -# fixlib "$file" +# fixlib "$file" # done # cd ../lib # for file in *; do -# fixlib "$file" +# fixlib "$file" # done) -# Get all the icons and the rest of the script framework -rsync -av --exclude ".svn" $resdir/Resources/* $package/Contents/Resources/ - exit 0 diff --git a/packaging/macosx/osx-build.sh b/packaging/macosx/osx-build.sh index 15af2589f..a708c8f2c 100755 --- a/packaging/macosx/osx-build.sh +++ b/packaging/macosx/osx-build.sh @@ -12,18 +12,20 @@ # Kees Cook # Michael Wybrow # -# Copyright 2006 -# Licensed under GNU General Public License +# Copyright (C) 2006-2007 +# Released under GNU GPL, read the file 'COPYING' for more information # ############################################################ # User modifiable parameters #---------------------------------------------------------- -# Configure flags +# Configure flags CONFFLAGS="--disable-static --enable-shared --enable-osxapp" -# Libraries prefix +# Libraries prefix (Warning: NO trailing slash) LIBPREFIX="/opt/local" +# User name on Modevia +MODEVIA_USER="" ############################################################ @@ -58,9 +60,11 @@ Compilation script for Inkscape on Mac OS X. \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[1m-py,--with-python\033[0m specify python packages path for inclusion into the dmg image + \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) @@ -68,12 +72,12 @@ Compilation script for Inkscape on Mac OS X. \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 p -py ~/pyxml/ d\033[0m + \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 withouth debugging information, - with python packages from ~/pyxml/ and prepare a dmg for - distribution." + Then package Inkscape without debugging information, + with python packages from ~/site-packages/ and prepare + a dmg for distribution." } # Parameters @@ -94,9 +98,10 @@ BUILD="f" INSTALL="f" PACKAGE="f" DISTRIB="f" +UPLOAD="f" -STRIP="f" -PYTHON="f" +STRIP="" +PYTHON_MODULES="" # Parse command line options #---------------------------------------------------------- @@ -108,7 +113,6 @@ do exit 1 ;; all) SVNUPDATE="t" - AUTOGEN="t" CONFIGURE="t" BUILD="t" INSTALL="t" @@ -128,15 +132,19 @@ do PACKAGE="t" ;; d|dist|distrib) DISTRIB="t" ;; + put|upload) + UPLOAD="t" ;; -p|--prefix) INSTALLPREFIX=$2 shift 1 ;; -s|-strip) - STRIP="t" ;; + STRIP="-s" ;; -py|--with-python) - PYTHON="t" - PYTHONDIR="$2" + PYTHON_MODULES="$2" shift 1 ;; + *) + echo "Invalid command line option" + exit 2 ;; esac shift 1 done @@ -151,15 +159,11 @@ export LIBPREFIX 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" export CXXFLAGS="$CFLAGS" -# add X11 executables and libraries [does not seem to be required now] -# export PATH="/usr/X11R6/bin:$PATH" -# export LIBRARY_PATH="/usr/X11R6/lib:$LIBPREFIX/lib" -# pkgconfig path [does not seem to be required either] -# export PKG_CONFIG_PATH="$LIBPREFIX/lib/pkgconfig" # Actions @@ -194,7 +198,7 @@ then cd $SRCROOT if [ ! -f configure ] then - echo "Configure script not found in $SRCROOT. Run autogen.sh first" + echo "Configure script not found in $SRCROOT. Run '$0 autogen' first" exit 1 fi ./configure $ALLCONFFLAGS @@ -233,13 +237,6 @@ fi 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 @@ -252,8 +249,13 @@ then 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 - ./osx-app.sh $STRIPPARAM $INSTALLPREFIX/bin/inkscape $SRCROOT/Info.plist + ./osx-app.sh $STRIP -b $INSTALLPREFIX/bin/inkscape -p $SRCROOT/Info.plist "$PYTHON_MODULES" status=$? if [[ $status -ne 0 ]]; then echo -e "\nApplication bundle creation failed" @@ -261,20 +263,17 @@ then 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" +# Fetch some information +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" +if [[ "$DISTRIB" == "t" ]] +then # Create dmg bundle - if [[ "$PYTHON" == "t" ]]; then - ./osx-dmg.sh -py "$PYTHONDIR" - else - ./osx-dmg.sh - fi + ./osx-dmg.sh -p "Inkscape.app" status=$? if [[ $status -ne 0 ]]; then echo -e "\nDisk image creation failed" @@ -303,9 +302,21 @@ Configure options: else echo "Debug info yes" >> $INFOFILE + fi +fi + +if [[ "$UPLOAD" == "t" ]] +then + scp $DMGFILE $INFOFILE "$MODEVIA_NAME"@inkscape.modevia.com:inkscape/docs/macosx-snap/ + status=$? + if [[ $status -ne 0 ]]; then + echo -e "\nUpload failed" + exit $status fi - - # open a Finder window here +fi + +if [[ "$PACKAGE" == "t" ]] | [[ "$DISTRIB" == "t" ]]; then + # open a Finder window here to admire what we just produced open . fi diff --git a/packaging/macosx/osx-dmg.sh b/packaging/macosx/osx-dmg.sh index 91aefdd41..86e83bf06 100755 --- a/packaging/macosx/osx-dmg.sh +++ b/packaging/macosx/osx-dmg.sh @@ -1,19 +1,19 @@ #!/bin/sh # -# Inkscape packaging script for Mac OS X +# USAGE +# osx-dmg [-s] -p /path/to/Inkscape.app # # The script creates a read-write disk image, -# copies Inkscape in it, copies additional python packages -# if needed, customizes its appearance using a -# previously created .DS_Store file (inkscape*.ds_store), +# copies Inkscape in it, customizes its appearance using a +# previously created .DS_Store file (inkscape.ds_store), # and then compresses the disk image for distribution. # -# Authors: +# AUTHORS # Jean-Olivier Irisson # Michael Wybrow # -# Copyright 2006 -# Licensed under GNU General Public License +# Copyright (C) 2006-2007 +# Released under GNU GPL, read the file 'COPYING' for more information # # # How to update the disk image layout: @@ -34,63 +34,75 @@ # Defaults set_ds_store=false -add_python=false ds_store_file="inkscape.ds_store" -package="Inkscape.app" -RWNAME="RWinkscape.dmg" -VOLNAME="Inkscape" -TMPDIR="/tmp/dmg-$$" -AUTOOPENOPT= +package="" +rw_name="RWinkscape.dmg" +volume_name="Inkscape" +tmp_dir="/tmp/dmg-$$" +auto_open_opt= + +# Help message +#---------------------------------------------------------- +help() +{ +echo -e " +Create a custom dmg file to distribute Inkscape + +\033[1mUSAGE\033[0m + $0 [-s] -p /path/to/Inkscape.app + +\033[1mOPTIONS\033[0m + \033[1m-h,--help\033[0m + display this help message + \033[1m-s\033[0m + set a new apperance (do not actually creates a bundle) + \033[1m-p,--package\033[0m + set the path to the Inkscape.app that should be copie + in the dmg +" +} # Parse command line arguments while [ "$1" != "" ] do case $1 in + -h|--help) + help + exit 0 ;; -s) set_ds_store=true ;; - -py|--with-python) - add_python=true - python_dir="$2" - ds_store_file="inkscape_python.ds_store" + -p|--package) + package="$2" shift 1 ;; + *) + echo "Invalid command line option" + exit 2 ;; esac shift 1 done -# some checks + +# Safety checks if [ ! -e "$package" ]; then - echo "Cannot find $package" + echo "Cannot find package: $package" exit 1 fi -if [ ${add_python} = "true" ]; then - if [ ! -e "$python_dir" ]; then - echo "Cannot find your python packages directory" - exit 1 - fi -fi + +echo -e "\n\033[1mCREATE INKSCAPE DISK IMAGE\033[0m\n" # Create temp directory with desired contents of the release volume. -rm -rf "$TMPDIR" -mkdir "$TMPDIR" +rm -rf "$tmp_dir" +mkdir "$tmp_dir" -echo "Copying files to temp directory..." +echo -e "\033[1mCopying files to temp directory\033[0m" # Inkscape itself # copy Inkscape.app -cp -rf "$package" "$TMPDIR"/ -# link to Applications in order to drag and drop inkscape onto it. -ln -sf /Applications "$TMPDIR"/ - -# Python -if [ ${add_python} = "true" ]; then - # copy python libraries - cp -rf "$python_dir"/* "$TMPDIR"/ - # link python environment in order to drag and drop inkscape onto it - ln -sf /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages "$TMPDIR"/Python\ site-packages -fi +cp -rf "$package" "$tmp_dir"/ +# link to Applications in order to drag and drop inkscape onto it +ln -sf /Applications "$tmp_dir"/ -# Copy a background image inside a hidden directory so the image -# file itself won't be shown. -mkdir "$TMPDIR/.background" -cp dmg_background.png "$TMPDIR/.background/background.png" +# Copy a background image inside a hidden directory so the image file itself won't be shown. +mkdir "$tmp_dir/.background" +cp dmg_background.png "$tmp_dir/.background/background.png" # If the appearance settings are not to be modified we just copy them if [ ${set_ds_store} = "false" ]; then @@ -98,31 +110,30 @@ if [ ${set_ds_store} = "false" ]; then # window size, appearance, etc. Most of this can be set # with Apple script but involves user intervention so we # just keep a copy of the correct settings and use that instead. - cp $ds_store_file "$TMPDIR/.DS_Store" - AUTOOPENOPT=-noautoopen + cp $ds_store_file "$tmp_dir/.DS_Store" + auto_open_opt=-noautoopen fi # Create a new RW image from the temp directory. -echo "Creating a new RW disk image..." -rm -f "$RWNAME" -/usr/bin/hdiutil create -srcfolder "$TMPDIR" -volname "$VOLNAME" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW "$RWNAME" +echo -e "\033[1mCreating a temporary disk image\033[0m" +rm -f "$rw_name" +/usr/bin/hdiutil create -srcfolder "$tmp_dir" -volname "$volume_name" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW "$rw_name" # We're finished with the temp directory, remove it. -rm -rf "$TMPDIR" +rm -rf "$tmp_dir" # Mount the created image. -echo "Mounting the disk image..." -MOUNT_DIR="/Volumes/$VOLNAME" -DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify $AUTOOPENOPT "$RWNAME" | egrep '^/dev/' | sed 1q | awk '{print $1}'` +MOUNT_DIR="/Volumes/$volume_name" +DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify $auto_open_opt "$rw_name" | egrep '^/dev/' | sed 1q | awk '{print $1}'` # Have the disk image window open automatically when mounted. -bless -openfolder /Volumes/$VOLNAME +bless -openfolder /Volumes/$volume_name # In case the apperance has to be modified, mount the image and apply the base settings to it via Applescript if [ ${set_ds_store} = "true" ]; then /usr/bin/osascript dmg_set_style.scpt - open "/Volumes/$VOLNAME" + open "/Volumes/$volume_name" # BUG: one needs to move and close the window manually for the # changes in appearance to be retained... echo " @@ -134,19 +145,18 @@ if [ ${set_ds_store} = "true" ]; then " read -e DUMB - # .DS_Store files aren't written till the disk is unmounted, - # or finder is restarted. + # .DS_Store files aren't written till the disk is unmounted, or finder is restarted. hdiutil detach "$DEV_NAME" - AUTOOPENOPT=-noautoopen - DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify $AUTOOPENOPT "$RWNAME" | egrep '^/dev/' | sed 1q | awk '{print $1}'` + auto_open_opt=-noautoopen + DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify $auto_open_opt "$rw_name" | egrep '^/dev/' | sed 1q | awk '{print $1}'` echo echo "New $ds_store_file file written. Re-run $0 without the -s option to use it" - cp /Volumes/$VOLNAME/.DS_Store ./$ds_store_file + cp /Volumes/$volume_name/.DS_Store ./$ds_store_file SetFile -a v ./$ds_store_file # Unmount the disk image. hdiutil detach "$DEV_NAME" - rm -f "$RWNAME" + rm -f "$rw_name" exit 0 fi @@ -155,7 +165,14 @@ fi hdiutil detach "$DEV_NAME" # Create the offical release image by compressing the RW one. -/usr/bin/hdiutil convert "$RWNAME" -format UDZO -imagekey zlib-level=9 -o "Inkscape.dmg" -rm -f "$RWNAME" +echo -e "\033[1mCompressing the final disk image\033[0m" +img_name="Inkscape.dmg" +# TODO make this a command line option +if [ -e "$img_name" ]; then + echo "$img_name already exists." + rm -i "$img_name" +fi +/usr/bin/hdiutil convert "$rw_name" -format UDZO -imagekey zlib-level=9 -o "$img_name" +rm -f "$rw_name" exit 0