diff options
author | Ries van Twisk <github@rvt.dds.nl> | 2019-12-28 14:42:48 +0100 |
---|---|---|
committer | Ries van Twisk <github@rvt.dds.nl> | 2019-12-28 14:42:48 +0100 |
commit | b7624b7003540258036babd0fff5c71e52b956d1 (patch) | |
tree | 99e06ad1dd457d3d26d7c066a7026f6742ee07a9 | |
parent | b84e9dfedbbd16470532312e16ee03c50453d438 (diff) |
Cleanup bundle generation
-rw-r--r-- | cmake/opentrack-hier.cmake | 8 | ||||
-rw-r--r-- | cmake/opentrack-platform.cmake | 18 | ||||
-rw-r--r-- | macosx/Info.plist | 4 | ||||
-rwxr-xr-x | macosx/make-app-bundle.sh | 48 | ||||
-rwxr-xr-x | macosx/opentrack.sh | 6 | ||||
-rw-r--r-- | opentrack/main-window.cpp | 2 |
6 files changed, 42 insertions, 44 deletions
diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index 8e9e3db8..13f876a5 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -10,7 +10,7 @@ include_guard(GLOBAL) if(APPLE) - set(opentrack-hier-pfx "${CMAKE_INSTALL_PREFIX}/opentrack.app/Contents/MacOS/Plugins") + set(opentrack-hier-pfx "Plugins") set(opentrack-hier-path "/Plugins/") # MUST HAVE A TRAILING BACKSLASH, Used in APP set(opentrack-hier-doc "/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-bin "${CMAKE_INSTALL_PREFIX}") @@ -18,14 +18,12 @@ if(APPLE) set(opentrack-doc-src-pfx "./source-code") set(opentrack-i18n-pfx "opentrack.app/Contents/Resources") # used during install set(opentrack-i18n-path "../Resources/i18n") # used in application - set(opentrack-install-rpath "../Frameworks") - set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) + set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/Library") elseif(WIN32) set(opentrack-hier-pfx "modules") set(opentrack-hier-path "/${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-doc "/doc/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-bin ".") - set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) set(opentrack-doc-pfx "./doc") set(opentrack-doc-src-pfx "./source-code") set(opentrack-i18n-pfx "./i18n") @@ -37,13 +35,13 @@ else() set(opentrack-hier-path "/../${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-doc "/share/doc/opentrack/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-bin "bin") - set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) set(opentrack-doc-pfx "./share/doc/opentrack") set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code") set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}") set(opentrack-i18n-pfx "./share/opentrack/i18n") set(opentrack-i18n-path "../share/opentrack/i18n") endif() +set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) function(otr_escape_string var str) string(REGEX REPLACE "([^_A-Za-z0-9./:-])" "\\\\\\1" str "${str}") diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index bb7fb1f8..23c18d52 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -43,16 +43,14 @@ set(CMAKE_CXX_STANDARD_DEFAULT 17) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS FALSE) -if (NOT APPLE) - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - set(CMAKE_SKIP_INSTALL_RPATH FALSE) - set(CMAKE_SKIP_RPATH FALSE) -else() - set(CMAKE_SKIP_BUILD_RPATH FALSE) - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - set(CMAKE_MACOSX_RPATH OFF) -endif() +set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_SKIP_INSTALL_RPATH FALSE) +set(CMAKE_SKIP_RPATH FALSE) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC OFF) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) diff --git a/macosx/Info.plist b/macosx/Info.plist index 64572bf3..3fd8b614 100644 --- a/macosx/Info.plist +++ b/macosx/Info.plist @@ -1,11 +1,11 @@ <?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"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> - <string>opentrack.sh</string> + <string>opentrack</string> <key>CFBundleIdentifier</key> <string>com.github.opentrack</string> <key>CFBundleName</key> diff --git a/macosx/make-app-bundle.sh b/macosx/make-app-bundle.sh index fc78f428..b124d4a1 100755 --- a/macosx/make-app-bundle.sh +++ b/macosx/make-app-bundle.sh @@ -13,42 +13,49 @@ APPNAME=opentrack #macosx directory dir="$1" -test -n "$dir" || exit 1 +test -n "$dir" # install directory install="$2" -test -n "$install" || exit 1 +test -n "$install" version="$3" -test -n "$version" || exit 1 +test -n "$version" tmp="$(mktemp -d "/tmp/$APPNAME-tmp.XXXXXXX")" -test $? -eq 0 || exit 1 +test $? -eq 0 -# Add framework and other libraries -macdeployqt "$install/$APPNAME.app" -libpath="$install/Library" -# Fixup dylib linker issues -sh "$dir/install-fail-tool" "$install/$APPNAME.app/Contents/Frameworks" +# Add rpath for application so it can find the libraries +#install_name_tool -add_rpath @executable_path/../Frameworks "$install/$APPNAME.app/Contents/MacOS/$APPNAME" # Copy our own plist and set correct version cp "$dir/Info.plist" "$install/$APPNAME.app/Contents/" +sed -i '' -e "s#@OPENTRACK-VERSION@#$version#g" "$install/$APPNAME.app/Contents/Info.plist" + +# Copy PkgInfo cp "$dir/PkgInfo" "$install/$APPNAME.app/Contents/" -cp "$dir/opentrack.sh" "$install/$APPNAME.app/Contents/MacOS/" -sed -i '' -e "s#@OPENTRACK-VERSION@#$version#g" "$install/$APPNAME.app/Contents/Info.plist" || exit 1 -# Create an 512 resolution size (for retina displays mostly) +# Copy plugins +mkdir -p "$install/$APPNAME.app/Contents/MacOS/Plugins" +cp -r "$install/Plugins" "$install/$APPNAME.app/Contents/MacOS/" + +# Add framework and other libraries and fixup other libraries +macdeployqt "$install/$APPNAME.app" -libpath="$install/Library" +sh "$dir/install-fail-tool" "$install/$APPNAME.app/Contents/Frameworks" + +# Create an 512 resolution size for the icon (for retina displays mostly) #gm convert -size 512x512 "$dir/../gui/images/opentrack.png" "$tmp/opentrack.png" convert "$dir/../gui/images/opentrack.png" -filter triangle -resize 512x512 "$tmp/opentrack.png" # Build iconset -mkdir "$tmp/$APPNAME.iconset" || exit 1 -sips -z 16 16 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16.png" || exit 1 -sips -z 32 32 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16@2x.png" || exit 1 -sips -z 32 32 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32.png" || exit 1 -sips -z 64 64 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32@2x.png" || exit 1 -sips -z 128 128 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128.png" || exit 1 -sips -z 256 256 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128@2x.png" || exit 1 -sips -z 512 512 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_256x256@2x.png" || exit 1 -sips -z 512 512 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_512x512.png" || exit 1 +mkdir "$tmp/$APPNAME.iconset" +sips -z 16 16 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16.png" +sips -z 32 32 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16@2x.png" +sips -z 32 32 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32.png" +sips -z 64 64 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32@2x.png" +sips -z 128 128 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128.png" +sips -z 256 256 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128@2x.png" +sips -z 512 512 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_256x256@2x.png" +sips -z 512 512 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_512x512.png" iconutil -c icns -o "$install/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$APPNAME.iconset" rm -rf "$tmp" @@ -66,6 +73,7 @@ create-dmg \ --app-drop-link 420 180 \ --hide-extension "$APPNAME.app" \ --add-folder "Document" "$install/doc" 20 40 \ + --no-internet-enable \ --add-folder "source-code" "$install/source-code" 220 40 \ --add-folder "Xplane-Plugin" "$install/xplane" 420 40 \ "$version.dmg" \ diff --git a/macosx/opentrack.sh b/macosx/opentrack.sh deleted file mode 100755 index 788afe96..00000000 --- a/macosx/opentrack.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd -- "$(dirname -- "$0")" && -exec ./opentrack -platformpluginpath "$(pwd)" "$@" - -exit 1 diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index cd715216..9bacff6e 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -34,7 +34,7 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH) { ui.setupUi(this); -#if !defined _WIN32 && !defined __APPLE__ +#if !defined _WIN32 annoy_if_root(); #endif |