aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <arrowd@FreeBSD.org>2021-04-27 18:47:40 +0000
committerGleb Popov <arrowd@FreeBSD.org>2021-04-29 05:39:22 +0000
commitf4397f5de0408abed022dca95ac78ba27686a205 (patch)
treea5651e2c74e1d345b981631b3878d0b5f8b5536a
parenta494841617354866a99cd63c4f8a2865a686c900 (diff)
downloadports-f4397f5de0408abed022dca95ac78ba27686a205.tar.gz
ports-f4397f5de0408abed022dca95ac78ba27686a205.zip
Uses/cabal.mk: Improve cabal-extract for USE_GITHUB/USE_GITLAB cases.
The `cabal-extract` is an auxiliary target that is intended to be run interactively by the port developer. It populates Cabal cache and then tries to fetch the main distribution file from Hackage package database. However, some packages reside on GitHub and other hostings, in which case this target fails. This commit modifies the target in such way that it does the usual `make extract`, but preserves the Cabal cache. Differential Revision: https://reviews.freebsd.org/D30014
-rw-r--r--Mk/Uses/cabal.mk13
1 files changed, 13 insertions, 0 deletions
diff --git a/Mk/Uses/cabal.mk b/Mk/Uses/cabal.mk
index 45ee43883ef6..ee632acd1f79 100644
--- a/Mk/Uses/cabal.mk
+++ b/Mk/Uses/cabal.mk
@@ -76,6 +76,12 @@ LIB_DEPENDS+= libgmp.so:math/gmp \
DIST_SUBDIR?= cabal
. if !defined(USE_GITHUB) && !defined(USE_GITLAB) && !${cabal_ARGS:Mnodefault}
+_hackage_is_default= yes
+. else
+_hackage_is_default= no
+. endif
+
+. if ${_hackage_is_default} == yes
MASTER_SITES= https://hackage.haskell.org/package/${PORTNAME}-${PORTVERSION}/ \
http://hackage.haskell.org/package/${PORTNAME}-${PORTVERSION}/
DISTFILES+= ${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX}
@@ -125,8 +131,15 @@ DISTFILES+= ${package:C/_[0-9]+//}/revision/${package:C/[^_]*//:S/_//}.cabal:${p
cabal-extract: ${WRKDIR}
${RM} -rf ${CABAL_HOME}/.cabal
${SETENV} HOME=${CABAL_HOME} cabal new-update
+. if ${_hackage_is_default} == yes
cd ${WRKDIR} && \
${SETENV} ${LOCALE_ENV} HOME=${CABAL_HOME} cabal get ${PORTNAME}-${PORTVERSION}
+. else
+ ${MV} ${CABAL_HOME} /tmp/${PORTNAME}-cabal-home
+ cd ${.CURDIR} && ${MAKE} extract CABAL_BOOTSTRAP=yes
+ ${RM} -rf ${CABAL_HOME}
+ ${MV} /tmp/${PORTNAME}-cabal-home ${CABAL_HOME}
+. endif
# Fetches and unpacks dependencies sources for a cabal-extract'ed package.
# Builds them as side-effect.