diff --git a/install_mac/1-release-extra.sh b/install_mac/1-release-extra.sh deleted file mode 100644 --- a/install_mac/1-release-extra.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Tim Sutton 2007 -# Copy supportibng libraries (except Qt) to Marble bundle -# and make search paths for them relative to bundle -# -# Change prefix if you built to a different install dest -# -PREFIX=/Applications/Marble.app/ -#set -x -install_name_tool -change $HOME/dev/cpp/marble/build/src/lib/libmarblewidget.5.dylib \ - @executable_path/lib/libmarblewidget.5.dylib \ - ${PREFIX}/Contents/MacOS/marble - -# Remove any debug etc symbols - comment this line out if you are debugging! -strip -x ${PREFIX}/Contents/MacOS/marble diff --git a/install_mac/2-release-qt.sh b/install_mac/2-release-qt.sh deleted file mode 100644 --- a/install_mac/2-release-qt.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/sh -#set -x -# Copy Qt frameworks to marble bundle -# and make search paths for them relative to bundle - -# -# Change the next two lines to match your system -# - -UNIVERSAL_LIBS_PREFIX=/usr/local/qgis_universal_deps -APP_PREFIX=/Applications/Marble.app - -# Note: that if you are debugging you may want to disable the -# strip section at the end of this file. - -#------ You should not need to edit anything after this ----- - -MACOS_PREFIX=${APP_PREFIX}/Contents/MacOS -FRAMEWORKPREFIX=${APP_PREFIX}/Contents/Frameworks -QTPREFIX=${UNIVERSAL_LIBS_PREFIX}/lib -mkdir -p $MACOS_PREFIX -mkdir -p $FRAMEWORKPREFIX -pushd $PWD -cd $FRAMEWORKPREFIX - -QTFRAMEWORKS="QtCore QtGui QtNetwork QtSvg QtXml" - -# -# Copy supporting frameworks to application bundle -# -cd $FRAMEWORKPREFIX -for FRAMEWORK in $QTFRAMEWORKS -do - LIBFRAMEWORK=$FRAMEWORK.framework/Versions/4/$FRAMEWORK - if test ! -f $LIBFRAMEWORK; then - mkdir -p $FRAMEWORK.framework/Versions/4 - cp $QTPREFIX/$LIBFRAMEWORK $LIBFRAMEWORK - install_name_tool -id @executable_path/../Frameworks/$LIBFRAMEWORK $LIBFRAMEWORK - fi -done - -# Update path to supporting frameworks -for FRAMEWORK in QtGui QtNetwork QtSvg QtXml -do - install_name_tool -change ${QTPREFIX}/QtCore.framework/Versions/4/QtCore \ - @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \ - $FRAMEWORK.framework/Versions/4/$FRAMEWORK -done - -for FRAMEWORK in QtSvg -do - install_name_tool -change ${QTPREFIX}/QtGui.framework/Versions/4/QtGui \ - @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \ - $FRAMEWORK.framework/Versions/4/$FRAMEWORK - install_name_tool -change ${QTPREFIX}/QtXml.framework/Versions/4/QtXml \ - @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml \ - $FRAMEWORK.framework/Versions/4/$FRAMEWORK -done - -# -# Update Marble related libs and binaries -# - -cd $MACOS_PREFIX -for FILE in \ - marble \ - lib/libmarblewidget.0.5.0.dylib -do - for FRAMEWORK in QtCore QtGui QtNetwork QtSvg QtXml - do - install_name_tool -change ${QTPREFIX}/${FRAMEWORK}.framework/Versions/4/$FRAMEWORK \ - @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/4/$FRAMEWORK \ - $MACOS_PREFIX/$FILE - done -done - - - -# -# Update qt imageformat plugin paths -# - - -cd ${MACOS_PREFIX}/../ -mkdir -p plugins/imageformats -cd plugins/imageformats - -LIBJPEG=libjpeg.dylib -LIBQJPEG=${UNIVERSAL_LIBS_PREFIX}/plugins/imageformats/libqjpeg.dylib -if test ! -f $LIBJPEG; then - cp $LIBQJPEG $LIBJPEG - # Update path to supporting libraries - install_name_tool -change ${QTPREFIX}/QtCore.framework/Versions/4/QtCore \ - @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \ - $LIBJPEG - install_name_tool -change ${QTPREFIX}/QtGui.framework/Versions/4/QtGui \ - @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \ - $LIBJPEG - install_name_tool -change $LIBQJPEG @executable_path/../plugins/imageformats/$LIBJPEG -fi -LIBGIF=libgif.dylib -LIBQGIF=${UNIVERSAL_LIBS_PREFIX}/plugins/imageformats/libqgif.dylib -if test ! -f $LIBGIF; then - cp $LIBQGIF $LIBGIF - # Update path to supporting libraries - install_name_tool -change ${QTPREFIX}/QtCore.framework/Versions/4/QtCore \ - @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \ - $LIBGIF - install_name_tool -change ${QTPREFIX}/QtGui.framework/Versions/4/QtGui \ - @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \ - $LIBGIF - install_name_tool -change $LIBQGIF @executable_path/../plugins/imageformats/$LIBGIF -fi - -popd - - -# You may want to comment out this section if you are trying to debug... -# but enable it for final packaging because your bundle will be much -# smaller -for FRAMEWORK in $QTFRAMEWORKS -do - strip -x ${APP_PREFIX}/Contents/Frameworks/${FRAMEWORK}.framework/Versions/4/${FRAMEWORK} -done diff --git a/install_mac/3-dmg.sh b/install_mac/3-dmg.sh deleted file mode 100755 --- a/install_mac/3-dmg.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# -# A bash script to create a dmg image file of the -# final application bundle -# (c) Tim Sutton 2007 - -# Change the next line to suite the verion release (no spaces) - -VERSION=5 -APPNAME=Marble - -# Should not need to edit after this point - -VOLNAME=${APPNAME}${VERSION} -DMGNAME=${VOLNAME}Uncompressed.dmg -COMPRESSEDDMGNAME=${VOLNAME}.dmg -set -x - -echo "Removing old dmg if it exists" -rm ~/Desktop/${DMGNAME} -rm ~/Desktop/${COMPRESSEDDMGNAME} -hdiutil create -size 65m -fs HFS+ -volname ${VOLNAME} ~/Desktop/${DMGNAME} - -# Mount the disk image -hdiutil attach ~/Desktop/${DMGNAME} - -# Obtain device information -DEVS=$(hdiutil attach ~/Desktop/${DMGNAME} | cut -f 1) -DEV=$(echo $DEVS | cut -f 1 -d ' ') -VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ') - -# copy in the application bundle -cp -Rp /Applications/${APPNAME}.app ${VOLUME}/${APPNAME}.app - -# copy in background image and folder settings for icon sizes etc -tar xvfz extra_dmg_files.tar.gz -C ${VOLUME} -cp ../LICENSE.txt ${VOLUME}/LICENSE.txt - -# Unmount the disk image -hdiutil detach $DEV - -# Convert the disk image to read-only -hdiutil convert ~/Desktop/${DMGNAME} \ - -format UDZO -o ~/Desktop/${COMPRESSEDDMGNAME} diff --git a/src/apps/marble-qt/CMakeLists.txt b/src/apps/marble-qt/CMakeLists.txt --- a/src/apps/marble-qt/CMakeLists.txt +++ b/src/apps/marble-qt/CMakeLists.txt @@ -15,9 +15,20 @@ endif() else (WIN32) if (APPLE) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_executable (marble-qt ${marble_SRCS}) - # For Mac OS X, the executable must be at the root of the bundle's executable folder + # For macOS, the executable must be at the root of the bundle's executable folder INSTALL(TARGETS marble-qt RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/Marble.app/Contents/MacOS) + # This bundle must then therefore be 'fixed': Qt needs to be placed in + # to the app bundle, and the paths to Qt must be replaced with + # rpath locations. + FIND_PROGRAM(QT_MACDEPLOYQT_EXECUTABLE NAMES macdeployqt) + INSTALL(CODE " + execute_process(COMMAND ${QT_MACDEPLOYQT_EXECUTABLE} + \"${CMAKE_INSTALL_PREFIX}/Marble.app\" + \"-always-overwrite\" + \"-verbose=3\") + ") else (APPLE) add_executable (marble-qt ${marble_SRCS}) endif (APPLE) @@ -35,8 +46,8 @@ if(WIN32) target_link_libraries( marble-qt - ws2_32 - imm32 + ws2_32 + imm32 winmm ) endif(WIN32) @@ -51,7 +62,7 @@ install (TARGETS marble-qt RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) else(WIN32) if (APPLE) - # No need for this when installing to a bundle + # Not needed on macOS. else (APPLE) install (TARGETS marble-qt RUNTIME DESTINATION bin ) endif (APPLE) diff --git a/install_mac/marble_mac.jpg b/tools/create_dmg/background.jpg rename from install_mac/marble_mac.jpg rename to tools/create_dmg/background.jpg diff --git a/tools/create_dmg/create.py b/tools/create_dmg/create.py new file mode 100644 --- /dev/null +++ b/tools/create_dmg/create.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +import sys, os, tempfile, subprocess, argparse, shutil + +# +# This file is part of the Marble Virtual Globe. +# +# This program is free software licensed under the GNU LGPL. You can +# find a copy of this license in LICENSE.txt in the top directory of +# the source code. +# +# Copyright 2016 George White +# + +VERSION = "1.14.0" +SCRIPT_ROOT = os.path.dirname(os.path.abspath(__file__)) +TREE_ROOT = os.path.abspath(os.path.join(SCRIPT_ROOT, "..", "..")) + +DMG_ROOT = tempfile.mkdtemp() +DMG_APP = os.path.abspath("Marble.app") +DMG_BACKGROUND = os.path.join(SCRIPT_ROOT, "background.jpg") +DMG_OUT = os.path.join(BUILD_DIR, "marble-{}.dmg".format(VERSION)) + +HDIUTIL = os.getenv("HDIUTIL", "hdiutil") +OSASCRIPT = os.getenv("OSASCRIPT", "osascript") + +def package_dmg(root=DMG_ROOT, app=DMG_APP, background=DMG_BACKGROUND, + out=DMG_OUT): + marble = os.path.join(root, "Marble") + os.mkdir(marble) + + if not os.path.exists(app): + print("{} doesn't exist!".format(app)) + sys.exit(1) + + # Copy the app to be placed in the disk into `Marble' as `Marble.app'. + shutil.copytree(app, os.path.join(marble, "Marble.app")) + + # Create a template image. + template = os.path.join(root, "template.dmg") + print("\n-- Create template: " + template) + subprocess.call([HDIUTIL, "create", template, "-srcfolder", marble, + "-volname", "Marble", "-format", "UDRW", "-size", + "100m"]) + subprocess.call([HDIUTIL, "attach", template]) + + # Add the `hidden' folder + hidden = os.path.join(marble, "hidden") + os.mkdir(hidden) + shutil.copyfile(os.path.join(SCRIPT_ROOT, "background.jpg"), + os.path.join(hidden, "background.jpg")) + + # Run the prepare script. + prepare = os.path.join(SCRIPT_ROOT, "prepare.scpt") + print("\n-- Execute osascript: " + prepare) + subprocess.call([OSASCRIPT, prepare]) + + # Let the disk eject. + subprocess.call([HDIUTIL, "detach", template]) + + # Convert it to read-write, compressed, and save it to `out'. + subprocess.call([HDIUTIL, "convert", "-format", "UDBZ", "-o", + out, template]) + + print("DMG: " + out + "\n") + shutil.rmtree(marble) + +if __name__ == "__main__": + d = dict() + + parser = argparse.ArgumentParser() + parser.add_argument("-i", "--app", + help="The app to insert in to the new DMG.") + parser.add_argument("-o", "--out", + help="The path to the new DMG.") + args = parser.parse_args() + + if args.app: + d["app"] = args.app + + if args.out: + d["out"] = args.out + + package_dmg(**d) diff --git a/tools/create_dmg/prepare.scpt b/tools/create_dmg/prepare.scpt new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@