mirror of
https://github.com/pumpbin/pumpbin
synced 2026-03-14 23:04:30 -07:00
ci: build-macos
This commit is contained in:
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@@ -26,3 +26,20 @@ jobs:
|
|||||||
files: |
|
files: |
|
||||||
PumpBin-x86_64-pc-windows-msvc.exe
|
PumpBin-x86_64-pc-windows-msvc.exe
|
||||||
PumpBin-Maker-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
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
|
/VERSION
|
||||||
|
/.DS_Store
|
||||||
|
|||||||
@@ -45,3 +45,4 @@ winresource = "0.1.17"
|
|||||||
strip = true
|
strip = true
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
lto = true
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
|||||||
49
assets/macos/PumpBin-Maker.app/Contents/Info.plist
Normal file
49
assets/macos/PumpBin-Maker.app/Contents/Info.plist
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?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>maker</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>io.b1n.pumpbin-maker</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>PumpBin-Maker</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>{{ VERSION }}</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>{{ BUILD }}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>icon.png</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string></string>
|
||||||
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
<true/>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>PumpBin-Maker</string>
|
||||||
|
<key>NSRequiresAquaSystemAppearance</key>
|
||||||
|
<string>NO</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>PumpBin-Maker</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>pumpbin-maker</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
BIN
assets/macos/PumpBin-Maker.app/Contents/Resources/icon.png
Normal file
BIN
assets/macos/PumpBin-Maker.app/Contents/Resources/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
49
assets/macos/PumpBin.app/Contents/Info.plist
Normal file
49
assets/macos/PumpBin.app/Contents/Info.plist
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?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>pumpbin</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>io.b1n.pumpbin</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>PumpBin</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>{{ VERSION }}</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>{{ BUILD }}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>icon.png</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string></string>
|
||||||
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
<true/>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>PumpBin</string>
|
||||||
|
<key>NSRequiresAquaSystemAppearance</key>
|
||||||
|
<string>NO</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>PumpBin</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>pumpbin</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
BIN
assets/macos/PumpBin.app/Contents/Resources/icon.png
Normal file
BIN
assets/macos/PumpBin.app/Contents/Resources/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
8
build.rs
8
build.rs
@@ -5,4 +5,12 @@ fn main() {
|
|||||||
res.set_icon("logo/icon.ico");
|
res.set_icon("logo/icon.ico");
|
||||||
res.compile().unwrap();
|
res.compile().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
|
fs::write("VERSION", version).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
71
scripts/build-macos.sh
Normal file
71
scripts/build-macos.sh
Normal file
@@ -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'"
|
||||||
Reference in New Issue
Block a user