haskell / haskell/hackage-server

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

Open
#821 5 comments 3 reactions 0 assignees View on GitHub
component: doc builder re: build-tools
Dominant language
Haskell
Stars
467
Forks
225
PR merge metrics
No merged PRs in 30d

Description

I want to upload a package that uses a custom build tool, namely [autoexporter](https://hackage.haskell.org/package/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`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.