Marc Espie <es...@nerim.net> writes:

> I would prefer that you would reconstitute DISTNAME from MODCABAL variables
> exactly like stuff is done for github.

Does the diff below look like what you had in mind? I like it as the
data becomes more structured (parsing is almost never the best choice).
I can imagine adding some error checks to help the users.

diff --git devel/alex/Makefile devel/alex/Makefile
index 77a2f8fec5f..e19050f77f0 100644
--- devel/alex/Makefile
+++ devel/alex/Makefile
@@ -2,7 +2,9 @@
 
 COMMENT =      lexical analyser generator for Haskell
 
-DISTNAME =     alex-3.2.5
+MODCABAL_STEM          = alex
+MODCABAL_VERSION       = 3.2.5
+MODCABAL_DATA_DIR      = data
 CATEGORIES =   devel
 
 HOMEPAGE =     http://www.haskell.org/alex/
@@ -13,7 +15,6 @@ PERMIT_PACKAGE =              Yes
 WANTLIB =              c charset ffi gmp iconv m pthread util
 
 MODULES =              devel/cabal
-MODCABAL_DATA_DIR=     data
 
 LIB_DEPENDS =          converters/libiconv \
                        devel/gmp \
diff --git devel/cabal/cabal.port.mk devel/cabal/cabal.port.mk
index 18a082206d9..3a5859266c9 100644
--- devel/cabal/cabal.port.mk
+++ devel/cabal/cabal.port.mk
@@ -3,8 +3,10 @@
 # Module for building Haskell programs with cabal-install.
 # Inspired by FreeBSD cabal.mk by Gleb Popov.
 
-# Available input variables:
+# Input variables:
 #
+#  MODCABAL_STEM - the name of the package on hackage.
+#  MODCABAL_VERSION  - the version of the package.
 #  MODCABAL_MANIFEST - hackage dependencies required by this package, tripples
 #    of space separate <package> <version> <revision>. Typically generated
 #    with cabal-bundler program from cabal-extras. The patch pending review
@@ -46,8 +48,7 @@ DIST_SUBDIR ?=                hackage
 # archives by the normal extraction rules.
 EXTRACT_CASES += *.cabal) ;;
 
-MODCABAL_STEM =                ${DISTNAME:C,-[0-9.]*$,,}
-MODCABAL_VERSION =     ${DISTNAME:C,.*-([0-9.]*)$,\1,}
+DISTNAME ?=            ${MODCABAL_STEM}-${MODCABAL_VERSION}
 HOMEPAGE ?=            ${MASTER_SITES9}${MODCABAL_STEM}
 MASTER_SITES ?=                ${MASTER_SITES9}${DISTNAME}/
 DISTFILES ?=           ${DISTNAME}.tar.gz
diff --git devel/happy/Makefile devel/happy/Makefile
index fbe2ab0a1bb..77b0888eba0 100644
--- devel/happy/Makefile
+++ devel/happy/Makefile
@@ -2,7 +2,10 @@
 
 COMMENT=               parser generator for Haskell
 
-DISTNAME=              happy-1.19.12
+MODCABAL_STEM=         happy
+MODCABAL_VERSION=      1.19.12
+MODCABAL_DATA_DIR=     data
+
 CATEGORIES=            devel
 
 HOMEPAGE=              http://www.haskell.org/happy/
@@ -14,8 +17,6 @@ WANTLIB=              c ffi gmp iconv m pthread
 
 MODULES=               devel/cabal
 
-MODCABAL_DATA_DIR=     data
-
 LIB_DEPENDS=           converters/libiconv \
                        devel/gmp \
                        devel/libffi

Reply via email to