AtlatestRepositorycore-channel
1;;; XML and HTML parsing.
2;;;
3;;; libxml2 is what gives Emacs `libxml-parse-html-region`, and therefore shr
4;;; and eww. Built static and deliberately narrow: no Python bindings, no
5;;; loadable modules, and no HTTP client, because Emacs uses libxml2 purely as
6;;; a parser and its network stack is its own.
7;;;
8;;; It also carries the channel's first patch, and the reason is worth reading
9;;; before touching it -- see the note beside the `patch` phase.
10(define-library (core packages xml)
11 (import (sigil core)
12 (core build-environments)
13 (sigil env package)
14 (sigil build external))
15 (export libxml2)
16 (begin
17 (define libxml2
18 (package
19 name: "libxml2"
20 version: "2.13.5"
21 source: (external-source
22 location: "https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.5.tar.xz"
23 sha256: "74fc163217a3964257d3be39af943e08861263c4231f9ef5b496b6f6d4c7b2b6")
24 buildenv: core-buildenv
25 phases: (list
26 ;; WHY THIS PATCH EXISTS. The pinned seed's pkgconf 1.9.5
27 ;; ABORTS (SIGABRT, a Zig pointer-overflow panic) on any .pc
28 ;; file carrying an EMPTY dependency-list field, and libxml2
29 ;; installs `Requires:` empty because it is built
30 ;; --without-zlib. Emacs finds libxml2 through
31 ;; PKG_CHECK_MODULES, which runs `pkg-config --exists` and
32 ;; reads ANY non-zero status as "not present" -- so a
33 ;; crashing tool impersonates a calm, plausible absence and
34 ;; configure still exits 0. That is how the port build lost
35 ;; libxml2 with no error and no warning.
36 ;;
37 ;; Measured against the seed's own pkg-config, both
38 ;; directions: with the empty `Requires:` line,
39 ;; `pkg-config --exists libxml-2.0` exits 134 with the panic;
40 ;; with the line deleted it exits 0 and `--cflags --libs`
41 ;; returns exactly what Emacs needs.
42 ;;
43 ;; This patch deletes the line from the TEMPLATE, before
44 ;; configure substitutes it, so no empty field is ever
45 ;; generated. It fixes libxml2 only. The general fix is a
46 ;; seed re-pin onto a pkgconf past the bug
47 ;; (investigations/seed-pkgconf-empty-field-abort), which is
48 ;; still owed -- gnutls' closure will hit the same wall.
49 (external-phase
50 kind: 'patch
51 patches: (list
52 (channel-patch
53 path: "patches/libxml2-pc-drop-empty-requires.patch"
54 sha256: "386f08e511d8f45fd649aacc2a55c7fcd52bdbc9ed11fac8fc613aa63eebf441")))
55 (external-phase
56 kind: 'configure
57 args: (list "--prefix=${out}"
58 "--disable-shared"
59 "--enable-static"
60 "--without-python"
61 "--without-lzma"
62 "--without-zlib"
63 "--without-http"
64 "--without-modules"))
65 (external-phase kind: 'make)
66 (external-phase kind: 'install))))))