From c505e04d5b21a317f99c0a8459b090428e845d2e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 23 Feb 2017 19:01:03 +0100 Subject: Preliminary native OSX work --- src/osx/Info.plist | 34 ++++++++++++++ src/osx/Jalv.icns | Bin 0 -> 202450 bytes src/osx/MainMenu.xib | 116 +++++++++++++++++++++++++++++++++++++++++++++++ src/osx/MainWindow.xib | 31 +++++++++++++ src/osx/SelectPlugin.xib | 99 ++++++++++++++++++++++++++++++++++++++++ src/osx/bundleify.sh | 79 ++++++++++++++++++++++++++++++++ 6 files changed, 359 insertions(+) create mode 100644 src/osx/Info.plist create mode 100644 src/osx/Jalv.icns create mode 100644 src/osx/MainMenu.xib create mode 100644 src/osx/MainWindow.xib create mode 100644 src/osx/SelectPlugin.xib create mode 100755 src/osx/bundleify.sh (limited to 'src/osx') diff --git a/src/osx/Info.plist b/src/osx/Info.plist new file mode 100644 index 0000000..3192998 --- /dev/null +++ b/src/osx/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Jalv + CFBundleExecutable + Jalv + CFBundleGetInfoString + Jalv, Copyright © 2016 David Robillard + CFBundleIconFile + Jalv + CFBundleIdentifier + net.drobilla.Jalv + CFBundleName + Jalv + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + djlv + LSApplicationCategoryType + public.app-category.music + NSHumanReadableCopyright + Copyright © 2016 David Robillard. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/src/osx/Jalv.icns b/src/osx/Jalv.icns new file mode 100644 index 0000000..f3e02ef Binary files /dev/null and b/src/osx/Jalv.icns differ diff --git a/src/osx/MainMenu.xib b/src/osx/MainMenu.xib new file mode 100644 index 0000000..63148ba --- /dev/null +++ b/src/osx/MainMenu.xib @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/osx/MainWindow.xib b/src/osx/MainWindow.xib new file mode 100644 index 0000000..c07da00 --- /dev/null +++ b/src/osx/MainWindow.xib @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/osx/SelectPlugin.xib b/src/osx/SelectPlugin.xib new file mode 100644 index 0000000..a5cd0fd --- /dev/null +++ b/src/osx/SelectPlugin.xib @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/osx/bundleify.sh b/src/osx/bundleify.sh new file mode 100755 index 0000000..3806bd2 --- /dev/null +++ b/src/osx/bundleify.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +if [ "$#" != 3 ]; then + echo "USAGE: $0 LIB_PREFIX BUNDLE EXE"; + exit 1; +fi + +prefix=$1 +bundle=$2 +exe=$3 + +mkdir -p "$bundle/Contents/lib" + +# Replace Control with Command in key bindings +sed -i '' 's/GDK_CONTROL_MASK/GDK_META_MASK/' $bundle/Contents/patchage.ui + +# Copy font configuration files +cp $prefix/etc/fonts/fonts.conf $bundle/Contents/Resources + +# Copy GTK and pango modules +mkdir -p "$bundle/Contents/lib/modules" +mkdir -p "$bundle/Contents/lib/gtk-2.0/engines" +cp $prefix/lib/gtk-2.0/2.10.0/engines/libquartz.so $bundle/Contents/lib/gtk-2.0/engines +cp $(find /usr/local/Cellar/pango -name '*basic-coretext*') $bundle/Contents/lib/modules + +# Copy GdkPixbuf loaders +mkdir -p $bundle/Contents/lib/gdk-pixbuf-2.0/2.10.0/loaders/ +for fmt in icns png; do + cp $prefix/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-$fmt.so \ + $bundle/Contents/lib/gdk-pixbuf-2.0/2.10.0/loaders/; +done + +chmod -R 755 $bundle/Contents/lib/* + +# Copy libraries depended on by the executable to bundle +libs="`otool -L $exe | grep '\.dylib\|\.so' | grep '/User\|/usr/local' | sed 's/(.*//'`" +for l in $libs; do + cp $l $bundle/Contents/lib/; +done +chmod 755 $bundle/Contents/lib/* + +# ... recursively +while true; do + newlibs=$libs + + # Copy all libraries this library depends on to bundle + for l in $(find $bundle -name '*.dylib' -or -name '*.so'); do + reclibs="`otool -L $l | grep '\.dylib\|\.so' | grep '/User\|/usr/local' | sed 's/(.*//'`" + for rl in $reclibs; do + cp $rl $bundle/Contents/lib/; + done + chmod 755 $bundle/Contents/lib/* + newlibs=$(echo "$newlibs"; echo "$reclibs") + done + + # Exit once we haven't added any new libraries + newlibs=$(echo "$newlibs" | sort | uniq) + if [ "$newlibs" = "$libs" ]; then + break; + fi + libs=$newlibs +done + +echo "Bundled libraries:" +echo "$libs" + +for l in $libs; do + lname=`echo $l | sed 's/.*\///'` + lid="@executable_path/lib/$lname" + lpath="$bundle/Contents/lib/$lname" + install_name_tool -id $lid $lpath + install_name_tool -change $l $lid $exe + for j in `find $bundle -name '*.so' -or -name '*.dylib'`; do + install_name_tool -change $l $lid $j + done; +done + +echo "External library references:" +otool -L $exe `find $bundle -name '*.so' -or -name '*.dylib'` | grep -v ':' | grep -v '@executable_path' | sort | uniq -- cgit v1.2.1