summaryrefslogtreecommitdiff
path: root/distribution/osx/gtk-bundle
diff options
context:
space:
mode:
Diffstat (limited to 'distribution/osx/gtk-bundle')
-rw-r--r--distribution/osx/gtk-bundle/CMakeLists.txt20
-rw-r--r--distribution/osx/gtk-bundle/Drag-to-Copy-Arrow.pngbin0 -> 2171 bytes
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/CMakeLists.txt14
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/Contents/CMakeLists.txt5
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/CMakeLists.txt12
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/CMakeLists.txt10
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/InfoPlist.strings2
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/icon_16x16.pngbin0 -> 673 bytes
-rw-r--r--distribution/osx/gtk-bundle/XTrackCAD-help/info-xtrkcad-help.plist.in36
-rw-r--r--distribution/osx/gtk-bundle/gtk-bundle.README44
-rw-r--r--distribution/osx/gtk-bundle/info-xtrkcad.plist34
-rw-r--r--distribution/osx/gtk-bundle/info-xtrkcad.plist.in34
-rw-r--r--distribution/osx/gtk-bundle/toc.js67
-rwxr-xr-xdistribution/osx/gtk-bundle/xtrkcad-bundler.sh84
-rwxr-xr-xdistribution/osx/gtk-bundle/xtrkcad-launcher.sh214
-rw-r--r--distribution/osx/gtk-bundle/xtrkcad-logo.icnsbin0 -> 1337741 bytes
-rw-r--r--distribution/osx/gtk-bundle/xtrkcad-template.dmg.zipbin0 -> 3990654 bytes
-rw-r--r--distribution/osx/gtk-bundle/xtrkcad.bundle132
18 files changed, 708 insertions, 0 deletions
diff --git a/distribution/osx/gtk-bundle/CMakeLists.txt b/distribution/osx/gtk-bundle/CMakeLists.txt
new file mode 100644
index 0000000..4aa1150
--- /dev/null
+++ b/distribution/osx/gtk-bundle/CMakeLists.txt
@@ -0,0 +1,20 @@
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Info-xtrkcad.plist.in ${CMAKE_CURRENT_BINARY_DIR}/info-xtrkcad.plist @ONLY)
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/xtrkcad-template.dmg.zip ${CMAKE_CURRENT_BINARY_DIR}/xtrkcad-template-dmg.zip COPYONLY)
+
+FILE(MAKE_DIRECTORY share)
+FILE(MAKE_DIRECTORY bin)
+
+INSTALL (
+FILES ${CMAKE_CURRENT_BINARY_DIR}/info-xtrkcad.plist
+DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/XTrackCAD.help
+)
+INSTALL (
+FILES ${CMAKE_CURRENT_SOURCE_DIR}/toc.js
+DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/XTrackCAD.help/Contents/Resources/en.lproj
+)
+
+ADD_SUBDIRECTORY(XTrackCAD-help)
+
+
+
diff --git a/distribution/osx/gtk-bundle/Drag-to-Copy-Arrow.png b/distribution/osx/gtk-bundle/Drag-to-Copy-Arrow.png
new file mode 100644
index 0000000..4031d45
--- /dev/null
+++ b/distribution/osx/gtk-bundle/Drag-to-Copy-Arrow.png
Binary files differ
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/CMakeLists.txt b/distribution/osx/gtk-bundle/XTrackCAD-help/CMakeLists.txt
new file mode 100644
index 0000000..c25d0e1
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/CMakeLists.txt
@@ -0,0 +1,14 @@
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Info-xtrkcad-help.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
+
+FILE(MAKE_DIRECTORY share)
+
+INSTALL (
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
+ DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/XTrackCAD.help/Contents
+)
+
+ADD_SUBDIRECTORY(Contents)
+
+
+
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/CMakeLists.txt b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/CMakeLists.txt
new file mode 100644
index 0000000..eb44cea
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+ADD_SUBDIRECTORY(Resources)
+
+
+
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/CMakeLists.txt b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/CMakeLists.txt
new file mode 100644
index 0000000..275bb02
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+MAKE_DIRECTORY (${CMAKE_INSTALL_PREFIX}/${XTRKCAD_SHARE_INSTALL_DIR}/XTrackCAD.help/shrd)
+
+INSTALL (
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/icon_16x16.png
+ DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/XTrackCAD.help/Contents/Resources
+ )
+
+ADD_SUBDIRECTORY(en.lproj)
+
+
+
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/CMakeLists.txt b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/CMakeLists.txt
new file mode 100644
index 0000000..4ac56f7
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+
+INSTALL(
+
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/InfoPlist.strings
+ DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/XTrackCAD.help/Contents/Resources/en.lproj
+ )
+
+
+
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/InfoPlist.strings b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/InfoPlist.strings
new file mode 100644
index 0000000..b024970
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+"CFBundleName" = "XTrackCAD Help"
+"HPDBookTitle" = "XTrackCAD Help"
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/icon_16x16.png b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/icon_16x16.png
new file mode 100644
index 0000000..ed29bd5
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/Contents/Resources/icon_16x16.png
Binary files differ
diff --git a/distribution/osx/gtk-bundle/XTrackCAD-help/info-xtrkcad-help.plist.in b/distribution/osx/gtk-bundle/XTrackCAD-help/info-xtrkcad-help.plist.in
new file mode 100644
index 0000000..4d149d6
--- /dev/null
+++ b/distribution/osx/gtk-bundle/XTrackCAD-help/info-xtrkcad-help.plist.in
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en_us</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.xtrkcad.help</string>
+ <key>CFInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundlePackageName</key>
+ <string>XTrackCAD</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@XTRKCAD_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@XTRKCAD_VERSION@</string>
+ <key>CFBundleDisplayName</key>
+ <string>XTrackCAD-Help</string>
+ <key>HPDBookAccessPath</key>
+ <string>index.html</string>
+ <key>HPDBookIconPath</key>
+ <string>icon_16x16.png</string>
+ <key>HPDBookIndexPath</key>
+ <string>XTrackCAD.helpindex</string>
+ <key>HPDBookKBDProduct</key>
+ <string>xtrkcad1</string>
+ <key>HPDBookTitle</key>
+ <string>XTrackCAD Help</string>
+ <key>HPDBookType</key>
+ <string>3</string>
+ <key>HPDBookTopicListCSSPath</key>
+ <string>xtrkcad_lin.css</string>
+</dict>
+</plist>
diff --git a/distribution/osx/gtk-bundle/gtk-bundle.README b/distribution/osx/gtk-bundle/gtk-bundle.README
new file mode 100644
index 0000000..139cec7
--- /dev/null
+++ b/distribution/osx/gtk-bundle/gtk-bundle.README
@@ -0,0 +1,44 @@
+Readme for gtk-bundle directory.
+Created 12-1-2016 by Adam Richards
+
+Date: Dec-2016.
+
+The gtk-bundle technique replaces prior bundle techniques for OSX.
+
+Prerequisites:
+This directory produces files only for use with the gtk-mac-bundler tool (G-M-B).
+That tool is available as a MacPort and should be installed with
+"sudo port install gtk-mac-bundler"
+The bundler also requires a prior Macports install of GTK
+"sudo port install webkit-gtk"
+and that was the GTK level was used to build the xtrkcad binary.
+
+The ccmake process will place a copy of the binary in the /bin build subdirectory
+for use by G-M-B. It also copies over the resource share libraries into a subdirectory.
+
+Process:
+Once ccmake has been run "make" followed by "make install", the G-M-B tool is run
+pointing at the xtrkcad.bundle file.
+"cd /gtk-bundle"
+"gtk-mac-bundler xtrkcad-bundle"
+
+Output:
+G-M-B produces an .app bundle that is a self-contained executable
+from the binary xtrkcad in gtk-bundle/bin. It recursively rewires all the link pointers to be
+self-referential - that is, to point within the bundle.
+
+It uses the xtrkcad.plist to set properties of the app, including the
+icon from the .icns file. It sets the pre-run script to be xtrkcad-launcher.sh
+
+Next Steps:
+Once this xtrkcad.app file has been created, it can be moved to wherever is desirable
+- such as the Application folder. The app does not have dependencies on GTK components
+from MACPorts like the binary does - it is standalone.
+
+To produce an installable image from the .app, the disk utility can be used to create
+a RW image .dmg that the .app can be copied into.
+
+NOTE -
+It is expected that as long as the GTK level used in build can run on the OSX level used
+in build, the app bundle will work without necessarily having to be rebuilt for each OSX
+level. \ No newline at end of file
diff --git a/distribution/osx/gtk-bundle/info-xtrkcad.plist b/distribution/osx/gtk-bundle/info-xtrkcad.plist
new file mode 100644
index 0000000..d9d9bd3
--- /dev/null
+++ b/distribution/osx/gtk-bundle/info-xtrkcad.plist
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>XtrkCAD</string>
+ <key>CFBundleGetInfoString</key>
+ <string>4.24a, (C) 1997-2016 The XtrkCAD Team http://www.xtrkcad.org</string>
+ <key>CFBundleIconFile</key>
+ <string>xtrkcad-logo.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.xtrkcad</string>
+ <key>CFBundleHelpBookFolder</key>
+ <string>XTrackCAD.help</string>
+ <key>CFBundleHelpBookName</key>
+ <string>XTrackCAD Help</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>4.3.beta1</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>4.3.beta1</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright 1997 - 2016 The The XtrkCAD Team, GNU General Public License.</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.10</string>
+</dict>
+</plist>
diff --git a/distribution/osx/gtk-bundle/info-xtrkcad.plist.in b/distribution/osx/gtk-bundle/info-xtrkcad.plist.in
new file mode 100644
index 0000000..94fc56a
--- /dev/null
+++ b/distribution/osx/gtk-bundle/info-xtrkcad.plist.in
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>XtrkCAD</string>
+ <key>CFBundleGetInfoString</key>
+ <string>4.24a, (C) 1997-2016 The XtrkCAD Team http://www.xtrkcad.org</string>
+ <key>CFBundleIconFile</key>
+ <string>xtrkcad-logo.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.xtrkcad</string>
+ <key>CFBundleHelpBookFolder</key>
+ <string>XTrackCAD.help</string>
+ <key>CFBundleHelpBookName</key>
+ <string>XTrackCAD Help</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@XTRKCAD_VERSION@</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>@XTRKCAD_VERSION@</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright 1997 - 2016 The The XtrkCAD Team, GNU General Public License.</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.10</string>
+</dict>
+</plist>
diff --git a/distribution/osx/gtk-bundle/toc.js b/distribution/osx/gtk-bundle/toc.js
new file mode 100644
index 0000000..4767236
--- /dev/null
+++ b/distribution/osx/gtk-bundle/toc.js
@@ -0,0 +1,67 @@
+<!-- Start of script to import html into div, toggle TOC button
+
+ // If in HelpViewer activate the TOC display button.
+ if ('HelpViewer' in window && 'showTOCButton' in window.HelpViewer) {
+ function toggle() {
+ var e = document.getElementById('toc');
+ if (e.style.display == 'block' || e.style.display=='')
+ {
+ e.style.display = 'none';
+ }
+ else
+ {
+ e.style.display = 'block';
+ }
+ }
+
+ function showTOCButton(state) {
+ window.HelpViewer.showTOCButton(state, toggle, toggle);
+ window.HelpViewer.setTOCButton(state);
+ }
+ window.setTimeout(showTOCButton(true), 1000);
+
+ }
+ window.onload=function() {
+ function include(a,b){
+ var c="/^(?:file):/"
+ var d=new XMLHttpRequest;
+ var e=0;
+ try {
+ d.open('GET',b,!0);
+ d.onreadystatechange=function(){
+ if (4==d.readyState) a.innerHTML=d.responseText;
+ var acc = document.getElementsByClassName("accordion");
+ var i;
+
+ for (i = 0; i < acc.length; i++) {
+ acc[i].onclick = function() {
+ var panels = document.getElementsByClassName("accordion");
+ this.classList.toggle("active");
+ var panel = this.parentElement.nextElementSibling;
+ if (panel.tagName == "DIV") {
+ if (panel.style.maxHeight){
+ panel.style.maxHeight = null;
+ } else {
+ panel.style.maxHeight = panel.scrollHeight + "px";
+ }
+ }
+ }
+ }
+ }
+ d.send();
+ } catch(f){};
+ }
+
+ var c=document.getElementsByTagName('DIV');
+ var i;
+ for(i = 0; i < c.length; i++) {
+ if (c[i].hasAttribute && c[i].hasAttribute('data-include')) {
+ include(c[i],c[i].getAttribute('data-include'));
+ };
+ }
+
+ }
+
+
+
+// End -->
diff --git a/distribution/osx/gtk-bundle/xtrkcad-bundler.sh b/distribution/osx/gtk-bundle/xtrkcad-bundler.sh
new file mode 100755
index 0000000..54928b0
--- /dev/null
+++ b/distribution/osx/gtk-bundle/xtrkcad-bundler.sh
@@ -0,0 +1,84 @@
+#!/bin/sh -x
+
+echo "Starting Xtrkcad-bundler" "@0"
+
+# Script to create Mac DMGs.
+# Created 12/1/2016
+# Author Adam Richards
+
+version="Version"
+
+while getopts "v:i:h" option; do
+ case "${option}" in
+ v) version="${OPTARG}";;
+ i) installib="${OPTARG}";;
+ h) usage;;
+ *) usage;;
+ esac
+done
+shift "$((OPTIND-1))"
+
+usage() {
+ echo "xtrkcad-bundler -i Cmake_Install_Lib [-v Version]";
+ echo " -v Version - will be appended to 'xtrkcad' in the image name";
+ echo " -i Cmake_Install_Lib where the binary and share files were placed by Make";
+ exit 1;
+
+ }
+
+if [ -z "${installib}" ]; then
+ usage;
+ exit 1;
+fi
+
+#copy in all shares
+echo "copying shares from build to share directory"
+cp -R "${installib}/share/" "share/"
+
+#copy in binary
+echo "copying binaries from build to bin directory"
+cp "${installib}/bin/xtrkcad" "bin"
+cp "${installib}/bin/helphelper" "bin"
+
+echo "executing gtk-mac-bundler"
+gtk-mac-bundler xtrkcad.bundle
+
+#Build dmg using template
+echo "making a copy of the tenplate"
+rm -f xtrkcad-template.dmg
+
+unzip -o xtrkcad-template.dmg.zip
+
+echo "mounting template copy"
+rm -rf dmg
+mkdir -p dmg
+
+hdiutil attach xtrkcad-template.dmg -quiet -noautoopen -mountpoint dmg
+
+#copy in bundle
+echo "copying in bundle"
+rm -rf "dmg/xtrkcad.app"
+cp -R "bin/xtrkcad.app" "dmg/xtrkcad.app"
+
+#convert dmg to RO
+echo "closing image"
+#dev_dmg='hdiutil info | grep "dmg" | grep "Apple_HFS"' && \
+hdiutil detach dmg -force
+master="xtrkcad-OSX-${version}"
+rm -rf "${master}".dmg
+echo "making image RO and compressed"
+hdiutil convert xtrkcad-template.dmg -format UDZO -imagekey zlib-level=9 -o "${master}"
+
+# compress the output
+
+rm -f "${master}".dmg.tar.gz
+
+tar -cvzf "${master}".dmg.tar.gz "${master}".dmg
+
+mv -f "${master}".dmg.tar.gz "${installib}"/bin
+
+rm -rf dmg
+
+echo "Tarball output image file ${master}.tar.gz is in ${installib}/bin directory"
+
+exit 0 \ No newline at end of file
diff --git a/distribution/osx/gtk-bundle/xtrkcad-launcher.sh b/distribution/osx/gtk-bundle/xtrkcad-launcher.sh
new file mode 100755
index 0000000..30988e5
--- /dev/null
+++ b/distribution/osx/gtk-bundle/xtrkcad-launcher.sh
@@ -0,0 +1,214 @@
+#!/bin/sh -x
+#
+# Author: Aaron Voisine <aaron@voisine.org>
+# Inkscape Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net>
+# XTrackCAD Modifications: Timothy M. Shead <tshead@k-3d.com>
+
+if test "x$GTK_DEBUG_LAUNCHER" != x; then
+ set -x
+fi
+
+if test "x$GTK_DEBUG_GDB" != x; then
+ EXEC="gdb --args"
+else
+ EXEC=exec
+fi
+
+name=`basename "$0"`
+tmp="$0"
+tmp=`dirname "$tmp"`
+tmp=`dirname "$tmp"`
+bundle=`dirname "$tmp"`
+bundle_contents="$bundle"/Contents
+bundle_res="$bundle_contents"/Resources
+bundle_lib="$bundle_res"/lib
+bundle_bin="$bundle_res"/bin
+bundle_data="$bundle_res"/share
+bundle_etc="$bundle_res"/etc
+
+# check X installed
+if type -p "X" & > /dev/null; then
+ echo "XQuartz installed"
+ else
+ echo "XQuartz not installed"
+ osascript -e 'display dialog "XQuartz is not installed, please install it from XQuartz.org" buttons "OK" default button 1 with title "Stop"'
+ exit 1
+fi
+
+#XTRKCAD_BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/XTrackCAD//'`"
+XTRKCAD_BUNDLE="$bundle"
+XTRKCAD_RESOURCES="$XTRKCAD_BUNDLE/Contents/Resources"
+XTRKCAD_TEMP="/tmp/xtrkcad/$UID"
+XTRKCAD_ETC="$XTRKCAD_TEMP/etc"
+
+export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
+export PANGO_LIBDIR="$bundle_lib"
+export PANGO_SYSCONFDIR="$bundle_etc"
+
+export XDG_CONFIG_DIRS="$bundle_etc"/xdg
+export XDG_DATA_DIRS="$bundle_data"
+export GTK_DATA_PREFIX="$bundle_res"
+export GTK_EXE_PREFIX="$bundle_res"
+export GTK_PATH="$bundle_res"
+
+export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
+XTRKCAD_PANGO_RC_FILE="$XTRKCAD_RESOURCES/etc/pango/pangorc"
+
+I18NDIR="$bundle_data/locale"
+# Set the locale-related variables appropriately:
+unset LANG LC_MESSAGES LC_MONETARY LC_COLLATE
+
+# Has a language ordering been set?
+# If so, set LC_MESSAGES and LANG accordingly; otherwise skip it.
+# First step uses sed to clean off the quotes and commas, to change - to _, and change the names for the chinese scripts from "Hans" to CN and "Hant" to TW.
+APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | sed -En -e 's/\-/_/' -e 's/Hant/TW/' -e 's/Hans/CN/' -e 's/[[:space:]]*\"?([[:alnum:]_]+)\"?,?/\1/p' `
+if test "$APPLELANGUAGES"; then
+ # A language ordering exists.
+ # Test, item per item, to see whether there is an corresponding locale.
+ for L in $APPLELANGUAGES; do
+ #test for exact matches:
+ if test -f "$I18NDIR/${L}/LC_MESSAGES/$APP.mo"; then
+ export LANG=$L
+ break
+ fi
+ #This is a special case, because often the original strings are in US
+ #English and there is no translation file.
+ if test "x$L" == "xen_US"; then
+ export LANG=$L
+ break
+ fi
+ #OK, now test for just the first two letters:
+ if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then
+ export LANG=${L:0:2}
+ break
+ fi
+ #Same thing, but checking for any english variant.
+ if test "x${L:0:2}" == "xen"; then
+ export LANG=$L
+ break
+ fi;
+ done
+fi
+unset APPLELANGUAGES L
+
+# If we didn't get a language from the language list, try the Collation preference, in case it's the only setting that exists.
+APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder`
+if test -z ${LANG} -a -n $APPLECOLLATION; then
+ if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then
+ export LANG=${APPLECOLLATION:0:2}
+ fi
+fi
+if test ! -z $APPLECOLLATION; then
+ export LC_COLLATE=$APPLECOLLATION
+fi
+unset APPLECOLLATION
+
+# Continue by attempting to find the Locale preference.
+APPLELOCALE=`defaults read .GlobalPreferences AppleLocale`
+
+if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then
+ if test -z $LANG; then
+ export LANG="${APPLELOCALE:0:5}"
+ fi
+
+elif test -z $LANG -a -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then
+ export LANG="${APPLELOCALE:0:2}"
+fi
+
+#Next we need to set LC_MESSAGES. If at all possilbe, we want a full
+#5-character locale to avoid the "Locale not supported by C library"
+#warning from Gtk -- even though Gtk will translate with a
+#two-character code.
+if test -n $LANG; then
+#If the language code matches the applelocale, then that's the message
+#locale; otherwise, if it's longer than two characters, then it's
+#probably a good message locale and we'll go with it.
+ if test $LANG == ${APPLELOCALE:0:5} -o $LANG != ${LANG:0:2}; then
+ export LC_MESSAGES=$LANG
+#Next try if the Applelocale is longer than 2 chars and the language
+#bit matches $LANG
+ elif test $LANG == ${APPLELOCALE:0:2} -a $APPLELOCALE > ${APPLELOCALE:0:2}; then
+ export LC_MESSAGES=${APPLELOCALE:0:5}
+#Fail. Get a list of the locales in $PREFIX/share/locale that match
+#our two letter language code and pick the first one, special casing
+#english to set en_US
+ elif test $LANG == "en"; then
+ export LC_MESSAGES="en_US"
+ else
+ LOC=`find $PREFIX/share/locale -name $LANG???`
+ for L in $LOC; do
+ export LC_MESSAGES=$L
+ done
+ fi
+else
+#All efforts have failed, so default to US english
+ export LANG="en_US"
+ export LC_MESSAGES="en_US"
+fi
+CURRENCY=`echo $APPLELOCALE | sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'`
+if test "x$CURRENCY" != "x"; then
+#The user has set a special currency. Gtk doesn't install LC_MONETARY files, but Apple does in /usr/share/locale, so we're going to look there for a locale to set LC_CURRENCY to.
+ if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then
+ if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then
+ export LC_MONETARY=$LC_MESSAGES
+ fi
+ fi
+ if test -z "$LC_MONETARY"; then
+ FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;`
+ if test -n "$FILES"; then
+ export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'`
+ fi
+ fi
+fi
+#No currency value means that the AppleLocale governs:
+if test -z "$LC_MONETARY"; then
+ LC_MONETARY=${APPLELOCALE:0:5}
+fi
+#For Gtk, which only looks at LC_ALL:
+export LC_ALL=$LC_MESSAGES
+
+unset APPLELOCALE FILES LOC
+
+echo "XTrackCAD: Starting $0"
+echo "XTrackCAD: XTRKCAD_BUNDLE: $XTRKCAD_BUNDLE"
+
+# Setup temporary runtime files
+# -rf "$XTRKCAD_TEMP"
+
+# Because the bundle could be located anywhere at runtime, we have to
+# create temporary copies of the Pango configuration files that
+# reflect our current location
+#mkdir -p "$XTRKCAD_ETC/gtk-2.0"
+#sed -e 's|/opt/local|'"$XTRKCAD_RESOURCES|g" "$XTRKCAD_RESOURCES/etc/gtk-2.0/gdk-pixbuf.loaders" > "$XTRKCAD_GDK_PIXBUF_MODULE_FILE"
+#sed -e 's|/opt/local|'"$XTRKCAD_RESOURCES|g" "$XTRKCAD_RESOURCES/etc/gtk-2.0/gtk.immodules" > "$XTRKCAD_GTK_IM_MODULE_FILE"
+#mkdir -p "$XTRKCAD_ETC/pango"
+#sed -e 's|/opt/local/etc|'"$XTRKCAD_ETC|g" "$XTRKCAD_RESOURCES/etc/pango/pangorc" > "$XTRKCAD_ETC/pango/pangorc"
+#sed -e 's|/opt/local|\"'"$XTRKCAD_RESOURCES|g" -e "s/\.so/.so\"/g" "$XTRKCAD_RESOURCES/etc/pango/pango.modules" > "$XTRKCAD_ETC/pango/pango.modules"
+
+#export "DYLD_LIBRARY_PATH=$XTRKCAD_RESOURCES/lib"
+#export "FONTCONFIG_PATH=$XTRKCAD_RESOURCES/etc/fonts"
+#export "GDK_PIXBUF_MODULE_FILE=$XTRKCAD_GDK_PIXBUF_MODULE_FILE"
+#export "GTK_IM_MODULE_FILE=$XTRKCAD_GTK_IM_MODULE_FILE"
+export "PANGO_RC_FILE=$XTRKCAD_PANGO_RC_FILE"
+export "PATH=$XTRKCAD_RESOURCES/bin:$PATH"
+export "XTRKCADLIB=$XTRKCAD_RESOURCES/xtrkcad"
+
+#export
+#exec "$XTRKCAD_BUNDLE/Contents/MacOS/XtrkCAD-bin"
+
+# Extra arguments can be added in environment.sh.
+EXTRA_ARGS=
+if test -f "$bundle_res/environment.sh"; then
+ source "$bundle_res/environment.sh"
+fi
+
+# Strip out the argument added by the OS.
+if /bin/expr "x$1" : '^x-psn_' > /dev/null; then
+ shift 1
+fi
+
+$EXEC "$XTRKCAD_BUNDLE/Contents/MacOS/XtrkCAD-bin" "$@"
+
+echo "XTrackCAD: Finishing $0"
+
diff --git a/distribution/osx/gtk-bundle/xtrkcad-logo.icns b/distribution/osx/gtk-bundle/xtrkcad-logo.icns
new file mode 100644
index 0000000..23213e1
--- /dev/null
+++ b/distribution/osx/gtk-bundle/xtrkcad-logo.icns
Binary files differ
diff --git a/distribution/osx/gtk-bundle/xtrkcad-template.dmg.zip b/distribution/osx/gtk-bundle/xtrkcad-template.dmg.zip
new file mode 100644
index 0000000..bb6972a
--- /dev/null
+++ b/distribution/osx/gtk-bundle/xtrkcad-template.dmg.zip
Binary files differ
diff --git a/distribution/osx/gtk-bundle/xtrkcad.bundle b/distribution/osx/gtk-bundle/xtrkcad.bundle
new file mode 100644
index 0000000..2259ea2
--- /dev/null
+++ b/distribution/osx/gtk-bundle/xtrkcad.bundle
@@ -0,0 +1,132 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<app-bundle>
+
+ <meta>
+ <!-- Where to pick up the GTK+ installation, icon themes,
+ etc. Note that "/opt/local" is evaluated to the
+ value of the environment variable JHBUILD_PREFIX. You can
+ define additional prefixes and refer to them in paths
+ throughout this file on the form "${prefix:name}". This is
+ useful for installing certain libraries or even the
+ application itself separately. Note that JHBUILD_PREFIX is
+ defined by jhbuild, so it you are not using jhbuild you can
+ either define your own or just hardcode the path here.
+ -->
+ <prefix name="default">/opt/local</prefix>
+
+ <!-- The project directory is the default location of the created
+ app. If you leave out the path, the current directory is
+ used. Note the usage of an environment variable here again.
+ -->
+
+ <destination overwrite="yes">${project}/bin</destination>
+
+
+ <!-- Comment this out to keep the install names in binaries -->
+
+ <run-install-name-tool/>
+
+
+ <!-- Optionally specify a launcher script to use. If the
+ application sets up everything needed itself, like
+ environment variable, linker paths, etc, a launcher script is
+ not needed. If the source path is left out, the default
+ script will be used.
+ -->
+
+ <launcher-script>${project}/xtrkcad-launcher.sh</launcher-script >
+
+
+ <!-- Not implemented: Optional runtime, could be python or mono
+ for example.
+ -->
+ <!-- runtime copy="yes">/usr/bin/python</runtime -->
+ <!-- Indicate the active gtk version to use. This is needed only
+ for gtk+-3.0 projects. -->
+ <gtk>gtk+-2.0</gtk>
+ </meta>
+
+ <!-- The special macro "${project}" refers to the directory where
+ this bundle file is located. The application name and bundle
+ identifier are taken from the plist file.
+ -->
+ <plist>${project}/info-xtrkcad.plist</plist>
+
+ <main-binary dest="${bundle}">${project}/bin/xtrkcad</main-binary>
+
+ <!-- Copy in the input methods. Dunno if they actually work with
+ OSX. Note the ${gtkdir} macro, which expands to the correct
+ library subdirectory for the specified gtk version. -->
+ <binary>
+ ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/*.so
+ </binary>
+
+<!-- And the print backends -->
+ <binary>
+ ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
+ </binary>
+
+<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
+ <binary>
+ ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so
+ </binary>
+
+<!-- No longer needed for pango >= 1.38
+ <binary>
+ ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/
+ </binary>
+-->
+
+ <!-- Translation filenames, one for each program or library that you
+ want to copy in to the bundle. The "dest" attribute is
+ optional, as usual. Bundler will find all translations of that
+ library/program under the to the bundle. The "dest" attribute is
+ optional, as usual. Bundler indicated directory and copy them.-->
+
+
+ <!-- Data to copy in, usually Glade/UI files, images, sounds files
+ etc. The destination inside the bundle can be specified if the
+ files should end up at a different location, by using the
+ "dest" property. The destination must then start with the macro
+ "${bundle}", which refers to the bundle root directory.
+ -->
+ <!--
+ <data>
+ ${prefix}/share/gtk3-demo
+ </data>
+ -->
+
+<!-- Copy in the glib schemas - needed for Help function -->
+ <data>
+ ${prefix}/share/glib-2.0/schemas
+ </data>
+ <data>
+ ${prefix}/etc/xdg
+ </data>
+
+
+ <!-- Copy in the themes data. You may want to trim this to save space
+ in your bundle. -->
+
+ <data dest="${bundle}/Contents/Resources/xtrkcad">
+ ${project}/share/xtrkcad
+ </data>
+
+
+ <!-- Copy icons. Note that the .icns file is an Apple format which
+ contains up to 4 sizes of icon. You can use
+ /Developer/Applications/Utilities/Icon Composer.app to import
+ artwork and create the file. -->
+ <data dest="${bundle}/Contents/Resources">
+ ${project}/xtrkcad-logo.icns
+ </data>
+
+ <binary dest="${bundle}/Contents/MacOS/helphelper">
+ ${project}/bin/helphelper
+ </binary>
+
+ <data dest="${bundle}/Contents/Resources/XTrackCAD.help">
+ ${project}/share/xtrkcad/XTrackCAD.help
+ </data>
+
+ </app-bundle>