Drag files in Finder, hold a modifier, and drop on a wheel of outputs. Conversions run entirely on-device through ImageIO, PDFKit, AVFoundation, the bundled CLI tools, and optional ffmpeg/LibreOffice. Includes a --self-test suite (41 checks) and a --convert CLI mode so the conversion matrix can be verified without the UI.
113 lines
3.3 KiB
Bash
Executable File
113 lines
3.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Builds Konverter.app.
|
|
#
|
|
# ./build-app.sh # version from git tag, else 0.1.0
|
|
# ./build-app.sh 1.2.0 # explicit version
|
|
#
|
|
# Signs with the first Developer ID Application identity in the keychain when
|
|
# one exists (needed for notarization), otherwise ad-hoc signs so the bundle
|
|
# still runs locally.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
if [ "${1:-}" != "" ]; then
|
|
VERSION="$1"
|
|
else
|
|
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || true)
|
|
VERSION="${VERSION:-0.1.0}"
|
|
fi
|
|
|
|
swift build -c release
|
|
|
|
BIN=".build/release/Konverter"
|
|
APP="Konverter.app"
|
|
|
|
if [ ! -x "$BIN" ]; then
|
|
echo "build-app.sh: $BIN not found after swift build." >&2
|
|
exit 1
|
|
fi
|
|
|
|
IDENT=""
|
|
if command -v security >/dev/null 2>&1; then
|
|
IDENT=$(security find-identity -v -p codesigning 2>/dev/null \
|
|
| awk '/Developer ID Application:/ { print $2; exit }')
|
|
fi
|
|
|
|
rm -rf "$APP"
|
|
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
|
|
cp "$BIN" "$APP/Contents/MacOS/Konverter"
|
|
printf 'APPL????' > "$APP/Contents/PkgInfo"
|
|
|
|
cat > "$APP/Contents/Info.plist" <<PLIST
|
|
<?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>Konverter</string>
|
|
<key>CFBundleIconFile</key>
|
|
<string>Icon</string>
|
|
<key>CFBundleIdentifier</key>
|
|
<string>dev.tzgyn.konverter</string>
|
|
<key>CFBundleInfoDictionaryVersion</key>
|
|
<string>6.0</string>
|
|
<key>CFBundleName</key>
|
|
<string>Konverter</string>
|
|
<key>CFBundleDisplayName</key>
|
|
<string>Konverter</string>
|
|
<key>CFBundlePackageType</key>
|
|
<string>APPL</string>
|
|
<key>CFBundleShortVersionString</key>
|
|
<string>${VERSION}</string>
|
|
<key>CFBundleVersion</key>
|
|
<string>${VERSION}</string>
|
|
<key>LSMinimumSystemVersion</key>
|
|
<string>13.0</string>
|
|
<key>LSUIElement</key>
|
|
<true/>
|
|
<key>LSApplicationCategoryType</key>
|
|
<string>public.app-category.utilities</string>
|
|
<key>NSHighResolutionCapable</key>
|
|
<true/>
|
|
<key>NSPrincipalClass</key>
|
|
<string>NSApplication</string>
|
|
<key>NSHumanReadableCopyright</key>
|
|
<string>Copyright © 2026 Teh Zi Gyn. All rights reserved.</string>
|
|
<key>NSServices</key>
|
|
<array>
|
|
<dict>
|
|
<key>NSMenuItem</key>
|
|
<dict>
|
|
<key>default</key>
|
|
<string>Convert with Konverter…</string>
|
|
</dict>
|
|
<key>NSMessage</key>
|
|
<string>convertFiles</string>
|
|
<key>NSPortName</key>
|
|
<string>Konverter</string>
|
|
<key>NSSendFileTypes</key>
|
|
<array>
|
|
<string>public.item</string>
|
|
</array>
|
|
<key>NSRequiredContext</key>
|
|
<dict/>
|
|
</dict>
|
|
</array>
|
|
</dict>
|
|
</plist>
|
|
PLIST
|
|
|
|
chmod +x scripts/make-icon.sh
|
|
./scripts/make-icon.sh
|
|
|
|
if [ -n "$IDENT" ]; then
|
|
security unlock-keychain "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null || true
|
|
codesign --force --options runtime --timestamp --sign "$IDENT" "$APP"
|
|
echo "Built $APP $VERSION (signed with Developer ID '$IDENT')"
|
|
else
|
|
codesign --force --sign - "$APP"
|
|
echo "Built $APP $VERSION (ad-hoc signed; not distributable)"
|
|
fi
|