From 8e8887c58351556afd728e330e802de7a4d88bd1 Mon Sep 17 00:00:00 2001 From: pho Date: Sat, 1 May 2021 16:14:19 +0000 Subject: Use tools framework for Haskell source preprocessors --- mk/haskell.mk | 9 ++++++++- mk/haskell/tools/alex.mk | 17 +++++++++++++++++ mk/haskell/tools/cpphs.mk | 17 +++++++++++++++++ mk/haskell/tools/happy.mk | 17 +++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 mk/haskell/tools/alex.mk create mode 100644 mk/haskell/tools/cpphs.mk create mode 100644 mk/haskell/tools/happy.mk (limited to 'mk') diff --git a/mk/haskell.mk b/mk/haskell.mk index 29511c3008b..e467a936758 100644 --- a/mk/haskell.mk +++ b/mk/haskell.mk @@ -1,4 +1,4 @@ -# $NetBSD: haskell.mk,v 1.32 2021/05/01 15:06:26 pho Exp $ +# $NetBSD: haskell.mk,v 1.33 2021/05/01 16:14:19 pho Exp $ # # This Makefile fragment handles Haskell Cabal packages. # Package configuration, building, installation, registration and @@ -111,6 +111,13 @@ HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= yes .include "../../lang/ghc88/buildlink3.mk" +# Some Cabal packages requires preprocessors to build, and we don't +# want them to implicitly depend on such tools. Place dummy scripts by +# default. +.include "../../mk/haskell/tools/alex.mk" +.include "../../mk/haskell/tools/cpphs.mk" +.include "../../mk/haskell/tools/happy.mk" + # Tools _HASKELL_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc _HASKELL_PKG_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc-pkg diff --git a/mk/haskell/tools/alex.mk b/mk/haskell/tools/alex.mk new file mode 100644 index 00000000000..8ba7b2900db --- /dev/null +++ b/mk/haskell/tools/alex.mk @@ -0,0 +1,17 @@ +# $NetBSD: alex.mk,v 1.1 2021/05/01 16:14:19 pho Exp $ +# +# Usage: USE_TOOLS+= alex +# + +ALEX_REQD?= 0 +TOOLS_CREATE+= alex + +.if !empty(USE_TOOLS:Malex) +TOOLS_DEPENDS.alex?= alex>=${ALEX_REQD}:../../devel/alex +TOOLS_PATH.alex= ${PREFIX}/bin/alex +.else +# We can't use TOOLS_FAIL because Cabal tries to invoke all of +# relevant tools regardless of whether they are actually required. +TOOLS_SCRIPT.alex= \ + ${FAIL_MSG} "To use this tool, add USE_TOOLS+=alex to the package Makefile." +.endif diff --git a/mk/haskell/tools/cpphs.mk b/mk/haskell/tools/cpphs.mk new file mode 100644 index 00000000000..4c9ec8581c6 --- /dev/null +++ b/mk/haskell/tools/cpphs.mk @@ -0,0 +1,17 @@ +# $NetBSD: cpphs.mk,v 1.1 2021/05/01 16:14:19 pho Exp $ +# +# Usage: USE_TOOLS+= cpphs +# + +CPPHS_REQD?= 0 +TOOLS_CREATE+= cpphs + +.if !empty(USE_TOOLS:Mcpphs) +TOOLS_DEPENDS.cpphs?= hs-cpphs>=${CPPHS_REQD}:../../devel/hs-cpphs +TOOLS_PATH.cpphs= ${PREFIX}/bin/cpphs +.else +# We can't use TOOLS_FAIL because Cabal tries to invoke all of +# relevant tools regardless of whether they are actually required. +TOOLS_SCRIPT.cpphs= \ + ${FAIL_MSG} "To use this tool, add USE_TOOLS+=cpphs to the package Makefile." +.endif diff --git a/mk/haskell/tools/happy.mk b/mk/haskell/tools/happy.mk new file mode 100644 index 00000000000..22a9a61827b --- /dev/null +++ b/mk/haskell/tools/happy.mk @@ -0,0 +1,17 @@ +# $NetBSD: happy.mk,v 1.1 2021/05/01 16:14:19 pho Exp $ +# +# Usage: USE_TOOLS+= happy +# + +HAPPY_REQD?= 0 +TOOLS_CREATE+= happy + +.if !empty(USE_TOOLS:Mhappy) +TOOLS_DEPENDS.happy?= happy>=${HAPPY_REQD}:../../devel/happy +TOOLS_PATH.happy= ${PREFIX}/bin/happy +.else +# We can't use TOOLS_FAIL because Cabal tries to invoke all of +# relevant tools regardless of whether they are actually required. +TOOLS_SCRIPT.happy= \ + ${FAIL_MSG} "To use this tool, add USE_TOOLS+=happy to the package Makefile." +.endif -- cgit v1.2.3