-
Notifications
You must be signed in to change notification settings - Fork 15
/
build-osx-x64.sh
86 lines (67 loc) · 2.22 KB
/
build-osx-x64.sh
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
84
85
86
#!/bin/bash
set -e
APPBASE="build/macos-x64/Elvarg.app"
build() {
pushd native
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 -B build-x64 .
cmake --build build-x64 --config Release
popd
source .jdk-versions.sh
rm -rf build/macos-x64
mkdir -p build/macos-x64
if ! [ -f mac64_jre.tar.gz ] ; then
curl -Lo mac64_jre.tar.gz $MAC_AMD64_LINK
fi
echo "$MAC_AMD64_CHKSUM mac64_jre.tar.gz" | shasum -c
mkdir -p $APPBASE/Contents/{MacOS,Resources}
cp native/build-x64/src/Elvarg $APPBASE/Contents/MacOS/
cp target/Elvarg.jar $APPBASE/Contents/Resources/
cp packr/macos-x64-config.json $APPBASE/Contents/Resources/config.json
cp target/filtered-resources/Info.plist $APPBASE/Contents/
cp osx/app.icns $APPBASE/Contents/Resources/icons.icns
tar zxf mac64_jre.tar.gz
mkdir $APPBASE/Contents/Resources/jre
mv jdk-$MAC_AMD64_VERSION-jre/Contents/Home/* $APPBASE/Contents/Resources/jre
echo Setting world execute permissions on Elvarg
pushd $APPBASE
chmod g+x,o+x Contents/MacOS/Elvarg
popd
otool -l $APPBASE/Contents/MacOS/Elvarg
}
dmg() {
SIGNING_IDENTITY="Developer ID Application"
codesign -f -s "${SIGNING_IDENTITY}" --entitlements osx/signing.entitlements --options runtime $APPBASE || true
# create-dmg exits with an error code due to no code signing, but is still okay
# note we use Adam-/create-dmg as upstream does not support UDBZ
create-dmg --format UDBZ $APPBASE . || true
mv Elvarg\ *.dmg Elvarg-x64.dmg
# dump for CI
hdiutil imageinfo Elvarg-x64.dmg
if ! hdiutil imageinfo Elvarg-x64.dmg | grep -q "Format: UDBZ" ; then
echo "Format of resulting dmg was not UDBZ, make sure your create-dmg has support for --format"
exit 1
fi
if ! hdiutil imageinfo Elvarg-x64.dmg | grep -q "Apple_HFS" ; then
echo Filesystem of dmg is not Apple_HFS
exit 1
fi
# Notarize app
if xcrun notarytool submit Elvarg-x64.dmg --wait --keychain-profile "AC_PASSWORD" ; then
xcrun stapler staple Elvarg-x64.dmg
fi
}
while test $# -gt 0; do
case "$1" in
--build)
build
shift
;;
--dmg)
dmg
shift
;;
*)
break
;;
esac
done