diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17dbd4d2a1..1b58542af6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/build.sh b/build.sh index cdba438e7b..5412f143cc 100755 --- a/build.sh +++ b/build.sh @@ -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...'