Cabal get build directory or redirect -hidir output

I’m interested in having an automated way of getting cabal’s interface files (either a copy/symlink to them or redirecting the output). Unfortunately the closest thing to getting a directory is cabal list-bin which seems fragile for this (would require some string manipulation/isn’t guaranteed).

I would prefer against setting -hidir if possible as some programs (cabal/ghc-pkg) assume that the location is not changed (though I do have workarounds for this case). Notably setting -hidir causes build failures with cabal unless you do a build without the flag first. If anyone knows how to resolve that easily it would be helpful as well.

If anyone has any ideas here on how to do this I would greatly appreciate it.

1 Like