@@ -14,7 +14,7 @@ echo "🍎 Starting macOS build process..."
1414# Configuration
1515APP_NAME=" RustCat"
1616BUNDLE_ID=" com.bearice.rustcat"
17- VERSION=$( grep ' ^version' Cargo.toml | sed ' s/version = "\(.*\)"/\1/' )
17+ VERSION=$( grep ' ^version' Cargo.toml | head -1 | sed ' s/version = "\(.*\)"/\1/' )
1818
1919# Build targets
2020INTEL_TARGET=" x86_64-apple-darwin"
@@ -45,7 +45,30 @@ file rust_cat_universal
4545
4646# Create app icon
4747echo " 🎨 Creating app icon..."
48- ./build_app_icon.sh || echo " ⚠️ Could not create app icon, continuing without it"
48+ if command -v iconutil & > /dev/null; then
49+ # Create iconset directory
50+ mkdir -p RustCat.iconset
51+
52+ # Convert ICO to PNG at required sizes using sips (macOS built-in tool)
53+ if command -v sips & > /dev/null; then
54+ sips -s format png -Z 16 assets/appIcon.ico --out RustCat.iconset/icon_16x16.png
55+ sips -s format png -Z 32 assets/appIcon.ico --out RustCat.iconset/icon_32x32.png
56+ sips -s format png -Z 128 assets/appIcon.ico --out RustCat.iconset/icon_128x128.png
57+ sips -s format png -Z 256 assets/appIcon.ico --out RustCat.iconset/icon_256x256.png
58+ sips -s format png -Z 512 assets/appIcon.ico --out RustCat.iconset/icon_512x512.png
59+ else
60+ echo " ❌ sips not found - cannot create app icon"
61+ exit 1
62+ fi
63+
64+ # Create the .icns file
65+ iconutil -c icns RustCat.iconset
66+
67+ echo " ✅ App icon created: RustCat.icns"
68+ else
69+ echo " ❌ iconutil not found - cannot create app icon"
70+ exit 1
71+ fi
4972
5073# Create app bundle
5174echo " 📱 Creating app bundle..."
@@ -56,16 +79,13 @@ mkdir -p "$APP_BUNDLE/Contents/Resources"
5679# Copy binary
5780cp rust_cat_universal " $APP_BUNDLE /Contents/MacOS/rust_cat"
5881
59- # Copy Info.plist
60- cp Info.plist " $APP_BUNDLE /Contents/"
82+ # Update and copy Info.plist with current version
83+ echo " 📝 Updating Info.plist with version $VERSION ..."
84+ sed " s/<string>2\.2\.0<\/string>/<string>$VERSION <\/string>/g" Info.plist > " $APP_BUNDLE /Contents/Info.plist"
6185
62- # Copy app icon if it exists
63- if [ -f " RustCat.icns" ]; then
64- cp RustCat.icns " $APP_BUNDLE /Contents/Resources/AppIcon.icns"
65- echo " ✅ App icon added"
66- else
67- echo " ⚠️ No app icon found"
68- fi
86+ # Copy app icon
87+ cp RustCat.icns " $APP_BUNDLE /Contents/Resources/AppIcon.icns"
88+ echo " ✅ App icon added"
6989
7090# Make binary executable
7191chmod +x " $APP_BUNDLE /Contents/MacOS/rust_cat"
@@ -76,7 +96,26 @@ zip -r "${APP_NAME}-universal.app.zip" "$APP_BUNDLE"
7696
7797# Create DMG
7898echo " 💿 Creating DMG..."
79- ./create_dmg.sh " $APP_BUNDLE " " ${APP_NAME} -universal.dmg"
99+ DMG_NAME=" ${APP_NAME} -universal.dmg"
100+
101+ # Create a temporary directory for DMG contents
102+ TEMP_DIR=$( mktemp -d)
103+ DMG_DIR=" $TEMP_DIR /dmg_contents"
104+ mkdir -p " $DMG_DIR "
105+
106+ # Copy the app bundle to the DMG directory
107+ cp -R " $APP_BUNDLE " " $DMG_DIR /"
108+
109+ # Create a symbolic link to Applications folder for easy installation
110+ ln -s /Applications " $DMG_DIR /Applications"
111+
112+ # Create the DMG
113+ hdiutil create -volname " RustCat" -srcfolder " $DMG_DIR " -ov -format UDZO " $DMG_NAME "
114+
115+ # Clean up temporary directory
116+ rm -rf " $TEMP_DIR "
117+
118+ echo " ✅ DMG created: $DMG_NAME "
80119
81120# Clean up temporary files
82121echo " 🧹 Cleaning up..."
0 commit comments