Skip to content

Add -w/--with-compiler flag to cabal init - #5658

Merged
hvr merged 1 commit into
haskell:masterfrom
hvr:PR/issue-5654
Nov 5, 2018
Merged

hvr merged 1 commit into
haskell:masterfrom
hvr:PR/issue-5654

Conversation

@hvr

@hvr hvr commented Nov 3, 2018 •

Copy link
Copy Markdown
Member

Fixes #5654
Fixes #4936


Besides giving you the ability to conveniently pick a different ghc which you could workaround by e.g.

PATH=/opt/ghc/8.6.2/bin:$PATH cabal init

via a simpler, more explicit (because it doesn't rely on the indirection via $PATH to pick the right exe), and more idiomatic

cabal init -w ghc-8.6.2

if you have a setup where all ghc versions are symlinked version-suffixed in your $PATH already.

However, there's also the case where you don't have any ghc in your PATH, but only ghc-<version> symlinks; this is e.g. the default setup scheme promoted by ghcup and for this case, there's not necessarily any workaround (other than creating a cabal.config file or modifying your global cabal config). Or an even more pathological case is

cabal init -w /work/ghc/inplace/bin/ghc-stage2

TODO:

  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.

@hvr

hvr commented Nov 3, 2018

Copy link
Copy Markdown
Member Author

@23Skidoo is this hack tolerable? if yes, I'd vote for backporting to 2.4 as it's low-risk and trival

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"osx-7.8.4"
}
@23Skidoo

23Skidoo commented Nov 3, 2018

Copy link
Copy Markdown
Member

Looks fine and not really hacky to me, unless I'm missing something.

@hvr

hvr commented Nov 3, 2018

Copy link
Copy Markdown
Member Author

@23Skidoo maybe I've just got a different threshold for what I consider a hack... :-)

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"osx-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 3, 2018
"url":"pull/5658",
"account":"haskell",
"repo":"cabal",
"commit": "677ab0a1e8cf365350f2e48944935db1654f4fc3",
"tag":"osx-8.0.2"
}
@23Skidoo

23Skidoo commented Nov 3, 2018

Copy link
Copy Markdown
Member

How would a non-hacky version look like? It doesn't make sense for init to inherit all of configure flags IMO.

@m-renaud

m-renaud commented Nov 3, 2018

Copy link
Copy Markdown
Contributor

Will this create a cabal.project.local like cabal v2-configure -w ghc-ver would, or does this still require running the configure to pin the version for the project?

@hvr

hvr commented Nov 5, 2018

Copy link
Copy Markdown
Member Author

@m-renaud for now no cabal.project.* generation; I'd also keep this PR agnostic to that

However, I wanted to see support for for creating cabal.project skeletons added to cabal init; but this ought to be controlled by a question "Do you want to create a cabal.project file?", and we'd want to create a couple of comments in there (again controllable) with common fields people might want to uncomment or tweak and a pointer to the docs or a cheatsheet

@hvr

hvr commented Nov 5, 2018

Copy link
Copy Markdown
Member Author

@23Skidoo Can I take your comment as approval to merge (after I've update docs & changelog)?

@23Skidoo

23Skidoo commented Nov 5, 2018

Copy link
Copy Markdown
Member

@hvr Sure, go ahead.

@hvr
hvr merged commit 1916fca into haskell:master Nov 5, 2018
@hvr
hvr deleted the PR/issue-5654 branch November 5, 2018 23:21
hvr added a commit that referenced this pull request Nov 5, 2018
`cabal init` needs a haskell compiler to operate but is missing the `-w` flag
other commands have (see also #4956). This patch addresses this inconsistency.

Fixes #5654
Fixes #4936
(cherry picked from commit 1916fca)
@hvr hvr added this to the 2.4.0.1 milestone Nov 5, 2018
@hvr

hvr commented Nov 5, 2018

Copy link
Copy Markdown
Member Author

(cherry-picked to 2.4 via 878642e + 08019e5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cabal init doesn't allow specifying an alternative location for GHC executable "cabal init" should support support --with-ghc

3 participants