git: e254bdde429a - main - Uses/cabal.mk: Change the way we act on cabal.project files.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Nov 2022 17:39:52 UTC
The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=e254bdde429a3d700beb9d421dc35f1da0b2077a commit e254bdde429a3d700beb9d421dc35f1da0b2077a Author: Gleb Popov <arrowd@FreeBSD.org> AuthorDate: 2022-11-11 09:08:48 +0000 Commit: Gleb Popov <arrowd@FreeBSD.org> CommitDate: 2022-11-20 17:39:27 +0000 Uses/cabal.mk: Change the way we act on cabal.project files. Instead of moving the original project file into a temporary location, employ cabal.project.local for Ports-related adjustments. This implements an idea that upstream cabal.project files shouldn't be touched by Ports framework. If needed they can be patched by the port maintainer directly. Adapt existing Haskell ports to this change. --- Mk/Uses/cabal.mk | 26 ++++++++-------------- devel/elm-format/Makefile | 3 +-- .../patch-cabal.project.haskell-language-server | 4 ++-- net-p2p/cardano-db-sync/Makefile | 6 ++--- net-p2p/cardano-node/Makefile | 6 ++--- net-p2p/ogmios/Makefile | 6 ++--- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/Mk/Uses/cabal.mk b/Mk/Uses/cabal.mk index 02464c39acf7..ac2ca56fef53 100644 --- a/Mk/Uses/cabal.mk +++ b/Mk/Uses/cabal.mk @@ -218,17 +218,14 @@ check-cabal2tuple: cabal-post-extract: . if !defined(SKIP_CABAL_EXTRACT) -# Remove the project file as requested . if "${CABAL_PROJECT}" == "remove" +# Remove the project file if requested ${RM} ${WRKSRC}/cabal.project . endif -# Save the original project file so that users can patch them -. if "${CABAL_PROJECT}" == "append" - ${MV} ${WRKSRC}/cabal.project ${WRKSRC}/cabal.project.${PORTNAME} -. endif - +. ifndef(CABAL_PROJECT) @${TEST} ! -f ${WRKSRC}/cabal.project || \ (${ECHO_CMD} "cabal.project file is already present in WRKSRC! Set CABAL_PROJECT variable." && false) +. endif # Move extracted dependencies into ${CABAL_DEPSDIR} directory ${MKDIR} ${CABAL_DEPSDIR} @@ -250,18 +247,13 @@ 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" - ${ECHO_CMD} " ." >> ${WRKSRC}/cabal.project -. endif +# Append our stuff to possibly existing cabal.project.local + ${ECHO_CMD} "" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} "-- added by USES=cabal" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} "packages:" >> ${WRKSRC}/cabal.project.local . for package in ${_use_cabal} - ${ECHO_CMD} " ${CABAL_DEPS_SUBDIR}/${package:C/_[0-9]+//}" >> ${WRKSRC}/cabal.project + ${ECHO_CMD} " ${CABAL_DEPS_SUBDIR}/${package:C/_[0-9]+//}" >> ${WRKSRC}/cabal.project.local . endfor -# Append the (possibly patched) original cabal.project, if requested -. if "${CABAL_PROJECT}" == "append" - ${CAT} ${WRKSRC}/cabal.project.${PORTNAME} >> ${WRKSRC}/cabal.project -. endif . endif # SKIP_CABAL_EXTRACT && !CABAL_COOKIE cabal-pre-configure: @@ -273,7 +265,7 @@ cabal-pre-configure: . 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} + ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --offline --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} --flags "${CABAL_FLAGS}" ${BUILD_ARGS} ${BUILD_TARGET} . endif . if !target(do-install) diff --git a/devel/elm-format/Makefile b/devel/elm-format/Makefile index 430e6b111767..9ab7c3d6a53b 100644 --- a/devel/elm-format/Makefile +++ b/devel/elm-format/Makefile @@ -62,7 +62,6 @@ post-extract: post-patch: @${REINPLACE_CMD} -e '/with-compiler: ghc-8.10.4/d' \ - ${WRKSRC}/cabal.project.${PORTNAME} || ${TRUE} - ${RM} ${WRKSRC}/cabal.config + ${WRKSRC}/cabal.project || ${TRUE} .include <bsd.port.mk> diff --git a/devel/hs-haskell-language-server/files/patch-cabal.project.haskell-language-server b/devel/hs-haskell-language-server/files/patch-cabal.project.haskell-language-server index b219ff162b34..ac3bf9580b99 100644 --- a/devel/hs-haskell-language-server/files/patch-cabal.project.haskell-language-server +++ b/devel/hs-haskell-language-server/files/patch-cabal.project.haskell-language-server @@ -1,5 +1,5 @@ ---- cabal.project.haskell-language-server.orig 2022-09-14 06:08:48 UTC -+++ cabal.project.haskell-language-server +--- cabal.project.orig 2022-09-14 06:08:48 UTC ++++ cabal.project @@ -62,20 +62,6 @@ constraints: ghc-lib-parser-ex -auto, stylish-haskell +ghc-lib diff --git a/net-p2p/cardano-db-sync/Makefile b/net-p2p/cardano-db-sync/Makefile index 27c09df523f9..c56d00e06477 100644 --- a/net-p2p/cardano-db-sync/Makefile +++ b/net-p2p/cardano-db-sync/Makefile @@ -409,9 +409,9 @@ post-patch: -e '/Cardano.Db.RevFromGit/d' \ ${WRKSRC}/cardano-db/src/Cardano/Db/Version.hs - ${ECHO_CMD} "package *" >> ${WRKSRC}/cabal.project.${PORTNAME} - ${ECHO_CMD} " extra-include-dirs: ${LIBS_PREFIX}${PREFIX}/include" >> ${WRKSRC}/cabal.project.${PORTNAME} - ${ECHO_CMD} " extra-lib-dirs: ${LIBS_PREFIX}${PREFIX}/lib" >> ${WRKSRC}/cabal.project.${PORTNAME} + ${ECHO_CMD} "package *" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} " extra-include-dirs: ${LIBS_PREFIX}${PREFIX}/include" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} " extra-lib-dirs: ${LIBS_PREFIX}${PREFIX}/lib" >> ${WRKSRC}/cabal.project.local pre-build: cd ${WRKSRC_sodium} && ./autogen.sh diff --git a/net-p2p/cardano-node/Makefile b/net-p2p/cardano-node/Makefile index f6ff9d3c3fc1..8236e90f222a 100644 --- a/net-p2p/cardano-node/Makefile +++ b/net-p2p/cardano-node/Makefile @@ -402,9 +402,9 @@ post-patch: -e '/Cardano.Git.RevFromGit/d' \ ${WRKSRC}/cardano-git-rev/src/Cardano/Git/Rev.hs - ${ECHO_CMD} "package *" >> ${WRKSRC}/cabal.project.${PORTNAME} - ${ECHO_CMD} " extra-include-dirs: ${LIBS_PREFIX}${PREFIX}/include" >> ${WRKSRC}/cabal.project.${PORTNAME} - ${ECHO_CMD} " extra-lib-dirs: ${LIBS_PREFIX}${PREFIX}/lib" >> ${WRKSRC}/cabal.project.${PORTNAME} + ${ECHO_CMD} "package *" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} " extra-include-dirs: ${LIBS_PREFIX}${PREFIX}/include" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} " extra-lib-dirs: ${LIBS_PREFIX}${PREFIX}/lib" >> ${WRKSRC}/cabal.project.local pre-build: cd ${WRKSRC_sodium} && ./autogen.sh diff --git a/net-p2p/ogmios/Makefile b/net-p2p/ogmios/Makefile index a788cadab76e..b08aa498d4f2 100644 --- a/net-p2p/ogmios/Makefile +++ b/net-p2p/ogmios/Makefile @@ -390,9 +390,9 @@ USE_CABAL= Glob-0.10.2_3 \ CABAL_PROJECT= append post-patch: - ${ECHO_CMD} "package *" >> ${WRKSRC}/cabal.project.${PORTNAME} - ${ECHO_CMD} " extra-include-dirs: ${LIBS_PREFIX}${PREFIX}/include" >> ${WRKSRC}/cabal.project.${PORTNAME} - ${ECHO_CMD} " extra-lib-dirs: ${LIBS_PREFIX}${PREFIX}/lib" >> ${WRKSRC}/cabal.project.${PORTNAME} + ${ECHO_CMD} "package *" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} " extra-include-dirs: ${LIBS_PREFIX}${PREFIX}/include" >> ${WRKSRC}/cabal.project.local + ${ECHO_CMD} " extra-lib-dirs: ${LIBS_PREFIX}${PREFIX}/lib" >> ${WRKSRC}/cabal.project.local pre-build: cd ${WRKSRC_sodium} && ./autogen.sh