| 1 | patch-url := "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/libxml2/" |
| 2 | patches := list( |
| 3 | list("CVE-2026-6732.patch", "42d45b35f36bf29229e39a9e5349d7347e51d92099573b5a509f448dbf0e34d7"), |
| 4 | list("CVE-2026-6732-test.patch", "7c93e102dfdeaaf5d7adeda70c0dec6bfc492dbe9a14a29d42512a6c3f39a6c2"), |
| 5 | list("CVE-2026-86144.patch", "0d82d4514d0fffe3dd2ea5dac4ce0811d3322e9460c1ea7610f59ee0e3857001"), |
| 6 | list("CVE-2026-0990.patch", "37f12ae5fdea648d5c8c7cb409f72f9a69185866fbc7d417a22ccbe9d184efe9"), |
| 7 | list("CVE-2026-0992.patch", "3e7d210ab035b266047b19f1b5dcf344a026a04c02b02e7d8cb760694d887acf"), |
| 8 | list("CVE-2026-0989.patch", "46268a32c38f033c6ae43752a69ba807d7cc6443f48b9a2777053cc2b9e9ad09"), |
| 9 | list("CVE-2026-86137.patch", "87784658a7037c0ab1901eb3b91c3a34de7be2392ecb57301eb34552bd889a3e"), |
| 10 | list("CVE-2026-86138.patch", "c5bbb7c2b33503449cfbce9aef7741f4fd3dc99b3bf35277a5265335f3d38e7e"), |
| 11 | list("CVE-2026-86139.patch", "8b3e9bea747aa2d7b049c9cc90a5abfff7b592d077d70a4ee6823eb3ab0ced82"), |
| 12 | list("CVE-2026-86140.patch", "0d6aaa0f370f492012f62090ea1e744ac35bd7eb6c2d115eeba9eee880df4c4b"), |
| 13 | list("CVE-2026-86141.patch", "5ef5f1bc2b0890c81796412d4869f404b1f8b2f3927bcd22529d3b1f2c4453f8"), |
| 14 | list("CVE-2026-86142.patch", "7f48454c4bbe544f9229294d4634dabd7b8ad20803cb511c405ca9489ce740fd"), |
| 15 | list("CVE-2026-86143.patch", "7fd27d379fbba9524ffec129153577e382072f44ff12d2750c56c5f68075aa61"), |
| 16 | list("CVE-2026-11979.patch", "f29b6fce188be7e70f1566a61c0b7be48b8f75ee45b3343a8b201c98bdc29065"), |
| 17 | list("c14n-double-free-in-xmlC14NFixupBaseAttr.patch", "2a3eb5a3ada2d9ef4689e63b2976448cfc84eefbbaa6d0a856cf7c5ac5d0ffab"), |
| 18 | list("c14n-type-confusion-in-xmlC14NProcessAttrsAxis.patch", "6268eb2d9715b0f9415ce8f81e4f7b59bb462a8cc8ea0c90828d80447000b437"), |
| 19 | list("xmlCopyEntity-copy-children.patch", "0c5157e1c76a9d645e5e2410f7b07d254081064638b3882baacfaeeca9be233d"), |
| 20 | list("python-double-free-in-pythonAttributeDecl.patch", "eeee257fd433b734d43d57b8eee45d0796337b4aed47c5f49fc7b5e1e85386c3"), |
| 21 | list("CVE-2026-1757.patch", "b69ae2fd0defc501d05cda7679f7cb8eeb346fa5e453760b0ff1116ade38b9ec") |
| 22 | ) |
| 23 | |
| 24 | defpkgbuild(libxml2, |
| 25 | #:pkgname, "libxml2", |
| 26 | #:pkgver, "2.13.9", |
| 27 | #:pkgrel, 1, |
| 28 | #:pkgdesc, "XML parsing library and command-line tools", |
| 29 | #:arch, [#:x86-64, #:aarch64], |
| 30 | #:license, "MIT", |
| 31 | #:url, "https://gitlab.gnome.org/GNOME/libxml2", |
| 32 | #:depends, ["musl", "xz", "zlib"], |
| 33 | #:source, cons("https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.9.tar.xz", |
| 34 | map(fn(p) { string-append(patch-url, car(p)) }, patches)), |
| 35 | #:sha256sums, cons("a2c9ae7b770da34860050c309f903221c67830c86e4a7e760692b803df95143a", map(cadr, patches)), |
| 36 | #:prepare, fn() { |
| 37 | for-each(fn(p) { |
| 38 | run("patch", "--batch", "-d", "libxml2-2.13.9", "-p1", "-i", string-append("../", car(p))) |
| 39 | }, patches) |
| 40 | }, |
| 41 | #:build, fn() { |
| 42 | run("vinix-configure", "libxml2-2.13.9/configure", "--enable-static", "--with-legacy", "--with-lzma", "--with-zlib", "--without-python") |
| 43 | run("make") |
| 44 | }, |
| 45 | #:check, fn() { |
| 46 | run("vinix-run", "--library-path", ".libs", ".libs/xmllint", "--noout", "libxml2-2.13.9/example/gjobs.xml") |
| 47 | run("vinix-run", "--library-path", ".libs", ".libs/xmllint", "--xpath", "//*[local-name()='Application'][.='GBackup']", "libxml2-2.13.9/example/gjobs.xml") |
| 48 | }, |
| 49 | #:package, fn() { |
| 50 | run("make", "-j1", "install", string-append("DESTDIR=", pkgdir())) |
| 51 | run("rm", string-append(pkgdir(), "/usr/lib/libxml2.la")) |
| 52 | run("install", "-Dm644", "libxml2-2.13.9/Copyright", string-append(pkgdir(), "/usr/share/licenses/libxml2/Copyright")) |
| 53 | }) |
| 54 | |