Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2019 16:52:50 +0000 (UTC)
From:      Gleb Popov <arrowd@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r507361 - head/Mk/Uses
Message-ID:  <201907261652.x6QGqoxC018196@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arrowd
Date: Fri Jul 26 16:52:49 2019
New Revision: 507361
URL: https://svnweb.freebsd.org/changeset/ports/507361

Log:
  Add support for USES= cabal:hpack and document this option.

Modified:
  head/Mk/Uses/cabal.mk

Modified: head/Mk/Uses/cabal.mk
==============================================================================
--- head/Mk/Uses/cabal.mk	Fri Jul 26 16:46:46 2019	(r507360)
+++ head/Mk/Uses/cabal.mk	Fri Jul 26 16:52:49 2019	(r507361)
@@ -2,9 +2,13 @@
 #
 # Provide support for building Haskell packages using Cabal.
 #
-# Feature:      cabal
-# Usage:        USES=cabal
+# Feature:	cabal
+# Usage:	USES=cabal or USES=cabal:ARGS
+# Valid ARGS:	hpack
 #
+# hpack:	The port doesn't have a .cabal file and needs devel/hs-hpack to
+#		generate it from package.yaml file
+#
 # Variables, which can be set by the port:
 #
 #  USE_CABAL		List of Haskell packages required to build a port.
@@ -36,10 +40,6 @@
 .if !defined(_INCLUDE_USES_CABAL_MK)
 _INCLUDE_USES_CABAL_MK=    yes
 
-.if !empty(cabal_ARGS)
-IGNORE=		Incorrect 'USES= cabal:${cabal_ARGS}' cabal takes no arguments
-.endif
-
 PKGNAMEPREFIX?=	hs-
 
 EXECUTABLES?=	${PORTNAME}
@@ -52,6 +52,10 @@ BUILD_DEPENDS+=	cabal:devel/hs-cabal-install \
 		ghc:lang/ghc
 .  endif
 
+.  if ${cabal_ARGS:Mhpack}
+EXTRACT_DEPENDS+=	hpack:devel/hs-hpack
+.  endif
+
 # Inherited via lang/ghc we need to depend on iconv and libgmp.so (stage q/a)
 iconv_ARGS=	translit
 .include "${USESDIR}/iconv.mk"
@@ -92,6 +96,7 @@ DISTFILES+=	${package:C/_[0-9]+//}/revision/${package:
 
 # Fetches and unpacks package source from Hackage using only PORTNAME and PORTVERSION.
 cabal-extract: ${WRKDIR}
+	${RM} -rf ${CABAL_HOME}/.cabal
 	${SETENV} HOME=${CABAL_HOME} cabal new-update
 	cd ${WRKDIR} && \
 		${SETENV} HOME=${CABAL_HOME} cabal get ${PORTNAME}-${PORTVERSION}
@@ -99,6 +104,9 @@ cabal-extract: ${WRKDIR}
 # Fetches and unpacks dependencies sources for a cabal-extract'ed package.
 # Builds them as side-effect.
 cabal-extract-deps:
+.  if ${cabal_ARGS:Mhpack}
+	cd ${WRKSRC} && ${SETENV} HOME=${CABAL_HOME} hpack
+.  endif
 	cd ${WRKSRC} && \
 		${SETENV} HOME=${CABAL_HOME} cabal new-configure --flags="${CABAL_FLAGS}" ${CONFIGURE_ARGS}
 	cd ${WRKSRC} && \
@@ -120,6 +128,9 @@ make-use-cabal-revs:
 .  if !defined(CABAL_BOOTSTRAP)
 
 cabal-post-extract:
+.    if ${cabal_ARGS:Mhpack}
+	cd ${WRKSRC} && ${SETENV} HOME=${CABAL_HOME} hpack
+.    endif
 .    for package in ${_use_cabal}
 .      if ${package:C/[^_]*//:S/_//} != ""
 		cp ${DISTDIR}/${DIST_SUBDIR}/${package:C/_[0-9]+//}/revision/${package:C/[^_]*//:S/_//}.cabal `find ${WRKDIR}/${package:C/_[0-9]+//} -name *.cabal -depth 1`



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907261652.x6QGqoxC018196>