internal/rosa/package: migrate nss
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 3m2s
Test / ShareFS (push) Successful in 3m46s
Test / Hakurei (push) Successful in 3m54s
Test / Sandbox (race detector) (push) Successful in 5m24s
Test / Hakurei (race detector) (push) Successful in 6m34s
Test / Flake checks (push) Successful in 1m23s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-21 15:35:48 +09:00
parent 1acb5b0105
commit cbf18b302d
18 changed files with 196 additions and 209 deletions

View File

@@ -61,7 +61,7 @@ func (t Toolchain) newBison() (pkg.Artifact, string) {
}, },
}, },
H("m4"), H("m4"),
diffutils, _diffutils,
H("sed"), H("sed"),
), version ), version
} }

View File

@@ -6,8 +6,7 @@ import (
"strings" "strings"
) )
// CMake is the package used by [CMakeHelper]. var _cmake = H("cmake")
var CMake = H("cmake")
// CMakeHelper is the [CMake] build system helper. // CMakeHelper is the [CMake] build system helper.
type CMakeHelper struct { type CMakeHelper struct {
@@ -35,9 +34,9 @@ var _ Helper = new(CMakeHelper)
// extra returns a hardcoded slice of [CMake] and [Ninja]. // extra returns a hardcoded slice of [CMake] and [Ninja].
func (attr *CMakeHelper) extra(int) P { func (attr *CMakeHelper) extra(int) P {
if attr != nil && attr.Make { if attr != nil && attr.Make {
return P{CMake, Make} return P{_cmake, _make}
} }
return P{CMake, Ninja} return P{_cmake, _ninja}
} }
// wantsChmod returns false. // wantsChmod returns false.

View File

@@ -7,8 +7,10 @@ import (
"hakurei.app/internal/pkg" "hakurei.app/internal/pkg"
) )
// Git is the package used by [Toolchain.NewViaGit]. var (
var Git = H("git") _git = H("git")
_nssCACert = H("nss-cacert")
)
// NewViaGit returns a [pkg.Artifact] for cloning a git repository. // NewViaGit returns a [pkg.Artifact] for cloning a git repository.
func (t Toolchain) NewViaGit( func (t Toolchain) NewViaGit(
@@ -19,8 +21,8 @@ func (t Toolchain) NewViaGit(
path.Base(url), path.Base(url),
".git", ".git",
)+"-src-"+path.Base(rev), THostNet, t.Append(nil, )+"-src-"+path.Base(rev), THostNet, t.Append(nil,
nssCACert, _nssCACert,
Git, _git,
), &checksum, nil, ` ), &checksum, nil, `
git \ git \
-c advice.detachedHead=false \ -c advice.detachedHead=false \

View File

@@ -12,7 +12,7 @@ var _go = H("go")
func (t Toolchain) newGoBootstrap() pkg.Artifact { func (t Toolchain) newGoBootstrap() pkg.Artifact {
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23" const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
return t.New("go1.4-bootstrap", 0, t.Append(nil, return t.New("go1.4-bootstrap", 0, t.Append(nil,
bash, _bash,
), nil, []string{ ), nil, []string{
"CGO_ENABLED=0", "CGO_ENABLED=0",
}, ` }, `
@@ -41,7 +41,7 @@ func (t Toolchain) newGo(
name = "make" name = "make"
} }
return t.New("go"+version, 0, t.Append(extra, return t.New("go"+version, 0, t.Append(extra,
bash, _bash,
), nil, slices.Concat([]string{ ), nil, slices.Concat([]string{
"CC=cc", "CC=cc",
"GOCACHE=/tmp/gocache", "GOCACHE=/tmp/gocache",

View File

@@ -16,7 +16,7 @@ go build -o /bin/hostname /usr/src/hostname/main.go
name := "hakurei" + suffix name := "hakurei" + suffix
return t.NewPackage(name, hakureiVersion, t.NewPatchedSource( return t.NewPackage(name, hakureiVersion, t.NewPatchedSource(
"hakurei", hakureiVersion, hakureiSource, false, hakureiPatches..., "hakurei-"+hakureiVersion, hakureiSource, false, hakureiPatches...,
), &PackageAttr{ ), &PackageAttr{
Writable: true, Writable: true,
Env: []string{ Env: []string{
@@ -58,7 +58,7 @@ HAKUREI_VERSION='v` + hakureiVersion + `'
H("wayland"), H("wayland"),
H("wayland-protocols"), H("wayland-protocols"),
kernelHeaders, _kernelHeaders,
) )
} }
func init() { func init() {

View File

@@ -5,7 +5,7 @@ import (
"hakurei.app/internal/pkg" "hakurei.app/internal/pkg"
) )
var earlyInit = H("earlyinit") var _earlyInit = H("earlyinit")
func init() { func init() {
meta := Metadata{ meta := Metadata{
@@ -41,7 +41,7 @@ func init() {
), nil, nil, ` ), nil, nil, `
mksquashfs /mnt/system /work/system.img mksquashfs /mnt/system /work/system.img
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil, `, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
musl, _musl,
Mksh, Mksh,
Toybox, Toybox,
@@ -60,8 +60,8 @@ func init() {
} }
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
return &meta, t.New("initramfs", TNoToolchain, t.Append(nil, return &meta, t.New("initramfs", TNoToolchain, t.Append(nil,
zstd, _zstd,
earlyInit, _earlyInit,
H("gen_init_cpio"), H("gen_init_cpio"),
), nil, nil, ` ), nil, nil, `
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst

View File

@@ -9,21 +9,21 @@ import (
) )
var ( var (
llvmSource = H("llvm-project") _llvmSource = H("llvm-project")
muslHeaders = H("musl-headers") _muslHeaders = H("musl-headers")
earlyCompilerRT = H("early-compiler-rt") _earlyCompilerRT = H("early-compiler-rt")
earlyRuntimes = H("early-runtimes") _earlyRuntimes = H("early-runtimes")
musl = H("musl") _musl = H("musl")
bash = H("bash") _bash = H("bash")
gawk = H("gawk") _gawk = H("gawk")
coreutils = H("coreutils") _coreutils = H("coreutils")
diffutils = H("diffutils") _diffutils = H("diffutils")
findutils = H("findutils") _findutils = H("findutils")
zlib = H("zlib") _zlib = H("zlib")
zstd = H("zstd") _zstd = H("zstd")
kernelHeaders = H("kernel-headers") _kernelHeaders = H("kernel-headers")
) )
// litArgs returns LIT arguments for optional verbosity and check skipping. // litArgs returns LIT arguments for optional verbosity and check skipping.
@@ -53,11 +53,9 @@ func init() {
Name: "early-compiler-rt", Name: "early-compiler-rt",
Description: "early LLVM runtime: compiler-rt", Description: "early LLVM runtime: compiler-rt",
Dependencies: P{ Dependencies: P{_musl},
musl,
},
} }
_meta, source := t.MustLoad(llvmSource) _meta, source := t.MustLoad(_llvmSource)
meta.Version = _meta.Version meta.Version = _meta.Version
major, _, _ := strings.Cut(meta.Version, ".") major, _, _ := strings.Cut(meta.Version, ".")
return &meta, t.NewPackage("early-compiler-rt", meta.Version, source, &PackageAttr{ return &meta, t.NewPackage("early-compiler-rt", meta.Version, source, &PackageAttr{
@@ -106,10 +104,10 @@ ln -s \
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o" "/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
`, `,
}, },
Python, _python,
muslHeaders, _muslHeaders,
kernelHeaders, _kernelHeaders,
) )
}) })
@@ -119,10 +117,10 @@ ln -s \
Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi", Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi",
Dependencies: P{ Dependencies: P{
earlyCompilerRT, _earlyCompilerRT,
}, },
} }
_meta, source := t.MustLoad(llvmSource) _meta, source := t.MustLoad(_llvmSource)
meta.Version = _meta.Version meta.Version = _meta.Version
return &meta, t.NewPackage("early-runtimes", meta.Version, source, &PackageAttr{ return &meta, t.NewPackage("early-runtimes", meta.Version, source, &PackageAttr{
@@ -162,12 +160,12 @@ ln -s \
}, },
SkipTest: true, SkipTest: true,
}, },
Python, _python,
zlib, _zlib,
zstd, _zstd,
earlyCompilerRT, _earlyCompilerRT,
kernelHeaders, _kernelHeaders,
) )
}) })
@@ -184,7 +182,7 @@ ln -s \
ID: 1830, ID: 1830,
} }
return &meta, t.NewPatchedSource("llvm", version, newFromGitHub( return &meta, t.NewPatchedSource("llvm-"+version, newFromGitHub(
"llvm/llvm-project", "llvm/llvm-project",
"llvmorg-"+version, "llvmorg-"+version,
checksum, checksum,
@@ -198,22 +196,22 @@ ln -s \
Website: "https://llvm.org", Website: "https://llvm.org",
Dependencies: P{ Dependencies: P{
zlib, _zlib,
zstd, _zstd,
musl, _musl,
}, },
} }
_meta, source := t.MustLoad(llvmSource) _meta, source := t.MustLoad(_llvmSource)
meta.Version = _meta.Version meta.Version = _meta.Version
early := muslHeaders early := _muslHeaders
if t.stage.isStage0() { if t.stage.isStage0() {
// The LLVM build system uses the system installation when building with // The LLVM build system uses the system installation when building with
// LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using // LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using
// the just-built toolchain. This is unacceptable in stage0 due to the // the just-built toolchain. This is unacceptable in stage0 due to the
// potential version difference. Later stages bootstrap off of runtimes // potential version difference. Later stages bootstrap off of runtimes
// of its previous stage via 3-stage determinism. // of its previous stage via 3-stage determinism.
early = earlyRuntimes early = _earlyRuntimes
} }
cache := []KV{ cache := []KV{
@@ -351,18 +349,18 @@ chmod +w /bin && ln -s \
ninja ` + jobsFlagE + ` check-all ninja ` + jobsFlagE + ` check-all
`, `,
}, },
Python, _python,
Perl, _perl,
diffutils, _diffutils,
bash, _bash,
gawk, _gawk,
coreutils, _coreutils,
findutils, _findutils,
zlib, _zlib,
zstd, _zstd,
early, early,
kernelHeaders, _kernelHeaders,
) )
}) })

View File

@@ -5,8 +5,7 @@ import (
"strings" "strings"
) )
// Make is the build system used by [MakeHelper]. var _make = H("make")
var Make = H("make")
// MakeHelper is the [Make] build system helper. // MakeHelper is the [Make] build system helper.
type MakeHelper struct { type MakeHelper struct {
@@ -52,11 +51,11 @@ var _ Helper = new(MakeHelper)
// extra returns make and other optional dependencies. // extra returns make and other optional dependencies.
func (attr *MakeHelper) extra(flag int) P { func (attr *MakeHelper) extra(flag int) P {
extra := P{Make} extra := P{_make}
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 { if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
extra = append(extra, extra = append(extra,
gawk, _gawk,
coreutils, _coreutils,
) )
} }
return extra return extra

View File

@@ -5,8 +5,7 @@ import (
"strings" "strings"
) )
// Meson is the meson package used by [MesonHelper]. var _meson = H("meson")
var Meson = H("meson")
// MesonHelper is the [Meson] build system helper. // MesonHelper is the [Meson] build system helper.
type MesonHelper struct { type MesonHelper struct {
@@ -26,7 +25,7 @@ type MesonHelper struct {
var _ Helper = new(MesonHelper) var _ Helper = new(MesonHelper)
// extra returns hardcoded meson runtime dependencies. // extra returns hardcoded meson runtime dependencies.
func (*MesonHelper) extra(int) P { return P{Meson} } func (*MesonHelper) extra(int) P { return P{_meson} }
// wantsChmod returns false. // wantsChmod returns false.
func (*MesonHelper) wantsChmod() bool { return false } func (*MesonHelper) wantsChmod() bool { return false }

View File

@@ -2,8 +2,7 @@ package rosa
import "hakurei.app/internal/pkg" import "hakurei.app/internal/pkg"
// Ninja is the build system used by [CMakeHelper] and [MesonHelper]. var _ninja = H("ninja")
var Ninja = H("ninja")
func init() { func init() {
const ( const (
@@ -19,11 +18,11 @@ func init() {
ID: 2089, ID: 2089,
} }
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
_, _python := t.Load(Python) _, python := t.Load(_python)
_, _bash := t.Load(bash) _, bash := t.Load(_bash)
return &meta, t.New(meta.Name+"-"+version, 0, []pkg.Artifact{ return &meta, t.New(meta.Name+"-"+version, 0, []pkg.Artifact{
_python, python,
_bash, bash,
}, nil, nil, ` }, nil, nil, `
cd "$(mktemp -d)" cd "$(mktemp -d)"
python3 /usr/src/ninja/configure.py \ python3 /usr/src/ninja/configure.py \
@@ -43,7 +42,7 @@ cp ninja /work/system/bin/
"NjLGvSbgPy_B-y-o1hdanlzEzaYeStFcvFGxpYV3KYlhrWWFRcugYhM3ZMzOA9B_", "NjLGvSbgPy_B-y-o1hdanlzEzaYeStFcvFGxpYV3KYlhrWWFRcugYhM3ZMzOA9B_",
pkg.TarGzip, pkg.TarGzip,
)), pkg.Path(AbsUsrSrc.Append("ninja"), true, t.NewPatchedSource( )), pkg.Path(AbsUsrSrc.Append("ninja"), true, t.NewPatchedSource(
meta.Name, version, newFromGitHub( meta.Name+"-"+version, newFromGitHub(
"ninja-build/ninja", "ninja-build/ninja",
"v"+version, "v"+version,
checksum, checksum,

View File

@@ -1,112 +0,0 @@
package rosa
import (
"strings"
"hakurei.app/internal/pkg"
)
var (
unzip = H("unzip")
nss = H("nss")
nssCACert = H("nss-cacert")
)
func (t Toolchain) newNSS() (pkg.Artifact, string) {
const (
version = "3.123.1"
checksum = "g811Z_fc74ssg-s6BeXRG-ipSfJggD6hrxjVJxrOBIz98CE7piv0OLwzIRLMQpwR"
version0 = "4_38_2"
checksum0 = "25x2uJeQnOHIiq_zj17b4sYqKgeoU8-IsySUptoPcdHZ52PohFZfGuIisBreWzx0"
)
return t.NewPackage("nss", version, newFromGitHub(
"nss-dev/nss",
"NSS_"+strings.Join(strings.SplitN(version, ".", 3), "_")+"_RTM",
checksum,
), &PackageAttr{
Paths: []pkg.ExecPath{
pkg.Path(AbsUsrSrc.Append("nspr.zip"), false, pkg.NewHTTPGet(
nil, "https://hg-edge.mozilla.org/projects/nspr/archive/"+
"NSPR_"+version0+"_RTM.zip",
mustDecode(checksum0),
)),
},
// uses source tree as scratch space
Writable: true,
Chmod: true,
ScriptEarly: `
unzip /usr/src/nspr.zip -d /usr/src
mv '/usr/src/nspr-NSPR_` + version0 + `_RTM' /usr/src/nspr
`,
}, &MakeHelper{
OmitDefaults: true,
SkipConfigure: true,
InPlace: true,
SkipCheck: true,
Make: []string{
"CCC=clang++",
"NSDISTMODE=copy",
"BUILD_OPT=1",
"USE_64=1",
"nss_build_all",
},
Install: `
mkdir -p /work/system/nss
cp -r \
/usr/src/dist/. \
lib/ckfw/builtins/certdata.txt \
/work/system/nss
`,
},
Perl,
Python,
unzip,
gawk,
coreutils,
zlib,
kernelHeaders,
), version
}
func init() {
native.mustRegister(Toolchain.newNSS, &Metadata{
Name: "nss",
Description: "Network Security Services",
Website: "https://firefox-source-docs.mozilla.org/security/nss/index.html",
Dependencies: P{
zlib,
},
ID: 2503,
})
}
func (t Toolchain) newNSSCACert() (pkg.Artifact, string) {
return t.New("nss-cacert", 0, t.Append(nil,
bash,
nss,
H("buildcatrust"),
), nil, nil, `
mkdir -p /work/system/etc/ssl/{certs/unbundled,certs/hashed,trust-source}
buildcatrust \
--certdata_input /system/nss/certdata.txt \
--ca_bundle_output /work/system/etc/ssl/certs/ca-bundle.crt \
--ca_standard_bundle_output /work/system/etc/ssl/certs/ca-no-trust-rules-bundle.crt \
--ca_unpacked_output /work/system/etc/ssl/certs/unbundled \
--ca_hashed_unpacked_output /work/system/etc/ssl/certs/hashed \
--p11kit_output /work/system/etc/ssl/trust-source/ca-bundle.trust.p11-kit
`), Unversioned
}
func init() {
native.mustRegister(Toolchain.newNSSCACert, &Metadata{
Name: "nss-cacert",
Description: "bundle of X.509 certificates of public Certificate Authorities",
Website: "https://curl.se/docs/caextract.html",
})
}

View File

@@ -0,0 +1,99 @@
package nspr {
description = "nspr source tree";
anitya = 7953;
exclude = true;
version* = "4.38.2";
output = remoteTar {
url = "https://ftp.mozilla.org/pub/nspr/releases/v"+version+
"/src/nspr-"+version+".tar.gz";
checksum = "BcKpVmN6bdBaoZyzht_SpGHnO1CRN5YHeVyWW2skfCKIdhy3ppKe1zMh85QBEsV_";
compress = gzip;
};
}
package nss {
description = "Network Security Services";
website = "https://firefox-source-docs.mozilla.org/security/nss/index.html";
anitya = 2503;
version* = "3.123.1";
source = remoteGitHub {
suffix = "nss-dev/nss";
tag = "NSS_"+join {
elems = split {
s = version;
sep = ".";
n = 3;
};
sep = "_";
}+"_RTM";
checksum = "g811Z_fc74ssg-s6BeXRG-ipSfJggD6hrxjVJxrOBIz98CE7piv0OLwzIRLMQpwR";
};
extra = [ nspr ];
enterSource = true;
writable = true;
chmod = true;
early = "\nln -s extra/nspr/nspr /usr/src/nspr\n";
exec = make {
omitDefaults = true;
skipConfigure = true;
inPlace = true;
make = [
"CCC=clang++",
"NSDISTMODE=copy",
"BUILD_OPT=1",
"USE_64=1",
"nss_build_all",
];
skipCheck = true;
install = `
cp -r \
/usr/src/dist/. \
lib/ckfw/builtins/certdata.txt \
/work/
`;
};
inputs = [
perl,
python,
gawk,
coreutils,
zlib,
kernel-headers,
];
runtime = [ zlib ];
}
package nss-cacert {
description = "bundle of X.509 certificates of public Certificate Authorities";
website = "https://curl.se/docs/caextract.html";
version = unversioned;
source = nss;
exec = generic {
build = `
mkdir -p /work/system/etc/ssl/{certs/unbundled,certs/hashed,trust-source}
buildcatrust \
--certdata_input certdata.txt \
--ca_bundle_output /work/system/etc/ssl/certs/ca-bundle.crt \
--ca_standard_bundle_output /work/system/etc/ssl/certs/ca-no-trust-rules-bundle.crt \
--ca_unpacked_output /work/system/etc/ssl/certs/unbundled \
--ca_hashed_unpacked_output /work/system/etc/ssl/certs/hashed \
--p11kit_output /work/system/etc/ssl/trust-source/ca-bundle.trust.p11-kit
`;
};
inputs = [
bash,
buildcatrust,
];
}

View File

@@ -6,8 +6,7 @@ import (
"hakurei.app/internal/pkg" "hakurei.app/internal/pkg"
) )
// Perl is the perl interpreter used by [MakeMakerHelper]. var _perl = H("perl")
var Perl = H("perl")
// MakeMakerHelper is the [Perl] MakeMaker helper. // MakeMakerHelper is the [Perl] MakeMaker helper.
type MakeMakerHelper struct { type MakeMakerHelper struct {
@@ -16,7 +15,7 @@ type MakeMakerHelper struct {
} }
// extra returns perl. // extra returns perl.
func (*MakeMakerHelper) extra(int) P { return P{Perl, Make} } func (*MakeMakerHelper) extra(int) P { return P{_perl, _make} }
// wantsChmod returns true. // wantsChmod returns true.
func (*MakeMakerHelper) wantsChmod() bool { return true } func (*MakeMakerHelper) wantsChmod() bool { return true }
@@ -64,6 +63,6 @@ func (t Toolchain) newViaPerlMakeMaker(
return t.NewPackage("perl-"+name, version, source, &PackageAttr{ return t.NewPackage("perl-"+name, version, source, &PackageAttr{
Patches: patches, Patches: patches,
}, (*MakeMakerHelper)(nil), slices.Concat(extra, P{ }, (*MakeMakerHelper)(nil), slices.Concat(extra, P{
Perl, _perl,
})...) })...)
} }

View File

@@ -6,8 +6,10 @@ import (
"hakurei.app/internal/pkg" "hakurei.app/internal/pkg"
) )
// Python is the python interpreter used by [PipHelper]. var (
var Python = H("python") _python = H("python")
_pythonPyTest = H("python-pytest")
)
// PipHelper is the [Python] pip packaging helper. // PipHelper is the [Python] pip packaging helper.
type PipHelper struct { type PipHelper struct {
@@ -29,15 +31,12 @@ type PipHelper struct {
var _ Helper = new(PipHelper) var _ Helper = new(PipHelper)
// pythonPyTest is used by [PipHelper] for automated testing.
var pythonPyTest = H("python-pytest")
// extra returns python, or pytest if defaults are assumed. // extra returns python, or pytest if defaults are assumed.
func (attr *PipHelper) extra(int) P { func (attr *PipHelper) extra(int) P {
if attr == nil || (!attr.SkipCheck && attr.Check == "") { if attr == nil || (!attr.SkipCheck && attr.Check == "") {
return P{pythonPyTest} return P{_pythonPyTest}
} }
return P{Python} return P{_python}
} }
// wantsChmod returns true. // wantsChmod returns true.
@@ -113,7 +112,7 @@ func (s *S) newPythonPackage(
Website: website, Website: website,
Version: version, Version: version,
Dependencies: slices.Concat(P{Python}, extra), Dependencies: slices.Concat(P{_python}, extra),
ID: id, ID: id,
}, t.NewPackage(name, version, source, attrP, attr, slices.Concat( }, t.NewPackage(name, version, source, attrP, attr, slices.Concat(

View File

@@ -302,7 +302,7 @@ mkdir -vp /work/system/bin
base := LLVM base := LLVM
if flag&TNoToolchain != 0 { if flag&TNoToolchain != 0 {
base = musl base = _musl
} }
support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{ support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{
@@ -345,7 +345,7 @@ var patch = H("patch")
// NewPatchedSource returns [pkg.Artifact] of source with patches applied. If // NewPatchedSource returns [pkg.Artifact] of source with patches applied. If
// passthrough is true, source is returned as is for zero length patches. // passthrough is true, source is returned as is for zero length patches.
func (t Toolchain) NewPatchedSource( func (t Toolchain) NewPatchedSource(
name, version string, name string,
source pkg.Artifact, source pkg.Artifact,
passthrough bool, passthrough bool,
patches ...KV, patches ...KV,
@@ -363,7 +363,7 @@ func (t Toolchain) NewPatchedSource(
} }
paths[0] = pkg.Path(AbsUsrSrc.Append(name), false, source) paths[0] = pkg.Path(AbsUsrSrc.Append(name), false, source)
aname := name + "-" + version + "-src" aname := name + "-src"
script := ` script := `
cp -r /usr/src/` + name + `/. /work/. cp -r /usr/src/` + name + `/. /work/.
chmod -R +w /work && cd /work chmod -R +w /work && cd /work
@@ -491,6 +491,10 @@ func (t Toolchain) NewPackage(
if source == nil { if source == nil {
panic("source must be non-nil") panic("source must be non-nil")
} }
rn := name
if version != Unversioned {
rn = name + "-" + version
}
wantsChmod, wantsWrite := helper.wantsChmod(), helper.wantsWrite() wantsChmod, wantsWrite := helper.wantsChmod(), helper.wantsWrite()
extraRes := make([]pkg.Artifact, 0, 1<<3+len(extra)) extraRes := make([]pkg.Artifact, 0, 1<<3+len(extra))
{ {
@@ -519,7 +523,7 @@ func (t Toolchain) NewPackage(
sourceSuffix = ".tar.xz" sourceSuffix = ".tar.xz"
scriptEarly += ` scriptEarly += `
tar -C /usr/src/ -xf '/usr/src/` + name + `.tar.xz' tar -C /usr/src/ -xf '/usr/src/` + name + `.tar.xz'
mv '/usr/src/` + name + `-` + version + `' '/usr/src/` + name + `' mv '/usr/src/` + rn + `' '/usr/src/` + name + `'
` `
} }
@@ -544,7 +548,7 @@ cd '/usr/src/` + name + `/'
} }
return t.New( return t.New(
name+"-"+version, rn,
attr.Flag, attr.Flag,
extraRes, extraRes,
attr.KnownChecksum, attr.KnownChecksum,
@@ -554,7 +558,7 @@ cd '/usr/src/` + name + `/'
pkg.Path(AbsUsrSrc.Append( pkg.Path(AbsUsrSrc.Append(
name+sourceSuffix, name+sourceSuffix,
), attr.Writable || wantsWrite, t.NewPatchedSource( ), attr.Writable || wantsWrite, t.NewPatchedSource(
name, version, source, !attr.Chmod && !wantsChmod, attr.Patches..., rn, source, !attr.Chmod && !wantsChmod, attr.Patches...,
)), )),
})..., })...,
) )

View File

@@ -450,6 +450,8 @@ func (s *S) getFrame() azalea.Frame {
} }
s.frame.Val = map[unique.Handle[azalea.Ident]]any{ s.frame.Val = map[unique.Handle[azalea.Ident]]any{
k("unversioned"): Unversioned,
k("triple"): s.triple(), k("triple"): s.triple(),
k("linuxArch"): s.linuxArch(), k("linuxArch"): s.linuxArch(),
k("earlyLDFLAGS"): s.earlyLDFLAGS(false), k("earlyLDFLAGS"): s.earlyLDFLAGS(false),

View File

@@ -8,7 +8,7 @@ func (t Toolchain) newTamaGo() (pkg.Artifact, string) {
checksum = "-nH3MjAzDDLTeJ2hRKYJcJwo5-Ikci4zOHfB8j1vKn7zrF9TS6zYaoLi8qohGwAE" checksum = "-nH3MjAzDDLTeJ2hRKYJcJwo5-Ikci4zOHfB8j1vKn7zrF9TS6zYaoLi8qohGwAE"
) )
return t.New("tamago-go"+version, 0, t.Append(nil, return t.New("tamago-go"+version, 0, t.Append(nil,
bash, _bash,
_go, _go,
), nil, []string{ ), nil, []string{
"CC=cc", "CC=cc",

View File

@@ -58,10 +58,10 @@ mkdir -p /work/usr/bin
ln -s ../../system/bin/env /work/usr/bin ln -s ../../system/bin/env /work/usr/bin
`, `,
}, },
bash, _bash,
gzip, gzip,
kernelHeaders, _kernelHeaders,
), version ), version
} }
func init() { func init() {