Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the executable output location for a Haskell project built with Stack?

While building my Haskell programs with Stack, I'm trying to get the executable to be written to project/dist/ but no matter what command line arguments I use or config files I change, it always ends up in project/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/project/.

After spending a decent amount of time looking at the command line arguments for the stack command, as well as options in project.cabal, Setup.hs, and stack.yaml, I can't seem to find how to configure the output location of stack build.

How do you configure the executable output location for stack build?

like image 543
TheEnvironmentalist Avatar asked Jul 15 '18 23:07

TheEnvironmentalist


People also ask

How does Haskell stack-work?

stack-work directories local to each project. The Stack root directory holds packages belonging to snapshots and any Stack-installed versions of GHC. Stack will not tamper with any system version of GHC or interfere with packages installed by other build tools (such as Cabal (the tool)).

Does Haskell have a stack?

Stack is a tool to build Haskell projects and manage their dependencies. It uses the Cabal library but with a curated version of the Hackage repository called Stackage.

What is Haskell tool stack?

Stack is a cross-platform program for developing Haskell projects. It is intended for Haskellers both new and experienced. See haskellstack.org or the doc directory for more information.

Where does stack install GHC?

You can find these sandboxed GHC installations in the ghc-* directories in the stack path --programs directory. If you would like Stack to use your system GHC installation, use the --system-ghc flag or run stack config set system-ghc --global true to make Stack check your PATH for a suitable GHC by default.


1 Answers

You can use the --copy-bins flag (or the install command) to copy the executables to some output directory. That destination directory can be controlled with --local-bin-path, but defaults to ~/.local/bin on POSIX systems.

like image 53
Michael Snoyman Avatar answered Sep 20 '22 19:09

Michael Snoyman