Code

osx-app.sh
authorjiho-sf <jiho-sf@users.sourceforge.net>
Sat, 3 Nov 2007 22:30:48 +0000 (22:30 +0000)
committerjiho-sf <jiho-sf@users.sourceforge.net>
Sat, 3 Nov 2007 22:30:48 +0000 (22:30 +0000)
- 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

packaging/macosx/dmg_background.png
packaging/macosx/dmg_background.svg
packaging/macosx/dmg_set_style.scpt
packaging/macosx/inkscape.ds_store
packaging/macosx/inkscape_python.ds_store [deleted file]
packaging/macosx/osx-app.sh
packaging/macosx/osx-build.sh
packaging/macosx/osx-dmg.sh

index 65b7964f84de127b63842e7dc6eba663edd931c4..94228b60dc096bba64cceb1cbe6c1af888839594 100644 (file)
Binary files a/packaging/macosx/dmg_background.png and b/packaging/macosx/dmg_background.png differ
index 8bd97119e1982f3b123bac9cea6857e38da4f1b6..c045e64866b9df8239388370699d876353551148 100644 (file)
@@ -2,7 +2,7 @@
 <!-- Created with Inkscape (http://www.inkscape.org/) -->
 <svg
    xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:cc="http://creativecommons.org/ns#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns="http://www.w3.org/2000/svg"
    height="350"
    id="svg2"
    sodipodi:version="0.32"
-   inkscape:version="0.45"
+   inkscape:version="0.45+devel"
    sodipodi:docname="dmg_background.svg"
-   sodipodi:docbase="/Volumes/files/softwares/inkscape/trunk_devel/packaging/macosx"
    version="1.0"
-   inkscape:export-filename="/Volumes/files/softwares/inkscape/trunk_devel/packaging/macosx/dmg_background.png"
    inkscape:export-xdpi="90"
    inkscape:export-ydpi="90"
    inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   sodipodi:modified="TRUE">
   <defs
      id="defs4">
     <linearGradient
          stdDeviation="0.79584663"
          id="feGaussianBlur6550" />
     </filter>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath8875">
+      <path
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.81105022pt;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         d="M 251.4419,206.10491 C 247.44915,206.10491 244.22315,209.33092 244.22315,213.32366 L 244.22315,312.47991 C 244.22315,316.47265 247.44915,319.69867 251.4419,319.69866 L 472.16065,319.69866 C 476.1534,319.69866 479.34815,316.47264 479.34815,312.47991 L 479.34815,213.32366 C 479.34815,209.33092 476.1534,206.10491 472.16065,206.10491 L 251.4419,206.10491 z M 321.1294,233.57366 L 321.1294,244.94866 L 321.16065,244.94866 L 440.0669,244.94866 L 440.0669,277.26116 L 321.1919,277.26116 L 321.2544,288.63616 L 282.1294,261.26116 L 321.1294,233.57366 z"
+         id="path8877" />
+    </clipPath>
     <filter
        inkscape:collect="always"
-       id="filter6556">
+       id="filter9015">
       <feGaussianBlur
          inkscape:collect="always"
-         stdDeviation="0.64344392"
-         id="feGaussianBlur6558" />
+         stdDeviation="1.755523"
+         id="feGaussianBlur9017" />
     </filter>
   </defs>
   <sodipodi:namedview
      borderopacity="1.0"
      inkscape:pageopacity="1"
      inkscape:pageshadow="2"
-     inkscape:zoom="1.041626"
-     inkscape:cx="302.42894"
-     inkscape:cy="159.47539"
+     inkscape:zoom="1"
+     inkscape:cx="302.3841"
+     inkscape:cy="179.85093"
      inkscape:document-units="px"
-     inkscape:current-layer="layer1"
+     inkscape:current-layer="g3978"
      showgrid="false"
      gridspacingx="2mm"
      gridspacingy="2mm"
      inkscape:object-paths="false"
      guidetolerance="10000"
      inkscape:guide-bbox="false"
-     inkscape:window-width="988"
-     inkscape:window-height="724"
-     inkscape:window-x="18"
+     inkscape:window-width="1244"
+     inkscape:window-height="756"
+     inkscape:window-x="36"
      inkscape:window-y="22"
      height="350px"
      width="624.54108px"
          id="flowDiv4803">This tutorial covers copy/paste, node editing, freehand and bezier  drawing, path manipulation, booleans, offsets, simplification, and text tool.  </flowDiv>    </flowRoot>
     <g
        id="g3978"
-       transform="translate(0,-6.7202624)">
+       transform="translate(0,-6.7202624)"
+       style="opacity:0.8258427">
+      <path
+         id="path6911"
+         d="M 321.13418,233.56827 L 282.14069,261.2464 L 321.2391,288.63935 L 321.20413,277.27453 L 440.07307,277.27453 L 440.07307,244.93309 L 321.16916,244.93309 L 321.13418,244.93309 L 321.13418,233.56827 z "
+         style="color:#000000;fill:#96db5b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.48407646999999998;visibility:visible;display:inline;overflow:visible;filter:url(#filter9015)"
+         sodipodi:nodetypes="ccccccccc"
+         clip-path="url(#clipPath8875)" />
       <path
          sodipodi:nodetypes="ccccccccc"
-         style="color:#000000;fill:#949494;fill-opacity:0.62420379;fill-rule:nonzero;stroke:#f5f5f5;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.48407647;visibility:visible;display:inline;overflow:visible"
+         style="color:#000000;fill:#a4a4a4;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.48407646999999998;visibility:visible;display:inline;overflow:visible;opacity:1"
          d="M 321.13418,233.56827 L 282.14069,261.2464 L 321.2391,288.63935 L 321.20413,277.27453 L 440.07307,277.27453 L 440.07307,244.93309 L 321.16916,244.93309 L 321.13418,244.93309 L 321.13418,233.56827 z "
          id="path4008" />
-      <text
-         xml:space="preserve"
-         style="font-size:15.74776745px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6548);font-family:Lucida Sans"
-         x="346.12503"
-         y="265.71155"
-         id="text6544"
-         sodipodi:linespacing="100%"><tspan
-           sodipodi:role="line"
-           id="tspan6546"
-           x="346.12503"
-           y="265.71155">Inkscape</tspan></text>
-      <text
-         sodipodi:linespacing="100%"
-         id="text3962"
-         y="265.71155"
-         x="346.12503"
-         style="font-size:15.74776745px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#666666;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Lucida Sans"
-         xml:space="preserve"><tspan
-           y="265.71155"
-           x="346.12503"
-           id="tspan3964"
-           sodipodi:role="line">Inkscape</tspan></text>
       <rect
          y="245.66743"
          x="320.60944"
          id="rect4939"
          style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
     </g>
-    <g
-       id="g3986"
-       transform="translate(0,-2.8801124)">
-      <path
-         id="path4941"
-         d="M 321.13418,369.69575 L 282.14069,397.37388 L 321.2391,424.76683 L 321.20413,413.40201 L 440.07307,413.40201 L 440.07307,381.06057 L 321.16916,381.06057 L 321.13418,381.06057 L 321.13418,369.69575 z "
-         style="opacity:1;color:#000000;fill:#949494;fill-opacity:0.62420379;fill-rule:nonzero;stroke:#f5f5f5;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.48407647;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-         sodipodi:nodetypes="ccccccccc" />
-      <text
-         sodipodi:linespacing="100%"
-         id="text6552"
-         y="401.83905"
-         x="346.12503"
-         style="font-size:15.74776745px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6556);font-family:Lucida Sans"
-         xml:space="preserve"><tspan
-           y="401.83905"
-           x="346.12503"
-           id="tspan6554"
-           sodipodi:role="line">Python</tspan></text>
-      <text
-         xml:space="preserve"
-         style="font-size:15.74776745px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#666666;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Lucida Sans"
-         x="346.12503"
-         y="401.83905"
-         id="text4943"
-         sodipodi:linespacing="100%"><tspan
-           sodipodi:role="line"
-           id="tspan4945"
-           x="346.12503"
-           y="401.83905">Python</tspan></text>
-      <rect
-         style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-         id="rect4947"
-         width="118.35905"
-         height="30.984045"
-         x="320.60944"
-         y="381.79492" />
-    </g>
   </g>
 </svg>
index c18f57154b77a76b58943afd5cf0278926afce52..7c010d102d6cccee2e7d14c67f599b5ec320b1b4 100755 (executable)
Binary files a/packaging/macosx/dmg_set_style.scpt and b/packaging/macosx/dmg_set_style.scpt differ
index 25cb6d7ef36a6387ce595075cc4e826906ce0869..c4bc9e32d35017a5b95958144e26254bba22e223 100644 (file)
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 (file)
index 4851cee..0000000
Binary files a/packaging/macosx/inkscape_python.ds_store and /dev/null differ
index fe093d18b2eb86d114ba516a2448ff60422bdf8e..4c09270013fc521f9f26f0c83943ebea002f6277 100755 (executable)
-#! /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 <kees@outflux.net>
-#    Michael Wybrow <mjwybrow@users.sourceforge.net>
-#    Jean-Olivier Irisson <jo.irisson@gmail.com>
+# 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.
-# 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 <<END_PANGO
 [Pango]
@@ -188,68 +250,96 @@ sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/etc/gtk-2.0/gtk.immodules > $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
index 15af2589ff791d4cfba9438117d5e867ced23f56..a708c8f2c9e3bd2d9d717205e342ad82c56b0f5c 100755 (executable)
 #      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
 
index 91aefdd41d6be74cdae6f0b878635009c5773064..86e83bf068b484bd91a4a2ec1a3bd2ee84067557 100755 (executable)
@@ -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 <jo.irisson@gmail.com>
 #      Michael Wybrow <mjwybrow@users.sourceforge.net>
 #
-# 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:
 
 # 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