summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/hs-haskell-src-exts/Makefile5
-rw-r--r--devel/hs-pretty-show/Makefile4
-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
6 files changed, 64 insertions, 5 deletions
diff --git a/devel/hs-haskell-src-exts/Makefile b/devel/hs-haskell-src-exts/Makefile
index e57abdc96ef..ed1bcd070ea 100644
--- a/devel/hs-haskell-src-exts/Makefile
+++ b/devel/hs-haskell-src-exts/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.8 2021/04/23 12:16:15 pho Exp $
+# $NetBSD: Makefile,v 1.9 2021/05/01 16:14:19 pho Exp $
DISTNAME= haskell-src-exts-1.23.1
CATEGORIES= devel
@@ -7,7 +7,8 @@ MAINTAINER= pho@cielonegro.org
COMMENT= Manipulating Haskell source
LICENSE= modified-bsd
-BUILD_DEPENDS+= happy>=1.19:../../devel/happy
+USE_TOOLS+= happy
+HAPPY_REQD= 1.19
.include "../../mk/haskell.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/devel/hs-pretty-show/Makefile b/devel/hs-pretty-show/Makefile
index 34ad1e62fdb..20f92d823b1 100644
--- a/devel/hs-pretty-show/Makefile
+++ b/devel/hs-pretty-show/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2021/04/23 10:31:55 pho Exp $
+# $NetBSD: Makefile,v 1.4 2021/05/01 16:14:19 pho Exp $
DISTNAME= pretty-show-1.10
CATEGORIES= devel
@@ -7,7 +7,7 @@ MAINTAINER= pho@cielonegro.org
COMMENT= Tools for working with derived Show instances
LICENSE= mit
-BUILD_DEPENDS+= happy-[0-9]*:../../devel/happy
+USE_TOOLS+= happy
.include "../../devel/hs-haskell-lexer/buildlink3.mk"
.include "../../mk/haskell.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