pcre2: build the regex libraries and exercise pcre2grep with Vinix musl
@@ -0,0 +1,33 @@
1+defpkgbuild(pcre2,
2+ #:pkgname, "pcre2",
3+ #:pkgver, "10.49",
4+ #:pkgrel, 1,
5+ #:pkgdesc, "Perl-compatible regular expressions with 8, 16 and 32-bit code units",
6+ #:arch, [#:x86-64],
7+ #:license, "BSD-3-Clause",
8+ #:url, "https://www.pcre.org/",
9+ #:depends, ["musl", "zlib"],
10+ #:source, ["https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.49/pcre2-10.49.tar.bz2"],
11+ #:sha256sums, ["53c156e1ba416a20da8e65395daa132da0d80e76910424caca3fcdae7831d384"],
12+
13+ #:build, fn() {
14+ root := get-environment-variable("VPAC_MAKEPKG_ROOT")
15+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",
16+ "CC=vinix-cc",
17+ "PKG_CONFIG_PATH=", string-append("PKG_CONFIG_LIBDIR=", root, "/usr/lib/pkgconfig"),
18+ string-append("PKG_CONFIG_SYSROOT_DIR=", root),
19+ "pcre2-10.49/configure", "--build=x86_64-pc-linux-gnu", "--host=x86_64-linux-musl",
20+ "--prefix=/usr", "--enable-pcre2-16", "--enable-pcre2-32", "--enable-jit",
21+ "--enable-pcre2grep-libz", "--disable-symvers")
22+ run("make")
23+ },
24+ #:check, fn() {
25+ root := get-environment-variable("VPAC_MAKEPKG_ROOT")
26+ run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path",
27+ string-append(".libs:", root, "/usr/lib"), ".libs/pcre2grep", "-q", "^defpkgbuild",
28+ string-append(startdir(), "/PKGBUILD.vile"))
29+ },
30+ #:package, fn() {
31+ run("make", "install", string-append("DESTDIR=", pkgdir()))
32+ run("install", "-Dm644", "pcre2-10.49/LICENCE.md", string-append(pkgdir(), "/usr/share/licenses/pcre2/LICENCE.md"))
33+ })