From nobody Wed Jul 27 14:56:52 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LtH1K0dS3z4XlqL; Wed, 27 Jul 2022 14:56:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LtH1K036Rz3ly5; Wed, 27 Jul 2022 14:56:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658933813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yFptZ01Zfws2RD1+I46xEQqtvWWK1BaSUprNUdfnpHg=; b=hnKxW0XVt3NaA5M1HXWz8E19iOgPiEqL97ncCAd/47KhJGX7ztj3rRn/+y7UTF6x86ERxM lxcPrllA0wj2DtPfa2EE0cUVIorv03UPAI77afgcK8rwuCJvj4WNCwxB0cJC+IFnFJCEXf NBJtBLmwyMremcYpldq4mvzS3HAzHvE2aCmDImAmBkK2Ds9cI+LZ7yhA4oLIqRltNJRdE0 3wdGaGHkKqTCYEcfTMi3J4mjvuMDwY82F4lm8KPz+2ApXGtOIXW3isHa1iGqPGsgiY9ilv pJnHiu8KGrmvRUkGKGpfa4ny5NW8gOuHk8kSdQd6frlF0JEGtUGLFw8h1eJ1hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LtH1J6DQzzLTp; Wed, 27 Jul 2022 14:56:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26REuqUa005216; Wed, 27 Jul 2022 14:56:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26REuqEW005215; Wed, 27 Jul 2022 14:56:52 GMT (envelope-from git) Date: Wed, 27 Jul 2022 14:56:52 GMT Message-Id: <202207271456.26REuqEW005215@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Gleb Popov Subject: git: 839dbcc4328b - main - Uses/cabal.mk: Various improvements. List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 839dbcc4328b5cf011f89f8d2355ff8767336c1b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658933813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yFptZ01Zfws2RD1+I46xEQqtvWWK1BaSUprNUdfnpHg=; b=cXdBh+uYv0wUndE2vK0ZOTttVHXjLiH6ECpE8MBxhSufOqLtZphn2pkLg8xspq53WNDwrq Q74oicJTrmS8tcE0sRkLkzYx+mlygHMLQqzpbMiXd9QdaqbNtQ0tuevG12o4rrAHMk3fwY CKxVpe8p1QxcHA+6YMXIsAzRFTfLNAZvlJzBZ3GF4zEoTz+9XDzNn60DJK6tScQl69tT+U JtbiQLyA2I+22/s0wrFYN/KbyKI+gufGh5hYOvI0TKWCtTnhd+FBCPEYn08ad1aJ48TSAa LgwLStiS/K8jkKe8r337DTiPh7QFqvLH3auQmCInDSeL0nsvZCCTI+QoTmFusQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658933813; a=rsa-sha256; cv=none; b=qdEKENT4TQALQ5CXSddDGrDMu/fNwNaiTmgNhQmwODmM8Lo+Z+c+w4LK9PNdQ857S4pb0R nmqSsfSdSGvIgv2d3JJFjRakIopRiP2RbNOs0UYXBT8Dq7gDGQMOmXLoVUdKOUz21+LwZj ntDtfK06vOWM0PGE8djpkamqhaDFACK0nvdIrTEaB0emIQcJ4lUZrjeIGj+FgGN90rzR4J zs+jJ9HHnQvpvrmxdDUpcdcPAUrPQ7ct1xzs7GutOb1S4CcJnVTQxVyCUd2evRcpEfE2+1 KY+ekZm+nVr7HI/x3BSlfntxBSuiTDbDlJUHzeVYIZth6JyEavhw5lrwY4+g6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=839dbcc4328b5cf011f89f8d2355ff8767336c1b commit 839dbcc4328b5cf011f89f8d2355ff8767336c1b Author: Gleb Popov AuthorDate: 2022-07-27 14:50:47 +0000 Commit: Gleb Popov CommitDate: 2022-07-27 14:55:51 +0000 Uses/cabal.mk: Various improvements. - Rename CABAL_BOOTSTRAP to SKIP_CABAL_EXTRACT. This is a much more descriptive name as to what this knob does. - Improve cabal-extract target to not overwrite WRKDIR and to leave a cookie file to let framework know if the user is updating the port. --- Mk/Uses/cabal.mk | 66 ++++++++++++++++++++++++----------------- devel/hs-cabal-install/Makefile | 6 ++-- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/Mk/Uses/cabal.mk b/Mk/Uses/cabal.mk index ee0ee4a2856e..552df05d8b7e 100644 --- a/Mk/Uses/cabal.mk +++ b/Mk/Uses/cabal.mk @@ -74,6 +74,9 @@ CABAL_EXTRACT_SUFX= .tar.gz CABAL_ARCH= ${ARCH:S/amd64/x86_64/:C/armv.*/arm/:S/powerpc64/ppc64/} CABAL_DEPSDIR= ${WRKSRC}/${CABAL_DEPS_SUBDIR} CABAL_DEPS_SUBDIR= _cabal_deps +# A special cookie used to signify that the user is a maintainer updating the port +# using cabal-* targets. The presense of this cookie disables cabal-post-patch. +CABAL_COOKIE= ${WRKDIR}/.cabal_update_done.${PORTNAME}.${PREFIX:S/\//_/g} HPACK_CMD?= hpack _CABAL2TUPLE_CMD= cabal2tuple @@ -85,7 +88,7 @@ CABAL_WITH_ARGS= --with-compiler=${BUILD_DEPENDS:Mghc?*\:lang/ghc?*:C/\:.*//} \ BUILD_DEPENDS+= ghc:lang/ghc . endif -. if !defined(CABAL_BOOTSTRAP) +. if "${PORTNAME}" != "cabal-install" BUILD_DEPENDS+= cabal:${CABAL_PORT} . endif @@ -139,29 +142,33 @@ _CABAL_EXTRACT_ONLY+= ${package:C/_[0-9]+//}/${package:C/_[0-9]+//}${CABAL_EXTRA . if !defined(EXTRACT_ONLY) EXTRACT_ONLY= ${_DISTFILES:N*\.cabal} . else +. if !defined(SKIP_CABAL_EXTRACT) EXTRACT_ONLY+= ${_CABAL_EXTRACT_ONLY} +. endif . endif + # Auxiliary targets used during port creation/updating. # Fetches and unpacks package source from Hackage using only PORTNAME and PORTVERSION. -cabal-extract: check-cabal ${WRKDIR} +cabal-extract: check-cabal +. if ${_hackage_is_default} == no + @${ECHO_MSG} "===> Recursing down to make extract" + @${MAKE} -C ${.CURDIR} extract SKIP_CABAL_EXTRACT=yes + ${RM} -rf ${CABAL_HOME} +. endif @${ECHO_MSG} "===> Fetching Cabal package index into ${CABAL_HOME}/.cabal" - ${RM} -rf ${CABAL_HOME}/.cabal - ${SETENV} HOME=${CABAL_HOME} ${CABAL_CMD} update + @${SETENV} HOME=${CABAL_HOME} ${CABAL_CMD} update . if ${_hackage_is_default} == yes - cd ${WRKDIR} && \ + @cd ${WRKDIR} && \ ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} get ${PORTNAME}-${PORTVERSION} . else - ${MV} ${CABAL_HOME} /tmp/${PORTNAME}-cabal-home - cd ${.CURDIR} && ${MAKE} extract CABAL_BOOTSTRAP=yes - ${RM} -rf ${CABAL_HOME} - ${MV} /tmp/${PORTNAME}-cabal-home ${CABAL_HOME} . if ${cabal_ARGS:Mhpack} @${ECHO_MSG} "===> Running ${HPACK_CMD} to generate .cabal file" - cd ${WRKSRC} && ${SETENV} HOME=${CABAL_HOME} ${HPACK_CMD} + @cd ${WRKSRC} && ${SETENV} HOME=${CABAL_HOME} ${HPACK_CMD} . endif . endif + @${TOUCH} ${EXTRACT_COOKIE} ${CABAL_COOKIE} # Calls cabal configure on the Haskell package located in ${WRKSRC} cabal-configure: check-cabal @@ -188,10 +195,11 @@ check-cabal2tuple: ${ECHO_MSG} "===> cabal2tuple executable not found, install \"ports-mgmt/hs-cabal2tuple\""; exit 1; \ fi -. if !defined(CABAL_BOOTSTRAP) + # Main targets implementation. cabal-post-extract: +. if !defined(SKIP_CABAL_EXTRACT) # Remove the project file as requested . if "${CABAL_PROJECT}" == "remove" ${RM} ${WRKSRC}/cabal.project @@ -201,7 +209,8 @@ cabal-post-extract: ${MV} ${WRKSRC}/cabal.project ${WRKSRC}/cabal.project.${PORTNAME} . endif - @/bin/test ! -f ${WRKSRC}/cabal.project || (echo "cabal.project file is already present in WRKSRC! Set CABAL_PROJECT variable." && false) + @${TEST} ! -f ${WRKSRC}/cabal.project || \ + (${ECHO_CMD} "cabal.project file is already present in WRKSRC! Set CABAL_PROJECT variable." && false) # Move extracted dependencies into ${CABAL_DEPSDIR} directory ${MKDIR} ${CABAL_DEPSDIR} @@ -217,8 +226,12 @@ cabal-post-extract: # Create the cabal-install config ${MKDIR} ${CABAL_HOME}/.cabal ${ECHO_CMD} "jobs: ${MAKE_JOBS_NUMBER}" > ${CABAL_HOME}/.cabal/config +. endif # SKIP_CABAL_EXTRACT cabal-post-patch: +. if !defined(SKIP_CABAL_EXTRACT) + @${TEST} ! -f ${CABAL_COOKIE} || \ + (${ECHO_CMD} "===> Patching done, skipping cabal-post-patch" && false) # Create our own cabal.project ${ECHO_CMD} "packages:" > ${WRKSRC}/cabal.project . if "${CABAL_PROJECT}" != "append" @@ -231,46 +244,45 @@ cabal-post-patch: . if "${CABAL_PROJECT}" == "append" ${CAT} ${WRKSRC}/cabal.project.${PORTNAME} >> ${WRKSRC}/cabal.project . endif +. endif # SKIP_CABAL_EXTRACT && !CABAL_COOKIE cabal-pre-configure: # Generate .cabal file with hpack if requested -. if ${cabal_ARGS:Mhpack} +. if ${cabal_ARGS:Mhpack} cd ${WRKSRC} && ${SETENV} HOME=${CABAL_HOME} hpack -. endif +. endif -. if !target(do-build) +. if !target(do-build) do-build: cd ${WRKSRC} && \ ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} new-build --offline --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} --flags "${CABAL_FLAGS}" ${BUILD_ARGS} ${BUILD_TARGET} -. endif +. endif -. if !target(do-install) +. if !target(do-install) do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/${CABAL_LIBEXEC} -. for exe in ${EXECUTABLES} +. for exe in ${EXECUTABLES} ${INSTALL_PROGRAM} \ $$(find ${WRKSRC}/dist-newstyle -name ${exe} -type f -perm +111) \ ${STAGEDIR}${PREFIX}/${CABAL_LIBEXEC}/${exe} ${ECHO_CMD} '#!/bin/sh' > ${STAGEDIR}${PREFIX}/bin/${exe} ${ECHO_CMD} '' >> ${STAGEDIR}${PREFIX}/bin/${exe} ${ECHO_CMD} 'export ${exe:S/-/_/g}_datadir=${DATADIR}' >> ${STAGEDIR}${PREFIX}/bin/${exe} -. for dep in ${${exe}_DATADIR_VARS} +. for dep in ${${exe}_DATADIR_VARS} ${ECHO_CMD} 'export ${dep:S/-/_/g}_datadir=${DATADIR}' >> ${STAGEDIR}${PREFIX}/bin/${exe} -. endfor +. endfor ${ECHO_CMD} '' >> ${STAGEDIR}${PREFIX}/bin/${exe} ${ECHO_CMD} 'exec ${PREFIX}/${CABAL_LIBEXEC}/${exe} "$$@"' >> ${STAGEDIR}${PREFIX}/bin/${exe} ${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/${exe} -. endfor -. endif +. endfor +. endif -. if !defined(SKIP_CABAL_PLIST) +. if !defined(SKIP_CABAL_PLIST) cabal-post-install-script: . for exe in ${EXECUTABLES} ${ECHO_CMD} 'bin/${exe}' >> ${TMPPLIST} ${ECHO_CMD} '${CABAL_LIBEXEC}/${exe}' >> ${TMPPLIST} -. endfor -. endif - -. endif # !defined(CABAL_BOOTSTRAP) +. endfor +. endif .endif diff --git a/devel/hs-cabal-install/Makefile b/devel/hs-cabal-install/Makefile index 0506c1ed42ed..65f03b649522 100644 --- a/devel/hs-cabal-install/Makefile +++ b/devel/hs-cabal-install/Makefile @@ -1,14 +1,13 @@ PORTNAME= cabal-install PORTVERSION= 3.6.2.0 CATEGORIES= devel haskell +EXTRACT_ONLY= ${DISTNAME_DEFAULT}${_GITHUB_EXTRACT_SUFX} MAINTAINER= haskell@FreeBSD.org COMMENT= Command-line interface for Cabal and Hackage LICENSE= BSD3CLAUSE -BUILD_DEPENDS= ghc:lang/ghc - USES= cabal:nodefault compiler:c11 python:build USE_GITHUB= yes @@ -38,7 +37,8 @@ USE_CABAL= async-2.2.4 \ th-compat-0.1.3 \ zlib-0.6.2.3_1 -CABAL_BOOTSTRAP= yes +SKIP_CABAL_EXTRACT= yes +SKIP_CABAL_PLIST= yes PLIST_FILES= bin/cabal