aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 678db803642e8d3937f53e64f34f5acc6ca975b6 (plain)
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
mkdir -p bin/release
odin build src/ -debug -out:bin/better-report
odin build src/ -o:speed -out:bin/release/better-report
chmod +x bin/better-report
chmod +x bin/release/better-report

# Create macOS .app bundle
APP_NAME="Better Report"
APP_DIR="bin/release/${APP_NAME}.app"
rm -rf "$APP_DIR"
mkdir -p "$APP_DIR/Contents/MacOS"
mkdir -p "$APP_DIR/Contents/Resources"

cp bin/release/better-report "$APP_DIR/Contents/MacOS/better-report-bin"

# Create launcher script that opens Terminal
cat > "$APP_DIR/Contents/MacOS/better-report" << 'LAUNCHER'
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
osascript -e "tell application \"Terminal\" to do script \"'$DIR/better-report-bin'; exit\""
LAUNCHER
chmod +x "$APP_DIR/Contents/MacOS/better-report"

# Copy icon
cp src/graphics/logo.icns "$APP_DIR/Contents/Resources/AppIcon.icns"

cat > "$APP_DIR/Contents/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>better-report</string>
    <key>CFBundleIconFile</key>
    <string>AppIcon</string>
    <key>CFBundleIdentifier</key>
    <string>com.wassimulator.better-report</string>
    <key>CFBundleName</key>
    <string>Better Report</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
</dict>
</plist>
EOF