aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa')
-rw-r--r--internal/rosa/dtc.go29
-rw-r--r--internal/rosa/fuse.go20
-rw-r--r--internal/rosa/gtk.go30
-rw-r--r--internal/rosa/kmod.go16
-rw-r--r--internal/rosa/meson.go105
-rw-r--r--internal/rosa/wayland.go43
6 files changed, 121 insertions, 122 deletions
diff --git a/internal/rosa/dtc.go b/internal/rosa/dtc.go
index 7dff7d22..e503060a 100644
--- a/internal/rosa/dtc.go
+++ b/internal/rosa/dtc.go
@@ -7,28 +7,27 @@ func (t Toolchain) newDTC() pkg.Artifact {
version = "1.7.2"
checksum = "vUoiRynPyYRexTpS6USweT5p4SVHvvVJs8uqFkkVD-YnFjwf6v3elQ0-Etrh00Dt"
)
- return t.NewViaMeson("dtc", version, t.NewPatchedSource(
- "dtc", version, pkg.NewHTTPGetTar(
- nil, "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/"+
- "dtc-v"+version+".tar.gz",
- mustDecode(checksum),
- pkg.TarGzip,
- ), false,
- ), &MesonAttr{
+ return t.NewPackage("dtc", version, pkg.NewHTTPGetTar(
+ nil, "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/"+
+ "dtc-v"+version+".tar.gz",
+ mustDecode(checksum),
+ pkg.TarGzip,
+ ), &PackageAttr{
// works around buggy test:
// fdtdump-runtest.sh /usr/src/dtc/tests/fdtdump.dts
Writable: true,
-
- Configure: [][2]string{
+ Chmod: true,
+ }, &MesonHelper{
+ Setup: [][2]string{
{"Dyaml", "disabled"},
{"Dstatic-build", "true"},
},
},
- t.Load(Flex),
- t.Load(Bison),
- t.Load(M4),
- t.Load(Coreutils),
- t.Load(Diffutils),
+ Flex,
+ Bison,
+ M4,
+ Coreutils,
+ Diffutils,
)
}
func init() { artifactsF[DTC] = Toolchain.newDTC }
diff --git a/internal/rosa/fuse.go b/internal/rosa/fuse.go
index 36b4bdd0..13781743 100644
--- a/internal/rosa/fuse.go
+++ b/internal/rosa/fuse.go
@@ -7,13 +7,13 @@ func (t Toolchain) newFuse() pkg.Artifact {
version = "3.18.1"
checksum = "COb-BgJRWXLbt9XUkNeuiroQizpMifXqxgieE1SlkMXhs_WGSyJStrmyewAw2hd6"
)
- return t.NewViaMeson("fuse", version, pkg.NewHTTPGetTar(
+ return t.NewPackage("fuse", version, pkg.NewHTTPGetTar(
nil, "https://github.com/libfuse/libfuse/releases/download/"+
"fuse-"+version+"/fuse-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
- ), &MesonAttr{
- Configure: [][2]string{
+ ), nil, &MesonHelper{
+ Setup: [][2]string{
{"Ddefault_library", "both"},
{"Dtests", "true"},
{"Duseroot", "false"},
@@ -22,15 +22,15 @@ func (t Toolchain) newFuse() pkg.Artifact {
ScriptCompiled: "python3 -m pytest test/",
// this project uses pytest
- SkipCheck: true,
+ SkipTest: true,
},
- t.Load(IniConfig),
- t.Load(Packaging),
- t.Load(Pluggy),
- t.Load(Pygments),
- t.Load(PyTest),
+ IniConfig,
+ Packaging,
+ Pluggy,
+ Pygments,
+ PyTest,
- t.Load(KernelHeaders),
+ KernelHeaders,
)
}
func init() { artifactsF[Fuse] = Toolchain.newFuse }
diff --git a/internal/rosa/gtk.go b/internal/rosa/gtk.go
index 78469e8d..06449ca2 100644
--- a/internal/rosa/gtk.go
+++ b/internal/rosa/gtk.go
@@ -12,21 +12,13 @@ func (t Toolchain) newGLib() pkg.Artifact {
version = "2.86.4"
checksum = "AfTjBrrxtXXPL6dFa1LfTe40PyPSth62CoIkM5m_VJTUngGLOFHw6I4XE7RGQE8G"
)
- return t.NewViaMeson("glib", version, pkg.NewHTTPGet(
+ return t.NewPackage("glib", version, pkg.NewHTTPGet(
nil, "https://download.gnome.org/sources/glib/"+
strings.Join(strings.SplitN(version, ".", 3)[:2], ".")+
"/glib-"+version+".tar.xz",
mustDecode(checksum),
- ), &MesonAttr{
- SourceSuffix: ".tar.xz",
- ScriptEarly: `
-cd /usr/src/
-tar xf glib.tar.xz
-mv glib-` + version + ` glib
-`,
- Configure: [][2]string{
- {"Ddefault_library", "both"},
- },
+ ), &PackageAttr{
+ SourceKind: sourceTarXZ,
Paths: []pkg.ExecPath{
pkg.Path(fhs.AbsEtc.Append(
@@ -42,14 +34,18 @@ mv glib-` + version + ` glib
[]byte("fefefefefefefefefefefefefefefefe\n"),
)),
},
+ }, &MesonHelper{
+ Setup: [][2]string{
+ {"Ddefault_library", "both"},
+ },
},
- t.Load(XZ),
- t.Load(Packaging),
- t.Load(Bash),
+ XZ,
+ Packaging,
+ Bash,
- t.Load(PCRE2),
- t.Load(Libffi),
- t.Load(Zlib),
+ PCRE2,
+ Libffi,
+ Zlib,
)
}
func init() { artifactsF[GLib] = Toolchain.newGLib }
diff --git a/internal/rosa/kmod.go b/internal/rosa/kmod.go
index 5be48732..4292bbf7 100644
--- a/internal/rosa/kmod.go
+++ b/internal/rosa/kmod.go
@@ -7,13 +7,13 @@ func (t Toolchain) newKmod() pkg.Artifact {
version = "34.2"
checksum = "0K7POeTKxMhExsaTsnKAC6LUNsRSfe6sSZxWONPbOu-GI_pXOw3toU_BIoqfBhJV"
)
- return t.NewViaMeson("kmod", version, pkg.NewHTTPGetTar(
+ return t.NewPackage("kmod", version, pkg.NewHTTPGetTar(
nil, "https://www.kernel.org/pub/linux/utils/kernel/"+
"kmod/kmod-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
- ), &MesonAttr{
- Configure: [][2]string{
+ ), nil, &MesonHelper{
+ Setup: [][2]string{
{"Dsysconfdir", "/system/etc"},
{"Dbashcompletiondir", "no"},
{"Dfishcompletiondir", "no"},
@@ -22,12 +22,12 @@ func (t Toolchain) newKmod() pkg.Artifact {
},
// makes assumptions about the running kernel
- SkipCheck: true,
+ SkipTest: true,
},
- t.Load(Zlib),
- t.Load(Zstd),
- t.Load(OpenSSL),
- t.Load(KernelHeaders),
+ Zlib,
+ Zstd,
+ OpenSSL,
+ KernelHeaders,
)
}
func init() { artifactsF[Kmod] = Toolchain.newKmod }
diff --git a/internal/rosa/meson.go b/internal/rosa/meson.go
index fbdb3637..317b102d 100644
--- a/internal/rosa/meson.go
+++ b/internal/rosa/meson.go
@@ -31,49 +31,59 @@ python3 setup.py \
}
func init() { artifactsF[Meson] = Toolchain.newMeson }
-// MesonAttr holds the project-specific attributes that will be applied to a new
-// [pkg.Artifact] compiled via [Meson].
-type MesonAttr struct {
- // Mount the source tree writable.
- Writable bool
-
- // Additional environment variables.
- Env []string
- // Runs before setup.
- ScriptEarly string
- // Runs after configure.
+// MesonHelper is the [Meson] build system helper.
+type MesonHelper struct {
+ // Runs after setup.
+ ScriptCompileEarly string
+ // Runs after compile.
ScriptCompiled string
// Runs after install.
Script string
// Flags passed to the setup command.
- Configure [][2]string
+ Setup [][2]string
// Whether to skip meson test.
- SkipCheck bool
- // Appended after the test command.
- AppendTest string
+ SkipTest bool
+}
- // Suffix appended to the source pathname.
- SourceSuffix string
+var _ Helper = new(MesonHelper)
- // Passed through to [Toolchain.New], before source.
- Paths []pkg.ExecPath
- // Passed through to [Toolchain.New].
- Flag int
+// name returns its arguments joined with '-'.
+func (*MesonHelper) name(name, version string) string {
+ return name + "-" + version
}
-// NewViaMeson returns a [pkg.Artifact] for compiling and installing via [Meson].
-func (t Toolchain) NewViaMeson(
- name, version string,
- source pkg.Artifact,
- attr *MesonAttr,
- extra ...pkg.Artifact,
-) pkg.Artifact {
- if name == "" || version == "" {
- panic("names must be non-empty")
+// extra returns hardcoded meson runtime dependencies.
+func (*MesonHelper) extra(int) []PArtifact {
+ return []PArtifact{
+ Python,
+ Meson,
+ Ninja,
+
+ PkgConfig,
+ CMake,
}
+}
+
+// wantsChmod returns false.
+func (*MesonHelper) wantsChmod() bool { return false }
+
+// wantsWrite returns false.
+func (*MesonHelper) wantsWrite() bool { return false }
+
+// scriptEarly returns the zero value.
+func (*MesonHelper) scriptEarly() string { return "" }
+
+// createDir returns false.
+func (*MesonHelper) createDir() bool { return false }
+
+// wantsDir requests a new directory in TMPDIR.
+func (*MesonHelper) wantsDir() string { return `"$(mktemp -d)"` }
+
+// script generates the cure script.
+func (attr *MesonHelper) script(name string) string {
if attr == nil {
- attr = new(MesonAttr)
+ attr = new(MesonHelper)
}
scriptCompiled := attr.ScriptCompiled
@@ -81,26 +91,21 @@ func (t Toolchain) NewViaMeson(
scriptCompiled = "\n" + scriptCompiled
}
- var check string
- if !attr.SkipCheck {
- check = "\nmeson test \\\n\t--print-errorlogs" + attr.AppendTest
+ var scriptTest string
+ if !attr.SkipTest {
+ scriptTest = `
+meson test \
+ --print-errorlogs`
}
- return t.New(name+"-"+version, attr.Flag, slices.Concat([]pkg.Artifact{
- t.Load(Python),
- t.Load(Meson),
- t.Load(Ninja),
-
- t.Load(PkgConfig),
- t.Load(CMake),
- }, extra), nil, attr.Env, attr.ScriptEarly+`
+ return `
cd "$(mktemp -d)"
meson setup \
- `+strings.Join(slices.Collect(func(yield func(string) bool) {
+ ` + strings.Join(slices.Collect(func(yield func(string) bool) {
for _, v := range append([][2]string{
{"prefix", "/system"},
{"buildtype", "release"},
- }, attr.Configure...) {
+ }, attr.Setup...) {
s := "-" + v[0]
if len(v[0]) > 0 && v[0][0] != 'D' {
s = "-" + s
@@ -112,14 +117,10 @@ meson setup \
return
}
}
- }), " \\\n\t")+` \
- . /usr/src/`+name+`
-meson compile`+scriptCompiled+check+`
+ }), " \\\n\t") + ` \
+ . '/usr/src/` + name + `'
+meson compile` + scriptCompiled + scriptTest + `
meson install \
--destdir=/work
-`+attr.Script, slices.Concat(attr.Paths, []pkg.ExecPath{
- pkg.Path(AbsUsrSrc.Append(
- name+attr.SourceSuffix,
- ), attr.Writable, source),
- })...)
+` + attr.Script
}
diff --git a/internal/rosa/wayland.go b/internal/rosa/wayland.go
index 063c71b0..00c5862d 100644
--- a/internal/rosa/wayland.go
+++ b/internal/rosa/wayland.go
@@ -7,30 +7,31 @@ func (t Toolchain) newWayland() pkg.Artifact {
version = "1.24.0"
checksum = "JxgLiFRRGw2D3uhVw8ZeDbs3V7K_d4z_ypDog2LBqiA_5y2vVbUAk5NT6D5ozm0m"
)
- return t.NewViaMeson("wayland", version, pkg.NewHTTPGetTar(
+ return t.NewPackage("wayland", version, pkg.NewHTTPGetTar(
nil, "https://gitlab.freedesktop.org/wayland/wayland/"+
"-/archive/"+version+"/wayland-"+version+".tar.bz2",
mustDecode(checksum),
pkg.TarBzip2,
- ), &MesonAttr{
+ ), &PackageAttr{
Writable: true,
ScriptEarly: `
cd /usr/src/wayland
chmod +w tests tests/sanity-test.c
echo 'int main(){}' > tests/sanity-test.c
`,
- Configure: [][2]string{
+ }, &MesonHelper{
+ Setup: [][2]string{
{"Ddefault_library", "both"},
{"Ddocumentation", "false"},
{"Dtests", "true"},
},
},
- t.Load(Gawk),
- t.Load(Diffutils),
+ Gawk,
+ Diffutils,
- t.Load(Libffi),
- t.Load(Libexpat),
- t.Load(Libxml2),
+ Libffi,
+ Libexpat,
+ Libxml2,
)
}
func init() { artifactsF[Wayland] = Toolchain.newWayland }
@@ -40,13 +41,14 @@ func (t Toolchain) newWaylandProtocols() pkg.Artifact {
version = "1.47"
checksum = "B_NodZ7AQfCstcx7kgbaVjpkYOzbAQq0a4NOk-SA8bQixAE20FY3p1-6gsbPgHn9"
)
- return t.NewViaMeson("wayland-protocols", version, t.NewPatchedSource(
- "wayland-protocols", version, pkg.NewHTTPGetTar(
- nil, "https://gitlab.freedesktop.org/wayland/wayland-protocols/"+
- "-/archive/"+version+"/wayland-protocols-"+version+".tar.bz2",
- mustDecode(checksum),
- pkg.TarBzip2,
- ), false, [2]string{"build-only", `From 8b4c76275fa1b6e0a99a53494151d9a2c907144d Mon Sep 17 00:00:00 2001
+ return t.NewPackage("wayland-protocols", version, pkg.NewHTTPGetTar(
+ nil, "https://gitlab.freedesktop.org/wayland/wayland-protocols/"+
+ "-/archive/"+version+"/wayland-protocols-"+version+".tar.bz2",
+ mustDecode(checksum),
+ pkg.TarBzip2,
+ ), &PackageAttr{
+ Patches: [][2]string{
+ {"build-only", `From 8b4c76275fa1b6e0a99a53494151d9a2c907144d Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Fri, 8 Nov 2024 11:27:25 -0600
Subject: [PATCH] tests: Make build-only tests actually build-only
@@ -97,11 +99,12 @@ index aa216ec2..5a93bb36 100644
--
GitLab
`},
- ), nil,
- t.Load(Wayland),
- t.Load(Libffi),
- t.Load(Libexpat),
- t.Load(Libxml2),
+ },
+ }, (*MesonHelper)(nil),
+ Wayland,
+ Libffi,
+ Libexpat,
+ Libxml2,
)
}
func init() { artifactsF[WaylandProtocols] = Toolchain.newWaylandProtocols }