#!/bin/sh
# Build Fox and assemble Fox.app with the CEF framework + helper bundles.
#
# scripts/bundle.sh [debug|release]
#
# The CEF distribution must be exported first:
# cargo install export-cef-dir --version 151.7.0+151.3.23 && export-cef-dir
set -e
PROFILE="${1:-debug}"
cd "$(dirname "$0")/.."
export CEF_PATH="${CEF_PATH:-$HOME/.local/share/cef}"
DIST="$CEF_PATH"
FRAMEWORK="Chromium Embedded Framework.framework"
if [ "$PROFILE" = "release" ]; then
cargo build --release
BIN="target/release/browser"
else
cargo build
BIN="target/debug/browser"
fi
APP="target/bundle/Fox.app"
CONTENTS="$APP/Contents"
rm -rf "$APP"
mkdir -p "$CONTENTS/MacOS" "$CONTENTS/Frameworks"
cp "$BIN" "$CONTENTS/MacOS/browser"
ditto "$DIST/$FRAMEWORK" "$CONTENTS/Frameworks/$FRAMEWORK"
cat > "$CONTENTS/Info.plist" <<'PLIST'
CFBundleDevelopmentRegionen
CFBundleExecutablebrowser
CFBundleIconFile
CFBundleIdentifierdev.fox.browser
CFBundleInfoDictionaryVersion6.0
CFBundleNameFox
CFBundleDisplayNameFox
CFBundlePackageTypeAPPL
CFBundleShortVersionString0.2.0
CFBundleVersion0.2.0
LSMinimumSystemVersion11.0
NSHighResolutionCapable
NSPrincipalClassNSApplication
PLIST
# Chromium on macOS launches child processes (GPU/renderer/network/utility)
# from dedicated .app bundles. We reuse the Fox binary itself as the helper
# executable — CEF child processes are dispatched via --type= arguments, which
# our bootstrap() already understands.
make_helper () {
HELPER_NAME="$1"
HELPER_ID="$2"
HELPER_DIR="$CONTENTS/Frameworks/$HELPER_NAME.app"
mkdir -p "$HELPER_DIR/Contents/MacOS"
cp "$BIN" "$HELPER_DIR/Contents/MacOS/$HELPER_NAME"
cat > "$HELPER_DIR/Contents/Info.plist" <
CFBundleDevelopmentRegionen
CFBundleExecutable$HELPER_NAME
CFBundleIdentifier$HELPER_ID
CFBundleInfoDictionaryVersion6.0
CFBundleName$HELPER_NAME
CFBundlePackageTypeAPPL
CFBundleShortVersionString0.2.0
CFBundleVersion0.2.0
LSMinimumSystemVersion11.0
NSSupportsAutomaticGraphicsSwitching
PLIST
}
make_helper "Fox Helper" "dev.fox.browser.helper"
make_helper "Fox Helper (Renderer)" "dev.fox.browser.helper.renderer"
make_helper "Fox Helper (GPU)" "dev.fox.browser.helper.gpu"
make_helper "Fox Helper (Plugin)" "dev.fox.browser.helper.plugin"
make_helper "Fox Helper (Alerts)" "dev.fox.browser.helper.alerts"
codesign --force --deep --sign - "$APP"
echo "Built $APP"