aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go14
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...,