Authentication-Results: name.execsw.org; dkim=pass (1024-bit key) header.d=netbsd.org header.i=@netbsd.org header.b=RtGmgYaG; dkim=pass (1024-bit key) header.d=netbsd.org header.i=@netbsd.org header.b=j9ee+YG3 Received: by mail.netbsd.org (Postfix, from userid 605) id 573638505D; Sat, 4 May 2024 11:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1714821689; bh=ObhWj1McJuMTL9oy1vwg4eevtkQPBc8otkdOXdxh0zE=; h=Date:From:Subject:To:Reply-To:List-Id:List-Unsubscribe; b=RtGmgYaGdbIx+/cK+tumcM+X+VNbYmL7np9pb3ITkOW0eq50c5HJK2N1fwhES1CUJ YvtvwWt0yVjOhFIAJan0EXvw+CupuTm3nZmFHFHEfgKsHHHQWGPjMi2Cs6g0K2gdIR gHfkSHr4JLamYgCONQwO4JwfoVADIsgbsC0M1mns= Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 45F7884E64 for ; Sat, 4 May 2024 11:21:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Authentication-Results: mail.netbsd.org (amavisd-new); dkim=pass (1024-bit key) header.d=netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id lnSh244r9faa for ; Sat, 4 May 2024 11:21:27 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 74B9084D27 for ; Sat, 4 May 2024 11:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1714821687; bh=ObhWj1McJuMTL9oy1vwg4eevtkQPBc8otkdOXdxh0zE=; h=Date:From:Subject:To:Reply-To; b=j9ee+YG3xu3IYen5U5/ncFjFwI6/qsgjJyrc88TPg7cMvO8mUl88sBPYZ9KyfrzHk pS84MdT1si2bX0UgKT0blCzl6oHn6d8JgO0D2x5DTNFhZZ81Uef71JoHnUgvrf8ovh FiSv2ydVLPIM2TwBhWNrNB//PS0ZG29G/ZC6RwNY= Received: by cvs.NetBSD.org (Postfix, from userid 500) id 3A9F7FA2C; Sat, 4 May 2024 11:21:27 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1714821687165210" MIME-Version: 1.0 Date: Sat, 4 May 2024 11:21:27 +0000 From: "Masatake Daimon" Subject: CVS commit: pkgsrc/mk To: pkgsrc-changes@NetBSD.org Reply-To: pho@netbsd.org X-Mailer: log_accum Message-Id: <20240504112127.3A9F7FA2C@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1714821687165210 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: pho Date: Sat May 4 11:21:27 UTC 2024 Modified Files: pkgsrc/mk: haskell.mk Added Files: pkgsrc/mk/haskell: disable-components.awk Removed Files: pkgsrc/mk/haskell: disable-executables.awk Log Message: mk/haskell.mk: New package-settable variable: HASKELL_DISABLE_LIBRARIES To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 pkgsrc/mk/haskell.mk cvs rdiff -u -r0 -r1.1 pkgsrc/mk/haskell/disable-components.awk cvs rdiff -u -r1.2 -r0 pkgsrc/mk/haskell/disable-executables.awk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1714821687165210 Content-Disposition: inline Content-Length: 5405 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.67 pkgsrc/mk/haskell.mk:1.68 --- pkgsrc/mk/haskell.mk:1.67 Mon Apr 29 07:58:38 2024 +++ pkgsrc/mk/haskell.mk Sat May 4 11:21:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: haskell.mk,v 1.67 2024/04/29 07:58:38 pho Exp $ +# $NetBSD: haskell.mk,v 1.68 2024/05/04 11:21:26 pho Exp $ # # This Makefile fragment handles Haskell Cabal packages. Package # configuration, building, installation, registration and unregistration @@ -48,6 +48,13 @@ # # Default value: empty # +# HASKELL_DISABLE_LIBRARIES +# A list of libraries that we don't want to build or install. Listing +# libraries in this variable will cause the *.cabal file to be +# rewritten so that they won't be built. +# +# Default value: empty +# # 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 @@ -101,6 +108,7 @@ _PKG_VARS.haskell= \ HASKELL_OPTIMIZATION_LEVEL \ HASKELL_PKG_NAME \ HASKELL_DISABLE_EXECUTABLES \ + HASKELL_DISABLE_LIBRARIES \ HASKELL_UNRESTRICT_DEPENDENCIES \ PKGNAME HOMEPAGE MASTER_SITES _DEF_VARS.haskell= \ @@ -136,6 +144,7 @@ _USE_VARS.haskell= \ _PATH_ORIG _SORTED_VARS.haskell= \ HASKELL_DISABLE_EXECUTABLES \ + HASKELL_DISABLE_LIBRARIES \ HASKELL_UNRESTRICT_DEPENDENCIES _LISTED_VARS.haskell= \ BUILDLINK_PASSTHRU_DIRS \ @@ -160,6 +169,7 @@ HASKELL_ENABLE_LIBRARY_PROFILING?= yes HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= yes HASKELL_ENABLE_TESTS?= no HASKELL_DISABLE_EXECUTABLES?= # empty +HASKELL_DISABLE_LIBRARIES?= # empty HASKELL_UNRESTRICT_DEPENDENCIES?= # empty .include "../../lang/ghc96/buildlink3.mk" @@ -196,17 +206,29 @@ _HASKELL_BUILD_SETUP_OPTS= -package-env # GHC requires C compiler. USE_LANGUAGES+= c -# Some Haskell libraries builds and installs example executables that are -# useless aside from debugging the libraries, and we don't want them to be +# Some Haskell packages build and install example executables that are +# useless aside from debugging the packages, and we don't want them to be # installed. .if !empty(HASKELL_DISABLE_EXECUTABLES) -SUBST_CLASSES+= exec -SUBST_STAGE.exec?= post-extract -SUBST_FILES.exec?= ${HASKELL_PKG_NAME:C/-[[:digit:].]+$//}.cabal -SUBST_MESSAGE.exec?= Disabling executables: ${HASKELL_DISABLE_EXECUTABLES} -SUBST_FILTER_CMD.exec= \ - ${AWK} -f "${.CURDIR}/../../mk/haskell/disable-executables.awk" \ - -v exec=${HASKELL_DISABLE_EXECUTABLES:Q} +SUBST_CLASSES+= exe +SUBST_STAGE.exe?= post-extract +SUBST_FILES.exe?= ${HASKELL_PKG_NAME:C/-[[:digit:].]+$//}.cabal +SUBST_MESSAGE.exe?= Disabling executables: ${HASKELL_DISABLE_EXECUTABLES} +SUBST_FILTER_CMD.exe= \ + ${AWK} -f "${.CURDIR}/../../mk/haskell/disable-components.awk" \ + -v exe=${HASKELL_DISABLE_EXECUTABLES:Q} +.endif + +# Some Haskell packages build and install libraries that are useless aside +# from debugging the packages, and we don't want them to be installed. +.if !empty(HASKELL_DISABLE_LIBRARIES) +SUBST_CLASSES+= lib +SUBST_STAGE.lib?= post-extract +SUBST_FILES.lib?= ${HASKELL_PKG_NAME:C/-[[:digit:].]+$//}.cabal +SUBST_MESSAGE.lib?= Disabling libraries: ${HASKELL_DISABLE_LIBRARIES} +SUBST_FILTER_CMD.lib= \ + ${AWK} -f "${.CURDIR}/../../mk/haskell/disable-components.awk" \ + -v lib=${HASKELL_DISABLE_LIBRARIES:Q} .endif # Haskell packages don't use semvars but they use something similar to it, @@ -440,6 +462,7 @@ do-configure: $$setup_src '"$$@"' >> Setup; \ ${CHMOD} +x Setup; \ else \ + ${ECHO} "[mk/haskell.mk] Failed to interpret $$setup_src; falling back to compilation"; \ ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -dynamic || \ ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -static; \ ${SETENV} ${CONFIGURE_ENV} \ Added files: Index: pkgsrc/mk/haskell/disable-components.awk diff -u /dev/null pkgsrc/mk/haskell/disable-components.awk:1.1 --- /dev/null Sat May 4 11:21:27 2024 +++ pkgsrc/mk/haskell/disable-components.awk Sat May 4 11:21:26 2024 @@ -0,0 +1,47 @@ +# $NetBSD: disable-components.awk,v 1.1 2024/05/04 11:21:26 pho Exp $ +# +# Prevent executables specified with -v "exe=foo bar ..." from being built +# or installed. Do the same for libraries specified with -v "exe=foo bar +# ...". +# +BEGIN { + split(exe, exev, /[[:space:]]+/); + split(lib, libv, /[[:space:]]+/); +} + +{ + print; + + matched = 0; + if (tolower($1) == "executable") { + for (i in exev) { + if (exev[i] == $2) { + matched = 1; + break; + } + } + } + else if (tolower($1) == "library") { + for (i in libv) { + if (libv[i] == $2) { + matched = 1; + break; + } + } + } + + if (matched) { + # The Cabal format requires that indentation levels are + # aligned. Read the next line and use the same indentation for + # "buildable: False". + if ((getline next_line) > 0) { + match(next_line, /[[:space:]]+/); + print substr(next_line, RSTART, RLENGTH) "buildable: False"; + print next_line; + } + else { + print "Invalid cabal file: premature end of file right after \"executable\" or \"library\" line." > "/dev/stderr" + exit 1 + } + } +} --_----------=_1714821687165210--