Skip to content
Merged
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
39 changes: 38 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,37 @@ $(if $(strip $(FLAVORS)),,$(error ci/flavor.py --list produced no flavours — i
FLAVOR ?= debug
$(if $(filter $(FLAVOR),$(FLAVORS)),,$(error unknown FLAVOR "$(FLAVOR)" — one of: $(FLAVORS)))

# --- WHICH OS: the PLATFORM axis -----------------------------------------------------------
#
# `webos` (the television this file has always built for, and the default), `desktop` (the macOS and
# Windows/WSLg simulators and the macOS app) or `tizen` (a name only: no goal builds it yet). It is the
# TARGET OS and nothing else. FLAVOR stays the install identity, and the compatibility axis — the Rust
# target (`RUST_TARGET`), the sysroot (`SYSROOT`) and, once a platform needs them, a managed TFM, a
# firmware floor and the signing path — stays a set of separate variables that PLATFORM does not choose:
# `make -s print-rust-target` answers the same under every PLATFORM. Today the axis labels and validates;
# no recipe reads it, so the default `PLATFORM=webos` builds exactly what it built before the axis existed.
#
# The simulators and the macOS app are desktop builds, so `sim`, `sim-*`, `macapp` and `macapp-zip` imply
# PLATFORM=desktop when it was not given: `$(origin PLATFORM)` is `undefined` (not on the command line,
# not in the environment), and an explicit value wins. It is one value per invocation, read from the whole
# goal list. The target names themselves do not change. This sits ABOVE the `?=`, so the literal default
# line below stays the one place that says `webos`.
#
# Validated against `ci/platform_axis.py --list` the way FLAVOR is against `ci/flavor.py --list`, for the
# same reason: `make PLATFORM=webso ...` must be a message on a terminal, not a build of something nobody
# asked for. One word, exactly (a `filter` of the value against the list would also pass `webos bogus`
# and `%`). The script is NOT `ci/platform.py`: scripts run from ci/ `import platform` (`mkmacapp.py`,
# `build-libass.py`, `test-compat.py`), and a file of that name would shadow the standard library for them.
PLATFORMS := $(shell python3 ci/platform_axis.py --list)
$(if $(strip $(PLATFORMS)),,$(error ci/platform_axis.py --list produced no platforms — is python3 available and does ci/platform_axis.py run?))
ifeq ($(origin PLATFORM),undefined)
ifneq ($(filter sim sim-% macapp macapp-zip,$(MAKECMDGOALS)),)
PLATFORM := desktop
endif
endif
PLATFORM ?= webos
$(if $(and $(filter 1,$(words $(PLATFORM))),$(filter $(PLATFORMS),$(PLATFORM))),,$(error unknown PLATFORM "$(PLATFORM)" — one of: $(PLATFORMS)))

# The id users get. Also `paths::STABLE_APP_ID` in the Rust half and `STABLE_ID` in ci/flavor.py —
# three copies of one string, each in a language that cannot see the others, and ci/flavor.py's
# selftest is what keeps them in step.
Expand Down Expand Up @@ -185,14 +216,20 @@ APPPORT = $(if $(filter stable,$(FLAVOR)),8910,$(if $(filter nightly,$(FLAV
QUERY_GOALS = print-flavor print-appid print-appdir print-rundir print-eventlog print-appport print-tv print-playback-config \
print-simbin print-app-files print-deploy-files print-sentry-handler print-ffmpeg-staged \
print-sentry-project print-bench-config print-disk-entries \
print-subs-font-files print-rust-toolchain print-rust-codegen print-cargo-env
print-subs-font-files print-rust-toolchain print-rust-codegen print-cargo-env \
print-platform print-rust-target
print-flavor: ; @echo '$(FLAVOR)'
print-appid: ; @echo '$(APPID)'
print-appdir: ; @echo '$(APPDIR)'
print-rundir: ; @echo '$(RUNDIR)'
print-eventlog: ; @echo '$(EVENTLOG)'
print-appport: ; @echo '$(APPPORT)'
print-tv: ; @echo '$(TV)'
# The PLATFORM axis (above) and the Rust target the ARM recipes cross-compile for. They are two queries
# because they are two axes: PLATFORM does not choose the Rust target, so `print-rust-target` does not
# move with it. Both are in QUERY_GOALS, so asking resets nothing under `pkg/`.
print-platform: ; @echo '$(PLATFORM)'
print-rust-target: ; @echo '$(RUST_TARGET)'
# Where `make sim` put the simulator. It is `$(SIM_TDIR)`-derived and `SIM_TDIR` is deliberately
# overridable — agents running several simulators at once keep separate target dirs, and the
# `macapp` build has its own — so a tool that restates the path silently runs another lane's
Expand Down
6 changes: 6 additions & 0 deletions ci/check-python-steps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,9 @@ python3 ci/test_runtime_ownership_borrows.py
# systemMessage, under the 10,000 character cap), the settings.json registrations, and a real process with a stub standing in for
# `build-gc.sh --auto` (detached, own session, output in the log). Never starts the real build-gc; temp dirs only; no sleeping on a timer.
python3 .claude/hooks/disk-low-notify-test.py
# The PLATFORM build axis (Makefile `PLATFORM`, ci/platform_axis.py --list): default `webos`, the three names accepted from the command line
# and the environment, anything else refused at parse time, `sim`/`sim-*`/`macapp`/`macapp-zip` implying `desktop` (read from a dry run in a
# scratch tree, where an explicit value still wins), `print-rust-target` unmoved by it, both new queries leaving a built `pkg/` alone, and
# that the selector is not named `platform.py`: scripts in ci/ import the stdlib `platform`, so a probe from ci/, every existing consumer and
# a shadow control are run. No cargo; the scratch trees are private temp dirs.
python3 ci/test_platform_axis.py
39 changes: 39 additions & 0 deletions ci/platform_axis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""The PLATFORM build axis: which operating system a build targets.

`PLATFORM` in the Makefile is one of the values below, and the Makefile reads them from `--list`
the way it reads FLAVOR's from `ci/flavor.py --list`, so a mistyped `make PLATFORM=webso ...` is
refused at parse time instead of building something nobody asked for:

webos the LG webOS television (armv7, the `.ipk`): what every target built before the axis
existed, and the default.
desktop the macOS and Windows/WSLg simulators and the macOS app (`sim-*`, `macapp`): the Makefile
makes it the default for those goals.
tizen the Samsung Tizen television (the `.tpk`). Only the name exists yet; no goal builds it.

The axis is the TARGET OS and nothing else. It does not choose the compatibility axis: the Rust
target (`RUST_TARGET`), the sysroot (`SYSROOT`), a managed TFM, a firmware floor and the signing
path stay separate variables, each recorded once per tested configuration, so adding a platform never
changes what another one links. FLAVOR stays the install identity (`debug`, `nightly`, `stable`) and
is orthogonal to it.

THIS FILE IS NOT NAMED `platform.py`. Scripts in `ci/` (`mkmacapp.py`, `build-libass.py`,
`test-compat.py`) `import platform` for `system()` and `machine()`, and Python puts a script's own
directory first on `sys.path`, so a `ci/platform.py` would replace the standard library module for
every one of them. `ci/test_platform_axis.py` runs them from this directory to keep it that way.

It imports nothing but `sys`: the Makefile spawns it on every `make` invocation, as it does
`ci/flavor.py`, and each import adds to that bill.
"""
import sys

# Order is the order the Makefile's error message lists them in. The default is the Makefile's
# `PLATFORM ?= webos`, not a property of this list.
PLATFORMS = ("webos", "desktop", "tizen")

if __name__ == "__main__":
if sys.argv[1:] == ["--list"]:
print(" ".join(PLATFORMS))
sys.exit(0)
print(__doc__)
sys.exit(2)
Loading
Loading