diff --git a/data/scripts/create_apple_bundle.sh.in b/data/scripts/create_apple_bundle.sh.in new file mode 100644 index 000000000..fa6df3454 --- /dev/null +++ b/data/scripts/create_apple_bundle.sh.in @@ -0,0 +1,123 @@ +#!/bin/bash +#title :create_applet_installer.sh +#description :Creates Apple ".app" bundle for LMMS +#author :Tres Finocchiaro +#date :20140331 +#version :1.0 +#usage :bash create_applet_installer.sh +#notes :See also https://github.com/LMMS +#notes :Troubleshooting try: export DYLD_PRINT_LIBRARIES=1 +#requires :deploymacqt +#========================================================================================= + +# MacPorts Location +MACPORTS=/opt/local + + # LMMS project root directory (extracted source) +CMAKE_SRC=@CMAKE_SOURCE_DIR@ + +# LMMS compiled (install) resources +CMAKE_INSTALL=@CMAKE_INSTALL_PREFIX@ + +# LMMS working build directory +CMAKE_BUILD=@CMAKE_CURRENT_BINARY_DIR@ + +# STK rawwaves directory +STK_RAWWAVE=$HOME/stk-*/rawwaves + + +# Place to create ".app" bundle +APP=$HOME/Desktop/LMMS.app + +# MacPorts installs libreadline with wrong permissions +LIBREADLINE=$MACPORTS/lib/libreadline.6.2.dylib + +#========================================================================================= + +echo -e "\n\nRunning..." + +# Check for u+w permissions on libreadline +_perm=`stat -f "%p" $LIBREADLINE` +_perm=${_perm:3:1} +if [ ${_perm} != "7" ] +then + echo -e "\n\n\t\t\t\t***********\n\t\t\t\t* WARNING *\n\t\t\t\t***********" + echo -e "File $LIBREADLINE is not marked as user writable." + echo -e "This will break macdeployqt's linking process after it is copied." + echo -e "A sudo password is required to elevate and fix using chmod u+w." + echo -e "\nPLEASE ENTER SUDO PASSWORD:" + sudo chmod u+w "$MACPORTS/lib/libreadline.6.2.dylib" +fi + +# Remove any old .app bundles +rm -Rf "$APP" + +# Create new bundle, copy our built code to it +mkdir -p "$APP" +cd "$CMAKE_INSTALL" +mkdir "$APP/Contents" +cp -R * "$APP/Contents" + +# Manually copy STK rawwaves +mkdir -p "$APP/Contents/share/stk/rawwaves" +cp "$STK_RAWWAVE/*.raw" "$APP/Contents/share/stk/rawwaves" + +# Make all libraries writable for macdeployqt +cd "$APP" +find . -type f -print0 | xargs -0 chmod u+w + +# Move lmms binary to the proper location +mkdir -p "$APP/Contents/MacOS" +mv "$APP/Contents/bin/lmms" "$APP/Contents/MacOS" +rm -rf "$APP/Contents/bin" + +# Move libraries to proper locations +mkdir -p "$APP/Contents/Frameworks" +mv "$APP/Contents/lib/lmms/libZynAddSubFxCore.dylib" \ + "$APP/Contents/Frameworks/libZynAddSubFxCore.dylib" + +mv "$APP/Contents/lib/lmms/RemoteZynAddSubFx" \ + "$APP/Contents/MacOS/RemoteZynAddSubFx" + +# Fix more Zyn Linking issues +# install_name_tool -change $CMAKE_INSTALL/lib/lmms/libZynAddSubFxCore.dylib \ +# @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ +# $APP/Contents/lib/lmms/libzynaddsubfx.so + +install_name_tool -change libZynAddSubFxCore.dylib \ + @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ + "$APP/Contents/lib/lmms/libzynaddsubfx.so" + +install_name_tool -change "$CMAKE_BUILD/plugins/zynaddsubfx/libZynAddSubFxCore.dylib" \ + @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ + "$APP/Contents/MacOS/RemoteZynAddSubFx" + +# Build a list of shared objects in target/lib/lmms +for file in "$APP/Contents/lib/lmms/*.so"; do + _executables="$_executables -executable=\"$APP/Contents/lib/lmms/${file##*/}\"" +done + +# Build a list of shared objects in target/lib/lmms/ladspa +for file in "$APP/Contents/lib/lmms/ladspa/*.so"; do + _executables="$_executables -executable=\"$APP/Contents/lib/lmms/ladspa/${file##*/}\"" +done + +# Additional binaries that require linking +_executables="$_executables -executable=\"$APP/Contents/MacOS/RemoteZynAddSubFx\"" +_executables="$_executables -executable=\"$APP/Contents/Frameworks/libZynAddSubFxCore.dylib\"" + +# Build our App Package using "macdeployqt" +macdeployqt "$APP" $_executables + +# OS X Specific Artwork +cp "$CMAKE_SRC/data/lmms.icns" "$APP/Contents/Resources/" +cp "$CMAKE_SRC/data/project.icns" "$APP/Contents/Resources/" + +# Copy "Info.plist" into bundle +cp "$CMAKE_BUILD/Info.plist" "$APP/Contents/Info.plist" + +# Done. Ready to build DMG +echo -e "\nFinished.\n\nPlease run \"create_apple_dmg.sh\" from the Desktop to build the installer.\n" +echo -e "Note: You can drag/drop it into this terminal window.)\n" +cp "CMAKE_INSTALL/create_apple_dmg.sh" "$HOME/Desktop/" +chmod +x "$HOME/Desktop/create_apple_dmg.sh" diff --git a/data/scripts/create_apple_dmg.sh b/data/scripts/create_apple_dmg.sh.in old mode 100755 new mode 100644 similarity index 97% rename from data/scripts/create_apple_dmg.sh rename to data/scripts/create_apple_dmg.sh.in index be50c2b81..0116f1f69 --- a/data/scripts/create_apple_dmg.sh +++ b/data/scripts/create_apple_dmg.sh.in @@ -10,10 +10,10 @@ if [ -d "$dir" ]; then fi # set up your app name, version number, and background image file name -APP_NAME="LMMS" -VERSION="1.0.0" +APP_NAME="@MACOSX_BUNDLE_BUNDLE_NAME@" +VERSION="@MACOSX_BUNDLE_LONG_VERSION@" DMG_BACKGROUND_IMG="dmg_branding.png" -cp $HOME/lmms/data/$DMG_BACKGROUND_IMG . +cp "@CMAKE_INSTALL_PREFIX@/data/$DMG_BACKGROUND_IMG" . # you should not need to change these APP_LOWERCASE=$(echo $APP_NAME|tr '[:upper:]' '[:lower:]') diff --git a/data/scripts/create_apple_installer.sh b/data/scripts/create_apple_installer.sh deleted file mode 100755 index 7836ca749..000000000 --- a/data/scripts/create_apple_installer.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/bash -#title :create_applet_installer.sh -#description :Creates Apple ".app" bundle for LMMS -#author :Tres Finocchiaro -#date :20140331 -#version :1.0 -#usage :bash create_applet_installer.sh -#notes :See also https://github.com/LMMS -#notes :Troubleshooting try: export DYLD_PRINT_LIBRARIES=1 -#requires :deploymacqt -#========================================================================================= - -# MacPorts Location -MACPORTS=/opt/local - - # LMMS source directory -CMAKE_SRC=$HOME/lmms - -# LMMS compiled resources -CMAKE_INSTALL=$CMAKE_SRC/target - -# LMMS source build directory -CMAKE_BUILD=$CMAKE_SRC/build - -# STK rawwaves directory -STK_RAWWAVE=$HOME/stk-*/rawwaves - - -# Place to create ".app" bundle -APP=$HOME/Desktop/LMMS.app - -# MacPorts installs libreadline with wrong permissions -LIBREADLINE=$MACPORTS/lib/libreadline.6.2.dylib - -#========================================================================================= - -echo -e "\n\nRunning..." - -# Check for u+w permissions on libreadline -_perm=`stat -f "%p" $LIBREADLINE` -_perm=${_perm:3:1} -if [ ${_perm} != "7" ] -then - echo -e "\n\n\t\t\t\t***********\n\t\t\t\t* WARNING *\n\t\t\t\t***********" - echo -e "File $LIBREADLINE is not marked as user writable." - echo -e "This will break macdeployqt's linking process after it is copied." - echo -e "A sudo password is required to elevate and fix using chmod u+w." - echo -e "\nPLEASE ENTER SUDO PASSWORD:" - sudo chmod u+w $MACPORTS/lib/libreadline.6.2.dylib -fi - -# Remove any old .app bundles -rm -Rf $APP - -# Create new bundle, copy our built code to it -mkdir -p $APP -cd $CMAKE_INSTALL -mkdir $APP/Contents -cp -R * $APP/Contents - -# Manually copy STK rawwaves -mkdir -p $APP/Contents/share/stk/rawwaves -cp $STK_RAWWAVE/*.raw $APP/Contents/share/stk/rawwaves - -# Make all libraries writable for macdeployqt -cd $APP -find . -type f -print0 | xargs -0 chmod u+w - -# Move lmms binary to the proper location -mkdir -p $APP/Contents/MacOS -mv $APP/Contents/bin/lmms $APP/Contents/MacOS -rm -rf $APP/Contents/bin - -# Move libraries to proper locations -mkdir -p $APP/Contents/Frameworks -mv $APP/Contents/lib/lmms/libZynAddSubFxCore.dylib \ - $APP/Contents/Frameworks/libZynAddSubFxCore.dylib - -mv $APP/Contents/lib/lmms/RemoteZynAddSubFx \ - $APP/Contents/MacOS/RemoteZynAddSubFx - -# Fix more Zyn Linking issues -# install_name_tool -change $CMAKE_INSTALL/lib/lmms/libZynAddSubFxCore.dylib \ -# @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ -# $APP/Contents/lib/lmms/libzynaddsubfx.so - -install_name_tool -change libZynAddSubFxCore.dylib \ - @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ - $APP/Contents/lib/lmms/libzynaddsubfx.so - -install_name_tool -change $CMAKE_BUILD/plugins/zynaddsubfx/libZynAddSubFxCore.dylib \ - @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ - $APP/Contents/MacOS/RemoteZynAddSubFx - -# Build a list of shared objects in target/lib/lmms -for file in $APP/Contents/lib/lmms/*.so; do - _executables="$_executables -executable=$APP/Contents/lib/lmms/${file##*/}" -done - -# Build a list of shared objects in target/lib/lmms/ladspa -for file in $APP/Contents/lib/lmms/ladspa/*.so; do - _executables="$_executables -executable=$APP/Contents/lib/lmms/ladspa/${file##*/}" -done - -# Additional binaries that require linking -_executables="$_executables -executable=$APP/Contents/MacOS/RemoteZynAddSubFx" -_executables="$_executables -executable=$APP/Contents/Frameworks/libZynAddSubFxCore.dylib" - -# Build our App Package using "macdeployqt" -macdeployqt $APP $_executables - -# OS X Specific Artwork -cp $CMAKE_SRC/data/lmms.icns $APP/Contents/Resources/ -cp $CMAKE_SRC/data/project.icns $APP/Contents/Resources/ - -# Create "Info.plist" using lmms.icns file, http://iconverticons.com/online/) -echo -e "" > "$APP/Contents/Info.plist" -echo -e "> "$APP/Contents/Info.plist" -echo -e "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "$APP/Contents/Info.plist" -echo -e "" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleIconFile" >> "$APP/Contents/Info.plist" -echo -e " lmms.icns" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeExtensions" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " mmpz" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeIconFile" >> "$APP/Contents/Info.plist" -echo -e " project.icns" >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeMIMETypes" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " application/x-lmms-project" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeName" >> "$APP/Contents/Info.plist" -echo -e " LMMS Project" >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeRole" >> "$APP/Contents/Info.plist" -echo -e " Editor" >> "$APP/Contents/Info.plist" -echo -e " LSIsAppleDefaultForType " >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeExtensions" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " mmp" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeIconFile" >> "$APP/Contents/Info.plist" -echo -e " project.icns" >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeMIMETypes" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " application/x-lmms-project" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeName" >> "$APP/Contents/Info.plist" -echo -e " LMMS Project" >> "$APP/Contents/Info.plist" -echo -e " CFBundleTypeRole" >> "$APP/Contents/Info.plist" -echo -e " Editor" >> "$APP/Contents/Info.plist" -echo -e " " >> "$APP/Contents/Info.plist" -echo -e "" >> "$APP/Contents/Info.plist" - -# Done. Ready to build DMG -echo -e "\nFinished.\n\nPlease run \"create_apple_dmg.sh\" from the Desktop to build the installer.\n" -echo -e "Note: You can drag/drop it into this terminal window.)\n" -cp $CMAKE_SRC/data/scripts/create_apple_dmg.sh $HOME/Desktop/ -chmod +x $HOME/Desktop/create_apple_dmg.sh