This commit is contained in:
2026-08-21 23:52:13 -05:00
parent f2a1898039
commit d6cd7ec94e
10 changed files with 2265 additions and 155 deletions
+95
View File
@@ -0,0 +1,95 @@
#!/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'
<?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>browser</string>
<key>CFBundleIconFile</key><string></string>
<key>CFBundleIdentifier</key><string>dev.fox.browser</string>
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
<key>CFBundleName</key><string>Fox</string>
<key>CFBundleDisplayName</key><string>Fox</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>0.2.0</string>
<key>CFBundleVersion</key><string>0.2.0</string>
<key>LSMinimumSystemVersion</key><string>11.0</string>
<key>NSHighResolutionCapable</key><true/>
<key>NSPrincipalClass</key><string>NSApplication</string>
</dict>
</plist>
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" <<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>$HELPER_NAME</string>
<key>CFBundleIdentifier</key><string>$HELPER_ID</string>
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
<key>CFBundleName</key><string>$HELPER_NAME</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>0.2.0</string>
<key>CFBundleVersion</key><string>0.2.0</string>
<key>LSMinimumSystemVersion</key><string>11.0</string>
<key>NSSupportsAutomaticGraphicsSwitching</key><true/>
</dict>
</plist>
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"
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# Build and run Fox in dev mode.
#
# scripts/run-dev.sh [extra cargo args...]
#
# On macOS the app must run from a .app bundle (CEF needs its framework
# resources, so a bare target/debug binary cannot start). This script
# therefore bundles first, then launches Fox.app with console output visible.
#
# The CEF distribution must be exported once:
# cargo install export-cef-dir --version 151.7.0+151.3.23
# export-cef-dir # installs to ~/.local/share/cef
set -e
cd "$(dirname "$0")/.."
export CEF_PATH="${CEF_PATH:-$HOME/.local/share/cef}"
scripts/bundle.sh "${FOX_PROFILE:-debug}"
exec ./target/bundle/Fox.app/Contents/MacOS/browser "$@"