diff options
Diffstat (limited to 'internal/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index c730127b..71755ef9 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -45,12 +45,19 @@ func mustDecode(s string) pkg.Checksum { // KV is a key-value pair of strings. type KV = [2]string +const ( + // prefixR is the Rosa OS installation prefix relative to sysroot. + prefixR = "system" + // Prefix is the Rosa OS installation prefix. + Prefix = "/" + prefixR +) + var ( // AbsUsrSrc is the conventional directory to place source code under. AbsUsrSrc = fhs.AbsUsr.Append("src") // AbsSystem is the Rosa OS installation prefix. - AbsSystem = fhs.AbsRoot.Append("system") + AbsSystem = fhs.AbsRoot.Append(prefixR) ) // linuxArch returns the architecture name used by linux corresponding to arch. @@ -97,14 +104,14 @@ func (s *S) triple() string { return triple(s.Arch()) } // earlyLDFLAGS returns LDFLAGS corresponding to triplet. func (s *S) earlyLDFLAGS(static bool) string { p := "-fuse-ld=lld " + - "-L/system/lib -Wl,-rpath=/system/lib " + - "-L/system/lib/" + s.triple() + " " + - "-Wl,-rpath=/system/lib/" + s.triple() + " " + + "-L" + Prefix + "/lib -Wl,-rpath=" + Prefix + "/lib " + + "-L" + Prefix + "/lib/" + s.triple() + " " + + "-Wl,-rpath=" + Prefix + "/lib/" + s.triple() + " " + "-rtlib=compiler-rt " + "-unwindlib=libunwind " + "-Wl,--as-needed" if !static { - p += " -Wl,--dynamic-linker=/system/bin/linker" + p += " -Wl,--dynamic-linker=" + Prefix + "/bin/linker" } return p } @@ -492,7 +499,7 @@ func (t Toolchain) New( env = fixupEnviron(env, []string{ lcMessages, "LDFLAGS=" + t.earlyLDFLAGS(true), - }, "/system/bin", + }, Prefix+"/bin", "/usr/bin", ) @@ -524,7 +531,7 @@ func (t Toolchain) New( ) env = fixupEnviron(env, []string{ lcMessages, - }, "/system/bin", "/bin") + }, Prefix+"/bin", "/bin") default: panic("unsupported toolchain " + strconv.Itoa(int(t.stage))) @@ -638,7 +645,7 @@ ln -s ../bin /usr/` if t.stage != stageGentoo && len(bin) > 0 { scriptEarly += "\nchmod +w /bin/" + - "\n(set -o braceexpand && ln -sf ../system/bin/" + "\n(set -o braceexpand && ln -sf .." + Prefix + "/bin/" if len(bin) > 1 { scriptEarly += "{'" + strings.Join(bin, "','") + "'}" } else { @@ -654,7 +661,7 @@ ln -s ../bin /usr/` ), pkg.Path( absCureScript, false, pkg.NewFile(scriptName, []byte( - "#!/system/bin/sh\n"+ + "#!"+Prefix+"/bin/sh\n"+ "set -eu -o pipefail\n"+ scriptEarly+helper.script(t, name), )), |
