Repository navigation
ghostscript: use the registry's zlib; drop the bundled tesseract OCR - #1574
bryan-minimal wants to merge 1 commit into
Conversation
configure uses a bundled library whenever its directory is in the source tree. build.sh now also deletes zlib/ (bundled zlib 1.3.2), so gs links the zlib package, and builds --without-tesseract with the tesseract and leptonica trees deleted (the largest compile in the package). Debian excludes all three trees. User-visible: the ocr, hocr, pdfocr8, pdfocr24 and pdfocr32 devices are gone. No registry package uses them. build.sh fails closed if configure keeps a bundled zlib or OCR, if gs does not need libz.so.1, or if it still needs libstdc++ (libstdcpp is dropped from runtime_deps: it was only for tesseract). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 57 minutes for your next included review. View limit details
|
norrietaylor
left a comment
There was a problem hiding this comment.
Scope matches the title. Both files change only what the PR body states: the zlib dependency, the deleted zlib, tesseract and leptonica trees, --without-tesseract, and the fail-closed checks.
Clobber none. #1372 added libstdcpp to runtime_deps because gs loaded it. This PR removes it together with its only stated consumer, and build.sh fails if gs still needs libstdc++.
Correctness The change is good. zlib is in build_deps and runtime_deps, and the zlib package ships the header, zlib.pc and libz.so*. The readelf pipeline fails closed: an empty result fails the libz.so.1 check. readelf comes from binutils through toolchain. No other package or stack imports ghostscript or names the removed OCR devices. The gs --version smoketest loads the binary, so a missing libz.so.1 at runtime fails it.
Not checked I did not build the package. I did not read the upstream 10.08.0 Makefile.in and configure.ac, because the fetch was denied. So the exact lines SHARE_ZLIB=1 and OCR_VERSION=0, and the claim that gs is plain C without tesseract, are not confirmed. A mismatch fails the build and does not ship a bad package.
| glibc, | ||
| subsetOf gcc ["libgcc", "libstdcpp"], | ||
| # libstdcpp was for the bundled tesseract OCR (C++), now not built; | ||
| # build.sh fails if gs still needs libstdc++. |
There was a problem hiding this comment.
nit · This comment tells the history of the change, not the state of the code. After the merge, libstdcpp is not in the file, so the reader has nothing to attach "was for ... now not built" to. Write the present fact, for example: "gs is plain C without the bundled tesseract. build.sh fails if it needs libstdc++." The same pattern is in build.sh at lines 8-9 ("before, one gs process carried two zlibs") and line 60-61 ("build.ncl no longer carries libstdcpp").
| # Fail closed: gs must link the registry's zlib (libz.so.1), and without | ||
| # tesseract it is plain C, so it must not need libstdc++ (build.ncl no longer | ||
| # carries libstdcpp as a runtime dep). | ||
| command -v readelf >/dev/null |
There was a problem hiding this comment.
nit · If readelf is absent, this line ends the build under set -e and prints nothing. Every other guard in this script prints an ERROR line first. Add a message, or remove the line: an absent readelf gives an empty needed, and the libz.so.1 check then fails with its own message.
Makes
packages/ghostscriptuse the registry's zlib instead of the copy bundled in the 10.08.0 tarball, and drops the bundled tesseract/leptonica OCR. From the ghostscript row of the 2026-11-18 unbundle survey; pkgs#1541 (or-tools) is the model.What changed
Ghostscript's
configureuses a bundled library whenever that library's directory exists in the source tree, sobuild.shdeletes the directory. Debian does the same thing withFiles-Excluded.zlib/(zlib 1.3.2)zlibadded to build_deps + runtime_depszlib/*. The libpng and freetype that gs already links also link libz, so until now a gs process carried two zlibs, and pkgscan could not see the bundled one.tesseract/,leptonica/--without-tesseractbrotli/(1.2.0)libbrotli-devbuild-dep). Separate follow-up if wanted.expat/dir. configure only looks for expat whenxps/xps.makexists, which is only in the full ghostpdl tree, so gs never linked expat. No expat dep was added.runtime_deps:subsetOf gcc ["libgcc", "libstdcpp"]becomes["libgcc"]. libstdc++ was only needed for tesseract; without it gs is plain C.Fail-closed checks in build.sh
Makefilemust haveSHARE_ZLIB=1andOCR_VERSION=0.readelf -d usr/bin/gsmust listlibz.so.1and must not listlibstdc++*. The full NEEDED list is printed to the build log.User-visible change
The OCR output devices are removed:
ocr,hocr,pdfocr8,pdfocr24,pdfocr32. Before this PR,gs -sDEVICE=pdfocr24 ...produced a searchable PDF with a text layer recognised by the built-in tesseract, andocr/hocrwrote text or hOCR. Those commands now fail withUnknown device. All other devices are unaffected. To OCR a document, run the rendered image through a standalone tesseract.A grep of
packages/forpdfocr,hocr,ghostscriptandtesseractfinds nothing outside this package, and no package imports ghostscript.Observation (pre-existing, not changed here)
--with-system-libtiffis passed, but no libtiff package exists. configure'sxyesbranch then prints "Disabling tiff and xps output devices", so on main thetiff*and fax (tiffg3/tiffg4/faxg*) devices andxpswriteare already missing. Dropping the flag would build the bundledtiff/instead. That is a separate decision.🤖 Generated with Claude Code