Jivan
Jivan

Reputation: 23068

Indicate target directory of stack build executable

I used to build a project with the following command:

stack ghc -- src/Main.hs -o build/myexecutablefile -odir build -hidir build -isrc

Now I've installed the project as a proper Stack package with stack.yaml and project.cabal files, I'm able to build it using the simpler stack build command.

However, I can't figure out how to specify, as I used to, that the executable file should go to the project/build directory. Currently, the executable file goes into the /Users/myself/project/.stack-work/install/x86_64-osx/993e24b...1126d52/8.8.4/bin folder and I haven't succeeded in changing it so far.

I've tried setting local-bin-path: ./build/ in stack.yaml, to no effect. stack path shows the correct value, but when running stack build, the executable still goes to the same destination folder as mentioned just above.

Upvotes: 0

Views: 517

Answers (1)

Li-yao Xia
Li-yao Xia

Reputation: 33399

To put the binaries in their place:

stack install

which is a shortcut for

stack build --copy-bins

Upvotes: 1

Related Questions