Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Any content imported from other projects retains its original license (for
example, any original unmodified code imported from ungoogled-chromium remains
licensed under their [BSD 3-Clause license](LICENSE.ungoogled_chromium)).

## Getting Started
Initialize the git submodule, using `git submodule update --init --recursive`. You can skip this if you cloned using `--recurse-submodules`.

## Building
To build the binary, run `scripts/docker-build.sh` from the repo root.

Expand Down
7 changes: 7 additions & 0 deletions scripts/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ set -euo pipefail
_base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && cd .. && pwd)"
_image="chromium-builder:trixie-slim"

# Fail fast: required submodule must be initialized before any Docker work
if [ ! -f "${_base_dir}/helium-chromium/utils/downloads.py" ] && [ ! -f "${_base_dir}/helium-chromium/utils/clone.py" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should fail if ANY file is missing not only if both of them.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally do not re write code just define one function in shared.sh verify_submodules and use it here.

echo "error: submodule 'helium-chromium' is not initialized (missing utils/*)" >&2
echo "hint: run 'git submodule update --init --recursive' in the repo root" >&2
exit 1
fi

if [ -z "${_use_existing_image:-}" ]; then
echo "building docker image '${_image}'"
cd "${_base_dir}/docker" && docker buildx build --load -t "${_image}" -f ./build.Dockerfile .
Expand Down
19 changes: 19 additions & 0 deletions scripts/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ setup_environment() {
setup_arch

_has_pgo=false

verify_submodules
}

# Verify required git submodules are present (helium-chromium)
verify_submodules() {
if [ ! -d "${_main_repo}" ]; then
echo "error: required submodule directory not found: ${_main_repo}" >&2
echo "hint: run 'git submodule update --init --recursive' in the repo root" >&2
exit 1
fi

# One of these utilities must exist if the submodule is initialized
if [ ! -f "${_main_repo}/utils/downloads.py" ] && [ ! -f "${_main_repo}/utils/clone.py" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should fail if ANY file is missing not only if both of them.

echo "error: submodule 'helium-chromium' appears uninitialized or incomplete" >&2
echo "missing: ${_main_repo}/utils/downloads.py (and/or clone.py)" >&2
echo "hint: run 'git submodule update --init --recursive' in the repo root" >&2
exit 1
fi
}

fetch_sources() {
Expand Down