-
Notifications
You must be signed in to change notification settings - Fork 723
Description
The Cabal library should be agnostic to the current working directory. That is, a build system that directly calls the Cabal library should be able to use the API exposed by Cabal to set the current working directory, instead of it being taken from the environment of the current process.
Why is this beneficial? For example, this feature is required to directly call Cabal library functions when compiling packages with Simple build-type in a concurrent manner, as using setCurrentDirectory is not thread-safe. Note that this would not affect packages with Custom build-type, as we necessarily have to run the corresponding Setup executable (for which we can set the current directory).
Currently, cabal-install defines the SelfExecMethod SetupMethod, which exists precisely to circumvent this problem (in practice we set forceExternalSetupMethod = parallelBuild).
See also the ghc -working-dir flag which was added as part of the implementation of multiple home units in GHC.