-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Labels
discussion-neededFurther discussion neededFurther discussion neededhelp-wantedHelp or suggestions neededHelp or suggestions needed
Description
Help wanted: I am lazy to impl.
Discussion needed: some design choices needed.
Rationale
Currently almost all (AFAIK, all) Zig packages (ghostty, ncdu, etc.) are compiled targeting either Zig baseline or build host. We should make them target the baseline of AOSC OS.
Background
- (hint: "Zig" refers to the programming language, "zig" refers to the implementation by Zig Software Foundation)
- By default, Zig build binaries targeting build host. [ref]
- Zig
build-{exe,lib,obj}build target is specified with a target query (i.e.-target <arch><sub>-<os>-<abi>) and a CPU model string (-mcpu [cpu][feature set]). - Zig
build(Zig Build System) provides a "standard" (sic.) way to specify build target (i.e.-Dtarget=,-Dcpu). Packages may adopt their own way to specify target or disallow specifying build target (Very rarely; I haven't seen any packages doing so; These should be fixed in upstream). - Some packages (e.g. ncdu) set build target in their own build script. We should override them.
- Note that some packages may want to cross-compile something intentionally. (AFAIK currently there isn't any case in AOSC OS)
- Note that AOSC OS may support more than one CPU feature sets on the same architecture (e.g.
loongarch{,_nosimd}).
Proposal
- Sourcing target queries
- A: Add
ZIG_TARGETandZIG_CPUvariables to Autobuild. - B: Hard-code the AOSC baseline by patching zig; add special
aosc_xxxxtarget strings (wherexxxxis the Autobuild architecture name).
- A: Add
- Adopting target queries
- A: Update all build scripts manually to use them.
- B: When
ABTARGETenvironment variable is set, let the standard functions of Zig Build System return the baseline target.
- Idiot-proofing, when
ABenvironment variable is set- Reject all ZCU targeting non-AOSC-baseline targets, unless
AOSC_ZIG_UNCHECK_TARGETenvironment variable is set. - Reject all ZCU with optimization modes other than ReleaseFast, unless
AOSC_ZIG_UNCHECK_OPT_MODEenvironment variable is set.
- Reject all ZCU targeting non-AOSC-baseline targets, unless
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
discussion-neededFurther discussion neededFurther discussion neededhelp-wantedHelp or suggestions neededHelp or suggestions needed