Skip to content

Commit

Permalink
Uses/cabal.mk: Introduce CABAL_REVISION knob.
Browse files Browse the repository at this point in the history
This knob allows pulling in a revised .cabal file for a Haskell package
being ported. This allows us to drop local patches that were serving the
same purpose.
  • Loading branch information
arrowd committed Nov 20, 2022
1 parent c50d10c commit 9e425fc
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 296 deletions.
19 changes: 17 additions & 2 deletions Mk/Uses/cabal.mk
Expand Up @@ -19,6 +19,9 @@
# When creating a new port, the initial list can be built
# using make-use-cabal auxiliary target.
#
# CABAL_REVISION Specifies a Haskell package revision. Set this to an
# integer to pull in revised .cabal file from Hackage.
#
# CABAL_FLAGS List of Cabal flags to be passed verbatim into --flags
# argument of cabal-install utility. Used for both
# cabal configure and cabal build.
Expand Down Expand Up @@ -125,6 +128,9 @@ MASTER_SITES+= https://hackage.haskell.org/package/${_hackage_group} \

. if ${_hackage_is_default} == yes
DISTFILES+= ${PORTNAME}-${PORTVERSION}/${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX}
. ifdef CABAL_REVISION
DISTFILES+= ${PORTNAME}-${PORTVERSION}/revision/${CABAL_REVISION}.cabal
. endif
. else
_hackage_group= :cabal_mk_hackage
. endif
Expand Down Expand Up @@ -201,6 +207,11 @@ cabal-build: check-cabal
make-use-cabal: check-cabal2tuple
@${ECHO_MSG} "===> Processing plan.json"
@${_CABAL2TUPLE_CMD} ${WRKSRC} || (${ECHO_CMD} "Did you forget to make cabal-configure ?" ; exit 1)
. if ${_hackage_is_default} == yes
@if ${GREP} -q 'x-revision' ${WRKSRC}/*.cabal; then \
${ECHO_MSG} "Downloaded .cabal file contains x-revision, make sure to add CABAL_REVISION=" `${GREP} 'x-revision' ${WRKSRC}/*.cabal | ${SED} -e s/x-revision://`; \
fi
. endif

check-cabal:
@if ! type ${CABAL_CMD} > /dev/null 2>&1; then \
Expand All @@ -225,18 +236,22 @@ cabal-post-extract:
@${TEST} ! -f ${WRKSRC}/cabal.project || \
(${ECHO_CMD} "cabal.project file is already present in WRKSRC! Set CABAL_PROJECT variable." && false)
. endif
# Copy revised .cabal file if present
. if defined(CABAL_REVISION) && ${_hackage_is_default} == yes
${CP} ${DISTDIR}/${DIST_SUBDIR}/${PORTNAME}-${PORTVERSION}/revision/${CABAL_REVISION}.cabal `find ${WRKSRC} -name '*.cabal' -depth 1`
. endif

# Move extracted dependencies into ${CABAL_DEPSDIR} directory
${MKDIR} ${CABAL_DEPSDIR}
. for package in ${_use_cabal}
. for pkg_name xrev in ${package:C/_[0-9]+//} x${package:C/[^_]*//:S/_//}
# Copy revised .cabal file if present
. if ${xrev} != "x"
cp ${DISTDIR}/${DIST_SUBDIR}/${pkg_name}/revision/${xrev:S/x//}.cabal `find ${WRKDIR}/${pkg_name} -name '*.cabal' -depth 1`
${CP} ${DISTDIR}/${DIST_SUBDIR}/${pkg_name}/revision/${xrev:S/x//}.cabal `find ${WRKDIR}/${pkg_name} -name '*.cabal' -depth 1`
. endif
# Move the dependency source itself
cd ${WRKDIR} && \
mv ${pkg_name} ${CABAL_DEPSDIR}/
${MV} ${pkg_name} ${CABAL_DEPSDIR}/
. endfor
. endfor
# Create the cabal-install config
Expand Down
1 change: 1 addition & 0 deletions converters/hs-aeson-pretty/Makefile
Expand Up @@ -11,6 +11,7 @@ LICENSE= BSD3CLAUSE

USES= cabal

CABAL_REVISION= 2
USE_CABAL= OneTuple-0.3.1_3 \
QuickCheck-2.14.2 \
StateVar-1.2.2 \
Expand Down
4 changes: 3 additions & 1 deletion converters/hs-aeson-pretty/distinfo
@@ -1,6 +1,8 @@
TIMESTAMP = 1668511709
TIMESTAMP = 1668587368
SHA256 (cabal/aeson-pretty-0.8.9/aeson-pretty-0.8.9.tar.gz) = 5dbc4f451dfa1e667b2c6ec5170714fed1905dc9cae6a1134b3376f355fa2a08
SIZE (cabal/aeson-pretty-0.8.9/aeson-pretty-0.8.9.tar.gz) = 5802
SHA256 (cabal/aeson-pretty-0.8.9/revision/2.cabal) = f7b1808efab1b9edd0efbdfc2cd47e7dfe8bbd42ee970d1d3780112a4de125a1
SIZE (cabal/aeson-pretty-0.8.9/revision/2.cabal) = 2559
SHA256 (cabal/OneTuple-0.3.1/OneTuple-0.3.1.tar.gz) = 98853682d52fb4cc37a45cd186fbd77cf2565d3df5171acc4cf026427e103eef
SIZE (cabal/OneTuple-0.3.1/OneTuple-0.3.1.tar.gz) = 5148
SHA256 (cabal/OneTuple-0.3.1/revision/3.cabal) = fc32cb744477befa450a538ea4975cc523f0a2f1585cb5a36e9936a3d18e9a3c
Expand Down
27 changes: 0 additions & 27 deletions converters/hs-aeson-pretty/files/patch-aeson-pretty.cabal

This file was deleted.

1 change: 1 addition & 0 deletions devel/hs-cpphs/Makefile
Expand Up @@ -11,6 +11,7 @@ LICENSE= LGPL21

USES= cabal

CABAL_REVISION= 1
USE_CABAL= polyparse-1.13_5

.include <bsd.port.mk>
4 changes: 3 additions & 1 deletion devel/hs-cpphs/distinfo
@@ -1,6 +1,8 @@
TIMESTAMP = 1668511758
TIMESTAMP = 1668595648
SHA256 (cabal/cpphs-1.20.9.1/cpphs-1.20.9.1.tar.gz) = 7f59b10bc3374004cee3c04fa4ee4a1b90d0dca84a3d0e436d5861a1aa3b919f
SIZE (cabal/cpphs-1.20.9.1/cpphs-1.20.9.1.tar.gz) = 45496
SHA256 (cabal/cpphs-1.20.9.1/revision/1.cabal) = 0ad26fef4e6be4cb13e1df93aab7bdbe9c3d3bc6c63b84d9e29cc0f691fe12b9
SIZE (cabal/cpphs-1.20.9.1/revision/1.cabal) = 3331
SHA256 (cabal/polyparse-1.13/polyparse-1.13.tar.gz) = 1c4c72980e1e5a4f07fea65ca08b2399581d2a6aa21eb1078f7ad286c279707b
SIZE (cabal/polyparse-1.13/polyparse-1.13.tar.gz) = 33144
SHA256 (cabal/polyparse-1.13/revision/5.cabal) = aca2fc54c5c90eaa85e59368ae3533cdc8a4bb85bb9d3e6de885f8e66eb11917
Expand Down
20 changes: 0 additions & 20 deletions devel/hs-cpphs/files/patch-cpphs.cabal

This file was deleted.

1 change: 1 addition & 0 deletions devel/hs-hasktags/Makefile
Expand Up @@ -11,6 +11,7 @@ LICENSE= BSD3CLAUSE

USES= cabal

CABAL_REVISION= 2
USE_CABAL= ansi-terminal-0.11.3 \
ansi-wl-pprint-0.6.9_3 \
colour-2.3.6 \
Expand Down
4 changes: 3 additions & 1 deletion devel/hs-hasktags/distinfo
@@ -1,6 +1,8 @@
TIMESTAMP = 1668511776
TIMESTAMP = 1668595900
SHA256 (cabal/hasktags-0.72.0/hasktags-0.72.0.tar.gz) = adadb5800ab2996f0198a6fc6af959dee6d69339c204cc9789f83e67024fe726
SIZE (cabal/hasktags-0.72.0/hasktags-0.72.0.tar.gz) = 59000
SHA256 (cabal/hasktags-0.72.0/revision/2.cabal) = 1d3cb246cf1b374bcbf5dfab2dd0f99c9c0898412281583ef89fe9bdc6347b38
SIZE (cabal/hasktags-0.72.0/revision/2.cabal) = 2866
SHA256 (cabal/ansi-terminal-0.11.3/ansi-terminal-0.11.3.tar.gz) = f4d563ecf71fb1d304bcdcad478d97efd9f61f6d9d4797a5d56e7722a92a9e6b
SIZE (cabal/ansi-terminal-0.11.3/ansi-terminal-0.11.3.tar.gz) = 37868
SHA256 (cabal/ansi-wl-pprint-0.6.9/ansi-wl-pprint-0.6.9.tar.gz) = a7b2e8e7cd3f02f2954e8b17dc60a0ccd889f49e2068ebb15abfa1d42f7a4eac
Expand Down
216 changes: 0 additions & 216 deletions devel/hs-hasktags/files/patch-hasktags.cabal

This file was deleted.

1 change: 1 addition & 0 deletions www/hs-hjsmin/Makefile
Expand Up @@ -13,6 +13,7 @@ USES= cabal

USE_LOCALE= en_US.UTF-8

CABAL_REVISION= 2
USE_CABAL= alex-3.2.7.1 \
ansi-terminal-0.11.3 \
ansi-wl-pprint-0.6.9_3 \
Expand Down
4 changes: 3 additions & 1 deletion www/hs-hjsmin/distinfo
@@ -1,6 +1,8 @@
TIMESTAMP = 1668511823
TIMESTAMP = 1668598670
SHA256 (cabal/hjsmin-0.2.0.4/hjsmin-0.2.0.4.tar.gz) = 81b9947714d8d2b73d0aba9e2e02af7e30c13b2cf8144df8904564d9642e57e4
SIZE (cabal/hjsmin-0.2.0.4/hjsmin-0.2.0.4.tar.gz) = 5233
SHA256 (cabal/hjsmin-0.2.0.4/revision/2.cabal) = 4e81260f019081f1bdd7e4e285b35f2f09eea83ff9cd721aaa4e0ba979228fa0
SIZE (cabal/hjsmin-0.2.0.4/revision/2.cabal) = 2237
SHA256 (cabal/alex-3.2.7.1/alex-3.2.7.1.tar.gz) = 9bd2f1a27e8f1b2ffdb5b2fbd3ed82b6f0e85191459a1b24ffcbef4e68a81bec
SIZE (cabal/alex-3.2.7.1/alex-3.2.7.1.tar.gz) = 108229
SHA256 (cabal/ansi-terminal-0.11.3/ansi-terminal-0.11.3.tar.gz) = f4d563ecf71fb1d304bcdcad478d97efd9f61f6d9d4797a5d56e7722a92a9e6b
Expand Down

0 comments on commit 9e425fc

Please sign in to comment.