-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmac-app.sh
38 lines (33 loc) · 957 Bytes
/
mac-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
#!/bin/bash
set -e
APPNAME=moggio
DIR="$APPNAME.app/Contents/MacOS"
OUTPUT="$DIR/$APPNAME"
PA=libportaudio.2.dylib
PALIB=/usr/local/opt/portaudio/lib/$PA
rm -rf $APPNAME.app
mkdir -p $DIR
go build -o $OUTPUT -ldflags "-linkmode=external"
chmod +x $OUTPUT
cp $PALIB $DIR/$PA
install_name_tool -change $PALIB @executable_path/$PA $OUTPUT
cat > $DIR/../Info.plist << EOF
<?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>moggio</string>
<key>CFBundleIdentifier</key>
<string>io.moggio.Moggio</string>
<key>CFBundleName</key>
<string>moggio</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
</dict>
</plist>
EOF
rm -f moggio.zip
zip moggio -r moggio.app