Received: by mail.netbsd.org (Postfix, from userid 605) id 7A7D984D6C; Sat, 1 May 2021 14:10:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id B450984D6B for ; Sat, 1 May 2021 14:10:55 +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 ak2Id5E-oVEd for ; Sat, 1 May 2021 14:10:55 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 349F884D53 for ; Sat, 1 May 2021 14:10:55 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 2E2E3FA95; Sat, 1 May 2021 14:10:55 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1619878255182030" MIME-Version: 1.0 Date: Sat, 1 May 2021 14:10:55 +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: <20210501141055.2E2E3FA95@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1619878255182030 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: pho Date: Sat May 1 14:10:55 UTC 2021 Modified Files: pkgsrc/mk: haskell.mk Log Message: Support Cabal packages that lack Setup.?hs They currently have Setup.hs in ${FILESDIR} with almost always the same content. We can do better than that. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 pkgsrc/mk/haskell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1619878255182030 Content-Disposition: inline Content-Length: 2214 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.29 pkgsrc/mk/haskell.mk:1.30 --- pkgsrc/mk/haskell.mk:1.29 Fri Apr 23 03:57:16 2021 +++ pkgsrc/mk/haskell.mk Sat May 1 14:10:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: haskell.mk,v 1.29 2021/04/23 03:57:16 pho Exp $ +# $NetBSD: haskell.mk,v 1.30 2021/05/01 14:10:55 pho Exp $ # # This Makefile fragment handles Haskell Cabal packages. # Package configuration, building, installation, registration and @@ -215,6 +215,43 @@ WARNINGS+= "[haskell.mk] Set HS_UPDATE_P # is much faster, we try it and then fall back to static linkage if # that didn't work. do-configure: +# Cabal packages are expected to have either Setup.hs or Setup.lhs, +# but its existence is not mandatory these days because the standard +# way to build a cabal package is to use the cabal-install command, +# which is not always available to us. As a result some packages +# actually lack it. The problem is that its expected content depends +# on the build-type field in *.cabal so we have to read it. + ${RUN} if ! ${TEST} -f ${WRKSRC}/Setup.hs -a -f ${WRKSRC}/Setup.lhs; then \ + getBuildType=' \ + BEGIN { buildTypeLine=0 } \ + tolower($$1) ~ /^build-type:/ { \ + if ($$2) { \ + print tolower($$2); exit \ + } \ + else { \ + buildTypeLine=1; next \ + } \ + } \ + buildTypeLine { \ + print tolower($$1); exit \ + } \ + '; \ + buildType=`${CAT} ${WRKSRC}/*.cabal | ${AWK} "$$getBuildType"`; \ + case "$$buildType" in \ + simple) \ + echo >${WRKSRC}/Setup.hs 'import Distribution.Simple'; \ + echo >>${WRKSRC}/Setup.hs 'main = defaultMain';; \ + configure) \ + echo >${WRKSRC}/Setup.hs 'import Distribution.Simple'; \ + echo >>${WRKSRC}/Setup.hs 'main = defaultMainWithHooks autoconfUserHooks';; \ + make) \ + echo >${WRKSRC}/Setup.hs 'import Distribution.Make'; \ + echo >>${WRKSRC}/Setup.hs 'main = defaultMain';; \ + *) \ + echo >&2 "Unknown Build-Type: $$buildType"; \ + exit 1;; \ + esac; \ + fi ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ ( ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -dynamic || \ ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -static ) --_----------=_1619878255182030--