Received: by mail.netbsd.org (Postfix, from userid 605) id 1F3ED84D7C; Sun, 10 May 2020 17:47:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 9851D84D5F for ; Sun, 10 May 2020 17:47:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id 6l28y2aTiHIB for ; Sun, 10 May 2020 17:46:59 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id BAAF384D5D for ; Sun, 10 May 2020 17:46:59 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id AD835FB27; Sun, 10 May 2020 17:46:59 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_158913281928320" MIME-Version: 1.0 Date: Sun, 10 May 2020 17:46:59 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/mk To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20200510174659.AD835FB27@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_158913281928320 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Sun May 10 17:46:59 UTC 2020 Modified Files: pkgsrc/mk: haskell.mk Log Message: mk/haskell.mk: allow to generate PLIST files Since GHC 7.10 or 7.8, the Haskell packages are installed in directories whose name contains the package hash. This made it harder to predict the exact pathname. Havin the exact pathnames in the PLIST file is the ideal, it also helps to record the general structure of the installed files to see whether some file unexpectedly appear or disappear. To enable this for Haskell packages, the various base directories are replaced with placeholders during print-PLIST. These placeholders are translated back to their respective paths when the +PLIST is generated from the PLIST in the package directory. Except for 2 packages, all Haskell packages in main pkgsrc had their package PLIST file removed. To help in adding them back, the pkgsrc developer can set HS_UPDATE_PLIST=yes in mk.conf, which will generate the PLIST directly into ${PKGDIR}/PLIST upon installation. Most packages in pkgsrc-wip still have their old PLIST, and these are migrated automatically as well. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 pkgsrc/mk/haskell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_158913281928320 Content-Disposition: inline Content-Length: 4815 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/mk/haskell.mk diff -u pkgsrc/mk/haskell.mk:1.19 pkgsrc/mk/haskell.mk:1.20 --- pkgsrc/mk/haskell.mk:1.19 Mon Mar 30 18:23:48 2020 +++ pkgsrc/mk/haskell.mk Sun May 10 17:46:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: haskell.mk,v 1.19 2020/03/30 18:23:48 riastradh Exp $ +# $NetBSD: haskell.mk,v 1.20 2020/05/10 17:46:59 rillig Exp $ # # This Makefile fragment handles Haskell Cabal packages. # See: http://www.haskell.org/cabal/ @@ -163,8 +163,8 @@ HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= y .include "../../lang/ghc88/buildlink3.mk" # Tools -_GHC_BIN= ${BUILDLINK_PREFIX.ghc}/bin/ghc -_GHC_PKG_BIN= ${BUILDLINK_PREFIX.ghc}/bin/ghc-pkg +_GHC_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc +_GHC_PKG_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc-pkg _HASKELL_BIN= ${_GHC_BIN} # Expose to the outer scope. _HASKELL_PKG_BIN= ${_GHC_PKG_BIN} # Expose to the outer scope. @@ -211,23 +211,58 @@ CONFIGURE_ARGS+= --with-haddock=${BUILDL # Optimization CONFIGURE_ARGS+= -O${HASKELL_OPTIMIZATION_LEVEL} -# Starting from GHC 7.10 (or 7.8?), packages are installed in -# directories with a hashed name so we can no longer predict the -# contents of PLIST. +# Starting from GHC 7.10 (or 7.8?), packages are installed in directories +# with a hashed name, which makes it a bit more complicated to generate +# the PLIST. +# +_HASKELL_PL_INTF= ${_HASKELL_PKG_ID_FILE:H:S,^${PREFIX}/,,} +_HASKELL_PL_IMPL_AWK= prev == "import-dirs:" { print $$1; exit } { prev = $$0 } +_HASKELL_PL_IMPL_CMD= ${AWK} '${_HASKELL_PL_IMPL_AWK}' ${DESTDIR}${_HASKELL_PKG_DESCR_FILE} +_HASKELL_PL_IMPL= ${_HASKELL_PL_IMPL_CMD:sh:S,^${PREFIX}/,,} +_HASKELL_PL_DOCS= ${_HASKELL_PL_IMPL:S,^lib,share/doc,:C,-[A-Za-z0-9]*$,,} +_HASKELL_PL_PLATFORM= ${_HASKELL_PL_IMPL:H:T} +_HASKELL_PL_PKGID_CMD= ${CAT} ${DESTDIR}${_HASKELL_PKG_ID_FILE} +_HASKELL_PL_PKGID= ${_HASKELL_PL_PKGID_CMD:sh} +_HASKELL_PL_VER= ${_HASKELL_VERSION:S,-,,} + +PLIST_SUBST+= HS_INTF=${_HASKELL_PL_INTF} +PLIST_SUBST+= HS_IMPL=${_HASKELL_PL_IMPL} +PLIST_SUBST+= HS_DOCS=${_HASKELL_PL_DOCS} +PLIST_SUBST+= HS_PLATFORM=${_HASKELL_PL_PLATFORM} +PLIST_SUBST+= HS_PKGID=${_HASKELL_PL_PKGID} +PLIST_SUBST+= HS_VER=${_HASKELL_PL_VER} +PRINT_PLIST_AWK+= { sub("^${_HASKELL_PL_INTF}", "$${HS_INTF}") } +PRINT_PLIST_AWK+= { sub("^${_HASKELL_PL_IMPL}", "$${HS_IMPL}") } +PRINT_PLIST_AWK+= { sub("^${_HASKELL_PL_DOCS}", "$${HS_DOCS}") } +PRINT_PLIST_AWK+= { sub("/${_HASKELL_PL_PLATFORM}/", "/$${HS_PLATFORM}/") } +PRINT_PLIST_AWK+= { sub( "${_HASKELL_PL_PKGID}", "$${HS_PKGID}") } +PRINT_PLIST_AWK+= { sub( "${_HASKELL_PL_VER}", "$${HS_VER}") } + +.if !exists(${PKGDIR}/PLIST) +_HS_PLIST_STATUS= missing +.elif ${${GREP} HS_INTF ${PKGDIR}/PLIST || ${TRUE}:L:sh} +_HS_PLIST_STATUS= up-to-date +.else +_HS_PLIST_STATUS= outdated +.endif + +HS_UPDATE_PLIST?= no + +.if ${HS_UPDATE_PLIST} != no && ${_HS_PLIST_STATUS} != up-to-date +GENERATE_PLIST+= ${MAKE} print-PLIST > ${PKGDIR}/PLIST; +.endif + +.if ${_HS_PLIST_STATUS} != up-to-date +# The PLISTs that don't use HS_INTF and the other placeholders defined +# above are outdated and wrong, and are therefore ignored. GENERATE_PLIST+= \ cd ${DESTDIR:Q}${PREFIX:Q} && \ ${FIND} * \( -type f -o -type l \) | ${SORT}; -# But since our packages may still have PLIST files, it is necessary -# to ignore them until we get rid of them all. Or they all will be -# broken. -PLIST_SRC= # none -.if ${PKG_DEVELOPER:Uno:tl} != "no" -.PHONY: _check-ignored-plist -privileged-install-hook: _check-ignored-plist -_check-ignored-plist: error-check - ${RUN}if ${TEST} -f PLIST; then \ - ${DELAYED_WARNING_MSG} "[haskell.mk] The PLIST file is no longer used. Please remove it."; \ - fi +PLIST_SRC= # none, because the PLIST file is outdated or missing +. if ${_HS_PLIST_STATUS} == outdated && ${HS_UPDATE_PLIST} == no +WARNINGS+= "[haskell.mk] The PLIST format is outdated." +WARNINGS+= "[haskell.mk] Set HS_UPDATE_PLIST=yes to update it automatically." +. endif .endif # Define configure target. We might not have any working Haskell @@ -288,4 +323,16 @@ FILES_SUBST+= HASKELL_PKG_ID_FILE=${_HAS INSTALL_TEMPLATES+= ../../mk/haskell/INSTALL.in DEINSTALL_TEMPLATES+= ../../mk/haskell/DEINSTALL.in +# Only present these variables if the definitions can be extracted +# from the files in DESTDIR. +_HS_DESTDIR_DEF_VARS= PLIST_SUBST PRINT_PLIST_AWK +_HS_DESTDIR_DEF_VARS+= _HASKELL_PL_INTF +_HS_DESTDIR_DEF_VARS+= _HASKELL_PL_IMPL +_HS_DESTDIR_DEF_VARS+= _HASKELL_PL_DOCS +_HS_DESTDIR_DEF_VARS+= _HASKELL_PL_PLATFORM +_HS_DESTDIR_DEF_VARS+= _HASKELL_PL_PKGID +_HS_DESTDIR_DEF_VARS+= _HASKELL_PL_VER +_DEF_VARS.haskell+= ${exists(${DESTDIR}${_HASKELL_PKG_DESCR_FILE}) :? ${_HS_DESTDIR_DEF_VARS} :} +_LISTED_VARS.haskell+= PLIST_SUBST PRINT_PLIST_AWK + .endif # HASKELL_MK --_----------=_158913281928320--