From ac4cec1625da50d6abd9fca40446e7f75aa5bd37 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 11 Nov 2026 21:59:18 +0900 Subject: internal/rosa: set common cross-compile environment This change avoids duplicating this piece of code all over the place. Signed-off-by: Ophestra --- internal/rosa/rosa.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/rosa/rosa.go') 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..., -- cgit v1.3.1