Skip to content

Commit 297c26a

Browse files
committed
zsh: statically link the optional modules (mathfunc, regex, system, ...)
A fully static binary cannot dlopen modules, so the -static build makes configure mark every optional module link=no -- they are dropped, leaving zsh with only its core set. This flips the buildable, libc-only modules to link=static in the generated config.modules and runs `make prep`, compiling them into the binary and making them usable via zmodload: mathfunc (float math functions), regex (=~), system (syscall/sysread/zsystem flock), stat, mapfile, files (zf_*), zselect, zpty, net/socket + net/tcp, zftp, clone, param/private, zprof, watch, deltochar, nearcolor. (datetime, zle, complete, ... were already link=static.) Modules needing libraries we do not ship are deliberately left link=no: cap->libcap, db/gdbm->libgdbm, pcre->libpcre2, and zsh/curses needs wide-char ncurses (the in-tree build is --disable-widec). The sed no-ops on versions that lack a given module, so one module list is safe across the whole range; older zsh (4.0.9/4.2.7) simply gets the smaller set of modules it actually ships. Also: --enable-multibyte (5.0+, pinned) and --enable-unicode9 (5.3.1+, in-tree Unicode-9 width tables, no external lib). And -Dgamma=lgamma for zsh <5.0, whose mathfunc.c calls the deprecated gamma() (a historical alias for lgamma) unconditionally -- musl dropped that symbol, so zsh/mathfunc otherwise fails to link; the only gamma( token in the tree is that call, and the "gamma" math function name is a string literal, so users still call gamma() and get lgamma. 5.0+ guards the call behind a configure probe and is left untouched. Verified across the full range on both arches: all 12 versions build, the module set loads (zmodload zsh/mathfunc -> sqrt(2), =~ matches, datetime), and verify_build_checksums passes. Regenerated checksums/build/{amd64,arm64}/zsh_*.
1 parent be8da58 commit 297c26a

25 files changed

Lines changed: 69 additions & 25 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ac63a020c9f5568ad5b5b9de2a9a42ade7197b1531c906d8d66c8aae402ee8a8 zsh
1+
018b6fe9a660d1c3ad532cd9b78b553057b1040739c3b483c5312d49b252408f zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ae58bf647203dc1b8d9a786094ffe8b3293d225b0ff38fd8ac71a15d0dec8eef zsh
1+
b1bf4f28641e31cce5da761be0458fac0cf8bb89badba92d470cd9c03e42305b zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
203ac448cd54f0bec664b924062963efa12574a905ae0f4745fd6baca4945dfd zsh
1+
24a5a7de8e33a69c3d838d8aa3291a1c886de61e6cebd0075d717d1b4b427280 zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cc8b175c0554d3312f4ef54bf580c7f781d751cb3c42dc2d0632895f7b5c1113 zsh
1+
9fce81a3ddcb40af8bac34a97a488ced5fc82167a57b02cc507210be37d0d477 zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0afbbff105cfa33912907088ccc2a97e75d8fbf7c537fcc9a41a899aeed1f806 zsh
1+
388e73e1dce0a9f54fbc43fe57e292295e1d1d6db9cd2b825c427bc9faa05ad9 zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6bad94a9c7f2bf5abeea353e4b50c4d0ed69ee0591169a78b1ecc8d00167eaa2 zsh
1+
447295941bf399d2c8f6dbebe043b49de7241893653e531e9a3b098cc3cccb3a zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
efca83c6c2e4dd3a95c9e3f7a307c6c1c7a0bb24c9dad32be51a126d110f4017 zsh
1+
395b3ea624b7acdb0fd359f5201b22afcd4a1d1d133d61455a86daccbf854113 zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8c852572ef5f4c822ec34a10c076e01f70084a9b032de8380d09c975e39fd553 zsh
1+
77d72cb185f00d95d983c250451feed4fd91a97b6a8724a9d18c6c9cbd456f75 zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3d3aa2fc7a4d6ba6a9f9cce11a9e63e55b0482ba979d63e5ffa6026934d3ef3d zsh
1+
20de56e16e490da763fe07a8b0b75693fd76a9fad3bc879707887a99e0a72226 zsh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ea732eda99f123a1cabf4cbb57f4b3540024d4e37fe97007c44cf3b135f14f91 zsh
1+
2321a2ea779797df6345c80f167db96c445ead20d0c99bac425a7a8d587c86f9 zsh

0 commit comments

Comments
 (0)