diff --git a/.ci/build.sh b/.ci/build.sh index e73e540b52..0c58fd5138 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -21,12 +21,22 @@ if [[ "$GHC_HEAD" != "yes" ]]; then mv cabal.project.local.disabled cabal.project.local [[ ! -f cabal.project.freeze.disabled ]] || mv cabal.project.freeze.disabled cabal.project.freeze fi -set -u -cabal v2-build clash-prelude --write-ghc-environment-files=always -# Undo mmap crash workaround for clash-cosim, see PR #2572. -# It uses a custom setup, which can't be linked with -rtsopts -GHCRTS="" cabal v2-build clash-cosim --write-ghc-environment-files=always +# Any package with a custom setup or using happy can only be build with GHCRTS="" +# see PR #2572. +if [[ "$GHCRTS" != "" ]]; then +CANT_BUILD_WITH_RTSOPTS="ghc-paths haskell-src-exts pretty-show singletons" + +GHC_MAJOR_VERSION=$(ghc --numeric-version | awk -F . '{print $1}') +if [[ "$GHC_MAJOR_VERSION" -gt "8" ]]; then +CANT_BUILD_WITH_RTSOPTS="$CANT_BUILD_WITH_RTSOPTS singletons-base" +fi +cabal v2-build --only-dependencies $CANT_BUILD_WITH_RTSOPTS +GHCRTS="" cabal v2-build $CANT_BUILD_WITH_RTSOPTS +cabal v2-build clash-prelude +GHCRTS="" cabal v2-build clash-cosim +fi +set -u # Build with default constraints cabal v2-build all --write-ghc-environment-files=always