Skip to content

Add ZLIB_DIR config option, and don't vendor zlib or zlib-ng automatically #147

Open
@micolous

Description

@micolous

libz-sys should have a configuration option like ZLIB(_LIB|_INCLUDE)_DIR which allows you to explicitly point at which zlib to use on all platforms, similar to what openssl-sys does with OPENSSL(_LIB|_INCLUDE)_DIR (documentation).

If those environment variables are unset, then libz-sys should continue to use vcpkg, pkg-config or system paths to find zlib.

Additionally, vendoring should be behind a feature flag, disabled by default, so that libz-sys failng to find zlib is a hard error by default:

  • While auto-vendoring makes libz-sys build in more scenarios with zero configuration, it leads to surprising behaviour, and makes it more difficult to track down your dependencies. Again, this is something that openssl-sys does well.

  • There's also no way to reliably force the library to be vendored, except by setting the static option - which is itself implemented incorrectly, as it never checks for a system-installed static zlib except with vcpkg.

These changes would require a major version bump, as they're SemVer incompatible changes, and will likely break some environments until they can be fixed up.

Some related issues include:

#83 has a similar request to disable auto-vendoring for zlib-ng.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions