ci: Create .app bundle for macOS

This commit is contained in:
Matt Borgerson 2020-03-26 01:04:56 -07:00
parent 60199805e6
commit 90461de5cf
2 changed files with 81 additions and 7 deletions

View File

@ -131,11 +131,11 @@ jobs:
if "${{ matrix.configuration }}" == "Debug":
print('Configuring for Debug')
print('::set-env name=BUILD_PARAM::--debug')
print('::set-env name=ARTIFACT_NAME::xemu-macos-debug')
print('::set-env name=ARTIFACT_NAME::xemu-macos-debug.zip')
else:
print('Configuring for Release')
print('::set-env name=BUILD_PARAM::')
print('::set-env name=ARTIFACT_NAME::xemu-macos-release')
print('::set-env name=ARTIFACT_NAME::xemu-macos-release.zip')
- name: Clone Tree
uses: actions/checkout@v2
- name: Install Dependencies
@ -143,12 +143,13 @@ jobs:
brew update
brew unlink python@2
brew install \
pixman \
sdl2 \
libepoxy \
ccache \
coreutils \
dylibbundler \
libepoxy \
pixman \
pkg-config \
ccache
sdl2
- name: Initialize Compiler Cache
id: cache
uses: actions/cache@v1
@ -164,6 +165,14 @@ jobs:
./build.sh ${{ env.BUILD_PARAM }}
echo -e "\nCompiler Cache Stats:"
ccache -s -c
pushd dist
zip -r ../${{env.ARTIFACT_NAME}} xemu.app
popd
- name: Upload Build Artifact
uses: actions/upload-artifact@v1
with:
name: dist
path: ${{env.ARTIFACT_NAME}}
Release:
runs-on: ubuntu-latest

View File

@ -13,6 +13,70 @@ package_windows() { # Script to prepare the windows exe
strip dist/xemuw.exe
}
package_macos() {
#
# Create bundle
#
rm -rf dist
# Copy in executable
mkdir -p dist/xemu.app/Contents/MacOS/
cp i386-softmmu/qemu-system-i386 dist/xemu.app/Contents/MacOS/xemu
# Copy in in executable dylib dependencies
mkdir -p dist/xemu.app/Contents/Frameworks
dylibbundler -cd -of -b -x dist/xemu.app/Contents/MacOS/xemu \
-d dist/xemu.app/Contents/Frameworks/ \
-p '@executable_path/../Frameworks/'
# Copy in runtime resources
mkdir -p dist/xemu.app/Contents/Resources
cp -r data dist/xemu.app/Contents/Resources
# Generate icon file
mkdir -p xemu.iconset
for r in 16 32 128 256 512; do cp ui/icons/xemu_${r}x${r}.png xemu.iconset/icon_${r}x${r}.png; done
iconutil --convert icns --output dist/xemu.app/Contents/Resources/xemu.icns xemu.iconset
# Generate Info.plist file
cat <<EOF > dist/xemu.app/Contents/Info.plist
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>xemu</string>
<key>CFBundleIconFile</key>
<string>xemu.icns</string>
<key>CFBundleIdentifier</key>
<string>xemu.app.0</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>xemu</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>CFBundleSignature</key>
<string>xemu</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
EOF
}
postbuild=''
debug_opts=''
user_opts=''
@ -48,7 +112,7 @@ case "$(uname -s)" in # Adjust compilation options based on platform
;;
Darwin)
echo 'Compiling for MacOS...'
sys_cflags='-march=native'
sys_cflags='-march=ivybridge'
sys_opts='--disable-cocoa'
# necessary to find libffi, which is required by gobject
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}/usr/local/opt/libffi/lib/pkgconfig"
@ -59,6 +123,7 @@ case "$(uname -s)" in # Adjust compilation options based on platform
echo 'Could not find a GNU compatible readlink. Please install coreutils with homebrew'
exit -1
fi
postbuild='package_macos'
;;
CYGWIN*|MINGW*|MSYS*)
echo 'Compiling for Windows...'