mm2 / Little-CMS

A free, open source, CMM engine. It provides fast transforms between ICC profiles.
https://www.littlecms.com
MIT License
571 stars 176 forks source link

The build system seems to have obsolete zlib support #446

Open TurtleWilly opened 6 months ago

TurtleWilly commented 6 months ago

When running configure --help it lists an option --without-zlib. This makes me accordingly assume the default is lcms2 to actually require zlib for something. On my system I need to tell any build system exactly where the correct zlib is located. Configure doesn't seem to have an option to specify the zlib location, so I have to manually ramp up the configure variables, something like this:

# Note: --with-zlib=<dir> is entirely a wild guess
./configure \
    --prefix=/usr/local/silo/lcms2/2.16                \
    --disable-static                                   \
    --with-jpeg=/usr/local/silo/jpeg/latest            \
    --with-tiff=/usr/local/silo/tiff/latest            \
    --with-zlib=/usr/local/silo/zlib/latest            \
    CFLAGS='-O3 -I/usr/local/silo/zlib/latest/include' \
    LDFLAGS='-L/usr/local/silo/zlib/latest/lib -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-dead_strip' \
    LIBS='-lz'

Which is obviously some extra typing work. 🥲

But ultimately it seems that extra hassle was for nothing. zlib doesn't seem to be used at all by lcms2? I also grepped for 'zlib.h' and got no hit, except inside the configure script.

If zlib is obsolete, then the respective zlib support should be removed from the configure script. E.g. also package systems like MacPorts still list zlib as dependency: https://github.com/macports/macports-ports/blob/master/graphics/lcms2/Portfile

mm2 commented 6 months ago

Little CMS has no real dependencies at all other than libm. For building the utilities which can be regarded as demos, you need libtiff and libjpeg. Nonetheless, if you don't have those you can still build Little CMS at full functionality. In the case you wish to build the demos, which happens by default on "configure" script, you can link them statically or dynamically. By default it is done dynamically. In the case you wish to build the demos statically, then there is a problem with libtiff because it has a lot of dependencies on the configured codecs. One of the minimal configurations is using libz. Hence, libz is stated as a dependency only for those cases you want to build the demos statically. I specifically want to avoid calls to package manager in configure.

Please note in the manual already documents that and libz is not required, see "Requirements" - "Dependencies" at the begin of the document. https://www.littlecms.com/LittleCMS2.16%20API.pdf

So, you hit an undocumented feature, which is only used for very specialized builds. You can safely ignore this in the command line of configure and follow what is documented in the manual.