aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--internal/rosa/cmake.go7
-rw-r--r--internal/rosa/llvm.go4
-rw-r--r--internal/rosa/make.go8
-rw-r--r--internal/rosa/package/llvm/package.az12
-rw-r--r--internal/rosa/package/make.az3
-rw-r--r--internal/rosa/rosa.go21
-rw-r--r--internal/rosa/state.go4
7 files changed, 32 insertions, 27 deletions
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go
index f9e5e38c..2a262e6e 100644
--- a/internal/rosa/cmake.go
+++ b/internal/rosa/cmake.go
@@ -62,6 +62,7 @@ func (attr *CMakeHelper) script(t Toolchain, name string) string {
if attr == nil {
attr = new(CMakeHelper)
}
+ target := t.triple()
generate := "Ninja"
test := "ninja " + jobsFlagE + " " + loadFlagE + " test"
@@ -88,9 +89,9 @@ func (attr *CMakeHelper) script(t Toolchain, name string) string {
return `
cmake -G ` + generate + ` \
-Wno-author -Wno-unused-cli \
- -DCMAKE_C_COMPILER_TARGET="${ROSA_TRIPLE}" \
- -DCMAKE_CXX_COMPILER_TARGET="${ROSA_TRIPLE}" \
- -DCMAKE_ASM_COMPILER_TARGET="${ROSA_TRIPLE}" \
+ -DCMAKE_C_COMPILER_TARGET='` + target + `' \
+ -DCMAKE_CXX_COMPILER_TARGET='` + target + `' \
+ -DCMAKE_ASM_COMPILER_TARGET='` + target + `' \
-DCMAKE_INSTALL_LIBDIR=lib \
` + strings.Join(slices.Collect(func(yield func(string) bool) {
for _, v := range cache {
diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go
index 08625fcf..d9ca83e1 100644
--- a/internal/rosa/llvm.go
+++ b/internal/rosa/llvm.go
@@ -73,6 +73,7 @@ func init() {
early = _earlyRuntimes
}
+ target := t.triple()
cache := []KV{
{"ENABLE_LINKER_BUILD_ID", "ON"},
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
@@ -109,8 +110,7 @@ func init() {
{"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"},
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
- {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
- {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
+ {"LLVM_HOST_TRIPLE", "'" + target + "'"},
{"LLVM_ENABLE_PROJECTS", "'" + strings.Join([]string{
"clang",
"lld",
diff --git a/internal/rosa/make.go b/internal/rosa/make.go
index 1c0e52d6..a41db646 100644
--- a/internal/rosa/make.go
+++ b/internal/rosa/make.go
@@ -103,15 +103,18 @@ func (attr *MakeHelper) script(t Toolchain, name string) string {
}
var configure string
+ target := t.triple()
if !attr.SkipConfigure {
- configure = attr.ConfigureName
+ configure += attr.ConfigureName
if configure == "" {
configure += `/usr/src/` + name + `/configure`
}
if attr.ForceAutoconf || attr.ConfigureName == "" {
configure += ` \
--prefix=/system`
- host := `"${ROSA_TRIPLE}"`
+ host := target
+ build := host
+
if attr.Host != "" {
host = attr.Host
}
@@ -120,7 +123,6 @@ func (attr *MakeHelper) script(t Toolchain, name string) string {
--host=` + host
}
- build := `"${ROSA_TRIPLE}"`
if attr.Build != "" {
build = attr.Build
}
diff --git a/internal/rosa/package/llvm/package.az b/internal/rosa/package/llvm/package.az
index 05a9d937..631228be 100644
--- a/internal/rosa/package/llvm/package.az
+++ b/internal/rosa/package/llvm/package.az
@@ -36,8 +36,7 @@ message(NOTICE "${LLVM_VERSION_MAJOR}")
// libc++ not yet available
"CMAKE_CXX_COMPILER_TARGET": "";
- "LLVM_HOST_TRIPLE": `"${ROSA_TRIPLE}"`;
- "LLVM_DEFAULT_TARGET_TRIPLE": `"${ROSA_TRIPLE}"`;
+ "LLVM_HOST_TRIPLE": triple;
"LLVM_ENABLE_RTTI": "ON";
"LLVM_BUILD_LLVM_DYLIB": "ON";
"LLVM_LINK_LLVM_DYLIB": "ON";
@@ -60,15 +59,15 @@ message(NOTICE "${LLVM_VERSION_MAJOR}")
postInstall = `
mkdir -p "/work/system/lib/clang/$LLVM_VERSION_MAJOR/lib/"
ln -s \
- "../../../${ROSA_TRIPLE}" \
+ '../../../`+triple+`' \
"/work/system/lib/clang/$LLVM_VERSION_MAJOR/lib/"
ln -s \
"clang_rt.crtbegin-`+linuxArch+`.o" \
- "/work/system/lib/${ROSA_TRIPLE}/crtbeginS.o"
+ '/work/system/lib/`+triple+`/crtbeginS.o'
ln -s \
"clang_rt.crtend-`+linuxArch+`.o" \
- "/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
+ '/work/system/lib/`+triple+`/crtendS.o'
`;
};
@@ -95,8 +94,7 @@ package early-runtimes {
// libc++ not yet available
"CMAKE_CXX_COMPILER_WORKS": "ON";
- "LLVM_HOST_TRIPLE": `"${ROSA_TRIPLE}"`;
- "LLVM_DEFAULT_TARGET_TRIPLE": `"${ROSA_TRIPLE}"`;
+ "LLVM_HOST_TRIPLE": triple;
"LLVM_ENABLE_RTTI": "ON";
"LLVM_BUILD_LLVM_DYLIB": "ON";
"LLVM_LINK_LLVM_DYLIB": "ON";
diff --git a/internal/rosa/package/make.az b/internal/rosa/package/make.az
index c35dcfa3..771bd20d 100644
--- a/internal/rosa/package/make.az
+++ b/internal/rosa/package/make.az
@@ -15,7 +15,8 @@ package make {
exec = generic {
build = `/usr/src/make/configure \
--prefix=/system \
- --build="${ROSA_TRIPLE}" \
+ --host= '`+triple+`' \
+ --build='`+hostTriple+`' \
--disable-dependency-tracking
./build.sh
`;
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index beffb3ff..c1f71cfa 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -54,8 +54,8 @@ var (
)
// linuxArch returns the architecture name used by linux corresponding to arch.
-func (s *S) linuxArch() string {
- switch s.arch {
+func linuxArch(arch string) string {
+ switch arch {
case "amd64":
return "x86_64"
case "arm64":
@@ -64,19 +64,20 @@ func (s *S) linuxArch() string {
return "riscv64"
default:
- panic("unsupported target " + s.arch)
+ panic("unsupported target " + arch)
}
}
+// linuxArch returns the architecture name used by linux corresponding to arch.
+func (s *S) linuxArch() string { return linuxArch(s.arch) }
+
// triple returns the Rosa OS host triple corresponding to arch.
-func (s *S) triple() string {
- return s.linuxArch() + "-rosa-linux-musl"
+func triple(arch string) string {
+ return linuxArch(arch) + "-rosa-linux-musl"
}
-const (
- // EnvTriple holds the Rosa OS host triple.
- EnvTriple = "ROSA_TRIPLE"
-)
+// triple returns the Rosa OS target triple corresponding to arch.
+func (s *S) triple() string { return triple(s.arch) }
// earlyLDFLAGS returns LDFLAGS corresponding to triplet.
func (s *S) earlyLDFLAGS(static bool) string {
@@ -447,7 +448,6 @@ func (t Toolchain) New(
)
}
env = fixupEnviron(env, []string{
- EnvTriple + "=" + t.triple(),
lcMessages,
"LDFLAGS=" + t.earlyLDFLAGS(true),
}, "/system/bin",
@@ -481,7 +481,6 @@ func (t Toolchain) New(
toybox,
)
env = fixupEnviron(env, []string{
- EnvTriple + "=" + t.triple(),
lcMessages,
}, "/system/bin", "/bin")
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index 01abf736..6d198d6b 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -491,6 +491,10 @@ func (s *S) getFrame() azalea.Frame {
s.frame.Val = map[unique.Handle[azalea.Ident]]any{
k("unversioned"): Unversioned,
+ k("hostTriple"): triple(runtime.GOARCH),
+ k("hostArch"): runtime.GOARCH,
+ k("hostLinuxArch"): linuxArch(runtime.GOARCH),
+
k("triple"): s.triple(),
k("arch"): s.arch,
k("linuxArch"): s.linuxArch(),