Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack datadir option writes to datadir during build, breaking DESTDIR, unlike cabal #5026

Open
essandess opened this issue Sep 6, 2019 · 0 comments

Comments

@essandess
Copy link

I believe that this stack behavior is a bug:

Specifying stack's --datadir= option in stack.yaml causes stack to write cabal's data-files to datadir during stack build. This breaks package manager GNU DESTDIR capability, as discussed in #848. Here is an example automated build that illustrates the problem.

In contrast, specifying datadir in the cabal file Paths_packagename.hs, causes stack to write cabal's data-files to the default .stack-work location during the build, and produce a binary with a correctly hardcoded path in PREFIX. This approach was described years ago by hlint's author @ndmitchell.

Here is the `stack.yaml' configuration that produces the issue:

configure-options:
  packagename:
  - --datadir=/path/to/my/datadir

Here is an automated stack build that solves the issue with related files:

Also noted for posterity: setting the environment variable packagename_datadir at runtime overrides the binary's hardcoded packagename_datadir path.

I believe that stack's behavior should be the same as setting datadir in Paths_packagename.hs, which would fix a longstanding problem of hardcoded paths of the build directory in stack binaries when cabal data-files exist in packagename.cabal.

This is related to:

essandess added a commit to essandess/macports-ports that referenced this issue Sep 13, 2019
* Uses port:stack for build
* Uses Paths_ihaskell.hs for correct `${prefix}` of Cabal data-files path

Related: haskell/cabal#6234
Related: commercialhaskell/stack#5026
Related: https://trac.macports.org/ticket/50608
mf2k pushed a commit to macports/macports-ports that referenced this issue Sep 14, 2019
* Uses port:stack for build
* Uses Paths_ihaskell.hs for correct `${prefix}` of Cabal data-files path

Related: haskell/cabal#6234
Related: commercialhaskell/stack#5026
Related: https://trac.macports.org/ticket/50608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant