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

There seems to be no way to use build tools in Hackage packages (need v2-build) #821

Open
gromakovsky opened this issue Mar 30, 2019 · 3 comments
Labels
component: doc builder re: build-tools Concerning build-tools or build-tool-depends

Comments

@gromakovsky
Copy link

I want to upload a package that uses a custom build tool, namely autoexporter. However, apparently there is no way to do it so that the package will be successfully built by Hackage. There are two relevant things that can be specified in .cabal files: build-tools and build-tool-depends.

I don't know which exact Cabal version is used by Hackage. However, if Cabal version is less than 2, only build-tools is available. Its documentation says the following:

A list of Haskell programs needed to build this component. Each may be followed by an optional version bound. Confusingly, each program in the list either refer to one of three things:

        Another executables in the same package (supported since Cabal 1.12)
        Tool name contained in Cabal’s hard-coded set of common tools
        A pre-built executable that should already be on the PATH (supported since Cabal 2.0)

In my case autoexporter is not in my package and is not a hard-coded tool. And the third option from the list above doesn't work before Cabal 2.0.

Now let's assume that Cabal ≥ 2.0 is used, which is more likely.
If we use the old build-tools option, we can consider the third case described there:

A pre-built executable that should already be on the PATH (supported since Cabal 2.0)

I've tried to use it, but build failed:
https://hackage.haskell.org/package/morley-0.1.0.3/reports/1
https://hackage.haskell.org/package/morley-0.1.0.3/morley.cabal

So probably autoexporter is not on the PATH, which is not surprising.

I've also tried using build-tool-depends. Unfortunately, it doesn't work either:
https://hackage.haskell.org/package/morley-0.1.0.2/reports/1
https://hackage.haskell.org/package/morley-0.1.0.2/morley.cabal

The documentation says the following:

Cabal tries to make sure that all specified programs are atomically built and prepended on the $PATH shell variable before building the component in question, but can only do so for Nix-style builds. Specifically:

    For Nix-style local builds, both internal and external dependencies.
    For old-style builds, only for internal dependencies [1]. It’s up to the user to provide needed executables in this case under $PATH.

AFAIU, Hackage uses old-style builds, I think so because there is a warning at the beginning of build report:

Warning: The install command is a part of the legacy v1 style of cabal usage.

So this build-tool-depends seems to work only for internal dependencies.

So I have a question: is it possible to use an external build tool so that Hackage build passes? Specifically:

  1. Maybe it's possible to forcefully use new-install instead of install?
  2. Maybe it's possible to somehow tell Hackage to put autoexporter (or any other build tool which is not hardcoded) into $PATH?
gromakovsky added a commit to serokell/xrefcheck that referenced this issue May 19, 2020
Problem: `autoexporter` is used in one place to re-export one module.
Probably one day it will re-export more, but at this point it's really
overkill.
Moreover, it causes Hackage build to fail for the reasons mentioned
here:
haskell/hackage-server#821

Solution: stop using it, re-export manually.
@gbaz gbaz changed the title There seems to be no way to use build tools in Hackage packages There seems to be no way to use build tools in Hackage packages (need v2-build) Jun 7, 2021
@gbaz
Copy link
Contributor

gbaz commented Jun 7, 2021

We tried to use v2 build in the latest gsoc and I think the obstacle we ran into was that the test and coverage flags didn't all work nicely with it.

cf: haskell/cabal#6811
haskell/cabal#6851
haskell/cabal#6938
haskell/cabal#6876

Martoon-00 added a commit to serokell/servant-util that referenced this issue Jul 26, 2021
Problem: at this moment, we want the package to be located on Hackage,
but it still fails to render documentation for packages using any build
tools, see the
[issue](haskell/hackage-server#821).

Moreover, my HLS fails to build the project because of autoexporter as
well.

Solution: replace uses of `autoexporter` with manually written module
lists.
@sol
Copy link
Member

sol commented Sep 19, 2023

@gbaz what's the procedure for getting build tools installed globally on Hackage? @alaendle wanted to use markdown-unlit. sol/markdown-unlit#52

@domenkozar
Copy link

This would be incredibly useful for those using markdown-unlit, as it makes sure that README code actually works.

workaround

@andreasabel andreasabel added the re: build-tools Concerning build-tools or build-tool-depends label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: doc builder re: build-tools Concerning build-tools or build-tool-depends
Projects
None yet
Development

No branches or pull requests

5 participants