AtlatestRepositorycore-channel
core-channel / tree / src / core / packagesevent.sgl
1
;;; Asynchronous event notification.2
;;;3
;;; libevent lands in its own module rather than beside ncurses in4
;;; (core packages terminal), even though tmux is the only thing in the channel5
;;; that wants it today. Two reasons, and the second is the one that matters:6
;;;7
;;; * it follows the channel's existing shape. compression/, databases/,8
;;; parsing/ and xml/ are each a single-package module named for a DOMAIN,9
;;; not for a consumer. libevent's domain is event loops, not terminals.10
;;;11
;;; * filing it under `terminal` would encode "libevent exists to serve tmux"12
;;; in the module layout, and the next consumer of libevent will not be a13
;;; terminal program. That is the same mistake in a different place as the14
;;; builder hardcoding `include/ncursesw` for every package -- one15
;;; consumer's situation written down somewhere general.16
(define-library (core packages event)17
(import (sigil core)18
(core build-environments)19
(sigil env package)20
(sigil build external))21
(export libevent)22
(begin23
;; NO `search-paths:` DECLARATION, and that is an answered question rather24
;; than an omission. ncurses needs one because `--enable-widec` puts every25
;; header under `include/ncursesw/` and leaves `include/` empty, so the26
;; builder's own `-I<dep>/include` reaches nothing. libevent installs27
;; `event.h`, `evutil.h` and friends directly in `include/`, with the28
;; modern API under `include/event2/` -- and `#include <event2/event.h>`,29
;; which is what tmux compiles, resolves relative to `include/`. The30
;; builder's own flag is therefore sufficient; measured on the built store31
;; item, see the task note.32
;;33
;; The `.pc` files matter more than the headers here: tmux finds libevent34
;; through PKG_CHECK_MODULES, and the builder puts every dependency's35
;; `lib/pkgconfig` on PKG_CONFIG_PATH already. Measured on the installed36
;; item, THREE of the four generated files carry an empty `Requires:`37
;; (`libevent_pthreads.pc` has `Requires: libevent`) and all four carry an38
;; empty `Conflicts:`. That empty-dependency-list shape is what makes39
;; pkgconf read past the start of its buffer and abort with SIGABRT under40
;; Zig's runtime safety.41
;;42
;; IT IS NOT A VERSION PROBLEM AND MUST NOT BE RECORDED AS ONE. The seed's43
;; own build script measured the identical defective line in pkgconf 1.9.544
;; (parser.c:88) and 2.4.3 (parser.c:95) and states plainly that no pkgconf45
;; release fixes it -- a version bump is not a fix. What makes the seed's46
;; pkgconf safe is a SOURCE PATCH the seed applies itself, plus two47
;; refusals guarding it; see seed/scripts/build-seed.sh. Naming "2.4.3" as48
;; the reason would invite exactly the wrong repair later.49
;;50
;; Verified against the seed's own binary on all four files this package51
;; installs: `--exists`, `--cflags --libs` and `--static` all exit 0, with52
;; an absent-package negative control still exiting 1.53
(define libevent54
(package55
name: "libevent"56
version: "2.1.13-stable"57
source: (external-source58
location: "https://github.com/libevent/libevent/releases/download/release-2.1.13-stable/libevent-2.1.13-stable.tar.gz"59
sha256: "f7e9383b8c0baa81b687e5b5eecc01beefaf1b19b64151d95ed61647fe7a315c")60
buildenv: core-buildenv61
phases: (list62
(external-phase63
kind: 'configure64
args: (list "--prefix=${out}"65
;; static only, consistent with the channel66
"--disable-shared"67
"--enable-static"68
;; openssl is not in the channel69
"--disable-openssl"70
;; nothing here is installed, and both build71
;; test programs we would only throw away72
"--disable-samples"73
"--disable-libevent-regress"74
"--disable-doxygen-html"))75
(external-phase kind: 'make)76
(external-phase kind: 'install))))))