1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#!/bin/bash
set -eux
# Creating "PasDoc.app" directory , which is a macOS "bundle"
# (magic directory that behaves like a clickable application under macOS).
#
# This is a simplified and specialized version of
# https://github.com/castle-engine/cge-scripts/blob/master/create_macosx_bundle.sh .
#
# Before calling this, compile binary by "lazbuild".
# Note that this script can in principle put any binary (compiled for any OS/CPU)
# into a bundle, but it really only makes sense to package this way macOS binary
# (OS=darwin, CPU=x86_64).
# Configurable variables -----------------------------------------------------
BUNDLE_NAME='pasdoc_gui'
BUNDLE_DIR="${BUNDLE_NAME}.app"
EXE_NAME='pasdoc_gui'
APP_VERSION="$1" # will be passed from Makefile
# Do the job -----------------------------------------------------------------
rm -Rf "${BUNDLE_DIR}"
mkdir -p "${BUNDLE_DIR}/Contents/MacOS"
mkdir -p "${BUNDLE_DIR}/Contents/Resources"
cp "${EXE_NAME}" "${BUNDLE_DIR}/Contents/MacOS"
# TODO: put icon in "${BUNDLE_DIR}/Contents/Resources/${EXE_NAME}.icns"
echo "APPL????" > "${BUNDLE_DIR}/Contents/PkgInfo"
cat > "${BUNDLE_DIR}/Contents/Info.plist" <<EOF
<?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">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXE_NAME}</string>
<key>CFBundleName</key>
<string>${BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>io.pasdoc.${EXE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>view</string>
<key>CFBundleShortVersionString</key>
<string>${APP_VERSION}</string>
<key>CFBundleVersion</key>
<string>${APP_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<!-- TODO -->
<!--key>CFBundleIconFile</key-->
<!--string>${EXE_NAME}</string-->
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
<string>disk</string>
<string>****</string>
</array>
</dict>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
EOF
|