forked from BeyondDimension/SteamTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-osx-app.sh
93 lines (78 loc) · 2.27 KB
/
build-osx-app.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
87
88
89
90
91
92
93
create_app_structure() {
APPNAME=$1
APPDIR="$APPNAME.app/Contents"
APPICONS="/Users/mossimo/bin/logo.icns"
if [ ! -d "$APPDIR" ]; then
echo "creating app structure $APPDIR"
mkdir -vp "$APPDIR"/{Resources,Frameworks}
cp -v "$APPICONS" "$APPDIR/Resources/$APPNAME.icns"
fi
}
emit_plist() {
PLIST_APPNAME=$1
PLIST_PATH="$2/Info.plist"
if [ "$3" ]; then
LSUIELEMENT="false"
else
LSUIELEMENT="true"
fi
if [ ! -f "$PLIST_PATH" ]; then
echo "emiting $PLIST_PATH"
cat <<EOF > "$PLIST_PATH"
<?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>CFBundleName</key>
<string>$PLIST_APPNAME</string>
<key>CFBundleIdentifier</key>
<string>net.steampp.app</string>
<key>CFBundleShortVersionString</key>
<string>2.6.1</string>
<key>CFBundleVersion</key>
<string>2.6.1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.14</string>
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>$PLIST_APPNAME</string>
<key>CFBundleGetInfoString</key>
<string>$PLIST_APPNAME</string>
<key>CFBundleIconFile</key>
<string>$PLIST_APPNAME</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSUIElement</key>
<string>$LSUIELEMENT</string>
<key>NSHumanReadableCopyright</key>
<string>© 长沙次元超越科技有限公司. All Rights Reserved.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
EOF
fi
}
cd "/Users/mossimo/bin"
BINARYNAME="Steam++"
echo "Building Avalonia demo..."
APPNAME="$BINARYNAME"
APPDIR="$APPNAME.app/Contents"
rm -rf "$APPDIR"
create_app_structure "$APPNAME"
emit_plist "$APPNAME" "$APPDIR" true
cd "$APPDIR/Frameworks"
APPNAME="$BINARYNAME Helper"
APPDIR="$APPNAME.app/Contents"
create_app_structure "$APPNAME"
emit_plist "$APPNAME" "$APPDIR"
cp -R "../../../steampp/" "../MacOS"
ln -s "../../MacOS" "Frameworks/$APPDIR/MacOS"
chmod +x "../MacOS/$BINARYNAME"
cp "../MacOS/$BINARYNAME" "../MacOS/$APPNAME"
chmod +x "../MacOS/$APPNAME"