Commit a7fb9b9a authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺 Committed by GitHub
Browse files

Fix install of packages bundling generated source in dist/ (#4012)

Packages like `alex` include pre-generated lexer/parser source
in their source tarball as e.g.


to avoid having to have `alex` already installed before building

Unfortunately, 8dc39db7 broke
packages relying on this accidental feature by changing where the
distdir points to. This patch partly reverts that commit and
therefore addresses the regression aspect of #4009.

This fix was suggested by @dcoutts
parent c56e35a2
......@@ -744,16 +744,21 @@ withTarballLocalDirectory verbosity distDirLayout@DistDirLayout{..}
tarball pkgid dparams buildstyle pkgTextOverride
buildPkg =
case buildstyle of
-- In this case we make a couple temp dirs, unpack the tarball to one
-- and build and install it from the other. We avoid nesting the
-- builddir under the tarball src dir to keep path name lengths down.
-- In this case we make a temp dir (e.g. tmp/src2345/), unpack
-- the tarball to it (e.g. tmp/src2345/foo-1.0/), and for
-- compatibility we put the dist dir within it
-- (i.e. tmp/src2345/foo-1.0/dist/).
-- Unfortunately, a few custom Setup.hs scripts do not respect
-- the --builddir flag and always look for it at ./dist/ so
-- this way we avoid breaking those packages
BuildAndInstall ->
let tmpdir = distTempDirectory in
withTempDirectory verbosity tmpdir "src" $ \unpackdir ->
withTempDirectory verbosity tmpdir "build" $ \builddir -> do
withTempDirectory verbosity tmpdir "src" $ \unpackdir -> do
unpackPackageTarball verbosity tarball unpackdir
pkgid pkgTextOverride
let srcdir = unpackdir </> display pkgid
builddir = srcdir </> "dist"
buildPkg srcdir builddir
-- In this case we make sure the tarball has been unpacked to the
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment