feat(macos): build a signed .app bundle in a .dmg (#4759)

This commit is contained in:
Andy Grundman
2026-03-03 23:30:53 -05:00
committed by GitHub
parent b000d43883
commit 423a864ee3
22 changed files with 660 additions and 112 deletions
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>dev.lizardbyte.sunshine</string>
<key>CFBundleName</key>
<string>Sunshine</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires access to your microphone to stream audio.</string>
</dict>
</plist>
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>@PROJECT_FQDN@</string>
<key>CFBundleName</key>
<string>@CMAKE_PROJECT_NAME@</string>
<key>CFBundleDisplayName</key>
<string>@CMAKE_PROJECT_NAME@</string>
<key>CFBundleExecutable</key>
<string>@CMAKE_PROJECT_NAME@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@PROJECT_VERSION@</string>
<key>CFBundleVersion</key>
<string>@PROJECT_VERSION@</string>
<key>CFBundleIconFile</key>
<string>sunshine.icns</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSMicrophoneUsageDescription</key>
<string>@CMAKE_PROJECT_NAME@ requires access to your microphone to stream audio.</string>
<key>NSBonjourServices</key>
<array>
<string>_nvstream._tcp</string>
</array>
</dict>
</plist>
+52
View File
@@ -0,0 +1,52 @@
# Based on https://gitlab.kitware.com/cmake/cmake/-/blob/master/Packaging/CMakeDMGSetup.scpt
on run argv
set image_name to item 1 of argv
tell application "Finder"
tell disk image_name
-- wait for the image to finish mounting
set open_attempts to 0
repeat while open_attempts < 4
try
open
delay 1
set open_attempts to 5
close
on error errStr number errorNumber
set open_attempts to open_attempts + 1
delay 10
end try
end repeat
delay 5
-- open the image the first time and save a DS_Store with just
-- background and icon setup
open
set current view of container window to icon view
set theViewOptions to the icon view options of container window
set background picture of theViewOptions to file ".background:background.jpg"
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
set text size of theViewOptions to 16
close
-- next setup the position of the app and Applications symlink
-- plus hide all the window decoration
open
update without registering applications
tell container window
set sidebar width to 0
set statusbar visible to false
set toolbar visible to false
set the bounds to { 400, 100, 900, 465 }
set position of item "Sunshine.app" to { 133, 200 }
set position of item "Applications" to { 378, 200 }
end tell
update without registering applications
close
end tell
delay 1
end tell
end run
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.
-41
View File
@@ -1,41 +0,0 @@
#!/bin/bash -e
# note: this file was used to remove files when using the pkg/dmg, it is no longer used, but left for reference
set -e
package_name=org.macports.Sunshine
echo "Removing files now..."
FILES=$(pkgutil --files $package_name --only-files)
for file in ${FILES}; do
file="/$file"
echo "removing: $file"
rm -f "$file"
done
echo "Removing directories now..."
DIRECTORIES=$(pkgutil --files org.macports.Sunshine --only-dirs)
for dir in ${DIRECTORIES}; do
dir="/$dir"
echo "Checking if empty directory: $dir"
# check if directory is empty... could just use ${DIRECTORIES} here if pkgutils added the `/` prefix
empty_dir=$(find "$dir" -depth 0 -type d -empty)
# remove the directory if it is empty
if [[ $empty_dir != "" ]]; then # prevent the loop from running and failing if no directories found
# shellcheck disable=SC2066 # don't split words as we already know this will be a single directory
for i in "${empty_dir}"; do
echo "Removing empty directory: ${i}"
rmdir "${i}"
done
fi
done
echo "Forgetting Sunshine..."
pkgutil --forget $package_name
echo "Sunshine has been uninstalled..."