diff options
Diffstat (limited to 'macosx')
| -rw-r--r-- | macosx/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | macosx/Info.plist (renamed from macosx/opentrack.app/Contents/Info.plist) | 12 | ||||
| -rw-r--r-- | macosx/PkgInfo | 1 | ||||
| -rw-r--r-- | macosx/dmgbackground.png | bin | 0 -> 32425 bytes | |||
| -rwxr-xr-x | macosx/install-fail-tool | 10 | ||||
| -rwxr-xr-x[-rw-r--r--] | macosx/make-app-bundle.sh | 103 | ||||
| -rw-r--r-- | macosx/opentrack.app/Contents/PkgInfo | 1 | ||||
| -rwxr-xr-x | macosx/opentrack.sh | 6 | 
8 files changed, 94 insertions, 45 deletions
| diff --git a/macosx/CMakeLists.txt b/macosx/CMakeLists.txt index 89901251..8520e9e9 100644 --- a/macosx/CMakeLists.txt +++ b/macosx/CMakeLists.txt @@ -1,13 +1,11 @@  if(APPLE)      otr_escape_string(srcdir "${CMAKE_SOURCE_DIR}") -    otr_escape_string(bindir "${CMAKE_BINARY_DIR}")      otr_escape_string(instdir "${CMAKE_INSTALL_PREFIX}")      otr_escape_string(commit "${OPENTRACK_COMMIT}")      install(CODE " -        execute_process(COMMAND /bin/sh \"${srcdir}/macosx/make-app-bundle.sh\" +       execute_process(COMMAND /bin/sh \"${srcdir}/macosx/make-app-bundle.sh\"                                          \"${srcdir}/macosx\"                                          \"${instdir}\" -                                        \"${bindir}\" -                                        \"${commit}\") +                                       \"${commit}\")      ")  endif() diff --git a/macosx/opentrack.app/Contents/Info.plist b/macosx/Info.plist index 41ca402a..3fd8b614 100644 --- a/macosx/opentrack.app/Contents/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> @@ -22,5 +22,13 @@    <string>opentrack</string>    <key>CFBundleSignature</key>    <string>????</string> +  <key>NSPrincipalClass</key> +  <string>NSApplication</string> +  <key>NSHighResolutionCapable</key> +  <string>True</string> +  <key>NSCameraUsageDescription</key> +  <string>OpenTrack need's to access your camera to capture track head position.</string> +  <key>NSDocumentsFolderUsageDescription</key> +  <string>OpenTrack need's to access your to your documents folder to store settings</string>  </dict>  </plist> diff --git a/macosx/PkgInfo b/macosx/PkgInfo new file mode 100644 index 00000000..6f749b0f --- /dev/null +++ b/macosx/PkgInfo @@ -0,0 +1 @@ +APPL???? diff --git a/macosx/dmgbackground.png b/macosx/dmgbackground.pngBinary files differ new file mode 100644 index 00000000..e3a398c0 --- /dev/null +++ b/macosx/dmgbackground.png diff --git a/macosx/install-fail-tool b/macosx/install-fail-tool index a5464c18..16284562 100755 --- a/macosx/install-fail-tool +++ b/macosx/install-fail-tool @@ -4,22 +4,22 @@ test -n "$1" || exit 1  dir="$1" -for i in "$dir"/* "$dir"/*/* "$dir"/*/*/*; do -        { test -x "$i" && test -f "$i"; } || continue +for i in "$dir"/*; do +	echo $i +        { test -f "$i"; } || continue          case "$i" in              *.dll|*.exe) continue ;;              *) : ;;          esac -        case "$i" in -            *.dylib|*.bin) strip -x "$i" ;; esac          echo ---- $i ----          install_name_tool -id "@executable_path/$(echo "$i" | sed -e "s,^$dir/,,")" "$i"          otool -L "$i" | awk '{ print $1 }' |          while read l; do                  j="$(basename -- "$l")" +                echo === $j ===                  if test -e "$dir/$j"; then -                        install_name_tool -change "$l" "@executable_path/$j" "$i" +                        install_name_tool -change "$l" "@rpath/$j" "$i"                  fi          done  done diff --git a/macosx/make-app-bundle.sh b/macosx/make-app-bundle.sh index 05259702..9265eeb9 100644..100755 --- a/macosx/make-app-bundle.sh +++ b/macosx/make-app-bundle.sh @@ -1,41 +1,90 @@  #!/bin/sh +# exit when any command fails +set -e + +# keep track of the last executed command +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +# echo an error message before exiting +trap 'echo "--\n--\n--\n--\n\"${last_command}\" command failed with exit code $?."' EXIT  +  APPNAME=opentrack +# Alternative we could look at https://github.com/arl/macdeployqtfix ?? -dir="$1" -test -n "$dir" || exit 1 +#macosx directory +dir="$1"  +test -n "$dir"  +# install directory  install="$2" -test -n "$install" || exit 1 -output_dir="$3" -test -n "$output_dir" || exit 1 -version="$4" -test -n "$version" || exit 1 +test -n "$install"  +version="$3" +test -n "$version"   tmp="$(mktemp -d "/tmp/$APPNAME-tmp.XXXXXXX")" -test $? -eq 0 || exit 1 +test $? -eq 0  + -rm -f -- "$install/.DS_Store" -sh "$dir/install-fail-tool" "$install" +# Add rpath for application so it can find the libraries +#install_name_tool -add_rpath @executable_path/../Frameworks "$install/$APPNAME.app/Contents/MacOS/$APPNAME" -cp -R "$dir/opentrack.app" "$tmp/" || exit 1 -cp -R "$install" "$tmp/$APPNAME.app/Contents/MacOS" || exit 1 -sed -i '' -e "s#@OPENTRACK-VERSION@#$version#g" "$tmp/$APPNAME.app/Contents/Info.plist" || exit 1 +# 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"  -mkdir "$tmp/$APPNAME.iconset" || exit 1 -mkdir "$tmp/$APPNAME.app/Contents/Resources" || exit 1 -cp "$dir"/opentrack.sh "$tmp/$APPNAME.app/Contents/MacOS" || exit 1 +# Copy PkgInfo +cp "$dir/PkgInfo" "$install/$APPNAME.app/Contents/" -sips -z 16 16     "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16.png" || exit 1 -sips -z 32 32     "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16@2x.png" || exit 1 -sips -z 32 32     "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32.png" || exit 1 -sips -z 64 64     "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32@2x.png" || exit 1 -sips -z 128 128   "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128.png" || exit 1 +# Copy plugins +mkdir -p "$install/$APPNAME.app/Contents/MacOS/Plugins" +cp -r "$install/Plugins" "$install/$APPNAME.app/Contents/MacOS/" -iconutil -c icns -o "$tmp/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$APPNAME.iconset" -rm -r "$tmp/$APPNAME.iconset" +# 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" -cd "$tmp" || exit 1 -rm -f "$output_dir/$version-macosx.zip" -zip -9r "$output_dir/$version-macosx.zip" "$APPNAME.app" || exit 1 +# 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"  +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" -ls -lh "$output_dir/$version-macosx.zip" + +#Build DMG +#https://github.com/andreyvit/create-dmg +rm -rf $install/../*.dmg +create-dmg \ +  --volname "$APPNAME" \ +  --volicon "$install/$APPNAME.app/Contents/Resources/$APPNAME.icns" \ +  --window-pos 200 120 \ +  --window-size 800 450 \ +  --icon-size 80 \ +  --background "$dir/dmgbackground.png" \ +  --icon "$APPNAME.app" 200 180 \ +  --app-drop-link 420 180 \ +  --hide-extension "$APPNAME.app" \ +  --no-internet-enable \ +  --add-folder "Document" "$install/doc" 20 40 \ +  --add-folder "source-code" "$install/source-code" 220 40 \ +  --add-folder "Xplane-Plugin" "$install/xplane" 420 40 \ +  --add-folder "thirdparty" "$install/thirdparty" 620 40 \ +  "$version.dmg" \ +  "$install/$APPNAME.app" + +# Check if we have a DMG otherwise fail +FILE=$install/../$version.dmg +if [ -f $FILE ]; then +   ls -ial $install/../*.dmg +else +   echo "Failed to create ${FILE}" +   exit 2 +fi diff --git a/macosx/opentrack.app/Contents/PkgInfo b/macosx/opentrack.app/Contents/PkgInfo deleted file mode 100644 index b18f8c6c..00000000 --- a/macosx/opentrack.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLopentrack diff --git a/macosx/opentrack.sh b/macosx/opentrack.sh deleted file mode 100755 index 74a911e2..00000000 --- a/macosx/opentrack.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd -- "$(dirname -- "$0")" && -exec ./opentrack.bin -platformpluginpath "$(pwd)" "$@" - -exit 1 | 
