commercialhaskell / commercialhaskell/stack

Flags not passed into extra-dep using local file path

Open
#5,301 0 comments 0 reactions 0 assignees View on GitHub
further investigation required
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)
When an extra-dep is specified using a local file path, flags are not used to configure it.

### Steps to reproduce
Main project's stack.yaml
```
resolver: lts-15.3
packages:
- .

extra-deps:
- ../my-test-pkg

flags:
my-test-pkg:
my-debug: False
```

Include any `.yaml` configuration if relevant.

Dependency's cabal (generated by stack init, only added the flag `my-debug`:
```
cabal-version: 1.12

name: my-test-pkg
version: 0.1.0.0
description: Please see the README on GitHub at
homepage: https://github.com/githubuser/my-test-pkg#readme
bug-reports: https://github.com/githubuser/my-test-pkg/issues
author: Author name here
maintainer: example@example.com
copyright: 2020 Author name here
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
ChangeLog.md

source-repository head
type: git
location: https://github.com/githubuser/my-test-pkg

flag my-debug
default: True
manual: True

library
exposed-modules:
Lib
other-modules:
Paths_my_test_pkg
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
default-language: Haskell2010
if flag(my-debug)
pkgconfig-depends: invalidpackagename

executable my-test-pkg-exe
main-is: Main.hs
other-modules:
Paths_my_test_pkg
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, my-test-pkg
default-language: Haskell2010
```
### Expected

The flag `my-debug` to be used in configuring the dependency.

### Actual

With the example above, `stack build` fails with:
```
Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.2: The pkg-config package
'invalidpackagename' is required but it could not be found.
```

In the error message given, it is shown that `-fmy-debug` is used in `cabal configure` instead of `-f-my-debug`.

### Stack version

```
Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.