From bc81274fa8f1ebe7091fbfa3512962a4cd59501f Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Mon, 5 May 2014 09:45:01 -0400 Subject: [PATCH] Apple Bundle Fix : Allow %VARS% for Bundle Script --- data/scripts/create_apple_bundle.sh.in | 108 ++++++++++++------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/data/scripts/create_apple_bundle.sh.in b/data/scripts/create_apple_bundle.sh.in index 2ccd36665..8b335cb0d 100644 --- a/data/scripts/create_apple_bundle.sh.in +++ b/data/scripts/create_apple_bundle.sh.in @@ -2,11 +2,11 @@ #title :create_applet_installer.sh #description :Creates Apple ".app" bundle for LMMS #author :Tres Finocchiaro -#date :20140331 -#version :1.0 +#date :20140504 +#version :1.1 #usage :bash create_applet_installer.sh #notes :See also https://github.com/LMMS -#notes :Troubleshooting try: export DYLD_PRINT_LIBRARIES=1 +#notes :Troubleshooting try: export DYLD_PRINT_LIBRARIES=1; export VERBOSE=1; #requires :deploymacqt #========================================================================================= @@ -14,110 +14,108 @@ MACPORTS=/opt/local # LMMS project root directory (extracted source) -CMAKE_SRC=/Users/tres/lmms +CMAKE_SRC=@CMAKE_SOURCE_DIR@ # LMMS compiled (install) resources -CMAKE_INSTALL=/Users/tres/lmms/target +CMAKE_INSTALL=@CMAKE_INSTALL_PREFIX@ # LMMS working build directory -CMAKE_BUILD=/Users/tres/lmms/build - +CMAKE_BUILD=$(cd @CMAKE_CURRENT_BINARY_DIR@/../..; pwd) + # STK rawwaves directory -STK_RAWWAVE=$HOME/stk-*/rawwaves - +STK_RAWWAVE=${HOME}/stk-*/rawwaves # Place to create ".app" bundle -APP=$HOME/Desktop/LMMS.app +APP=${HOME}/Desktop/LMMS.app # MacPorts installs libreadline with wrong permissions -LIBREADLINE=$MACPORTS/lib/libreadline.6.2.dylib +LIBREADLINE=${MACPORTS}/lib/libreadline.6.2.dylib + +# The DMG packager script location +DMG_SCRIPT_SRC=${CMAKE_BUILD}/create_apple_dmg.sh +DMG_SCRIPT_DST=${HOME}/Desktop/create_apple_dmg.sh #========================================================================================= - -echo -e "\n\nRunning..." + +MSG_COLOR='\x1B[1;36m' +COLOR_RESET='\x1B[0m' +echo -e "${MSG_COLOR}\n\nCreating App Bundle \"${APP}\"...${COLOR_RESET}" # Check for u+w permissions on libreadline CHECKREADLINE=$(stat -f "%p" $LIBREADLINE) CHECKREADLINE=${CHECKREADLINE:3:1} -if [ "$CHECKREADLINE" != "7" ] +if [ "${CHECKREADLINE}" != "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 "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" + sudo chmod u+w "${MACPORTS}/lib/libreadline.6.2.dylib" fi # Remove any old .app bundles -rm -Rf "$APP" +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" +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" +mkdir -p ${APP}/Contents/share/stk/rawwaves +cp ${STK_RAWWAVE}/*.raw ${APP}/Contents/share/stk/rawwaves # Make all libraries writable for macdeployqt -cd "$APP" +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" +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" +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" +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" + ${APP}/Contents/lib/lmms/libzynaddsubfx.so -install_name_tool -change "$CMAKE_BUILD/plugins/zynaddsubfx/libZynAddSubFxCore.dylib" \ +install_name_tool -change ${CMAKE_BUILD}/plugins/zynaddsubfx/libZynAddSubFxCore.dylib \ @loader_path/../../Frameworks/libZynAddSubFxCore.dylib \ - "$APP/Contents/MacOS/RemoteZynAddSubFx" + ${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##*/}" +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##*/}" +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" +_executables="${_executables} -executable=${APP}/Contents/MacOS/RemoteZynAddSubFx" +_executables="${_executables} -executable=${APP}/Contents/Frameworks/libZynAddSubFxCore.dylib" # Build our App Package using "macdeployqt" -macdeployqt "$APP" $_executables +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_INSTALL/Info.plist" "$APP/Contents/Info.plist" +cp ${CMAKE_SRC}/data/*.icns ${APP}/Contents/Resources/ # 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" +echo -e "\nFinished.\n\nYou may run LMMS from the Desktop." +echo -e "\nTo create an Apple DMG Package run ${MSG_COLOR}\"${DMG_SCRIPT_DST}\"${COLOR_RESET}.\n" +echo -e "(Note: You can drag/drop the script directly into this terminal window.)\n" +cp ${DMG_SCRIPT_SRC} ${DMG_SCRIPT_DST} +chmod +x ${DMG_SCRIPT_DST}