haskell/zlib

Reconsider default value of Cabal flag `pkg-config` on Windows

Closed this issue · 2 comments

zlib-0.7's zlib.cabal has (extracts):

flag pkg-config
  default:     True
  manual:      False
  description: Use @pkg-config(1)@ to locate foreign @zlib@ library.
...
if flag(bundled-c-zlib) || impl(ghcjs) || os(ghcjs) || arch(wasm32)
    ...
  else
    if flag(pkg-config)
      -- NB: pkg-config is available on windows as well when using msys2
      pkgconfig-depends: zlib
    else
      -- On Windows zlib is shipped with GHC starting from 7.10
      extra-libraries: z

However, pkg-config.exe is not available on Windows with MSYS2 'out of the box' - although it can be installed separately with pacman.

For people using Stack to build (which promises reproducible builds) on Windows, the choice of default on that operating system may be problematic.

Given that, I ask whether it would be more appropriate for the Cabal file to specify - for Windows only - a default value of false.

However, pkg-config.exe is not available on Windows with MSYS2 'out of the box' - although it can be installed separately with pacman.

The situation is similar on other operating systems, there is no guarantee that pkg-config executable is available. Windows is no special. Stack would run into the very same issue on Linux, it just happens that Stackage build servers have pkg-config preinstalled. But the only portable and reproducible default for Stack is to disable zlib -pkg-config in build-constraints.yaml on all platforms.

Given that Stackage has switched the flag, I think we can close the issue.