Paths in Paths_ module wrong for local/vendored packages
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Still trying to use `cabal` v2-commands to build a project where the authors use stack. I ran into this problem:
A number of local libraries and executable have data-files, and use them during execution, based on the paths in the generated `Paths_foo` module. In one case, a `Setup.hs` even writes generated files into the data directory.
But when I build these with `cabal new-build`, they are not installed into the paths that are included in the `Paths` directory:
```
$ cat ./dist-newstyle/build/x86_64-linux/ghc-8.7.20180822/asterius-0.0.1/build/autogen/Paths_asterius.hs
…
bindir = "/home/jojo/.cabal/bin"
libdir = "/home/jojo/.cabal/lib/x86_64-linux-ghc-8.7.20180822/asterius-0.0.1-inplace"
dynlibdir = "/home/jojo/.cabal/lib/x86_64-linux-ghc-8.7.20180822"
datadir = "/home/jojo/.cabal/share/x86_64-linux-ghc-8.7.20180822/asterius-0.0.1"
libexecdir = "/home/jojo/.cabal/libexec/x86_64-linux-ghc-8.7.20180822/asterius-0.0.1"
sysconfdir = "/home/jojo/.cabal/etc"
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
getBinDir = catchIO (getEnv "asterius_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "asterius_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "asterius_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "asterius_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "asterius_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "asterius_sysconfdir") (\_ -> return sysconfdir)
```
It looks to me as if these are the paths that one would have after a `v1`-style installation.
The code also has support for overriding these paths using environment variables… but I am not sure who should do the overriding (`cabal new-exec`?), and what to override them with.
Contributor guide
Research direction
Start with the generated dist-newstyle/.../autogen/Paths_asterius.hs and the Setup.hs behavior described in the report. Trace how cabal new-build selects paths for local and vendored packages, and how the documented environment-variable overrides are expected to work. Done means local package data files and generated files resolve to the paths used by the build, with the override behavior clarified or corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100