mirror of
https://github.com/mileswolfallen2/browser.git
synced 2026-09-08 11:23:18 +00:00
96 lines
3.4 KiB
Bash
Executable File
96 lines
3.4 KiB
Bash
Executable File
#!/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"
|