haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

Command to build an sdist #9025

Open michaelpj opened 1 year ago

michaelpj commented 1 year ago

At the moment it's not that easy to build a generated sdist. You can unpack it yourself and build it from there, but it would be nice to have a one-command way to do this.

This is useful to catch issues like missing extra-source-files, which seems to be quite common (and just bit me!).

I would be happy with:

Related:

jneira commented 1 year ago

iirc you can install tarballs with cabal install path/to/package.tar.gz, is it not suitable for your workflow?

michaelpj commented 1 year ago

Discussed a bit on IRC, but I interpret cabal install as very side-effect-y, which is very much not what I want. I want to build it! And I might want to test it or haddock it also.

andreabedini commented 1 year ago

Note that the command line help says that you can do cabal build ./sdist.tgz but IIRC it does not work.

I'd also stay clear of cabal install.

Question: how do would you expect it to work? Should it be build like a local parkage? (Where is the build directory then?) or like a configured package (like extra-packages in cabal.project)?

andreabedini commented 1 year ago

I remembered but not quite correctly. https://github.com/haskell/cabal/issues/7328 talks about specifying a source directory not a source tarball.

Mikolaj commented 1 year ago

Question: how do would you expect it to work? Should it be build like a local parkage? (Where is the build directory then?) or like a configured package (like extra-packages in cabal.project)?

IIRC, the idea would be to do what cabal install does, namely pretend it's a non-local package just like all the others involved in the build. No idea about ' configured package (like extra-packages in cabal.project)' vs what cabal install does.

andreabedini commented 1 year ago

I mean like a named package can be listed in extra-packages in cabal.project, this makes it a non-local package. Notice you can use package: ../path/to/sdist but that becomes a local package. TBH I haven't looked into CmdInstall.hs enough to know what it does :)