forked from TurboHsu/Vocab-Master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_macos.sh
executable file
·45 lines (38 loc) · 1022 Bytes
/
build_macos.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
#!/bin/bash
if [ -d ./VocabMaster.app ]; then
rm -r ./VocabMaster.app
fi
tmpdir=$(mktemp -d)
bundleDir="$tmpdir/VocabMaster.app"
contentDir="$bundleDir/Contents"
resourcesDir="$contentDir/Resources"
exeDir="$contentDir/MacOS"
mkdir "$bundleDir"
mkdir "$contentDir"
mkdir "$exeDir"
mkdir "$resourcesDir"
cp ./icon/VocabMaster.icns "$resourcesDir/icon.icns"
cp ./font/red_bean.ttf "$resourcesDir/font.ttf"
CGO_ENABLED=1 go build -o vocabmaster
mv ./vocabmaster "$exeDir"
plistContent=$(
cat <<-END
<?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>CFBundleExecutable</key>
<string>vocabmaster</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.turbohsu.vocabmaster</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
END
)
echo "$plistContent" > "$contentDir/Info.plist"
cp -r "$bundleDir" .
rm -r "$tmpdir"