Search code examples
cabalhaskell-stack

Installing a customized version of Cabal and use it for stack


I'm trying to build stack against a customized version of Cabal. For that I first tried to install my customized Cabal version out of the modified git tree via cabal install --project-file=cabal.project.release --lib Cabal producing the followng trimmed output:

[...]
Resolving dependencies...
Build profile: -w ghc-8.10.5 -O1
In order, the following will be built (use -v for more details):
 - Cabal-3.7.0.0 (lib) (requires build)
Starting     Cabal-3.7.0.0 (lib)
Building     Cabal-3.7.0.0 (lib)
Installing   Cabal-3.7.0.0 (lib)
Completed    Cabal-3.7.0.0 (lib)

Afterwards I tried to install stack. However, while building I observed that my old system Cabal version 3.2.1.0 instead of my modified version 3.7.0.0 is used:

[...]
stack                > configure (lib + exe)
[1 of 2] Compiling Main             ( /home/max/stack/Setup.hs, /home/max/stack/.stack-work/dist/x86_64-linux/Cabal-3.2.1.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim   ( /home/max/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/max/stack/.stack-work/dist/x86_64-linux/Cabal-3.2.1.0/setup/StackSetupShim.o )
Linking /home/max/stack/.stack-work/dist/x86_64-linux/Cabal-3.2.1.0/setup/setup ...
Configuring stack-2.7.4...

Looking up my cabal version gives:

$ cabal list --installed Cabal
* Cabal
    Synopsis: A framework for packaging Haskell software
    Default available version: 3.6.2.0
    Installed versions: 3.2.1.0
    Homepage: http://www.haskell.org/cabal/
    License:  BSD3

It looks like as if the installation of my modified Cabal version 3.7.0.0 did not succeed. Is there any way to install a customized Cabal library and use that in a different project as e.g. while building stack?


Solution

  • As described by @sjakobi the solution is to add an extra-deps to the stack yaml file and use stack to build itself.