Skip to content

Commit c465919

Browse files
authored
Refactor pkg-config flag logic
This reorders the conditional and renames the manual flag to the shorter `pkg-config`
1 parent 282780e commit c465919

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

zlib.cabal

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ flag non-blocking-ffi
4545
prevents other Haskell threads running. Enabling this flag
4646
avoids this unfairness, but with greater overall cost.
4747

48-
flag use-pkg-config
48+
flag pkg-config
4949
default: False
5050
manual: True
51-
description: Use pkg-config to find foreign zlib.
51+
description: Use @pkg-config(1)@ to locate foreign @zlib@ library.
5252

5353
library
5454
exposed-modules: Codec.Compression.GZip,
@@ -73,21 +73,23 @@ library
7373
ghc-options: -Wall -fwarn-tabs
7474
if flag(non-blocking-ffi)
7575
cpp-options: -DNON_BLOCKING_FFI
76-
if !os(windows)
77-
-- Normally we use the the standard system zlib:
78-
if !flag(use-pkg-config)
76+
if flag(pkg-config)
77+
-- NB: pkg-config is available on windows as well when using msys2
78+
pkgconfig-depends: zlib
79+
else
80+
-- don't use pkg-config
81+
if !os(windows)
82+
-- Normally we use the the standard system zlib.
7983
extra-libraries: z
8084
else
81-
pkgconfig-depends: zlib
82-
else
83-
-- However for the benefit of users of Windows (which does not have zlib
84-
-- by default) we bundle a complete copy of the C sources of zlib-1.2.8
85-
c-sources: cbits/adler32.c cbits/compress.c cbits/crc32.c
85+
-- However for the benefit of users of Windows (which does not have zlib
86+
-- by default) we bundle a complete copy of the C sources of zlib-1.2.8
87+
c-sources: cbits/adler32.c cbits/compress.c cbits/crc32.c
8688
cbits/deflate.c cbits/infback.c
8789
cbits/inffast.c cbits/inflate.c cbits/inftrees.c
8890
cbits/trees.c cbits/uncompr.c cbits/zutil.c
89-
include-dirs: cbits
90-
install-includes: zlib.h zconf.h
91+
include-dirs: cbits
92+
install-includes: zlib.h zconf.h
9193

9294
test-suite tests
9395
type: exitcode-stdio-1.0

0 commit comments

Comments
 (0)