-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartbrowser.sh
More file actions
executable file
·95 lines (84 loc) · 2.85 KB
/
startbrowser.sh
File metadata and controls
executable file
·95 lines (84 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$SCRIPT_DIR"
# Convenience defaults for local V8 builds.
# Prefer the sibling engine-custom repo, but keep the old third_party path as
# a transitional fallback if it still exists.
if [[ -z "${BRIDGE_V8_INCLUDE_DIR:-}" && -d "${ROOT_DIR}/../engine-custom/third_party/v8/include" ]]; then
export BRIDGE_V8_INCLUDE_DIR="${ROOT_DIR}/../engine-custom/third_party/v8/include"
elif [[ -z "${BRIDGE_V8_INCLUDE_DIR:-}" && -d "${ROOT_DIR}/../third_party/v8/include" ]]; then
export BRIDGE_V8_INCLUDE_DIR="${ROOT_DIR}/../third_party/v8/include"
fi
if [[ -z "${BRIDGE_V8_LIBRARY_DIR:-}" && -d "${ROOT_DIR}/../engine-custom/third_party/v8/out.gn/x64.release/obj" ]]; then
export BRIDGE_V8_LIBRARY_DIR="${ROOT_DIR}/../engine-custom/third_party/v8/out.gn/x64.release/obj"
elif [[ -z "${BRIDGE_V8_LIBRARY_DIR:-}" && -d "${ROOT_DIR}/../third_party/v8/out.gn/x64.release/obj" ]]; then
export BRIDGE_V8_LIBRARY_DIR="${ROOT_DIR}/../third_party/v8/out.gn/x64.release/obj"
fi
if [[ -z "${BRIDGE_V8_INCLUDE_DIR:-}" && -n "${BROWZ_V8_INCLUDE_DIR:-}" ]]; then
export BRIDGE_V8_INCLUDE_DIR="$BROWZ_V8_INCLUDE_DIR"
fi
if [[ -z "${BRIDGE_V8_LIBRARY_DIR:-}" && -n "${BROWZ_V8_LIBRARY_DIR:-}" ]]; then
export BRIDGE_V8_LIBRARY_DIR="$BROWZ_V8_LIBRARY_DIR"
fi
BUILD_VARIANT="v8-on"
BROWSER_BIN="$ROOT_DIR/build/$BUILD_VARIANT/browser"
DEFAULT_URL="https://google.com"
DEBUG_PRESET=""
ARGS=()
usage() {
cat <<EOF
Usage: ./startbrowser.sh [options] [url]
Options:
-d, --debug <preset> pass a debug preset hint to the browser environment
--renderer <name> select renderer backend (e.g. custom, chromium, cef)
--cef-runtime-probe launch the browser-owned CEF runtime probe staging lane
--off use build/v8-off/browser
--on use build/v8-on/browser (default)
-h, --help show help
Notes:
- `--renderer=cef` is the long-term destination lane under the shell/backend contract.
- `--cef-runtime-probe` is a separate staging/runtime-host lane for validation and bring-up.
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
-d|--debug)
DEBUG_PRESET="${2:-}"
shift 2
;;
--renderer)
ARGS+=("--renderer=${2:-}")
shift 2
;;
--off)
BUILD_VARIANT="v8-off"
shift
;;
--on)
BUILD_VARIANT="v8-on"
shift
;;
-h|--help)
usage
exit 0
;;
*)
ARGS+=("$1")
shift
;;
esac
done
BROWSER_BIN="$ROOT_DIR/build/$BUILD_VARIANT/browser"
if [[ ! -x "$BROWSER_BIN" ]]; then
echo "Browser binary not found: $BROWSER_BIN" >&2
echo "Run ./build.sh first." >&2
exit 1
fi
if [[ -n "$DEBUG_PRESET" ]]; then
export BROWZ_DEBUG_PRESET="$DEBUG_PRESET"
fi
if [[ ${#ARGS[@]} -eq 0 ]]; then
ARGS+=("$DEFAULT_URL")
fi
exec "$BROWSER_BIN" "${ARGS[@]}"