forked from rosa/hakurei
internal/rosa/llvm: use llvm build system
This removes the multistep bootstrap hack. Stage0 exceptions are also eliminated for a later change to bring the stage0 distribution down to just a bare toolchain, toybox and shell. This change also enables dynamic linking and ThinLTO. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -2,10 +2,7 @@ package rosa
|
||||
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (t Toolchain) newMusl(
|
||||
headers bool,
|
||||
extra ...pkg.Artifact,
|
||||
) (pkg.Artifact, string) {
|
||||
func (t Toolchain) newMusl(headers bool) (pkg.Artifact, string) {
|
||||
const (
|
||||
version = "1.2.6"
|
||||
checksum = "WtWb_OV_XxLDAB5NerOL9loLlHVadV00MmGk65PPBU1evaolagoMHfvpZp_vxEzS"
|
||||
@@ -36,25 +33,26 @@ rmdir -v /work/lib
|
||||
helper.Script = ""
|
||||
}
|
||||
|
||||
env := []string{
|
||||
"LDFLAGS=" + earlyLDFLAGS(false),
|
||||
}
|
||||
if t.isStage0() {
|
||||
env = append(env,
|
||||
"CC=clang",
|
||||
"AR=ar",
|
||||
"RANLIB=ranlib",
|
||||
)
|
||||
}
|
||||
|
||||
return t.NewPackage(name, version, newTar(
|
||||
"https://musl.libc.org/releases/musl-"+version+".tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
), &PackageAttr{
|
||||
NonStage0: extra,
|
||||
|
||||
// expected to be writable in copies
|
||||
Chmod: true,
|
||||
|
||||
Env: stage0ExclConcat(t, []string{
|
||||
"CC=clang",
|
||||
"LIBCC=/system/lib/clang/" + llvmVersionMajor + "/lib/" +
|
||||
triplet() + "/libclang_rt.builtins.a",
|
||||
"AR=ar",
|
||||
"RANLIB=ranlib",
|
||||
},
|
||||
"LDFLAGS="+earlyLDFLAGS(false),
|
||||
),
|
||||
Env: env,
|
||||
}, &helper,
|
||||
Coreutils,
|
||||
), version
|
||||
@@ -62,7 +60,7 @@ rmdir -v /work/lib
|
||||
func init() {
|
||||
artifactsM[Musl] = Metadata{
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.newMusl(false, t.Load(CompilerRT))
|
||||
return t.newMusl(false)
|
||||
},
|
||||
|
||||
Name: "musl",
|
||||
@@ -71,4 +69,13 @@ func init() {
|
||||
|
||||
ID: 11688,
|
||||
}
|
||||
|
||||
artifactsM[muslHeaders] = Metadata{
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.newMusl(true)
|
||||
},
|
||||
|
||||
Name: "musl-headers",
|
||||
Description: "system installation of musl headers",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user