[dia] Continued work on Mac OS X DMG build automation.



commit 661c2026529fb72003c9fbd9c5aa0b95b73a8832
Author: Steffen Macke <sdteffen sdteffen de>
Date:   Mon Apr 18 20:36:41 2011 +0200

    Continued work on Mac OS X DMG build automation.

 installer/macosx/Makefile.am |    2 +-
 installer/macosx/dia         |  128 ++++++++++++++++++++++++++++++++++++++++++
 installer/macosx/osx-app.sh  |   35 +----------
 3 files changed, 133 insertions(+), 32 deletions(-)
---
diff --git a/installer/macosx/Makefile.am b/installer/macosx/Makefile.am
index 4848c28..3dd2bff 100644
--- a/installer/macosx/Makefile.am
+++ b/installer/macosx/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-EXTRA_DIST = osx-app.sh osx-build.sh osx-dmg.sh
+EXTRA_DIST = dia osx-app.sh osx-build.sh osx-dmg.sh
 
 Info.plist: Info.plist.in
 	sed -e 's/@VERSION/'$(VERSION)'/;' < $< > $@
diff --git a/installer/macosx/dia b/installer/macosx/dia
new file mode 100644
index 0000000..a598ff0
--- /dev/null
+++ b/installer/macosx/dia
@@ -0,0 +1,128 @@
+#!/bin/sh
+#
+# Author: Aaron Voisine <aaron voisine org>
+# Dia Modifications: Steffen Macke <sdteffen sdteffen de>
+# Inkscape Modifications:
+#	Michael Wybrow <mjwybrow users sourceforge net>
+#	Jean-Olivier Irisson <jo irisson gmail com>
+#
+
+CWD="`(cd \"\`dirname \\\"$0\\\"\`\"; echo \"$PWD\")`"
+# e.g. /Applications/Dia.app/Contents/Resources/bin
+TOP="`dirname \"$CWD\"`"
+# e.g. /Applications/Dia.app/Contents/Resources
+
+
+# Brutally add many things to the PATH. If the directories do not exist, they won't be used anyway. 
+# People should really use ~/.macosx/environment.plist to set environment variables as explained by Apple:
+#	http://developer.apple.com/qa/qa2001/qa1067.html
+# but since no one does, we correct this by making the 'classic' PATH additions here:
+#	/usr/local/bin which, though standard, doesn't seem to be in the PATH
+# 	newer python as recommended by MacPython http://www.python.org/download/mac/
+#	Fink
+#	MacPorts (former DarwinPorts)
+#	LaTeX distribution for Mac OS X
+export PATH="/usr/texbin:/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH"
+
+# Setup PYTHONPATH to use python modules shipped with Dia
+ARCH=`arch`
+PYTHON_VERS=`python -V 2>&1 | cut -c 8-10`
+export PYTHONPATH="$TOP/python/site-packages/$ARCH/$PYTHON_VERS"
+# NB: we are only preprending some stuff to the default python path so if the directory does not exist it should not harm the rest
+
+# No longer required if path rewriting has been conducted.
+export DYLD_LIBRARY_PATH="$TOP/lib"
+
+mkdir -p "${HOME}/.dia-etc"
+
+export FONTCONFIG_PATH="$TOP/etc/fonts"
+export PANGO_RC_FILE="$HOME/.dia-etc/pangorc"
+export GTK_IM_MODULE_FILE="$HOME/.dia-etc/gtk.immodules"
+export GDK_PIXBUF_MODULE_FILE="$HOME/.dia-etc/gdk-pixbuf.loaders"
+export GTK_DATA_PREFIX="$TOP"
+export GTK_EXE_PREFIX="$TOP"
+export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules"
+export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules"
+export XDG_DATA_DIRS="$TOP/share"
+export ASPELL_CONF="prefix $TOP;"
+
+# Note: This requires the path with the exact ImageMagic version number.
+#        Also, that ImageMagick will only work if it does not find a 
+#        version installed into the same PREFIX as it was originally 
+#        installed.  Luckily, this is very unlikely given the extra long 
+#        and strangely named install prefix we use.
+#        The actual version is inserted by the packaging script.
+export MAGICK_CONFIGURE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/config:$TOP/share/ImageMagick-IMAGEMAGICKVER/config"
+export MAGICK_CODER_FILTER_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/filters"
+export MAGICK_CODER_MODULE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/coders"
+
+export INKSCAPE_SHAREDIR="$TOP"
+# TODO: move the share directory to a its own folder to make things a bit cleaner in the app bundle
+export INKSCAPE_PLUGINDIR="$TOP/lib/dia"
+export INKSCAPE_LOCALEDIR="$TOP/locale"
+
+# Handle the case where the directory storing Dia has special characters
+# ('#', '&', '|') in the name.  These need to be escaped to work properly for 
+# various configuration files.
+ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'`
+
+# Set GTK theme (only if there is no .gtkrc-2.0 in the user's home)
+if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then
+	# Appearance setting
+	aquaStyle=`defaults read "Apple Global Domain" AppleAquaColorVariant 2>/dev/null`
+	# 1 for aqua, 6 for graphite, inexistant if the default color was never changed
+	if [[ "$aquaStyle" == "" ]]; then
+		aquaStyle=1		# set aqua as default
+	fi
+
+	# Highlight Color setting
+	hiliColor=`defaults read "Apple Global Domain" AppleHighlightColor 2>/dev/null`
+	# a RGB value, with components between 0 and 1, also inexistant if it was not changed
+	if [[ "$hiliColor" == "" ]]; then
+		hiliColor="0.709800 0.835300 1.000000"	# set blue as default
+	fi
+
+	# Menu items color
+	if [[ aquaStyle -eq 1 ]]; then
+		menuColor="#4a76cd"	# blue
+	else
+		menuColor="#7c8da4"	# graphite
+	fi
+	# Format highlight color as a GTK rgb value
+	hiliColorFormated=`echo $hiliColor | awk -F " " '{print "\\\{"$1","$2","$3"\\\}"}'`
+
+	# echo $menuColor
+	# echo $hiliColorFormated
+
+	# Modify the gtkrc
+	#	- with the correct colors
+	#	- to point to the correct scrollbars folder
+	export GTK2_RC_FILES="$HOME/.dia-etc/gtkrc"
+fi
+
+# If the AppleCollationOrder preference doesn't exist, we fall back to using
+# the AppleLocale preference.
+LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null`
+if [ "x$LANGSTR" == "x" ]
+then
+    echo "Warning: AppleCollationOrder setting not found, using AppleLocale." 1>&2
+    LANGSTR=`defaults read .GlobalPreferences AppleLocale 2>/dev/null | \
+            sed 's/_.*//'`
+fi
+
+# NOTE: Have to add ".UTF-8" to the LANG since omitting causes Dia
+#       to crash on startup in locale_from_utf8().
+export LANG="`grep \"\`echo $LANGSTR\`_\" /usr/share/locale/locale.alias | \
+	tail -n1 | sed 's/\./ /' | awk '{print $2}'`.UTF-8"
+echo "Setting Language: $LANG" 1>&2
+
+sed 's|${HOME}|'"$HOME|g" "$TOP/etc/pango/pangorc" > "${HOME}/.dia-etc/pangorc"
+sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \
+    > "${HOME}/.dia-etc/pango.modules"
+cp -f "$TOP/etc/pango/pangox.aliases" "${HOME}/.dia-etc/"
+sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/gtk-2.0/gtk.immodules" \
+    > "${HOME}/.dia-etc/gtk.immodules"
+sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/gtk-2.0/gdk-pixbuf.loaders" \
+    > "${HOME}/.dia-etc/gdk-pixbuf.loaders"
+
+exec "$CWD/dia-bin" "$@"
diff --git a/installer/macosx/osx-app.sh b/installer/macosx/osx-app.sh
old mode 100755
new mode 100644
index c648021..c462509
--- a/installer/macosx/osx-app.sh
+++ b/installer/macosx/osx-app.sh
@@ -20,7 +20,7 @@
 # Copyright (C) 2005 Kees Cook
 # Copyright (C) 2005-2009 Michael Wybrow
 # Copyright (C) 2007-2009 Jean-Olivier Irisson
-# Copyright (C) 2010 Steffen Macke
+# Copyright (C) 2010,2011 Steffen Macke
 #
 # Released under GNU GPL, read the file 'COPYING' for more information
 #
@@ -107,7 +107,7 @@ do
 	shift 1
 done
 
-echo -e "\n\033[1mCREATE INKSCAPE APP BUNDLE\033[0m\n"
+echo -e "\n\033[1mCREATE DIA APP BUNDLE\033[0m\n"
 
 # Safety tests
 
@@ -137,11 +137,6 @@ if [ ! -e "$LIBPREFIX" ]; then
 	exit 1
 fi
 
-if [ ! -e "$LIBPREFIX/share/themes/Clearlooks-Quicksilver" ]; then
-	echo "Missing Clearlooks -- please install gtk2-clearlooks and try again." >&2
-	exit 1
-fi
-
 # Handle some version specific details.
 VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
 if [ "$VERSION" -ge "4" ]; then
@@ -188,29 +183,6 @@ mkdir -p "$pkglib"
 mkdir -p "$pkglocale"
 mkdir -p "$pkgpython"
 
-mkdir -p "$pkgresources/Dutch.lprj"
-mkdir -p "$pkgresources/English.lprj"
-mkdir -p "$pkgresources/French.lprj"
-mkdir -p "$pkgresources/German.lprj"
-mkdir -p "$pkgresources/Italian.lprj"
-mkdir -p "$pkgresources/Spanish.lprj"
-mkdir -p "$pkgresources/fi.lprj"
-mkdir -p "$pkgresources/no.lprj"
-mkdir -p "$pkgresources/sv.lprj"
-
-# Build and add the launcher
-#----------------------------------------------------------
-(
-	# 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" "$pkgexec/Dia"
-
-
 # Copy all files into the bundle
 #----------------------------------------------------------
 echo -e "\n\033[1mFilling app bundle...\033[0m\n"
@@ -221,7 +193,8 @@ binary_dir=`dirname "$binary"`
 # Dia's binary
 binpath="$pkgbin/dia-bin"
 cp -v "$binary" "$binpath"
-# TODO Add a "$verbose" variable and command line switch, which sets wether these commands are verbose or not
+cp "dia" "$pkgbin/dia"
+cp -R "$LIBPREFIX/dia" "$pkgresources/lib/dia"
 
 # Share files
 rsync -av "$binary_dir/../share/$binary_name"/* "$pkgresources/"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]