Skip to content

Commit 565f3a0

Browse files
committed
🔧 Add build script
1 parent b16e350 commit 565f3a0

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

build.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
# Build script for ChangeMenuBarColor binary release
4+
# Creates a universal binary that works on both Intel and ARM Macs
5+
6+
set -e
7+
8+
# Set up variables
9+
PROJECT_NAME="ChangeMenuBarColor"
10+
OUTPUT_DIR="./build"
11+
RELEASE_DIR="$OUTPUT_DIR/release"
12+
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "1.0.0")
13+
14+
# Create directory structure
15+
echo "Creating build directories..."
16+
mkdir -p "$OUTPUT_DIR/arm64"
17+
mkdir -p "$OUTPUT_DIR/x86_64"
18+
mkdir -p "$RELEASE_DIR"
19+
20+
# Build for ARM64 architecture (Apple Silicon)
21+
echo "Building for ARM64 architecture (Apple Silicon)..."
22+
swift build --configuration release --arch arm64 -Xswiftc "-target" -Xswiftc "arm64-apple-macosx10.15"
23+
cp -f ".build/arm64-apple-macosx/release/$PROJECT_NAME" "$OUTPUT_DIR/arm64/"
24+
25+
# Build for x86_64 architecture (Intel)
26+
echo "Building for x86_64 architecture (Intel)..."
27+
swift build --configuration release --arch x86_64 -Xswiftc "-target" -Xswiftc "x86_64-apple-macosx10.15"
28+
cp -f ".build/x86_64-apple-macosx/release/$PROJECT_NAME" "$OUTPUT_DIR/x86_64/"
29+
30+
# Create universal binary
31+
echo "Creating universal binary..."
32+
lipo -create -output "$RELEASE_DIR/$PROJECT_NAME" "$OUTPUT_DIR/arm64/$PROJECT_NAME" "$OUTPUT_DIR/x86_64/$PROJECT_NAME"
33+
34+
# Check the binary architectures
35+
echo "Verifying architectures in the universal binary:"
36+
lipo -info "$RELEASE_DIR/$PROJECT_NAME"
37+
38+
# Create a zip file for distribution
39+
echo "Creating zip archive for distribution..."
40+
cd "$RELEASE_DIR" || exit
41+
zip -r "../$PROJECT_NAME-$VERSION.zip" "$PROJECT_NAME"
42+
cd - || exit
43+
44+
echo "✅ Build complete!"
45+
echo "Universal binary is available at: $RELEASE_DIR/$PROJECT_NAME"
46+
echo "Zip archive is available at: $OUTPUT_DIR/$PROJECT_NAME-$VERSION.zip"

0 commit comments

Comments
 (0)