summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorpho <pho@pkgsrc.org>2021-05-01 16:14:19 +0000
committerpho <pho@pkgsrc.org>2021-05-01 16:14:19 +0000
commit8e8887c58351556afd728e330e802de7a4d88bd1 (patch)
treed8d3c349a298a3f6e175f0c9a51f6ed1b7fcf364 /mk
parent95a4fc2bfa85ec9dc07aa77c4dbdd62a6261c183 (diff)
downloadpkgsrc-8e8887c58351556afd728e330e802de7a4d88bd1.tar.gz
Use tools framework for Haskell source preprocessors
Diffstat (limited to 'mk')
-rw-r--r--mk/haskell.mk9
-rw-r--r--mk/haskell/tools/alex.mk17
-rw-r--r--mk/haskell/tools/cpphs.mk17
-rw-r--r--mk/haskell/tools/happy.mk17
4 files changed, 59 insertions, 1 deletions
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