diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-11-11 21:59:18 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-11-12 12:44:39 +0900 |
| commit | ac4cec1625da50d6abd9fca40446e7f75aa5bd37 (patch) | |
| tree | 22b3789634008a43277952abea766be4f278e4f7 /internal/rosa/rosa.go | |
| parent | e28bac0fe480c065e653b847d1b54f3e3d712156 (diff) | |
internal/rosa: set common cross-compile environment
This change avoids duplicating this piece of code all over the place.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index c50a7efe..845919bf 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -377,6 +377,8 @@ type PackageAttr struct { CrossTools P // Native utilities used by the build process. Tools P + // Whether to set common cross-compilation environment variables. + CrossCommon bool // Unregistered extras. Extra []pkg.Artifact // Passed through to [Toolchain.New], before source. @@ -654,6 +656,18 @@ ln -s ../bin /usr/` } arch := t.Arch() + if _, ok := helper.(*MakeHelper); cross && (attr.CrossCommon || ok) { + sysroot := Prefix + "/" + arch + target := t.triple() + scriptEarly += ` +export \ + CC='clang --target=` + target + ` --sysroot=` + sysroot + `' \ + CXX='clang++ --target=` + target + ` --sysroot=` + sysroot + `' \ + PKG_CONFIG_SYSROOT_DIR='` + sysroot + `' \ + PKG_CONFIG_LIBDIR='` + sysroot + Prefix + `/lib/pkgconfig:` + sysroot + Prefix + `/share/pkgconfig' +` + } + sys := []pkg.ExecPath{pkg.Path( fhs.AbsRoot, true, root..., |
