diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 39baeeb..5552361 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -26,3 +26,20 @@ jobs:
files: |
PumpBin-x86_64-pc-windows-msvc.exe
PumpBin-Maker-x86_64-pc-windows-msvc.exe
+
+ build-macos:
+ name: build-macos
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: x86_64-apple-darwin, aarch64-apple-darwin
+ - run: bash scripts/build-macos.sh
+ - run: mv target/release/macos-pumpbin/PumpBin.dmg PumpBin.dmg
+ - run: mv target/release/macos-maker/PumpBin-Maker.dmg PumpBin-Maker.dmg
+ - uses: softprops/action-gh-release@v2
+ with:
+ files: |
+ PumpBin.dmg
+ PumpBin-Maker.dmg
diff --git a/.gitignore b/.gitignore
index ea8c4bf..96f559d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
/target
+/VERSION
+/.DS_Store
diff --git a/Cargo.toml b/Cargo.toml
index 287555d..11a2582 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,3 +45,4 @@ winresource = "0.1.17"
strip = true
opt-level = 3
lto = true
+codegen-units = 1
diff --git a/assets/macos/PumpBin-Maker.app/Contents/Info.plist b/assets/macos/PumpBin-Maker.app/Contents/Info.plist
new file mode 100644
index 0000000..9829987
--- /dev/null
+++ b/assets/macos/PumpBin-Maker.app/Contents/Info.plist
@@ -0,0 +1,49 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ maker
+ CFBundleIdentifier
+ io.b1n.pumpbin-maker
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ PumpBin-Maker
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ {{ VERSION }}
+ CFBundleSupportedPlatforms
+
+ MacOSX
+
+ CFBundleVersion
+ {{ BUILD }}
+ CFBundleIconFile
+ icon.png
+ NSHighResolutionCapable
+
+ NSMainNibFile
+
+ NSSupportsAutomaticGraphicsSwitching
+
+ CFBundleDisplayName
+ PumpBin-Maker
+ NSRequiresAquaSystemAppearance
+ NO
+ CFBundleURLTypes
+
+
+ CFBundleURLName
+ PumpBin-Maker
+ CFBundleURLSchemes
+
+ pumpbin-maker
+
+
+
+
+
diff --git a/assets/macos/PumpBin-Maker.app/Contents/Resources/icon.png b/assets/macos/PumpBin-Maker.app/Contents/Resources/icon.png
new file mode 100644
index 0000000..7e2fd7b
Binary files /dev/null and b/assets/macos/PumpBin-Maker.app/Contents/Resources/icon.png differ
diff --git a/assets/macos/PumpBin.app/Contents/Info.plist b/assets/macos/PumpBin.app/Contents/Info.plist
new file mode 100644
index 0000000..f50ed1d
--- /dev/null
+++ b/assets/macos/PumpBin.app/Contents/Info.plist
@@ -0,0 +1,49 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ pumpbin
+ CFBundleIdentifier
+ io.b1n.pumpbin
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ PumpBin
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ {{ VERSION }}
+ CFBundleSupportedPlatforms
+
+ MacOSX
+
+ CFBundleVersion
+ {{ BUILD }}
+ CFBundleIconFile
+ icon.png
+ NSHighResolutionCapable
+
+ NSMainNibFile
+
+ NSSupportsAutomaticGraphicsSwitching
+
+ CFBundleDisplayName
+ PumpBin
+ NSRequiresAquaSystemAppearance
+ NO
+ CFBundleURLTypes
+
+
+ CFBundleURLName
+ PumpBin
+ CFBundleURLSchemes
+
+ pumpbin
+
+
+
+
+
diff --git a/assets/macos/PumpBin.app/Contents/Resources/icon.png b/assets/macos/PumpBin.app/Contents/Resources/icon.png
new file mode 100644
index 0000000..7e2fd7b
Binary files /dev/null and b/assets/macos/PumpBin.app/Contents/Resources/icon.png differ
diff --git a/build.rs b/build.rs
index c93aaed..24550ad 100644
--- a/build.rs
+++ b/build.rs
@@ -5,4 +5,12 @@ fn main() {
res.set_icon("logo/icon.ico");
res.compile().unwrap();
}
+
+ #[cfg(target_os = "macos")]
+ {
+ use std::fs;
+
+ let version = env!("CARGO_PKG_VERSION");
+ fs::write("VERSION", version).unwrap();
+ }
}
diff --git a/scripts/build-macos.sh b/scripts/build-macos.sh
new file mode 100644
index 0000000..dfb0450
--- /dev/null
+++ b/scripts/build-macos.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+export MACOSX_DEPLOYMENT_TARGET="11.0"
+cargo build --release --target=x86_64-apple-darwin
+cargo build --release --target=aarch64-apple-darwin
+
+TARGET="pumpbin"
+ASSETS_DIR="assets"
+RELEASE_DIR="target/release"
+APP_NAME="PumpBin.app"
+APP_TEMPLATE="$ASSETS_DIR/macos/$APP_NAME"
+APP_TEMPLATE_PLIST="$APP_TEMPLATE/Contents/Info.plist"
+APP_DIR="$RELEASE_DIR/macos-pumpbin"
+APP_BINARY="$RELEASE_DIR/$TARGET"
+APP_BINARY_DIR="$APP_DIR/$APP_NAME/Contents/MacOS"
+APP_EXTRAS_DIR="$APP_DIR/$APP_NAME/Contents/Resources"
+
+TARGET_MAKER="maker"
+APP_NAME_MAKER="PumpBin-Maker.app"
+APP_TEMPLATE_MAKER="$ASSETS_DIR/macos/$APP_NAME_MAKER"
+APP_TEMPLATE_PLIST_MAKER="$APP_TEMPLATE_MAKER/Contents/Info.plist"
+APP_DIR_MAKER="$RELEASE_DIR/macos-maker"
+APP_BINARY_MAKER="$RELEASE_DIR/$TARGET_MAKER"
+APP_BINARY_DIR_MAKER="$APP_DIR_MAKER/$APP_NAME_MAKER/Contents/MacOS"
+APP_EXTRAS_DIR_MAKER="$APP_DIR_MAKER/$APP_NAME_MAKER/Contents/Resources"
+
+DMG_NAME="PumpBin.dmg"
+DMG_DIR="$RELEASE_DIR/macos-pumpbin"
+
+DMG_NAME_MAKER="PumpBin-Maker.dmg"
+DMG_DIR_MAKER="$RELEASE_DIR/macos-maker"
+
+VERSION=$(cat VERSION)
+BUILD=$(git describe --always --dirty --exclude='*')
+
+# update version and build
+sed -i '' -e "s/{{ VERSION }}/$VERSION/g" "$APP_TEMPLATE_PLIST"
+sed -i '' -e "s/{{ BUILD }}/$BUILD/g" "$APP_TEMPLATE_PLIST"
+
+sed -i '' -e "s/{{ VERSION }}/$VERSION/g" "$APP_TEMPLATE_PLIST_MAKER"
+sed -i '' -e "s/{{ BUILD }}/$BUILD/g" "$APP_TEMPLATE_PLIST_MAKER"
+
+# build binary
+lipo "target/x86_64-apple-darwin/release/$TARGET" "target/aarch64-apple-darwin/release/$TARGET" -create -output "$APP_BINARY"
+
+# build app
+mkdir -p "$APP_BINARY_DIR"
+mkdir -p "$APP_EXTRAS_DIR"
+cp -fRp "$APP_TEMPLATE" "$APP_DIR"
+cp -fp "$APP_BINARY" "$APP_BINARY_DIR"
+touch -r "$APP_BINARY" "$APP_DIR/$APP_NAME"
+echo "Created '$APP_NAME' in '$APP_DIR'"
+
+# package dmg
+echo "Packing disk image..."
+ln -sf /Applications "$DMG_DIR/Applications"
+hdiutil create "$DMG_DIR/$DMG_NAME" -volname "PumpBin" -fs HFS+ -srcfolder "$APP_DIR" -ov -format UDZO
+echo "Packed '$APP_NAME' in '$APP_DIR'"
+
+lipo "target/x86_64-apple-darwin/release/$TARGET_MAKER" "target/aarch64-apple-darwin/release/$TARGET_MAKER" -create -output "$APP_BINARY_MAKER"
+
+mkdir -p "$APP_BINARY_DIR_MAKER"
+mkdir -p "$APP_EXTRAS_DIR_MAKER"
+cp -fRp "$APP_TEMPLATE_MAKER" "$APP_DIR_MAKER"
+cp -fp "$APP_BINARY_MAKER" "$APP_BINARY_DIR_MAKER"
+touch -r "$APP_BINARY_MAKER" "$APP_DIR_MAKER/$APP_NAME_MAKER"
+echo "Created '$APP_NAME_MAKER' in '$APP_DIR_MAKER'"
+
+ln -sf /Applications "$DMG_DIR_MAKER/Applications"
+hdiutil create "$DMG_DIR_MAKER/$DMG_NAME_MAKER" -volname "PumpBin-Maker" -fs HFS+ -srcfolder "$APP_DIR_MAKER" -ov -format UDZO
+echo "Packed '$APP_NAME_MAKER' in '$APP_DIR_MAKER'"