Skip to content

Commit

Permalink
Downgrade cabal-version to 2.2 since hackage does not allow version g…
Browse files Browse the repository at this point in the history
…reater than 3.0
  • Loading branch information
4eUeP committed Aug 7, 2023
1 parent 5f4663b commit 5cde804
Showing 1 changed file with 36 additions and 29 deletions.
65 changes: 36 additions & 29 deletions zoovisitor.cabal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cabal-version: 3.6
cabal-version: 2.2
name: zoovisitor
version: 0.2.6.1
synopsis:
Expand Down Expand Up @@ -27,20 +27,25 @@ source-repository head
type: git
location: https://github.com/ZHaskell/zoovisitor

flag zoovisitor_enable_asan
default: False
description: Enable AddressSanitizer.

-- XXX: Tricky options to link static archive, see: https://github.com/haskell/cabal/issues/4677
common link-asan
if os(osx)
ghc-options: "-optl-Wl,-lasan"

if !os(osx)
ghc-options:
-pgml g++ "-optl-Wl,--allow-multiple-definition"
"-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lasan"
"-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"
-- XXX: Hackage requires 'cabal-version' must be at most 3.0.
-- But the flag 'zoovisitor_enable_asan' use 'hsc2hs-options' requres >= 3.6.
-- flag zoovisitor_enable_asan
-- default: False
-- description:
-- Enable AddressSanitizer. This is only for local debug usage.
-- Also, do not forget to set cabal-version to 3.6 manually.

-- XXX: require cabal-version >= 3.6
-- Tricky options to link static archive, see: https://github.com/haskell/cabal/issues/4677
-- common link-asan
-- if os(osx)
-- ghc-options: "-optl-Wl,-lasan"
--
-- if !os(osx)
-- ghc-options:
-- -pgml g++ "-optl-Wl,--allow-multiple-definition"
-- "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lasan"
-- "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"

library
hs-source-dirs: src
Expand All @@ -60,23 +65,24 @@ library

build-depends:
, base >=4.12 && <5
, bytestring >=0.10.10.0
, bytestring >=0.10.10.0 && <0.13
, exceptions ^>=0.10
, Z-Data >=0.7.2 && <1.5 || ^>=2.0
, Z-Data >=0.7.2 && <1.5 || ^>=2.0

includes: hs_zk.h
c-sources: cbits/hs_zk.c
include-dirs: include /usr/local/include
build-tool-depends: hsc2hs:hsc2hs
extra-libraries: zookeeper_mt

if flag(zoovisitor_enable_asan)
cc-options:
-fsanitize=address -fno-omit-frame-pointer -static-libasan
-- XXX: require cabal-version >= 3.6
-- if flag(zoovisitor_enable_asan)
-- cc-options:
-- -fsanitize=address -fno-omit-frame-pointer -static-libasan

hsc2hs-options:
"--cflag=-fsanitize=address" "--lflag=-fsanitize=address"
"--cflag=-static-libasan" "--lflag=-static-libasan"
-- hsc2hs-options:
-- "--cflag=-fsanitize=address" "--lflag=-fsanitize=address"
-- "--cflag=-static-libasan" "--lflag=-static-libasan"

default-language: Haskell2010
default-extensions:
Expand Down Expand Up @@ -104,17 +110,18 @@ library
-Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints

test-suite zoovisitor-test
if flag(zoovisitor_enable_asan)
import: link-asan
-- XXX: require cabal-version >= 3.6
-- if flag(zoovisitor_enable_asan)
-- import: link-asan

type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: test
build-depends:
, async
, base >=4.12 && <5
, hspec
, uuid
, async ^>=2.2
, base >=4.12 && <5
, hspec ^>=2.11
, uuid ^>=1.3
, Z-Data
, zoovisitor

Expand Down

0 comments on commit 5cde804

Please sign in to comment.