af126b8f0cf9ddc553a78869a3c820a4bd4fdc59
braney
  Mon Aug 17 13:36:13 2026 -0700
build: link the browser against zlib-ng instead of the system zlib, refs #38125

Adds zlib-ng as a second git submodule, alongside htslib, and points ZLIB at it.
It is built with --zlib-compat, so the header and the symbol names are the
ordinary zlib ones and no calling code has to change.

Measured over the eight Recommended Track Set pages, hgTracks uses 29 percent
less processor time and 26 percent less wall clock, and the image it produces is
pixel identical. Writing the PNG is about three times faster and reading a
bigBed data block about twice as fast, which is why the gain is larger than the
image work alone would give.

This also makes the platforms agree. x86_64 was linking a static /lib64/libz.a
only because that file happened to be present, the arm64 Docker build fell
through to a shared -lz, and Darwin was taking MacPorts zlib. All three now use
the submodule.

Verified on x86_64 Linux, aarch64 Linux and Apple silicon: zlib-ng builds, its
own test suite passes, the makefiles pick it up, and bigBedToBed output is byte
identical to before the change.

diff --git .gitmodules .gitmodules
index 6dc26f62290..36c05970e1f 100644
--- .gitmodules
+++ .gitmodules
@@ -1,3 +1,7 @@
 [submodule "src/submodules/htslib"]
 	path = src/submodules/htslib
 	url = ../htslib.git
+[submodule "src/submodules/zlib-ng"]
+	path = src/submodules/zlib-ng
+	url = ../zlib-ng.git
+	branch = ucsc-browser-support