aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: ccbe0f3e533a86520b27ed6dcfb8ff17f48a6a5e (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
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
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"
RELEASE_DIR="bin/release"
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

cat > "$APP_DIR/../HELP_IT_DOESNT_OPEN.txt" << EOF

Getting some popup about it not being trusted? Or is MacOS telling you it's broken? It's not broken.
I just refuse to pay Apple for a loiscence to provide good software for their platform. So they block it.
Fuck you Apple.

So, here's how to fix it.


To fix it permanently so you don't have this problem ever again:

1. Open Terminal
2. Paste this text in there and press Enter/Return
sudo spctl --master-disable
3. You may need to write your password, just be aware that you won't see what you're typing
4. Go to System Settings > Privacy & Security and scroll down to set Allow apps from: Everywhere


To fix it for just this program:

1. Open Terminal, and paste this in there:
xattr -rd com.apple.quarantine 
2. Make sure there's a space at the end of what you just pasted
3. Drag and drop the program into the Terminal and hit Enter

EOF

cd "$RELEASE_DIR/"
rm "Better Report.zip"
zip "Better Report.zip" "${APP_NAME}.app" "HELP_IT_DOESNT_OPEN.txt"