pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk mk/haskell.mk: New package-settable variable "HASKE...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/396f5913fb65
branches:  trunk
changeset: 384934:396f5913fb65
user:      pho <pho%pkgsrc.org@localhost>
date:      Thu Sep 08 04:45:44 2022 +0000

description:
mk/haskell.mk: New package-settable variable "HASKELL_UNRESTRICT_DEPENDENCIES"

It's a list of Cabal package names whose version constraints need to be
relaxed. This should free ourselves from needing to patch *.cabal files
most of the time. Suggested by wiz@

diffstat:

 mk/haskell.mk |  33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diffs (75 lines):

diff -r 6ce362a5b94f -r 396f5913fb65 mk/haskell.mk
--- a/mk/haskell.mk     Thu Sep 08 03:42:10 2022 +0000
+++ b/mk/haskell.mk     Thu Sep 08 04:45:44 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: haskell.mk,v 1.45 2022/09/08 03:42:10 pho Exp $
+# $NetBSD: haskell.mk,v 1.46 2022/09/08 04:45:44 pho Exp $
 #
 # This Makefile fragment handles Haskell Cabal packages. Package
 # configuration, building, installation, registration and unregistration
@@ -32,6 +32,15 @@
 #      Possible values: yes, no
 #      Default value: inherits ${HASKELL_ENABLE_SHARED_LIBRARY}
 #
+# HASKELL_UNRESTRICT_DEPENDENCIES
+#      A list of Cabal packages that the package depends on, whose version
+#      constraints are way too restricted to solve. Listing packages in
+#      this variable will cause the *.cabal file to be rewritten so that
+#      any version is accepted. Use this with care, because not every
+#      incompatibilities are caught during build time.
+#
+#      Default value: empty
+#
 # User-settable variables:
 #
 # HASKELL_ENABLE_SHARED_LIBRARY
@@ -74,6 +83,7 @@
        HASKELL_ENABLE_DYNAMIC_EXECUTABLE \
        HASKELL_OPTIMIZATION_LEVEL \
        HASKELL_PKG_NAME \
+       HASKELL_UNRESTRICT_DEPENDENCIES \
        PKGNAME HOMEPAGE MASTER_SITES
 _DEF_VARS.haskell= \
        BUILDLINK_PASSTHRU_DIRS \
@@ -102,6 +112,8 @@
        PKGDIR DESTDIR \
        PREFIX \
        WRKSRC
+_SORTED_VARS.haskell= \
+       HASKELL_UNRESTRICT_DEPENDENCIES
 _LISTED_VARS.haskell= \
        BUILDLINK_PASSTHRU_DIRS \
        CONFIGURE_ARGS \
@@ -123,6 +135,7 @@
 HASKELL_ENABLE_SHARED_LIBRARY?=                yes
 HASKELL_ENABLE_LIBRARY_PROFILING?=     yes
 HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= yes
+HASKELL_UNRESTRICT_DEPENDENCIES?=      # empty
 
 .include "../../lang/ghc92/buildlink3.mk"
 
@@ -149,6 +162,24 @@
 # GHC requires C compiler.
 USE_LANGUAGES+=        c
 
+# Haskell packages don't use semvars but it uses something similar to it,
+# which is called Haskell PVP (https://pvp.haskell.org/). Packages usually
+# have version constraints on their dependencies that specify not only
+# lower bounds but also upper bounds. The problem is that, while lower
+# bounds are mostly acculate, package authors can not be sure about upper
+# bounds so they tend to be too pessimistic about compatibility.
+.if !empty(HASKELL_UNRESTRICT_DEPENDENCIES)
+SUBST_CLASSES+=                cabal
+SUBST_STAGE.cabal?=    post-extract
+SUBST_FILES.cabal?=    ${HASKELL_PKG_NAME:C/-[[:digit:].]+$//}.cabal
+SUBST_MESSAGE.cabal?=  Relaxing version constraints on dependencies
+.  for _pkg_ in ${HASKELL_UNRESTRICT_DEPENDENCIES}
+# Leading whitespaces or commas to avoid mismatches, remove version
+# constraints up to end of line or ','.
+SUBST_SED.cabal+=      -Ee 's/((^|,)[[:space:]]*${_pkg_})[^[:alpha:],]+(,|$$)/\1\3/g'
+.  endfor
+.endif
+
 # Declarations for ../../mk/configure/configure.mk
 CONFIGURE_ARGS+=       --ghc
 CONFIGURE_ARGS+=       --with-compiler=${_HASKELL_BIN:Q}



Home | Main Index | Thread Index | Old Index