summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <arrowd@FreeBSD.org>2022-11-11 12:08:48 +0300
committerGleb Popov <arrowd@FreeBSD.org>2022-11-20 20:39:27 +0300
commite254bdde429a3d700beb9d421dc35f1da0b2077a (patch)
treea62bd18700680c14461f51bf721e4a3253bcdcd8
parentUses/cabal.mk: Use "cabal build --dry-run" in cabal-configure target. (diff)
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.
-rw-r--r--Mk/Uses/cabal.mk26
-rw-r--r--devel/elm-format/Makefile3
-rw-r--r--devel/hs-haskell-language-server/files/patch-cabal.project.haskell-language-server4
-rw-r--r--net-p2p/cardano-db-sync/Makefile6
-rw-r--r--net-p2p/cardano-node/Makefile6
-rw-r--r--net-p2p/ogmios/Makefile6
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