2019-11-01 17:32:24 +03:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather ghcide will via configuration in hie.yaml.
|
2019-11-01 18:01:17 +03:00
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
cd $(dirname "$0")/..
|
|
|
|
|
|
|
|
|
|
root="$(pwd)"
|
|
|
|
|
ghc_version="$(ghc --numeric-version)"
|
|
|
|
|
|
2019-12-18 01:06:11 +03:00
|
|
|
|
# recent hie-bios requires us to output to the file at $HIE_BIOS_OUTPUT, but older builds & script/repl don’t set that var, so we default it to stdout
|
2019-12-18 00:49:45 +03:00
|
|
|
|
output_file="${HIE_BIOS_OUTPUT:-/dev/stdout}"
|
|
|
|
|
|
2019-11-01 18:50:45 +03:00
|
|
|
|
if [ "$1" == "--builddir" ]; then
|
|
|
|
|
repl_builddir="$2"
|
|
|
|
|
shift 2
|
|
|
|
|
else
|
|
|
|
|
repl_builddir=dist-newstyle
|
|
|
|
|
fi
|
|
|
|
|
|
2019-12-18 00:50:26 +03:00
|
|
|
|
function flags {
|
|
|
|
|
echo "-O0"
|
|
|
|
|
echo "-ignore-dot-ghci"
|
|
|
|
|
|
2019-12-18 00:51:21 +03:00
|
|
|
|
echo "-outputdir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/build"
|
|
|
|
|
echo "-odir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/build"
|
|
|
|
|
echo "-hidir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/build"
|
|
|
|
|
echo "-stubdir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/build"
|
2019-12-18 00:50:26 +03:00
|
|
|
|
|
2019-12-18 00:51:21 +03:00
|
|
|
|
echo "-i$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/build/autogen"
|
2019-12-18 00:50:26 +03:00
|
|
|
|
|
2019-12-18 00:51:21 +03:00
|
|
|
|
echo "-I$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/build/autogen"
|
2019-12-18 00:50:26 +03:00
|
|
|
|
|
|
|
|
|
echo "-i$root/semantic-analysis/src"
|
|
|
|
|
echo "-i$root/semantic-ast/src"
|
|
|
|
|
echo "-i$root/semantic-core/src"
|
|
|
|
|
echo "-i$root/semantic-java/src"
|
|
|
|
|
echo "-i$root/semantic-json/src"
|
|
|
|
|
echo "-i$root/semantic-python/src"
|
|
|
|
|
echo "-i$root/semantic-tags/src"
|
|
|
|
|
echo "-i$root/app"
|
|
|
|
|
echo "-i$root/src"
|
|
|
|
|
echo "-i$root/bench"
|
|
|
|
|
echo "-i$root/test"
|
|
|
|
|
|
|
|
|
|
echo "-optP-include"
|
2019-12-18 00:51:21 +03:00
|
|
|
|
echo "-optP$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/build/autogen/cabal_macros.h"
|
2019-12-18 00:50:26 +03:00
|
|
|
|
|
|
|
|
|
echo "-hide-all-packages"
|
|
|
|
|
|
|
|
|
|
# Emit package flags from the environment file, removing comments & prefixing with -
|
|
|
|
|
cabal v2-exec --builddir="$repl_builddir" -v0 bash -- -c 'cat $GHC_ENVIRONMENT' | grep -v '^--' | sed -e 's/^/-/'
|
|
|
|
|
|
|
|
|
|
echo "-XHaskell2010"
|
|
|
|
|
echo "-XStrictData"
|
|
|
|
|
|
|
|
|
|
echo "-Wwarn"
|
|
|
|
|
|
|
|
|
|
echo "-Weverything"
|
|
|
|
|
echo "-Wno-all-missed-specialisations"
|
|
|
|
|
echo "-Wno-implicit-prelude"
|
|
|
|
|
echo "-Wno-missed-specialisations"
|
|
|
|
|
echo "-Wno-missing-import-lists"
|
|
|
|
|
echo "-Wno-missing-local-signatures"
|
|
|
|
|
echo "-Wno-monomorphism-restriction"
|
|
|
|
|
echo "-Wno-name-shadowing"
|
|
|
|
|
echo "-Wno-safe"
|
|
|
|
|
echo "-Wno-unsafe"
|
|
|
|
|
echo "-Wno-star-is-type"
|
2019-12-18 00:54:39 +03:00
|
|
|
|
echo "-Wno-missing-deriving-strategies"
|
2019-12-18 00:50:26 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flags > "$output_file"
|