1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Correctly account of the presence of autogen files in build/noopt.

If you have `optimizations: False` in your cabal.project.local (such
as when you're in a tight build-run-debug cycle for some executable or
test suite), the autogenerated cabal_macros and Paths_ files might not
be present in the `build/` folder; if they aren't, we should look in
`build/noopt`.

This patch appears to address an issue I saw where the cabal macros
were being redefined, but I'm not entirely sure why. :/
This commit is contained in:
Patrick Thomson 2020-01-31 11:33:23 -05:00
parent b5fb41e7e4
commit 4058cd7b83

View File

@ -13,6 +13,14 @@ output_file="${HIE_BIOS_OUTPUT:-/dev/stdout}"
build_dir="dist-newstyle/build/x86_64-osx/ghc-$ghc_version"
build_products_dir="$build_dir/build-repl"
function add_autogen_includes {
echo "-optP-include"
echo "-optP$1/cabal_macros.h"
# autogenerated files, .h and .hs
echo "-i$1"
echo "-I$1"
}
function flags {
# disable optimizations for faster loading
echo "-O0"
@ -25,13 +33,11 @@ function flags {
echo "-hidir $build_products_dir"
echo "-stubdir $build_products_dir"
# preprocessor options, for -XCPP
echo "-optP-include"
echo "-optP$build_dir/semantic-0.10.0.0/build/autogen/cabal_macros.h"
# autogenerated sources, both .hs and .h (e.g. Foo_paths.hs)
echo "-i$build_dir/semantic-0.10.0.0/build/autogen"
echo "-I$build_dir/semantic-0.10.0.0/build/autogen"
if [ -d "$build_dir/semantic-0.10.0.0/build/autogen" ]
then add_autogen_includes "$build_dir/semantic-0.10.0.0/build/autogen"
elif [ -d "$build_dir/semantic-0.10.0.0/noopt/build/autogen" ]
then add_autogen_includes "$build_dir/semantic-0.10.0.0/noopt/build/autogen"
fi
# .hs source dirs
# TODO: would be nice to figure this out from cabal.project & the .cabal files