-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-script.sh
executable file
·65 lines (56 loc) · 2.06 KB
/
test-script.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Define the project paths and app bundle location
desktop_project="OpenIPC/OpenIPC_Config.Desktop"
output_dir="./build"
app_bundle="$output_dir/OpenIPC_Config.app"
binary_source="$output_dir/osx-arm64/OpenIPC_Config.Desktop"
# Clean and prepare the output directory
echo "Cleaning previous builds..."
rm -rf "$output_dir"
mkdir -p "$output_dir/osx-arm64"
# Build for macOS
echo "Building $desktop_project for macOS (osx-arm64)..."
dotnet publish "$desktop_project" -c Release -r osx-arm64 --output "$output_dir/osx-arm64" --self-contained -v normal
# Verify that the binary is for macOS
file_type=$(file "$binary_source" | grep -o 'Mach-O 64-bit executable arm64')
if [ -z "$file_type" ]; then
echo "Error: macOS build did not produce a valid macOS executable."
exit 1
fi
echo "macOS binary built successfully."
# Create the .app bundle structure
echo "Packaging the .app bundle..."
mkdir -p "$app_bundle/Contents/MacOS"
mkdir -p "$app_bundle/Contents/Resources"
# Copy and rename the macOS binary to remove .dll extension
cp "$binary_source" "$app_bundle/Contents/MacOS/OpenIPC_Config"
# Add Info.plist for macOS app metadata
cat > "$app_bundle/Contents/Info.plist" <<EOL
<?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>CFBundleName</key>
<string>OpenIPC_Config</string>
<key>CFBundleDisplayName</key>
<string>OpenIPC Config</string>
<key>CFBundleIdentifier</key>
<string>com.openipc.config</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleExecutable</key>
<string>OpenIPC_Config</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
</dict>
</plist>
EOL
# Set executable permissions
chmod +x "$app_bundle/Contents/MacOS/OpenIPC_Config"
echo ".app bundle created at $app_bundle"