Skip to content

Commit

Permalink
Set default ghc for cabal-docspec
Browse files Browse the repository at this point in the history
  • Loading branch information
harendra-kumar committed Dec 27, 2023
1 parent 8b8b615 commit f6cfd7b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Set default "ghc" in PATH for cabal-docspec to work

## 0.7.0 (Dec 2023)

### Enhancements
Expand Down
20 changes: 13 additions & 7 deletions packcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,16 @@ ghcup_install() {
fi
}

ensure_default_ghc() {
local ghc
ghc="$(which_cmd ghc)"
if test -z "$ghc" -a -n "$GHCUP_VERSION"
then
echo "No default ghc found in PATH. Setting it using ghcup"
ghcup set ghc $GHCVER
fi
}

ensure_ghc() {
local found
local compiler
Expand Down Expand Up @@ -1024,13 +1034,7 @@ ensure_ghc() {
# cabal info command requires "ghc" to be in PATH
if test -z "$DISABLE_SDIST_BUILD"
then
local ghc
ghc="$(which_cmd ghc)"
if test -z "$ghc" -a -n "$GHCUP_VERSION"
then
echo "No default ghc found in PATH. Setting it using ghcup because SDIST_BUILD needs it"
ghcup set ghc $GHCVER
fi
ensure_default_ghc
fi

if test -n "$ENABLE_GHCJS"
Expand Down Expand Up @@ -2104,6 +2108,8 @@ else
die "Use DOCSPEC_URL option to install."
fi
fi
# XXX Use the --with-compiler option instead
ensure_default_ghc
run_verbose_errexit cabal-docspec --version
run_verbose_errexit cabal-docspec $DOCSPEC_OPTIONS
fi
Expand Down

0 comments on commit f6cfd7b

Please sign in to comment.