-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·112 lines (93 loc) · 3.55 KB
/
build.sh
File metadata and controls
executable file
·112 lines (93 loc) · 3.55 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# Build script for ClipboardManager.app
set -e
APP_NAME="ClipboardManager"
BUNDLE_ID="com.rodrifs.clipboardmanager"
VERSION="1.0.0"
BUILD_DIR="build"
APP_DIR="$BUILD_DIR/$APP_NAME.app"
CONTENTS_DIR="$APP_DIR/Contents"
MACOS_DIR="$CONTENTS_DIR/MacOS"
RESOURCES_DIR="$CONTENTS_DIR/Resources"
echo "🔨 Building ClipboardManager.app..."
# Clean previous build
rm -rf "$BUILD_DIR"
# Create app bundle structure
mkdir -p "$MACOS_DIR"
mkdir -p "$RESOURCES_DIR"
# Build the Go binary
echo "📦 Building Go binary..."
go build -o "$MACOS_DIR/$APP_NAME" -ldflags="-s -w"
# Create Info.plist
echo "📝 Creating Info.plist..."
cat > "$CONTENTS_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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$APP_NAME</string>
<key>CFBundleIdentifier</key>
<string>$BUNDLE_ID</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$APP_NAME</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION</string>
<key>CFBundleVersion</key>
<string>$VERSION</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>LSUIElement</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSRequiresAquaSystemAppearance</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2025 Rodrigo Sanchez. All rights reserved.</string>
</dict>
</plist>
EOF
# Create app icon (optional - using emoji for now)
echo "🎨 Creating app icon..."
# For now, we'll skip the icon creation - you can add an .icns file later
echo "✅ App bundle created at: $APP_DIR"
# Check for code signing certificate
if security find-identity -v -p codesigning | grep -q "Developer ID Application"; then
echo "🔐 Code signing certificate found. Signing app..."
# Sign the binary first
codesign --force --options runtime --sign "Developer ID Application" "$MACOS_DIR/$APP_NAME"
# Sign the entire app bundle
codesign --force --options runtime --sign "Developer ID Application" "$APP_DIR"
echo "✅ App signed successfully!"
# Verify the signature
echo "🔍 Verifying signature..."
codesign --verify --verbose "$APP_DIR"
spctl --assess --verbose "$APP_DIR"
elif security find-identity -v -p codesigning | grep -q "Mac Developer\|Apple Development"; then
echo "🔐 Development certificate found. Signing for development..."
# Sign with development certificate
CERT=$(security find-identity -v -p codesigning | grep "Mac Developer\|Apple Development" | head -n1 | cut -d'"' -f2)
codesign --force --options runtime --sign "$CERT" "$MACOS_DIR/$APP_NAME"
codesign --force --options runtime --sign "$CERT" "$APP_DIR"
echo "✅ App signed for development!"
else
echo "⚠️ No code signing certificate found. App will not be signed."
echo " To sign the app, you need a Developer ID Application certificate."
fi
echo ""
echo "🚀 Build complete!"
echo " App location: $APP_DIR"
echo " You can now drag this to /Applications or run it directly."
echo ""
echo "To install in Applications folder:"
echo " cp -r '$APP_DIR' /Applications/"
echo ""
echo "To create a DMG:"
echo " hdiutil create -volname '$APP_NAME' -srcfolder '$APP_DIR' -ov -format UDZO '$BUILD_DIR/$APP_NAME.dmg'"