From ef414ab01a28b61ef01766c3dd28ed2342f5ab75 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 20 May 2026 03:14:11 +0900 Subject: [PATCH] internal/rosa/package: migrate many libraries This also adds more string helpers. Signed-off-by: Ophestra --- internal/rosa/libbsd.go | 58 ------------------- internal/rosa/libcap.go | 52 ----------------- internal/rosa/libdisplay-info.go | 28 --------- internal/rosa/libepoxy.go | 31 ---------- internal/rosa/libev.go | 24 -------- internal/rosa/libexpat.go | 32 ---------- internal/rosa/libffi.go | 28 --------- internal/rosa/libgd.go | 38 ------------ internal/rosa/libpng.go | 36 ------------ internal/rosa/libpsl.go | 35 ----------- internal/rosa/libseccomp.go | 53 ----------------- internal/rosa/libtirpc.go | 42 -------------- internal/rosa/libucontext.go | 37 ------------ internal/rosa/libxml2.go | 30 ---------- internal/rosa/libxslt.go | 40 ------------- internal/rosa/package/libbsd.az | 23 ++++++++ internal/rosa/package/libcap.az | 44 ++++++++++++++ .../libconfig/disable-broken-tests.patch} | 30 +--------- internal/rosa/package/libconfig/package.az | 15 +++++ internal/rosa/package/libdisplay-info.az | 21 +++++++ internal/rosa/package/libepoxy.az | 21 +++++++ internal/rosa/package/libev.az | 14 +++++ internal/rosa/package/libexpat.az | 22 +++++++ internal/rosa/package/libffi.az | 18 ++++++ internal/rosa/package/libgd.az | 25 ++++++++ internal/rosa/package/libmd.az | 22 +++++++ internal/rosa/package/libpng.az | 27 +++++++++ internal/rosa/package/libpsl.az | 25 ++++++++ .../libseccomp/fix-export-oob-read.patch | 13 +++++ internal/rosa/package/libseccomp/package.az | 27 +++++++++ internal/rosa/package/libtirpc.az | 36 ++++++++++++ internal/rosa/package/libucontext.az | 28 +++++++++ internal/rosa/package/libxml2.az | 23 ++++++++ internal/rosa/package/libxslt.az | 31 ++++++++++ internal/rosa/state.go | 43 ++++++++++++++ internal/rosa/state_native.go | 2 - 36 files changed, 479 insertions(+), 595 deletions(-) delete mode 100644 internal/rosa/libbsd.go delete mode 100644 internal/rosa/libcap.go delete mode 100644 internal/rosa/libdisplay-info.go delete mode 100644 internal/rosa/libepoxy.go delete mode 100644 internal/rosa/libev.go delete mode 100644 internal/rosa/libexpat.go delete mode 100644 internal/rosa/libffi.go delete mode 100644 internal/rosa/libgd.go delete mode 100644 internal/rosa/libpng.go delete mode 100644 internal/rosa/libpsl.go delete mode 100644 internal/rosa/libseccomp.go delete mode 100644 internal/rosa/libtirpc.go delete mode 100644 internal/rosa/libucontext.go delete mode 100644 internal/rosa/libxml2.go delete mode 100644 internal/rosa/libxslt.go create mode 100644 internal/rosa/package/libbsd.az create mode 100644 internal/rosa/package/libcap.az rename internal/rosa/{libconfig.go => package/libconfig/disable-broken-tests.patch} (50%) create mode 100644 internal/rosa/package/libconfig/package.az create mode 100644 internal/rosa/package/libdisplay-info.az create mode 100644 internal/rosa/package/libepoxy.az create mode 100644 internal/rosa/package/libev.az create mode 100644 internal/rosa/package/libexpat.az create mode 100644 internal/rosa/package/libffi.az create mode 100644 internal/rosa/package/libgd.az create mode 100644 internal/rosa/package/libmd.az create mode 100644 internal/rosa/package/libpng.az create mode 100644 internal/rosa/package/libpsl.az create mode 100644 internal/rosa/package/libseccomp/fix-export-oob-read.patch create mode 100644 internal/rosa/package/libseccomp/package.az create mode 100644 internal/rosa/package/libtirpc.az create mode 100644 internal/rosa/package/libucontext.az create mode 100644 internal/rosa/package/libxml2.az create mode 100644 internal/rosa/package/libxslt.az diff --git a/internal/rosa/libbsd.go b/internal/rosa/libbsd.go deleted file mode 100644 index a1b1ff84..00000000 --- a/internal/rosa/libbsd.go +++ /dev/null @@ -1,58 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibmd() (pkg.Artifact, string) { - const ( - version = "1.2.0" - checksum = "1rJ6joAO0wwMZvSfnRNkc1MOhywyAq7SM8VmF92NvDtv7Qdl1LRbjm5fg_DFFtGj" - ) - return t.NewPackage("libmd", version, t.newTagRemote( - "https://git.hadrons.org/git/libmd.git", - version, checksum, - ), nil, &MakeHelper{ - Generate: "echo '" + version + "' > .dist-version && ./autogen", - ScriptMakeEarly: ` -install -D /usr/src/libmd/src/helper.c src/helper.c -`, - }, - Automake, - Libtool, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibmd, &Metadata{ - Name: "libmd", - Description: "Message Digest functions from BSD systems", - Website: "https://www.hadrons.org/software/libmd/", - - ID: 15525, - }) -} - -func (t Toolchain) newLibbsd() (pkg.Artifact, string) { - const ( - version = "0.12.2" - checksum = "NVS0xFLTwSP8JiElEftsZ-e1_C-IgJhHrHE77RwKt5178M7r087waO-zYx2_dfGX" - ) - return t.NewPackage("libbsd", version, t.newTagRemote( - "https://gitlab.freedesktop.org/libbsd/libbsd.git", - version, checksum, - ), nil, &MakeHelper{ - Generate: "echo '" + version + "' > .dist-version && ./autogen", - }, - Automake, - Libtool, - - Libmd, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibbsd, &Metadata{ - Name: "libbsd", - Description: "provides useful functions commonly found on BSD systems", - Website: "https://libbsd.freedesktop.org/", - - ID: 1567, - }) -} diff --git a/internal/rosa/libcap.go b/internal/rosa/libcap.go deleted file mode 100644 index 5c1a0123..00000000 --- a/internal/rosa/libcap.go +++ /dev/null @@ -1,52 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibcap() (pkg.Artifact, string) { - const ( - version = "2.78" - checksum = "wFdUkBhFMD9InPnrBZyegWrlPSAg_9JiTBC-eSFyWWlmbzL2qjh2mKxr9Kx2a8ut" - ) - return t.NewPackage("libcap", version, newTar( - "https://git.kernel.org/pub/scm/libs/libcap/libcap.git/"+ - "snapshot/libcap-"+version+".tar.gz", - checksum, - pkg.TarGzip, - ), &PackageAttr{ - // uses source tree as scratch space - Writable: true, - Chmod: true, - - Env: []string{ - "prefix=/system", - "lib=lib", - }, - ScriptEarly: ` -ln -s ../system/bin/bash /bin/ -`, - }, &MakeHelper{ - SkipConfigure: true, - InPlace: true, - - Make: []string{ - "CC=cc", - "all", - }, - Check: []string{ - "CC=cc", - "test", - }, - }, - Bash, - Diffutils, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibcap, &Metadata{ - Name: "libcap", - Description: "a library for getting and setting POSIX.1e draft 15 capabilities", - Website: "https://sites.google.com/site/fullycapable/", - - ID: 1569, - }) -} diff --git a/internal/rosa/libdisplay-info.go b/internal/rosa/libdisplay-info.go deleted file mode 100644 index 4a4d17bf..00000000 --- a/internal/rosa/libdisplay-info.go +++ /dev/null @@ -1,28 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibdisplayInfo() (pkg.Artifact, string) { - const ( - version = "0.3.0" - checksum = "yjOqPUHHYgRtpqGw5RI1n2Q1_hO5j0LiFNMbjcRWV4Nf71XwwoC9fZMlKBDeLchT" - ) - return t.NewPackage("libdisplay-info", version, newFromGitLab( - "gitlab.freedesktop.org", - "emersion/libdisplay-info", - version, checksum, - ), nil, (*MesonHelper)(nil), - Diffutils, - - Hwdata, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibdisplayInfo, &Metadata{ - Name: "libdisplay-info", - Description: "EDID and DisplayID library", - Website: "https://gitlab.freedesktop.org/emersion/libdisplay-info", - - ID: 326668, - }) -} diff --git a/internal/rosa/libepoxy.go b/internal/rosa/libepoxy.go deleted file mode 100644 index 1704e5a4..00000000 --- a/internal/rosa/libepoxy.go +++ /dev/null @@ -1,31 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibepoxy() (pkg.Artifact, string) { - const ( - version = "1.5.10" - checksum = "OHI8wshrlGw6BMGrmSyejJtwzM2gPhyFJrTsKxULyKMmYrfgcOe7Iw2ibVoUND_Q" - ) - return t.NewPackage("libepoxy", version, newFromGitHub( - "anholt/libepoxy", - version, - checksum, - ), nil, &MesonHelper{ - Setup: []KV{ - {"Dglx", "no"}, - {"Degl", "no"}, - }, - }, - LibX11, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibepoxy, &Metadata{ - Name: "libepoxy", - Description: "a library for handling OpenGL function pointer management", - Website: "https://github.com/anholt/libepoxy", - - ID: 6090, - }) -} diff --git a/internal/rosa/libev.go b/internal/rosa/libev.go deleted file mode 100644 index 6015382a..00000000 --- a/internal/rosa/libev.go +++ /dev/null @@ -1,24 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibev() (pkg.Artifact, string) { - const ( - version = "4.33" - checksum = "774eSXV_4k8PySRprUDChbEwsw-kzjIFnJ3MpNOl5zDpamBRvC3BqPyRxvkwcL6_" - ) - return t.NewPackage("libev", version, newTar( - "https://dist.schmorp.de/libev/Attic/libev-"+version+".tar.gz", - checksum, - pkg.TarGzip, - ), nil, (*MakeHelper)(nil)), version -} -func init() { - native.mustRegister(Toolchain.newLibev, &Metadata{ - Name: "libev", - Description: "a full-featured and high-performance event loop", - Website: "http://libev.schmorp.de/", - - ID: 1605, - }) -} diff --git a/internal/rosa/libexpat.go b/internal/rosa/libexpat.go deleted file mode 100644 index 1f1f9225..00000000 --- a/internal/rosa/libexpat.go +++ /dev/null @@ -1,32 +0,0 @@ -package rosa - -import ( - "strings" - - "hakurei.app/internal/pkg" -) - -func (t Toolchain) newLibexpat() (pkg.Artifact, string) { - const ( - version = "2.8.1" - checksum = "iMEtbOJhQfGof2GxSlxffQSI1va_NDDQ9VIuqcPbNZ0291Dr8wttD5QecYyjIQap" - ) - return t.NewPackage("libexpat", version, newFromGitHubRelease( - "libexpat/libexpat", - "R_"+strings.ReplaceAll(version, ".", "_"), - "expat-"+version+".tar.bz2", - checksum, - pkg.TarBzip2, - ), nil, (*MakeHelper)(nil), - Bash, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibexpat, &Metadata{ - Name: "libexpat", - Description: "a stream-oriented XML parser library", - Website: "https://libexpat.github.io/", - - ID: 770, - }) -} diff --git a/internal/rosa/libffi.go b/internal/rosa/libffi.go deleted file mode 100644 index 01a70b5e..00000000 --- a/internal/rosa/libffi.go +++ /dev/null @@ -1,28 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibffi() (pkg.Artifact, string) { - const ( - version = "3.5.2" - checksum = "2_Q-ZNBBbVhltfL5zEr0wljxPegUimTK4VeMSiwJEGksls3n4gj3lV0Ly3vviSFH" - ) - return t.NewPackage("libffi", version, newFromGitHubRelease( - "libffi/libffi", - "v"+version, - "libffi-"+version+".tar.gz", - checksum, - pkg.TarGzip, - ), nil, (*MakeHelper)(nil), - KernelHeaders, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibffi, &Metadata{ - Name: "libffi", - Description: "a portable, high level programming interface to various calling conventions", - Website: "https://sourceware.org/libffi/", - - ID: 1611, - }) -} diff --git a/internal/rosa/libgd.go b/internal/rosa/libgd.go deleted file mode 100644 index 98ce0083..00000000 --- a/internal/rosa/libgd.go +++ /dev/null @@ -1,38 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibgd() (pkg.Artifact, string) { - const ( - version = "2.3.3" - checksum = "8T-sh1_FJT9K9aajgxzh8ot6vWIF-xxjcKAHvTak9MgGUcsFfzP8cAvvv44u2r36" - ) - return t.NewPackage("libgd", version, newFromGitHubRelease( - "libgd/libgd", - "gd-"+version, - "libgd-"+version+".tar.gz", checksum, - pkg.TarGzip, - ), &PackageAttr{ - Env: []string{ - "TMPDIR=/dev/shm/gd", - }, - ScriptEarly: ` -mkdir /dev/shm/gd -`, - }, (*MakeHelper)(nil), - Zlib, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibgd, &Metadata{ - Name: "libgd", - Description: "an open source code library for the dynamic creation of images", - Website: "https://libgd.github.io/", - - Dependencies: P{ - Zlib, - }, - - ID: 880, - }) -} diff --git a/internal/rosa/libpng.go b/internal/rosa/libpng.go deleted file mode 100644 index 2d0807ba..00000000 --- a/internal/rosa/libpng.go +++ /dev/null @@ -1,36 +0,0 @@ -package rosa - -import ( - "strings" - - "hakurei.app/internal/pkg" -) - -func (t Toolchain) newLibpng() (pkg.Artifact, string) { - const ( - version = "1.6.58" - checksum = "m_a5lROJH7vmF3cMjqwTUqURuQLhV1JQx2ySPzcN3VPdgDB9pG3UINsIx_mtkr-t" - ) - return t.NewPackage("libpng", version, newTar( - "https://downloads.sourceforge.net/project/libpng/libpng"+ - strings.Join(strings.SplitN(version, ".", 3)[:2], "")+ - "/"+version+"/libpng-"+version+".tar.gz", - checksum, - pkg.TarGzip, - ), nil, (*MakeHelper)(nil), - Zlib, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibpng, &Metadata{ - Name: "libpng", - Description: "the official PNG reference library", - Website: "https://www.libpng.org/pub/png/libpng.html", - - Dependencies: P{ - Zlib, - }, - - ID: 1705, - }) -} diff --git a/internal/rosa/libpsl.go b/internal/rosa/libpsl.go deleted file mode 100644 index 69fff34b..00000000 --- a/internal/rosa/libpsl.go +++ /dev/null @@ -1,35 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibpsl() (pkg.Artifact, string) { - const ( - version = "0.21.5" - checksum = "XjfxSzh7peG2Vg4vJlL8z4JZJLcXqbuP6pLWkrGCmRxlnYUFTKNBqWGHCxEOlCad" - ) - return t.NewPackage("libpsl", version, newFromGitHubRelease( - "rockdaboot/libpsl", - version, - "libpsl-"+version+".tar.gz", - checksum, - pkg.TarGzip, - ), &PackageAttr{ - Writable: true, - ScriptEarly: ` -test_disable() { chmod +w "$2" && echo "$1" > "$2"; } - -test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c -`, - }, (*MakeHelper)(nil), - Python, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibpsl, &Metadata{ - Name: "libpsl", - Description: "provides functions to work with the Mozilla Public Suffix List", - Website: "https://rockdaboot.github.io/libpsl/", - - ID: 7305, - }) -} diff --git a/internal/rosa/libseccomp.go b/internal/rosa/libseccomp.go deleted file mode 100644 index 5cf0154a..00000000 --- a/internal/rosa/libseccomp.go +++ /dev/null @@ -1,53 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibseccomp() (pkg.Artifact, string) { - const ( - version = "2.6.0" - checksum = "mMu-iR71guPjFbb31u-YexBaanKE_nYPjPux-vuBiPfS_0kbwJdfCGlkofaUm-EY" - ) - return t.NewPackage("libseccomp", version, newFromGitHubRelease( - "seccomp/libseccomp", - "v"+version, - "libseccomp-"+version+".tar.gz", - checksum, - pkg.TarGzip, - ), &PackageAttr{ - ScriptEarly: ` -ln -s ../system/bin/bash /bin/ -`, - - Patches: []KV{ - {"fix-export-oob-read", `diff --git a/src/api.c b/src/api.c -index adccef3..65a277a 100644 ---- a/src/api.c -+++ b/src/api.c -@@ -786,7 +786,7 @@ API int seccomp_export_bpf_mem(const scmp_filter_ctx ctx, void *buf, - if (BPF_PGM_SIZE(program) > *len) - rc = _rc_filter(-ERANGE); - else -- memcpy(buf, program->blks, *len); -+ memcpy(buf, program->blks, BPF_PGM_SIZE(program)); - } - *len = BPF_PGM_SIZE(program); - -`}, - }, - }, (*MakeHelper)(nil), - Bash, - Diffutils, - Gperf, - - KernelHeaders, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibseccomp, &Metadata{ - Name: "libseccomp", - Description: "an interface to the Linux Kernel's syscall filtering mechanism", - Website: "https://github.com/seccomp/libseccomp/", - - ID: 13823, - }) -} diff --git a/internal/rosa/libtirpc.go b/internal/rosa/libtirpc.go deleted file mode 100644 index 3cba7c9d..00000000 --- a/internal/rosa/libtirpc.go +++ /dev/null @@ -1,42 +0,0 @@ -package rosa - -import ( - "strings" - - "hakurei.app/internal/pkg" -) - -func (t Toolchain) newLibtirpc() (pkg.Artifact, string) { - const ( - version = "1.3.7" - checksum = "nzFfu7LNvnSNiNAryD1vtnNWnU-Xqee8KqfXUKoBf5yjb5-dkeRkYuRijdCoYLof" - ) - return t.NewPackage("libtirpc", version, t.newTagRemote( - "git://linux-nfs.org/~steved/libtirpc", - "libtirpc-"+ - strings.Join(strings.SplitN(version, ".", 3), "-"), - checksum, - ), nil, &MakeHelper{ - Generate: "sh -e ./bootstrap", - Configure: []KV{ - {"CFLAGS", `"$(pkg-config --cflags libbsd-overlay) ${CFLAGS:-}"`}, - {"disable-gssapi"}, - }, - }, - Automake, - Libtool, - PkgConfig, - - Libbsd, - KernelHeaders, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibtirpc, &Metadata{ - Name: "libtirpc", - Description: "a port of Suns Transport-Independent RPC library to Linux", - Website: "https://sourceforge.net/projects/libtirpc/", - - ID: 1740, - }) -} diff --git a/internal/rosa/libucontext.go b/internal/rosa/libucontext.go deleted file mode 100644 index d693cb12..00000000 --- a/internal/rosa/libucontext.go +++ /dev/null @@ -1,37 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibucontext() (pkg.Artifact, string) { - const ( - version = "1.5.1" - checksum = "mUgeyJknjMxT-5fORzz-rqhZfP3Y7EZGBhOwvhuX7MsF4Pk9wkuwtrLf5IML-jWu" - ) - return t.NewPackage("libucontext", version, newFromGitHub( - "kaniini/libucontext", - "libucontext-"+version, - checksum, - ), &PackageAttr{ - // uses source tree as scratch space - Writable: true, - Chmod: true, - EnterSource: true, - }, &MakeHelper{ - OmitDefaults: true, - SkipConfigure: true, - InPlace: true, - Make: []string{ - "ARCH=" + t.linuxArch(), - }, - Install: "make prefix=/system DESTDIR=/work install", - }), version -} -func init() { - native.mustRegister(Toolchain.newLibucontext, &Metadata{ - Name: "libucontext", - Description: "ucontext implementation featuring glibc-compatible ABI", - Website: "https://github.com/kaniini/libucontext/", - - ID: 17085, - }) -} diff --git a/internal/rosa/libxml2.go b/internal/rosa/libxml2.go deleted file mode 100644 index 80ad9430..00000000 --- a/internal/rosa/libxml2.go +++ /dev/null @@ -1,30 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibxml2() (pkg.Artifact, string) { - const ( - version = "2.15.3" - checksum = "oJy74htGlEpf70KPvpW18fYJo0RQQkCXZRwqUz6NoXborS3HCq3Nm4gsyaSeNmUH" - ) - return t.NewPackage("libxml2", version, newFromGitLab( - "gitlab.gnome.org", - "GNOME/libxml2", - "v"+version, checksum, - ), &PackageAttr{ - // can't create shell.out: Read-only file system - Writable: true, - }, (*MesonHelper)(nil), - Git, - Diffutils, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibxml2, &Metadata{ - Name: "libxml2", - Description: "an XML toolkit implemented in C", - Website: "https://gitlab.gnome.org/GNOME/libxml2/", - - ID: 1783, - }) -} diff --git a/internal/rosa/libxslt.go b/internal/rosa/libxslt.go deleted file mode 100644 index 0161b2da..00000000 --- a/internal/rosa/libxslt.go +++ /dev/null @@ -1,40 +0,0 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibxslt() (pkg.Artifact, string) { - const ( - version = "1.1.45" - checksum = "67ks7v8od2oWaEGf23Sst_Xbn_8brQyolQjqxPoO-lK35k_WJhi2Px5JJgbk-nfn" - ) - return t.NewPackage("libxslt", version, newFromGitLab( - "gitlab.gnome.org", - "GNOME/libxslt", - "v"+version, checksum, - ), nil, &MakeHelper{ - Generate: "NOCONFIGURE=1 ./autogen.sh", - - // python libxml2 cyclic dependency - SkipCheck: true, - }, - Automake, - Libtool, - Python, - PkgConfig, - - Libxml2, - ), version -} -func init() { - native.mustRegister(Toolchain.newLibxslt, &Metadata{ - Name: "libxslt", - Description: "an XSLT processor based on libxml2", - Website: "https://gitlab.gnome.org/GNOME/libxslt/", - - Dependencies: P{ - Libxml2, - }, - - ID: 13301, - }) -} diff --git a/internal/rosa/package/libbsd.az b/internal/rosa/package/libbsd.az new file mode 100644 index 00000000..0e381e21 --- /dev/null +++ b/internal/rosa/package/libbsd.az @@ -0,0 +1,23 @@ +package libbsd { + description = "provides useful functions commonly found on BSD systems"; + website = "https://libbsd.freedesktop.org"; + anitya = 1567; + + version* = "0.12.2"; + source = remoteGit { + url = "https://gitlab.freedesktop.org/libbsd/libbsd.git"; + tag = version; + checksum = "NVS0xFLTwSP8JiElEftsZ-e1_C-IgJhHrHE77RwKt5178M7r087waO-zYx2_dfGX"; + }; + + exec = make { + generate = "echo '" + version + "' > .dist-version && ./autogen"; + }; + + inputs = [ + automake, + libtool, + + libmd, + ]; +} diff --git a/internal/rosa/package/libcap.az b/internal/rosa/package/libcap.az new file mode 100644 index 00000000..5e476256 --- /dev/null +++ b/internal/rosa/package/libcap.az @@ -0,0 +1,44 @@ +package libcap { + description = "a library for getting and setting POSIX.1e draft 15 capabilities"; + website = "https://sites.google.com/site/fullycapable"; + anitya = 1569; + + version* = "2.78"; + source = remoteTar { + url = "https://git.kernel.org/pub/scm/libs/libcap/libcap.git/"+ + "snapshot/libcap-"+version+".tar.gz"; + checksum = "wFdUkBhFMD9InPnrBZyegWrlPSAg_9JiTBC-eSFyWWlmbzL2qjh2mKxr9Kx2a8ut"; + compress = gzip; + }; + + // uses source tree as scratch space + writable = true; + chmod = true; + + env = [ + "prefix=/system", + "lib=lib", + ]; + + early = "\nln -s ../system/bin/bash /bin/\n"; + + exec = make { + skipConfigure = true; + inPlace = true; + + make = [ + "CC=cc", + "all", + ]; + + check = [ + "CC=cc", + "test", + ]; + }; + + inputs = [ + bash, + diffutils, + ]; +} diff --git a/internal/rosa/libconfig.go b/internal/rosa/package/libconfig/disable-broken-tests.patch similarity index 50% rename from internal/rosa/libconfig.go rename to internal/rosa/package/libconfig/disable-broken-tests.patch index dfe2c6fc..9378221b 100644 --- a/internal/rosa/libconfig.go +++ b/internal/rosa/package/libconfig/disable-broken-tests.patch @@ -1,19 +1,4 @@ -package rosa - -import "hakurei.app/internal/pkg" - -func (t Toolchain) newLibconfig() (pkg.Artifact, string) { - const ( - version = "1.8.2" - checksum = "fD32hjeAZuTz98g6WYHRwsxphrgrEFqxi5Z1jlJemPckPBfxpS3i5HgshAuA6vmT" - ) - return t.NewPackage("libconfig", version, newFromGitHub( - "hyperrealm/libconfig", - "v"+version, - checksum, - ), &PackageAttr{ - Patches: []KV{ - {"disable-broken-tests", `diff --git a/tests/tests.c b/tests/tests.c +diff --git a/tests/tests.c b/tests/tests.c index eba7eae..f916d2e 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -33,16 +18,3 @@ index eba7eae..f916d2e 100644 TT_SUITE_RUN(LibConfigTests); failures = TT_SUITE_NUM_FAILURES(LibConfigTests); TT_SUITE_END(LibConfigTests); -`}, - }, - }, (*CMakeHelper)(nil)), version -} -func init() { - native.mustRegister(Toolchain.newLibconfig, &Metadata{ - Name: "libconfig", - Description: "a simple library for processing structured configuration files", - Website: "https://hyperrealm.github.io/libconfig/", - - ID: 1580, - }) -} diff --git a/internal/rosa/package/libconfig/package.az b/internal/rosa/package/libconfig/package.az new file mode 100644 index 00000000..e4110b80 --- /dev/null +++ b/internal/rosa/package/libconfig/package.az @@ -0,0 +1,15 @@ +package libconfig { + description = "a simple library for processing structured configuration files"; + website = "https://hyperrealm.github.io/libconfig"; + anitya = 1580; + + version* = "1.8.2"; + source = remoteGitHub { + suffix = "hyperrealm/libconfig"; + tag = "v"+version; + checksum = "fD32hjeAZuTz98g6WYHRwsxphrgrEFqxi5Z1jlJemPckPBfxpS3i5HgshAuA6vmT"; + }; + patches = [ "disable-broken-tests.patch" ]; + + exec = cmake {}; +} diff --git a/internal/rosa/package/libdisplay-info.az b/internal/rosa/package/libdisplay-info.az new file mode 100644 index 00000000..dca259f5 --- /dev/null +++ b/internal/rosa/package/libdisplay-info.az @@ -0,0 +1,21 @@ +package libdisplay-info { + description = "EDID and DisplayID library"; + website = "https://gitlab.freedesktop.org/emersion/libdisplay-info"; + anitya = 326668; + + version* = "0.3.0"; + source = remoteGitLab { + domain = "gitlab.freedesktop.org"; + suffix = "emersion/libdisplay-info"; + ref = version; + checksum = "yjOqPUHHYgRtpqGw5RI1n2Q1_hO5j0LiFNMbjcRWV4Nf71XwwoC9fZMlKBDeLchT"; + }; + + exec = meson {}; + + inputs = [ + diffutils, + + hwdata, + ]; +} diff --git a/internal/rosa/package/libepoxy.az b/internal/rosa/package/libepoxy.az new file mode 100644 index 00000000..aef55336 --- /dev/null +++ b/internal/rosa/package/libepoxy.az @@ -0,0 +1,21 @@ +package libepoxy { + description = "a library for handling OpenGL function pointer management"; + website = "https://github.com/anholt/libepoxy"; + anitya = 6090; + + version* = "1.5.10"; + source = remoteGitHub { + suffix = "anholt/libepoxy"; + tag = version; + checksum = "OHI8wshrlGw6BMGrmSyejJtwzM2gPhyFJrTsKxULyKMmYrfgcOe7Iw2ibVoUND_Q"; + }; + + exec = meson { + setup = { + "Dglx": "no"; + "Degl": "no"; + }; + }; + + inputs = [ libX11 ]; +} diff --git a/internal/rosa/package/libev.az b/internal/rosa/package/libev.az new file mode 100644 index 00000000..20827d80 --- /dev/null +++ b/internal/rosa/package/libev.az @@ -0,0 +1,14 @@ +package libev { + description = "a full-featured and high-performance event loop"; + website = "http://libev.schmorp.de"; + anitya = 1605; + + version* = "4.33"; + source = remoteTar { + url = "https://dist.schmorp.de/libev/Attic/libev-"+version+".tar.gz"; + checksum = "774eSXV_4k8PySRprUDChbEwsw-kzjIFnJ3MpNOl5zDpamBRvC3BqPyRxvkwcL6_"; + compress = gzip; + }; + + exec = make {}; +} diff --git a/internal/rosa/package/libexpat.az b/internal/rosa/package/libexpat.az new file mode 100644 index 00000000..9c7990f8 --- /dev/null +++ b/internal/rosa/package/libexpat.az @@ -0,0 +1,22 @@ +package libexpat { + description = "a stream-oriented XML parser library"; + website = "https://libexpat.github.io"; + anitya = 770; + + version* = "2.8.1"; + source = remoteGitHubRelease { + suffix = "libexpat/libexpat"; + tag = "R_"+replace { + s = version; + old = "."; + new = "_"; + }; + name = "expat-"+version+".tar.bz2"; + checksum = "iMEtbOJhQfGof2GxSlxffQSI1va_NDDQ9VIuqcPbNZ0291Dr8wttD5QecYyjIQap"; + compress = bzip2; + }; + + exec = make {}; + + inputs = [ bash ]; +} diff --git a/internal/rosa/package/libffi.az b/internal/rosa/package/libffi.az new file mode 100644 index 00000000..a7f9a20a --- /dev/null +++ b/internal/rosa/package/libffi.az @@ -0,0 +1,18 @@ +package libffi { + description = "a portable, high level programming interface to various calling conventions"; + website = "https://sourceware.org/libffi"; + anitya = 1611; + + version* = "3.5.2"; + source = remoteGitHubRelease { + suffix = "libffi/libffi"; + tag = "v"+version; + name = "libffi-"+version+".tar.gz"; + checksum = "2_Q-ZNBBbVhltfL5zEr0wljxPegUimTK4VeMSiwJEGksls3n4gj3lV0Ly3vviSFH"; + compress = gzip; + }; + + exec = make {}; + + inputs = [ kernel-headers ]; +} diff --git a/internal/rosa/package/libgd.az b/internal/rosa/package/libgd.az new file mode 100644 index 00000000..1899a072 --- /dev/null +++ b/internal/rosa/package/libgd.az @@ -0,0 +1,25 @@ +package libgd { + description = "an open source code library for the dynamic creation of images"; + website = "https://libgd.github.io"; + anitya = 880; + + version* = "2.3.3"; + source = remoteGitHubRelease { + suffix = "libgd/libgd"; + tag = "gd-"+version; + name = "libgd-"+version+".tar.gz"; + checksum = "8T-sh1_FJT9K9aajgxzh8ot6vWIF-xxjcKAHvTak9MgGUcsFfzP8cAvvv44u2r36"; + compress = gzip; + }; + + env = [ + "TMPDIR=/dev/shm/gd", + ]; + + early = "\nmkdir /dev/shm/gd\n"; + + exec = make {}; + + inputs = [ zlib ]; + runtime = [ zlib ]; +} diff --git a/internal/rosa/package/libmd.az b/internal/rosa/package/libmd.az new file mode 100644 index 00000000..7752e7bf --- /dev/null +++ b/internal/rosa/package/libmd.az @@ -0,0 +1,22 @@ +package libmd { + description = "Message Digest functions from BSD systems"; + website = "https://www.hadrons.org/software/libmd"; + anitya = 15525; + + version* = "1.2.0"; + source = remoteGit { + url = "https://git.hadrons.org/git/libmd.git"; + tag = version; + checksum = "1rJ6joAO0wwMZvSfnRNkc1MOhywyAq7SM8VmF92NvDtv7Qdl1LRbjm5fg_DFFtGj"; + }; + + exec = make { + generate = "echo '" + version + "' > .dist-version && ./autogen"; + preMake = "\ninstall -D /usr/src/libmd/src/helper.c src/helper.c\n"; + }; + + inputs = [ + automake, + libtool, + ]; +} diff --git a/internal/rosa/package/libpng.az b/internal/rosa/package/libpng.az new file mode 100644 index 00000000..1e5e3ed0 --- /dev/null +++ b/internal/rosa/package/libpng.az @@ -0,0 +1,27 @@ +package libpng { + description = "the official PNG reference library"; + website = "https://www.libpng.org/pub/png/libpng.html"; + anitya = 1705; + + version* = "1.6.58"; + source = remoteTar { + url = "https://downloads.sourceforge.net/project/libpng/libpng"+ + join { + elems = slice { + elems = split { + s = version; + sep = "."; + n = 3; + }; + end = 2; + }; + }+"/"+version+"/libpng-"+version+".tar.gz"; + checksum = "m_a5lROJH7vmF3cMjqwTUqURuQLhV1JQx2ySPzcN3VPdgDB9pG3UINsIx_mtkr-t"; + compress = gzip; + }; + + exec = make {}; + + inputs = [ zlib ]; + runtime = [ zlib ]; +} diff --git a/internal/rosa/package/libpsl.az b/internal/rosa/package/libpsl.az new file mode 100644 index 00000000..dc3d4fb9 --- /dev/null +++ b/internal/rosa/package/libpsl.az @@ -0,0 +1,25 @@ +package libpsl { + description = "provides functions to work with the Mozilla Public Suffix List"; + website = "https://rockdaboot.github.io/libpsl"; + anitya = 7305; + + version* = "0.21.5"; + source = remoteGitHubRelease { + suffix = "rockdaboot/libpsl"; + tag = version; + name = "libpsl-"+version+".tar.gz"; + checksum = "XjfxSzh7peG2Vg4vJlL8z4JZJLcXqbuP6pLWkrGCmRxlnYUFTKNBqWGHCxEOlCad"; + compress = gzip; + }; + + writable = true; + early = ` +test_disable() { chmod +w "$2" && echo "$1" > "$2"; } + +test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c +`; + + exec = make {}; + + inputs = [ python ]; +} diff --git a/internal/rosa/package/libseccomp/fix-export-oob-read.patch b/internal/rosa/package/libseccomp/fix-export-oob-read.patch new file mode 100644 index 00000000..c399dcc5 --- /dev/null +++ b/internal/rosa/package/libseccomp/fix-export-oob-read.patch @@ -0,0 +1,13 @@ +diff --git a/src/api.c b/src/api.c +index adccef3..65a277a 100644 +--- a/src/api.c ++++ b/src/api.c +@@ -786,7 +786,7 @@ API int seccomp_export_bpf_mem(const scmp_filter_ctx ctx, void *buf, + if (BPF_PGM_SIZE(program) > *len) + rc = _rc_filter(-ERANGE); + else +- memcpy(buf, program->blks, *len); ++ memcpy(buf, program->blks, BPF_PGM_SIZE(program)); + } + *len = BPF_PGM_SIZE(program); + diff --git a/internal/rosa/package/libseccomp/package.az b/internal/rosa/package/libseccomp/package.az new file mode 100644 index 00000000..f9dffb43 --- /dev/null +++ b/internal/rosa/package/libseccomp/package.az @@ -0,0 +1,27 @@ +package libseccomp { + description = "an interface to the Linux Kernel's syscall filtering mechanism"; + website = "https://github.com/seccomp/libseccomp"; + anitya = 13823; + + version* = "2.6.0"; + source = remoteGitHubRelease { + suffix = "seccomp/libseccomp"; + tag = "v"+version; + name = "libseccomp-"+version+".tar.gz"; + checksum = "mMu-iR71guPjFbb31u-YexBaanKE_nYPjPux-vuBiPfS_0kbwJdfCGlkofaUm-EY"; + compress = gzip; + }; + patches = [ "fix-export-oob-read.patch" ]; + + early = "\nln -s ../system/bin/bash /bin/\n"; + + exec = make {}; + + inputs = [ + bash, + diffutils, + gperf, + + kernel-headers, + ]; +} diff --git a/internal/rosa/package/libtirpc.az b/internal/rosa/package/libtirpc.az new file mode 100644 index 00000000..91e62f50 --- /dev/null +++ b/internal/rosa/package/libtirpc.az @@ -0,0 +1,36 @@ +package libtirpc { + description = "a port of Suns Transport-Independent RPC library to Linux"; + website = "https://sourceforge.net/projects/libtirpc"; + anitya = 1740; + + version* = "1.3.7"; + source = remoteGit { + url = "git://linux-nfs.org/~steved/libtirpc"; + tag = "libtirpc-"+join { + elems = split { + s = version; + sep = "."; + n = 3; + }; + sep = "-"; + }; + checksum = "nzFfu7LNvnSNiNAryD1vtnNWnU-Xqee8KqfXUKoBf5yjb5-dkeRkYuRijdCoYLof"; + }; + + exec = make { + generate = "sh -e ./bootstrap"; + configure = { + "CFLAGS": `"$(pkg-config --cflags libbsd-overlay) ${CFLAGS:-}"`; + "disable-gssapi"; + }; + }; + + inputs = [ + automake, + libtool, + pkg-config, + + libbsd, + kernel-headers, + ]; +} diff --git a/internal/rosa/package/libucontext.az b/internal/rosa/package/libucontext.az new file mode 100644 index 00000000..0be5b1d0 --- /dev/null +++ b/internal/rosa/package/libucontext.az @@ -0,0 +1,28 @@ +package libucontext { + description = "ucontext implementation featuring glibc-compatible ABI"; + website = "https://github.com/kaniini/libucontext"; + anitya = 17085; + + version* = "1.5.1"; + source = remoteGitHub { + suffix = "kaniini/libucontext"; + tag = "libucontext-"+version; + checksum = "mUgeyJknjMxT-5fORzz-rqhZfP3Y7EZGBhOwvhuX7MsF4Pk9wkuwtrLf5IML-jWu"; + }; + + // uses source tree as scratch space + writable = true; + chmod = true; + enterSource = true; + + exec = make { + omitDefaults = true; + skipConfigure = true; + inPlace = true; + + make = [ + "ARCH=" + linuxArch, + ]; + install = "make prefix=/system DESTDIR=/work install"; + }; +} diff --git a/internal/rosa/package/libxml2.az b/internal/rosa/package/libxml2.az new file mode 100644 index 00000000..e844b43b --- /dev/null +++ b/internal/rosa/package/libxml2.az @@ -0,0 +1,23 @@ +package libxml2 { + description = "an XML toolkit implemented in C"; + website = "https://gitlab.gnome.org/GNOME/libxml2"; + anitya = 1783; + + version* = "2.15.3"; + source = remoteGitLab { + domain = "gitlab.gnome.org"; + suffix = "GNOME/libxml2"; + ref = "v"+version; + checksum = "oJy74htGlEpf70KPvpW18fYJo0RQQkCXZRwqUz6NoXborS3HCq3Nm4gsyaSeNmUH"; + }; + + // can't create shell.out: Read-only file system + writable = true; + + exec = meson {}; + + inputs = [ + git, + diffutils, + ]; +} diff --git a/internal/rosa/package/libxslt.az b/internal/rosa/package/libxslt.az new file mode 100644 index 00000000..4056efb9 --- /dev/null +++ b/internal/rosa/package/libxslt.az @@ -0,0 +1,31 @@ +package libxslt { + description = "an XSLT processor based on libxml2"; + website = "https://gitlab.gnome.org/GNOME/libxslt"; + anitya = 13301; + + version* = "1.1.45"; + source = remoteGitLab { + domain = "gitlab.gnome.org"; + suffix = "GNOME/libxslt"; + ref = "v"+version; + checksum = "67ks7v8od2oWaEGf23Sst_Xbn_8brQyolQjqxPoO-lK35k_WJhi2Px5JJgbk-nfn"; + }; + + exec = make { + generate = "NOCONFIGURE=1 ./autogen.sh"; + + // python libxml2 cyclic dependency + skipCheck = true; + }; + + inputs = [ + automake, + libtool, + python, + pkg-config, + + libxml2, + ]; + + runtime = [ libxml2 ]; +} diff --git a/internal/rosa/state.go b/internal/rosa/state.go index ed1124fb..0f32ab55 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -477,6 +477,49 @@ func (s *S) getFrame() azalea.Frame { // library functions + k("replace"): {F: func( + args azalea.FArgs, + ) (v any, set bool, err error) { + var _s, _old, _new string + var n int + if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ + k("s"): &_s, + k("old"): &_old, + k("new"): &_new, + k("n"): &n, + }); err != nil { + return + } + + if n < 0 { + n = 0 + } else if n == 0 { + n = -1 + } + + v = strings.Replace(_s, _old, _new, n) + set = true + return + }}, + + k("slice"): {F: func( + args azalea.FArgs, + ) (v any, set bool, err error) { + var elems []string + var start, end int64 + if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ + k("elems"): &elems, + k("start"): &start, + k("end"): &end, + }); err != nil { + return + } + + v = elems[start:end] + set = true + return + }}, + k("join"): {F: func( args azalea.FArgs, ) (v any, set bool, err error) { diff --git a/internal/rosa/state_native.go b/internal/rosa/state_native.go index ecec14ae..1355ef10 100644 --- a/internal/rosa/state_native.go +++ b/internal/rosa/state_native.go @@ -29,11 +29,9 @@ var ( Gettext = H("gettext") Glslang = H("glslang") Go = H("go") - Gperf = H("gperf") Gzip = H("gzip") Hakurei = H("hakurei") HakureiDist = H("hakurei-dist") - Hwdata = H("hwdata") Kmod = H("kmod") LibX11 = H("libX11") LibXau = H("libXau")