From cac8c7bb098002ddce0ef7c1e4429940d22d8cc2 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 24 May 2022 10:59:57 +0100 Subject: hadrian: Fix building from source-dist without alex/happy This fixes two bugs which were adding dependencies on alex/happy when building from a source dist. * When we try to pass `--with-alex` and `--with-happy` to cabal when configuring but the builders are not set. This is fixed by making them optional. * When we configure, cabal requires alex/happy because of the build-tool-depends fields. These are now made optional with a cabal flag (build-tool-depends) for compiler/hpc-bin/genprimopcode. Fixes #21627 --- compiler/ghc.cabal.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'compiler/ghc.cabal.in') diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 9e61e0e2a2..74d95cdc65 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -56,6 +56,12 @@ Flag dynamic-system-linker Default: True Manual: True +-- hadrian disables this flag because the user may be building from a source +-- distribution where the parser has already been generated. +Flag build-tool-depends + Description: Use build-tool-depends + Default: True + Library Default-Language: Haskell2010 Exposed: False @@ -67,7 +73,8 @@ Library FunTypes.h ghc-llvm-version.h - build-tool-depends: alex:alex >= 3.2.6, happy:happy >= 1.20.0, genprimopcode:genprimopcode, deriveConstants:deriveConstants + if flag(build-tool-depends) + build-tool-depends: alex:alex >= 3.2.6, happy:happy >= 1.20.0, genprimopcode:genprimopcode, deriveConstants:deriveConstants Build-Depends: base >= 4.11 && < 4.17, deepseq >= 1.4 && < 1.5, -- cgit v1.2.1