Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions packcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ SAFE_ENVVARS="\
BUILD_PREFETCH \
BUILD_PREFETCH_DEBUG \
DISABLE_DOCS \
DISABLE_BUILD \
ENABLE_DOCSPEC \
DISABLE_DIST_CHECKS \
TOOLS_DIR \
Expand Down Expand Up @@ -513,10 +514,11 @@ show_help() {
help_envvar HADDOCK_OPTIONS "ADDITIONAL haddock build options to append to defaults"

show_step1 "Specifying what to build"
help_envvar DISABLE_BUILD "[y] Do not build, makes sense if only docs are built"
help_envvar DISABLE_BENCH "[y] Do not build benchmarks, default is to build but not run"
help_envvar DISABLE_TEST "[y] Do not run tests, default is to run tests"
help_envvar DISABLE_DOCS "[y] Do not build haddocks, default is to build docs"
help_envvar ENABLE_DOCSPEC "[y] Run cabal-docspec after the cabal build"
help_envvar DISABLE_DOCS "[y] Do not build haddocks, default is to build docs"
help_envvar DISABLE_SDIST_BUILD "[y] Do not build from source distribution"
help_envvar DISABLE_SDIST_PROJECT_CHECK "[y] Ignore project file and continue"
help_envvar DISABLE_SDIST_GIT_CHECK "[y] Do not compare source distribution with git repo"
Expand Down Expand Up @@ -596,6 +598,7 @@ check_all_boolean_vars () {
check_boolean_var BUILD_PACKAGE_ONLY
check_boolean_var BUILD_PREFETCH
check_boolean_var BUILD_PREFETCH_DEBUG
check_boolean_var DISABLE_BUILD
check_boolean_var DISABLE_DOCS
check_boolean_var ENABLE_DOCSPEC
check_boolean_var COVERAGE
Expand Down Expand Up @@ -1745,8 +1748,10 @@ ensure_cabal_config() {
# Precedence: CABAL_CONFIG > CABAL_DIR > Legacy > XDG
if test -n "$CABAL_CONFIG"; then
CABAL_OLD_CONFIG_PATH="$CABAL_CONFIG"
CABAL_NEW_CONFIG_PATH="$CABAL_CONFIG"
elif test -n "$CABAL_DIR"; then
CABAL_OLD_CONFIG_PATH="$(cygpath -u $CABAL_DIR)/config"
CABAL_NEW_CONFIG_PATH="${OS_APP_HOME}/.config/cabal/config"
else
CABAL_OLD_CONFIG_PATH="${OS_APP_HOME}/${OS_CABAL_DIR}/config"
CABAL_NEW_CONFIG_PATH="${OS_APP_HOME}/.config/cabal/config"
Expand Down Expand Up @@ -2025,15 +2030,18 @@ build_and_test() {
show_step "Build"
echo "pwd: $(pwd)"

# If we use --enable-documenation cabal compiles once for build
# and compilation is forced again for documentation it says "Flags
# Changed". The same thing happens for separate haddock step as
# well. But in a separate haddock step we can at least change the
# build-dir to not clobber our pervious build. If haddock clobbers then
# running tests will build it again.
run_verbose_errexit $SDIST_CABALCMD v2-build \
--with-compiler "$COMPILER_EXE_PATH" \
$GHCJS_FLAG $CABAL_BUILD_OPTIONS $CABAL_BUILD_TARGETS
if test -z "$DISABLE_BUILD" -o -z "$DISABLE_TEST" -o -z "$DISABLE_BENCH" -o -n "$ENABLE_DOCSPEC"
then
# If we use --enable-documenation cabal compiles once for build
# and compilation is forced again for documentation it says "Flags
# Changed". The same thing happens for separate haddock step as
# well. But in a separate haddock step we can at least change the
# build-dir to not clobber our pervious build. If haddock clobbers then
# running tests will build it again.
run_verbose_errexit $SDIST_CABALCMD v2-build \
--with-compiler "$COMPILER_EXE_PATH" \
$GHCJS_FLAG $CABAL_BUILD_OPTIONS $CABAL_BUILD_TARGETS
fi

# Haddock build forces recompilation of tests, so we should either do
# haddock in separate builddir or do them after the tests.
Expand All @@ -2043,7 +2051,7 @@ build_and_test() {
echo "pwd: $(pwd)"
run_verbose_errexit $SDIST_CABALCMD v2-haddock \
--with-compiler "$COMPILER_EXE_PATH" \
$GHCJS_FLAG
$GHCJS_FLAG \
--builddir dist-newstyle-haddock \
$CABAL_BUILD_OPTIONS \
$HADDOCK_OPTIONS \
Expand Down Expand Up @@ -2546,15 +2554,6 @@ get_rel_time() {
echo $((`get_sys_time` - ${BASE_TIME}))
}

#------------------------------------------------------------------------------
# Some adjustments to the build environment
#------------------------------------------------------------------------------

setup_environment() {
# stack does not work well with empty STACK_YAML env var
test -n "$STACK_YAML" || unset STACK_YAML
}

#------------------------------------------------------------------------------
# Main flow of script starts here
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -2715,7 +2714,6 @@ TOOLS="awk cat curl cut date env head mkdir printf rm sleep sort tail tr uname w
$OS_HAS_TOOLS"

show_step "Check basic tools"
setup_environment
require_cmd bash
for i in $TOOLS; do require_cmd $i; done

Expand All @@ -2733,6 +2731,8 @@ if test "$BUILD" = "hlint"
then
start_hlint
else
# stack does not work well with empty STACK_YAML env var
test -n "$STACK_YAML" || unset STACK_YAML
verify_build_config
build_compile
fi
Expand Down
Loading