public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal
@ 2021-07-05 22:25 Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support Sergei Trofimovich
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-05 22:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich

The changes are mostly code removal. And example ebuild.

Sergei Trofimovich (6):
  haskell-cabal.eclass: drop EAPI={0..5} support
  ghc-package.eclass: drop EAPI={0..5} support
  ghc-package.eclass: allow EAPI=8
  haskell-cabal.eclass: allow EAPI=8
  haskell-cabal.eclass: foo
  dev-haskell/c2hs: bump up to 0.28.8, EAPI=8 example

 dev-haskell/c2hs/Manifest           |  1 +
 dev-haskell/c2hs/c2hs-0.28.8.ebuild | 41 +++++++++++++++++++++++++++
 eclass/ghc-package.eclass           |  6 ++--
 eclass/haskell-cabal.eclass         | 43 ++++++++---------------------
 4 files changed, 56 insertions(+), 35 deletions(-)
 create mode 100644 dev-haskell/c2hs/c2hs-0.28.8.ebuild

-- 
2.32.0



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support
  2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
@ 2021-07-05 22:25 ` Sergei Trofimovich
  2021-07-06  7:34   ` Ulrich Mueller
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 2/5] ghc-package.eclass: " Sergei Trofimovich
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-05 22:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 eclass/haskell-cabal.eclass | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index 5b67f43f0c5..f7a6d35e610 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -1,780 +1,757 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
 # Haskell herd <haskell@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 6 7
 # @AUTHOR:
 # Original author: Andres Loeh <kosmikus@gentoo.org>
 # Original author: Duncan Coutts <dcoutts@gentoo.org>
 # @BLURB: for packages that make use of the Haskell Common Architecture for Building Applications and Libraries (cabal)
 # @DESCRIPTION:
 # Basic instructions:
 #
 # Before inheriting the eclass, set CABAL_FEATURES to
 # reflect the tools and features that the package makes
 # use of.
 #
 # Currently supported features:
 #   haddock    --  for documentation generation
 #   hscolour   --  generation of colourised sources
 #   hoogle     --  generation of documentation search index
 #   profile    --  if package supports to build profiling-enabled libraries
 #   bootstrap  --  only used for the cabal package itself
 #   lib        --  the package installs libraries
 #   nocabaldep --  don't add dependency on cabal.
 #                  only used for packages that _must_ not pull the dependency
 #                  on cabal, but still use this eclass (e.g. haskell-updater).
 #   ghcdeps    --  constraint dependency on package to ghc onces
 #                  only used for packages that use libghc internally and _must_
 #                  not pull upper versions
 #   test-suite --  add support for cabal test-suites (introduced in Cabal-1.8)
 #   rebuild-after-doc-workaround -- enable doctest test failue workaround.
 #                  Symptom: when `./setup haddock` is run in a `build-type: Custom`
 #                  package it might cause cause the test-suite to fail with
 #                  errors like:
 #                  > <command line>: cannot satisfy -package-id singletons-2.7-3Z7pnljD8tU1NrslJodXmr
 #                  Workaround re-reginsters the package to avoid the failure
 #                  (and rebuilds changes).
 #                  FEATURE can be removed once https://github.com/haskell/cabal/issues/7213
 #                  is fixed.
 
 inherit eutils ghc-package multilib toolchain-funcs
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup configure'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_CONFIGURE_FLAGS="--enable-shared --enable-executable-dynamic"
 : ${CABAL_EXTRA_CONFIGURE_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_BUILD_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup build'.
 # example: /etc/portage/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v
 : ${CABAL_EXTRA_BUILD_FLAGS:=}
 
 # @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters for ghc when building
 # _only_ 'setup' binary bootstrap.
 # example: /etc/portage/make.conf: GHC_BOOTSTRAP_FLAGS=-dynamic to make
 # linking 'setup' faster.
 : ${GHC_BOOTSTRAP_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_HADDOCK_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup haddock'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_HADDOCK_FLAGS="--haddock-options=--latex --haddock-options=--pretty-html"
 : ${CABAL_EXTRA_HADDOCK_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_HOOGLE_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup haddock --hoogle'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_HOOGLE_FLAGS="--haddock-options=--show-all"
 : ${CABAL_EXTRA_HOOGLE_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_HSCOLOUR_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup hscolour'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_HSCOLOUR_FLAGS="--executables --tests"
 : ${CABAL_EXTRA_HSCOLOUR_FLAGS:=}
 
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_TEST_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup test'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_TEST_FLAGS="-v3 --show-details=streaming"
 : ${CABAL_EXTRA_TEST_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_DEBUG_LOOSENING
 # @DESCRIPTION:
 # Show debug output for 'cabal_chdeps' function if set.
 # Needs working 'diff'.
 : ${CABAL_DEBUG_LOOSENING:=}
 
 # @ECLASS-VARIABLE: CABAL_REPORT_OTHER_BROKEN_PACKAGES
 # @DESCRIPTION:
 # Show other broken packages if 'cabal configure' fails.
 # It should be normally enabled unless you know you are about
 # to try to compile a lot of broken packages. Default value: 'yes'
 # Set to anything else to disable.
 : ${CABAL_REPORT_OTHER_BROKEN_PACKAGES:=yes}
 
-HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install pkg_postinst pkg_postrm"
-
 # 'dev-haskell/cabal' passes those options with ./configure-based
 # configuration, but most packages don't need/don't accept it:
 # #515362, #515362
 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-hc --with-hc-pkg --with-gcc"
 
 case "${EAPI:-0}" in
-	0|1) ;;
-	2|3|4|5|6|7) HASKELL_CABAL_EXPF+=" src_configure" ;;
+	6|7) ;;
 	*) die "EAPI ${EAPI} unsupported." ;;
 esac
 
-EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF}
+EXPORT_FUNCTIONS pkg_setup src_configure src_compile src_test src_install pkg_postinst pkg_postrm
 
 for feature in ${CABAL_FEATURES}; do
 	case ${feature} in
 		haddock)    CABAL_USE_HADDOCK=yes;;
 		hscolour)   CABAL_USE_HSCOLOUR=yes;;
 		hoogle)     CABAL_USE_HOOGLE=yes;;
 		profile)    CABAL_USE_PROFILE=yes;;
 		bootstrap)  CABAL_BOOTSTRAP=yes;;
 		lib)        CABAL_HAS_LIBRARIES=yes;;
 		nocabaldep) CABAL_FROM_GHC=yes;;
 		ghcdeps)    CABAL_GHC_CONSTRAINT=yes;;
 		test-suite) CABAL_TEST_SUITE=yes;;
 		rebuild-after-doc-workaround) CABAL_REBUILD_AFTER_DOC_WORKAROUND=yes;;
 
-		# does nothing, removed 2016-09-04
-		bin)        ;;
-
 		*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
 	esac
 done
 
 if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
 	IUSE="${IUSE} doc"
 fi
 
 if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then
 	IUSE="${IUSE} hscolour"
 	DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
 fi
 
 if [[ -n "${CABAL_USE_HOOGLE}" ]]; then
 	# enabled only in ::haskell
 	#IUSE="${IUSE} hoogle"
 	CABAL_USE_HOOGLE=
 fi
 
 if [[ -n "${CABAL_USE_PROFILE}" ]]; then
 	IUSE="${IUSE} profile"
 fi
 
 if [[ -n "${CABAL_TEST_SUITE}" ]]; then
 	IUSE="${IUSE} test"
 	RESTRICT+=" !test? ( test )"
 fi
 
 # returns the version of cabal currently in use.
 # Rarely it's handy to pin cabal version from outside.
 : ${_CABAL_VERSION_CACHE:=""}
 cabal-version() {
 	if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then
 		if [[ "${CABAL_BOOTSTRAP}" ]]; then
 			# We're bootstrapping cabal, so the cabal version is the version
 			# of this package itself.
 			_CABAL_VERSION_CACHE="${PV}"
 		elif [[ "${CABAL_FROM_GHC}" ]]; then
 			_CABAL_VERSION_CACHE="$(ghc-cabal-version)"
 		else
 			# We ask portage, not ghc, so that we only pick up
 			# portage-installed cabal versions.
 			_CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
 		fi
 	fi
 	echo "${_CABAL_VERSION_CACHE}"
 }
 
 cabal-bootstrap() {
 	local setupmodule
 	local cabalpackage
 	local setup_bootstrap_args=()
 
 	if [[ -f "${S}/Setup.lhs" ]]; then
 		setupmodule="${S}/Setup.lhs"
 	elif [[ -f "${S}/Setup.hs" ]]; then
 		setupmodule="${S}/Setup.hs"
 	else
 		eqawarn "No Setup.lhs or Setup.hs found. Either add Setup.hs to package or call cabal-mksetup from ebuild"
 		cabal-mksetup
 		setupmodule="${S}/Setup.hs"
 	fi
 
 	# We build the setup program using the latest version of
 	# cabal that we have installed
 	cabalpackage=Cabal-$(cabal-version)
 	einfo "Using cabal-$(cabal-version)."
 
 	if $(ghc-supports-threaded-runtime); then
 		# Cabal has a bug that deadlocks non-threaded RTS:
 		#     https://bugs.gentoo.org/537500
 		#     https://github.com/haskell/cabal/issues/2398
 		setup_bootstrap_args+=(-threaded)
 	fi
 
 	make_setup() {
 		set -- -package "${cabalpackage}" --make "${setupmodule}" \
 			$(ghc-make-args) \
 			"${setup_bootstrap_args[@]}" \
 			${HCFLAGS} \
 			${GHC_BOOTSTRAP_FLAGS} \
 			"$@" \
 			-o setup
 		echo $(ghc-getghc) "$@"
 		$(ghc-getghc) "$@"
 	}
 	if $(ghc-supports-shared-libraries); then
 		# # some custom build systems might use external libraries,
 		# # for which we don't have shared libs, so keep static fallback
 		# bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3
 		# http://hackage.haskell.org/trac/ghc/ticket/7062
 		# http://hackage.haskell.org/trac/ghc/ticket/3072
 		# ghc does not set RPATH for extralibs, thus we do it ourselves by hands
 		einfo "Prepending $(ghc-libdir) to LD_LIBRARY_PATH"
 		if [[ ${CHOST} != *-darwin* ]]; then
 			LD_LIBRARY_PATH="$(ghc-libdir)${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
 			export LD_LIBRARY_PATH
 		else
 			DYLD_LIBRARY_PATH="$(ghc-libdir)${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
 			export DYLD_LIBRARY_PATH
 		fi
 		{ make_setup -dynamic "$@" && ./setup --help >/dev/null; } ||
 		make_setup "$@" || die "compiling ${setupmodule} failed"
 	else
 		make_setup "$@" || die "compiling ${setupmodule} failed"
 	fi
 }
 
 cabal-mksetup() {
 	local setupdir=${1:-${S}}
 	local setup_src=${setupdir}/Setup.hs
 
 	rm -vf "${setupdir}"/Setup.{lhs,hs}
 	elog "Creating 'Setup.hs' for 'Simple' build type."
 
 	echo 'import Distribution.Simple; main = defaultMain' \
 		> "${setup_src}" || die "failed to create default Setup.hs"
 }
 
 haskell-cabal-run_verbose() {
 	echo "$@"
 	"$@" || die "failed: $@"
 }
 
 cabal-hscolour() {
 	haskell-cabal-run_verbose ./setup hscolour "$@"
 }
 
 cabal-haddock() {
 	haskell-cabal-run_verbose ./setup haddock "$@"
 }
 
 cabal-die-if-nonempty() {
 	local breakage_type=$1
 	shift
 
 	[[ "${#@}" == 0 ]] && return 0
 	eerror "Detected ${breakage_type} packages: ${@}"
 	die "//==-- Please, run 'haskell-updater' to fix ${breakage_type} packages --==//"
 }
 
 cabal-show-brokens() {
 	[[ ${CABAL_REPORT_OTHER_BROKEN_PACKAGES} != yes ]] && return 0
 
 	elog "ghc-pkg check: 'checking for other broken packages:'"
 	# pretty-printer
 	$(ghc-getghcpkg) check 2>&1 \
 		| egrep -v '^Warning: haddock-(html|interfaces): ' \
 		| egrep -v '^Warning: include-dirs: ' \
 		| head -n 20
 
 	cabal-die-if-nonempty 'broken' \
 		$($(ghc-getghcpkg) check --simple-output)
 }
 
 cabal-show-old() {
 	[[ ${CABAL_REPORT_OTHER_BROKEN_PACKAGES} != yes ]] && return 0
 
 	cabal-die-if-nonempty 'outdated' \
 		$("${EPREFIX}"/usr/sbin/haskell-updater --quiet --upgrade --list-only)
 }
 
 cabal-show-brokens-and-die() {
 	cabal-show-brokens
 	cabal-show-old
 
 	die "$@"
 }
 
 cabal-configure() {
 	local cabalconf=()
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
 
 	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
 		# We use the bundled with GHC version if exists
 		# Haddock is very picky about index files
 		# it generates for ghc's base and other packages.
 		local p=${EPREFIX}/usr/bin/haddock-ghc-$(ghc-version)
 		if [[ -f $p ]]; then
 			cabalconf+=(--with-haddock="${p}")
 		else
 			cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock)
 		fi
 	fi
 	if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
 		cabalconf+=(--enable-library-profiling)
 	fi
 
 	if [[ -n "${CABAL_TEST_SUITE}" ]]; then
 		cabalconf+=($(use_enable test tests))
 	fi
 
 	if [[ -n "${CABAL_GHC_CONSTRAINT}" ]]; then
 		cabalconf+=($(cabal-constraint "ghc"))
 	fi
 
 	cabalconf+=(--ghc-options="$(ghc-make-args)")
 
 	local option
 	for option in ${HCFLAGS}
 	do
 		cabalconf+=(--ghc-option="$option")
 	done
 
 	# toolchain
 	cabalconf+=(--with-ar="$(tc-getAR)")
 
 	# Building GHCi libs on ppc64 causes "TOC overflow".
 	if use ppc64; then
 		cabalconf+=(--disable-library-for-ghci)
 	fi
 
 	# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
 	# so translate LDFLAGS to ghc parameters (with mild filtering).
 	local flag
 	for flag in   $CFLAGS; do
 		case "${flag}" in
 			-flto|-flto=*)
 				# binutils does not support partial linking yet:
 				# https://github.com/gentoo-haskell/gentoo-haskell/issues/1110
 				# https://sourceware.org/PR12291
 				einfo "Filter '${flag}' out of CFLAGS (avoid lto partial linking)"
 				continue
 				;;
 		esac
 
 		cabalconf+=(--ghc-option="-optc$flag")
 	done
 	for flag in  $LDFLAGS; do
 		case "${flag}" in
 			-flto|-flto=*)
 				# binutils does not support partial linking yet:
 				# https://github.com/gentoo-haskell/gentoo-haskell/issues/1110
 				# https://sourceware.org/PR12291
 				einfo "Filter '${flag}' out of LDFLAGS (avoid lto partial linking)"
 				continue
 				;;
 		esac
 
 		cabalconf+=(--ghc-option="-optl$flag")
 	done
 
 	# disable executable stripping for the executables, as portage will
 	# strip by itself, and pre-stripping gives a QA warning.
 	# cabal versions previous to 1.4 does not strip executables, and does
 	# not accept the flag.
 	# this fixes numerous bugs, amongst them;
 	# bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
 	cabalconf+=(--disable-executable-stripping)
 
 	cabalconf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF})
 	# As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
 	# it's better if the configure chatter is in the build logs:
 	cabalconf+=(--verbose)
 
 	# We build shared version of our Cabal where ghc ships it's shared
 	# version of it. We will link ./setup as dynamic binary againt Cabal later.
 	[[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
 		$(ghc-supports-shared-libraries) && \
 			cabalconf+=(--enable-shared)
 
 	if $(ghc-supports-shared-libraries); then
 		# Experimental support for dynamically linked binaries.
 		# We are enabling it since 7.10.1_rc3
 		if ver_test "$(ghc-version)" -ge "7.10.0.20150316"; then
 			# we didn't enable it before as it was not stable on all arches
 			cabalconf+=(--enable-shared)
 			# Known to break on ghc-7.8/Cabal-1.18
 			# https://ghc.haskell.org/trac/ghc/ticket/9625
 			cabalconf+=(--enable-executable-dynamic)
 		fi
 	fi
 
 	# --sysconfdir appeared in Cabal-1.18+
 	if ./setup configure --help | grep -q -- --sysconfdir; then
 		cabalconf+=(--sysconfdir="${EPREFIX}"/etc)
 	fi
 
 	# appeared in Cabal-1.18+ (see '--disable-executable-stripping')
 	if ./setup configure --help | grep -q -- --disable-library-stripping; then
 		cabalconf+=(--disable-library-stripping)
 	fi
 
 	set -- configure \
 		--ghc --prefix="${EPREFIX}"/usr \
 		--with-compiler="$(ghc-getghc)" \
 		--with-hc-pkg="$(ghc-getghcpkg)" \
 		--prefix="${EPREFIX}"/usr \
 		--libdir="${EPREFIX}"/usr/$(get_libdir) \
 		--libsubdir=${P}/ghc-$(ghc-version) \
 		--datadir="${EPREFIX}"/usr/share/ \
 		--datasubdir=${P}/ghc-$(ghc-version) \
 		"${cabalconf[@]}" \
 		${CABAL_CONFIGURE_FLAGS} \
 		"$@" \
 		${CABAL_EXTRA_CONFIGURE_FLAGS}
 	echo ./setup "$@"
 	./setup "$@" || cabal-show-brokens-and-die "setup configure failed"
 }
 
 cabal-build() {
 	set --  build "$@" ${CABAL_EXTRA_BUILD_FLAGS}
 	echo ./setup "$@"
 	./setup "$@" \
 		|| die "setup build failed"
 }
 
 cabal-copy() {
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED=${D}
-
 	set -- copy --destdir="${D}" "$@"
 	echo ./setup "$@"
 	./setup "$@" || die "setup copy failed"
 
 	# cabal is a bit eager about creating dirs,
 	# so remove them if they are empty
 	rmdir "${ED}/usr/bin" 2> /dev/null
 }
 
 cabal-pkg() {
 	# This does not actually register since we're using true instead
 	# of ghc-pkg. So it just leaves the .conf file and we can
 	# register that ourselves (if it exists).
 
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
 		# Newer cabal can generate a package conf for us:
 		./setup register --gen-pkg-config="${T}/${P}.conf"
 		if [[ -d "${T}/${P}.conf" ]]; then
 			ghc-install-pkg "${T}/${P}.conf"/*
 		else
 			ghc-install-pkg "${T}/${P}.conf"
 		fi
 	fi
 }
 
 # Some cabal libs are bundled along with some versions of ghc
 # eg filepath-1.0 comes with ghc-6.6.1
 # by putting CABAL_CORE_LIB_GHC_PV="6.6.1" in an ebuild we are declaring that
 # when building with this version of ghc, the ebuild is a dummy that is it will
 # install no files since the package is already included with ghc.
 # However portage still records the dependency and we can upgrade the package
 # to a later one that's not included with ghc.
 # You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1".
 # Those versions are taken as-is from ghc `--numeric-version`.
 # Package manager versions are also supported:
 #     CABAL_CORE_LIB_GHC_PV="7.10.* PM:7.8.4-r1".
 cabal-is-dummy-lib() {
 	local bin_ghc_version=$(ghc-version)
 	local pm_ghc_version=$(ghc-pm-version)
 
 	for version in ${CABAL_CORE_LIB_GHC_PV}; do
 		[[ "${bin_ghc_version}" == ${version} ]] && return 0
 		[[ "${pm_ghc_version}"  == ${version} ]] && return 0
 	done
 
 	return 1
 }
 
 # exported function: check if cabal is correctly installed for
 # the currently active ghc (we cannot guarantee this with portage)
 haskell-cabal_pkg_setup() {
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
 		[[ ${RDEPEND} == *dev-lang/ghc* ]] || eqawarn "QA Notice: A library does not have runtime dependency on dev-lang/ghc."
 	fi
 	if [[ -n "${CABAL_UNKNOWN}" ]]; then
 		eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
 	fi
 	if cabal-is-dummy-lib; then
 		einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
 	fi
 }
 
 haskell-cabal_src_configure() {
 	cabal-is-dummy-lib && return
 
 	pushd "${S}" > /dev/null || die
 
 	cabal-bootstrap
 
 	cabal-configure "$@"
 
 	popd > /dev/null || die
 }
 
 # exported function: nice alias
 cabal_src_configure() {
 	haskell-cabal_src_configure "$@"
 }
 
 # exported function: cabal-style bootstrap configure and compile
 cabal_src_compile() {
-	# it's a common mistake when one bumps ebuild to EAPI="2" (and upper)
-	# and forgets to separate src_compile() to src_configure()/src_compile().
-	# Such error leads to default src_configure and we lose all passed flags.
-	if ! has "${EAPI:-0}" 0 1; then
-		local passed_flag
-		for passed_flag in "$@"; do
-			[[ ${passed_flag} == --flags=* ]] && \
-				eqawarn "QA Notice: Cabal option '${passed_flag}' has effect only in src_configure()"
-		done
-	fi
-
 	cabal-is-dummy-lib && return
 
-	has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
 	cabal-build
 
 	if [[ -n "$CABAL_USE_HADDOCK" ]] && use doc; then
 		if [[ -n "$CABAL_USE_HSCOLOUR" ]] && use hscolour; then
 			# --hyperlink-source implies calling 'setup hscolour'
 			haddock_args+=(--hyperlink-source)
 		fi
 
 		cabal-haddock "${haddock_args[@]}" $CABAL_EXTRA_HADDOCK_FLAGS
 
 		if [[ -n "$CABAL_USE_HOOGLE" ]] && use hoogle; then
 			cabal-haddock --hoogle $CABAL_EXTRA_HOOGLE_FLAGS
 		fi
 		if [[ -n "${CABAL_REBUILD_AFTER_DOC_WORKAROUND}" ]]; then
 			ewarn "rebuild-after-doc-workaround is enabled. This is a"
 			ewarn "temporary worakround to deal with https://github.com/haskell/cabal/issues/7213"
 			ewarn "until the upstream issue can be resolved."
 			cabal-build
 		fi
 	else
 		if [[ -n "$CABAL_USE_HSCOLOUR" ]] && use hscolour; then
 			cabal-hscolour $CABAL_EXTRA_HSCOLOUR_FLAGS
 		fi
 
 		if [[ -n "$CABAL_USE_HOOGLE" ]] && use hoogle; then
 			ewarn "hoogle USE flag requires doc USE flag, building without hoogle"
 		fi
 	fi
 }
 
 haskell-cabal_src_compile() {
 	pushd "${S}" > /dev/null || die
 
 	cabal_src_compile "$@"
 
 	popd > /dev/null || die
 }
 
 haskell-cabal_src_test() {
 	local cabaltest=()
 
 	pushd "${S}" > /dev/null || die
 
 	if cabal-is-dummy-lib; then
 		einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}"
 	else
 		einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
 
 		# '--show-details=streaming' appeared in Cabal-1.20
 		if ./setup test --help | grep -q -- "'streaming'"; then
 			cabaltest+=(--show-details=streaming)
 		fi
 
 		set -- test \
 			"${cabaltest[@]}" \
 			${CABAL_TEST_FLAGS} \
 			"$@" \
 			${CABAL_EXTRA_TEST_FLAGS}
 		echo ./setup "$@"
 		./setup "$@" || die "cabal test failed"
 	fi
 
 	popd > /dev/null || die
 }
 
 # exported function: cabal-style copy and register
 cabal_src_install() {
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-
 	if ! cabal-is-dummy-lib; then
 		cabal-copy
 		cabal-pkg
 	fi
 
 	# create a dummy local package conf file for haskell-updater
 	# if it does not exist (dummy libraries and binaries w/o libraries)
 	local ghc_confdir_with_prefix="$(ghc-confdir)"
 	# remove EPREFIX
 	dodir ${ghc_confdir_with_prefix#${EPREFIX}}
 	local hint_db="${D}/$(ghc-confdir)"
 	local hint_file="${hint_db}/gentoo-empty-${CATEGORY}-${PF}.conf"
 	mkdir -p "${hint_db}" || die
 	touch "${hint_file}" || die
 }
 
 haskell-cabal_src_install() {
 	pushd "${S}" > /dev/null || die
 
 	cabal_src_install
 
 	popd > /dev/null || die
 }
 
 haskell-cabal_pkg_postinst() {
 	ghc-package_pkg_postinst
 }
 
 haskell-cabal_pkg_postrm() {
 	ghc-package_pkg_postrm
 }
 
 # @FUNCTION: cabal_flag
 # @DESCRIPTION:
 # ebuild.sh:use_enable() taken as base
 #
 # Usage examples:
 #
 #     CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
 #  leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')
 #
 #     CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
 #  also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')
 #
 cabal_flag() {
 	if [[ -z "$1" ]]; then
 		echo "!!! cabal_flag() called without a parameter." >&2
 		echo "!!! cabal_flag() <USEFLAG> [<cabal_flagname>]" >&2
 		return 1
 	fi
 
 	local UWORD=${2:-$1}
 
 	if use "$1"; then
 		echo "--flags=${UWORD}"
 	else
 		echo "--flags=-${UWORD}"
 	fi
 
 	return 0
 }
 
 # @FUNCTION: cabal_chdeps
 # @DESCRIPTION:
 # Allows easier patching of $CABAL_FILE (${S}/${PN}.cabal by default)
 # depends
 #
 # Accepts argument list as pairs of substitutions: <from-string> <to-string>...
 #
 # Dies on error.
 #
 # Usage examples:
 #
 # src_prepare() {
 #    cabal_chdeps \
 #        'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7' \
 #        'containers ==0.4.*' 'containers >= 0.4 && < 0.6'
 #}
 # or
 # src_prepare() {
 #    CABAL_FILE=${S}/${MY_PN}.cabal cabal_chdeps \
 #        'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7'
 #    CABAL_FILE=${S}/${MY_PN}-tools.cabal cabal_chdeps \
 #        'base == 3.*' 'base >= 4.2 && < 4.7'
 #}
 #
 cabal_chdeps() {
 	local cabal_fn=${MY_PN:-${PN}}.cabal
 	local cf=${CABAL_FILE:-${S}/${cabal_fn}}
 	local from_ss # ss - substring
 	local to_ss
 	local orig_c # c - contents
 	local new_c
 
 	[[ -f $cf ]] || die "cabal file '$cf' does not exist"
 
 	orig_c=$(< "$cf")
 
 	while :; do
 		from_pat=$1
 		to_str=$2
 
 		[[ -n ${from_pat} ]] || break
 		[[ -n ${to_str} ]] || die "'${from_str}' does not have 'to' part"
 
 		einfo "CHDEP: '${from_pat}' -> '${to_str}'"
 
 		# escape pattern-like symbols
 		from_pat=${from_pat//\*/\\*}
 		from_pat=${from_pat//\[/\\[}
 
 		new_c=${orig_c//${from_pat}/${to_str}}
 
 		if [[ -n $CABAL_DEBUG_LOOSENING ]]; then
 			echo "${orig_c}" >"${T}/${cf}".pre
 			echo "${new_c}" >"${T}/${cf}".post
 			diff -u "${T}/${cf}".{pre,post}
 		fi
 
 		[[ "${orig_c}" == "${new_c}" ]] && die "no trigger for '${from_pat}'"
 		orig_c=${new_c}
 		shift
 		shift
 	done
 
 	echo "${new_c}" > "$cf" ||
 		die "failed to update"
 }
 
 # @FUNCTION: cabal-constraint
 # @DESCRIPTION:
 # Allowes to set contraint to the libraries that are
 # used by specified package
 cabal-constraint() {
 	while read p v ; do
 		echo "--constraint \"$p == $v\""
 	done < $(ghc-pkgdeps ${1})
 }
 
 # @FUNCTION: replace-hcflags
 # @USAGE: <old> <new>
 # @DESCRIPTION:
 # Replace the <old> flag with <new> in HCFLAGS. Accepts shell globs for <old>.
 # The implementation is picked from flag-o-matic.eclass:replace-flags()
 replace-hcflags() {
 	[[ $# != 2 ]] && die "Usage: replace-hcflags <old flag> <new flag>"
 
 	local f new=()
 	for f in ${HCFLAGS} ; do
 		# Note this should work with globs like -O*
 		if [[ ${f} == ${1} ]]; then
 			einfo "HCFLAGS: replacing '${f}' to '${2}'"
 			f=${2}
 		fi
 		new+=( "${f}" )
 	done
 	export HCFLAGS="${new[*]}"
 
 	return 0
 }
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 2/5] ghc-package.eclass: drop EAPI={0..5} support
  2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support Sergei Trofimovich
@ 2021-07-05 22:25 ` Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 3/5] ghc-package.eclass: allow EAPI=8 Sergei Trofimovich
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-05 22:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 eclass/ghc-package.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass
index 5decbaa228e..71e84af3444 100644
--- a/eclass/ghc-package.eclass
+++ b/eclass/ghc-package.eclass
@@ -1,346 +1,346 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
 # "Gentoo's Haskell Language team" <haskell@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 6 7
 # @AUTHOR:
 # Original Author: Andres Loeh <kosmikus@gentoo.org>
 # @BLURB: This eclass helps with the Glasgow Haskell Compiler's package configuration utility.
 # @DESCRIPTION:
 # Helper eclass to handle ghc installation/upgrade/deinstallation process.
 
 inherit multiprocessing
 
 # Maintain version-testing compatibility with ebuilds not using EAPI 7.
 case "${EAPI:-0}" in
-	0|1|2|3|7) ;;
-	4|5|6) inherit eapi7-ver ;;
+	7) ;;
+	6) inherit eapi7-ver ;;
 	*) die "EAPI ${EAPI} unsupported." ;;
 esac
 
 # GHC uses it's own native code generator. Portage's
 # QA check generates false positive because it assumes
 # presence of GCC-specific sections.
 #
 # Workaround false positiove by disabling the check completely.
 # bug #722078, bug #677600
 QA_FLAGS_IGNORED='.*'
 
 # @FUNCTION: ghc-getghc
 # @DESCRIPTION:
 # returns the name of the ghc executable
 ghc-getghc() {
 	if ! type -P ${HC:-ghc}; then
 		ewarn "ghc not found"
 		type -P false
 	fi
 }
 
 # @FUNCTION: ghc-getghcpkg
 # @INTERNAL
 # @DESCRIPTION:
 # Internal function determines returns the name of the ghc-pkg executable
 ghc-getghcpkg() {
 	if ! type -P ${HC_PKG:-ghc-pkg}; then
 		ewarn "ghc-pkg not found"
 		type -P false
 	fi
 }
 
 # @FUNCTION: ghc-getghcpkgbin
 # @DESCRIPTION:
 # returns the name of the ghc-pkg binary (ghc-pkg
 # itself usually is a shell script, and we have to
 # bypass the script under certain circumstances);
 # for Cabal, we add an empty global package config file,
 # because for some reason the global package file
 # must be specified
 ghc-getghcpkgbin() {
 	local empty_db="${T}/empty.conf.d" ghc_pkg="$(ghc-libdir)/bin/ghc-pkg"
 	if [[ ! -d ${empty_db} ]]; then
 		"${ghc_pkg}" init "${empty_db}" || die "Failed to initialize empty global db"
 	fi
 	echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${empty_db}"
 }
 
 # @FUNCTION: ghc-version
 # @DESCRIPTION:
 # returns upstream version of ghc
 # as reported by '--numeric-version'
 # Examples: "7.10.2", "7.9.20141222"
 _GHC_VERSION_CACHE=""
 ghc-version() {
 	if [[ -z "${_GHC_VERSION_CACHE}" ]]; then
 		_GHC_VERSION_CACHE="$($(ghc-getghc) --numeric-version)"
 	fi
 	echo "${_GHC_VERSION_CACHE}"
 }
 
 # @FUNCTION: ghc-pm-version
 # @DESCRIPTION:
 # returns package manager(PM) version of ghc
 # as reported by '$(best_version)'
 # Examples: "PM:7.10.2", "PM:7.10.2_rc1", "PM:7.8.4-r4"
 _GHC_PM_VERSION_CACHE=""
 ghc-pm-version() {
 	local pm_ghc_p
 
 	if [[ -z "${_GHC_PM_VERSION_CACHE}" ]]; then
 		pm_ghc_p=$(best_version dev-lang/ghc)
 		_GHC_PM_VERSION_CACHE="PM:${pm_ghc_p#dev-lang/ghc-}"
 	fi
 	echo "${_GHC_PM_VERSION_CACHE}"
 }
 
 # @FUNCTION: ghc-cabal-version
 # @DESCRIPTION:
 # return version of the Cabal library bundled with ghc
 ghc-cabal-version() {
 	# outputs in format: 'version: 1.18.1.5'
 	set -- `$(ghc-getghcpkg) --package-db=$(ghc-libdir)/package.conf.d.initial field Cabal version`
 	echo "$2"
 }
 
 # @FUNCTION: ghc-is-dynamic
 # @DESCRIPTION:
 # checks if ghc is built against dynamic libraries
 # binaries linked against GHC library (and using plugin loading)
 # have to be linked the same way:
 #    https://ghc.haskell.org/trac/ghc/ticket/10301
 ghc-is-dynamic() {
 	$(ghc-getghc) --info | grep "GHC Dynamic" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-supports-shared-libraries
 # @DESCRIPTION:
 # checks if ghc is built with support for building
 # shared libraries (aka '-dynamic' option)
 ghc-supports-shared-libraries() {
 	$(ghc-getghc) --info | grep "RTS ways" | grep -q "dyn"
 }
 
 # @FUNCTION: ghc-supports-threaded-runtime
 # @DESCRIPTION:
 # checks if ghc is built with support for threaded
 # runtime (aka '-threaded' option)
 ghc-supports-threaded-runtime() {
 	$(ghc-getghc) --info | grep "RTS ways" | grep -q "thr"
 }
 
 # @FUNCTION: ghc-supports-smp
 # @DESCRIPTION:
 # checks if ghc is built with support for multiple cores runtime
 ghc-supports-smp() {
 	$(ghc-getghc) --info | grep "Support SMP" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-supports-interpreter
 # @DESCRIPTION:
 # checks if ghc has interpreter mode (aka GHCi)
 # It usually means that ghc supports for template haskell.
 ghc-supports-interpreter() {
 	$(ghc-getghc) --info | grep "Have interpreter" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-supports-parallel-make
 # @DESCRIPTION:
 # checks if ghc has support for '--make -j' mode
 # The option was introduced in ghc-7.8-rc1.
 ghc-supports-parallel-make() {
 	$(ghc-getghc) --info | grep "Support parallel --make" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-extractportageversion
 # @DESCRIPTION:
 # extract the version of a portage-installed package
 ghc-extractportageversion() {
 	local pkg
 	local version
 	pkg="$(best_version $1)"
 	version="${pkg#$1-}"
 	version="${version%-r*}"
 	version="${version%_pre*}"
 	echo "${version}"
 }
 
 # @FUNCTION: ghc-libdir
 # @DESCRIPTION:
 # returns the library directory
 _GHC_LIBDIR_CACHE=""
 ghc-libdir() {
 	if [[ -z "${_GHC_LIBDIR_CACHE}" ]]; then
 		_GHC_LIBDIR_CACHE="$($(ghc-getghc) --print-libdir)"
 	fi
 	echo "${_GHC_LIBDIR_CACHE}"
 }
 
 # @FUNCTION: ghc-make-args
 # @DESCRIPTION:
 # Returns default arguments passed along 'ghc --make'
 # build mode. Used mainly to enable parallel build mode.
 ghc-make-args() {
 	local ghc_make_args=()
 	# parallel on all available cores
 	if ghc-supports-smp && ghc-supports-parallel-make; then
 		# It should have been just -j$(makeopts_jobs)
 		# but GHC does not yet have nice defaults:
 		#    https://ghc.haskell.org/trac/ghc/ticket/9221#comment:57
 		# SMP is a requirement for parallel GC's gen0
 		# 'qb' balancing.
 		echo "-j$(makeopts_jobs) +RTS -A256M -qb0 -RTS"
 		ghc_make_args=()
 	fi
 	echo "${ghc_make_args[@]}"
 }
 
 # @FUNCTION: ghc-confdir
 # @DESCRIPTION:
 # returns the (Gentoo) library configuration directory, we
 # store here a hint for 'haskell-updater' about packages
 # installed for old ghc versions and current ones.
 ghc-confdir() {
 	echo "$(ghc-libdir)/gentoo"
 }
 
 # @FUNCTION: ghc-package-db
 # @DESCRIPTION:
 # returns the global package database directory
 ghc-package-db() {
 	echo "$(ghc-libdir)/package.conf.d"
 }
 
 # @FUNCTION: ghc-localpkgconfd
 # @DESCRIPTION:
 # returns the name of the local (package-specific)
 # package configuration file
 ghc-localpkgconfd() {
 	echo "${PF}.conf.d"
 }
 
 # @FUNCTION: ghc-package-exists
 # @DESCRIPTION:
 # tests if a ghc package exists
 ghc-package-exists() {
 	$(ghc-getghcpkg) describe "$1" > /dev/null 2>&1
 }
 
 # @FUNCTION: check-for-collisions
 # @DESCRIPTION:
 # makes sure no packages
 # have the same version as initial package setup
 check-for-collisions() {
 	local localpkgconf=$1
 	local checked_pkg
 	local initial_pkg_db="$(ghc-libdir)/package.conf.d.initial"
 
 	for checked_pkg in `$(ghc-getghcpkgbin) -f "${localpkgconf}" list --simple-output`
 	do
 		# should return empty output
 		local collided=`$(ghc-getghcpkgbin) -f ${initial_pkg_db} list --simple-output "${checked_pkg}"`
 
 		if [[ -n ${collided} ]]; then
 			eerror "Cabal package '${checked_pkg}' is shipped with '$(ghc-pm-version)' ('$(ghc-version)')."
 			eerror "Ebuild author forgot an entry in CABAL_CORE_LIB_GHC_PV='${CABAL_CORE_LIB_GHC_PV}'."
 			eerror "Found in ${initial_pkg_db}."
 			die
 		fi
 	done
 }
 
 # @FUNCTION: ghc-install-pkg
 # @DESCRIPTION:
 # moves the local (package-specific) package configuration
 # file to its final destination
 ghc-install-pkg() {
 	local localpkgconf="${T}/$(ghc-localpkgconfd)"
 	local pkg_path pkg pkg_db="${D}/$(ghc-package-db)" hint_db="${D}/$(ghc-confdir)"
 
 	$(ghc-getghcpkgbin) init "${localpkgconf}" || die "Failed to initialize empty local db"
 	for pkg_config_file in "$@"; do
 		$(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \
 				< "${pkg_config_file}" || die "failed to register ${pkg}"
 	done
 
 	check-for-collisions "${localpkgconf}"
 
 	mkdir -p "${pkg_db}" || die
 	for pkg_path in "${localpkgconf}"/*.conf; do
 		pkg=$(basename "${pkg_path}")
 		cp "${pkg_path}" "${pkg_db}/${pkg}" || die
 	done
 
 	mkdir -p "${hint_db}" || die
 	for pkg_config_file in "$@"; do
 		local pkg_name="gentoo-${CATEGORY}-${PF}-"$(basename "${pkg_config_file}")
 		cp "${pkg_config_file}" "${hint_db}/${pkg_name}" || die
 		chmod 0644 "${hint_db}/${pkg_name}" || die
 	done
 }
 
 # @FUNCTION: ghc-recache-db
 # @DESCRIPTION:
 # updates 'package.cache' binary cacne for registered '*.conf'
 # packages
 ghc-recache-db() {
 	einfo "Recaching GHC package DB"
 	$(ghc-getghcpkg) recache
 }
 
 # @FUNCTION: ghc-register-pkg
 # @DESCRIPTION:
 # registers all packages in the local (package-specific)
 # package configuration file
 ghc-register-pkg() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-reregister
 # @DESCRIPTION:
 # re-adds all available .conf files to the global
 # package conf file, to be used on a ghc reinstallation
 ghc-reregister() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-unregister-pkg
 # @DESCRIPTION:
 # unregisters a package configuration file
 ghc-unregister-pkg() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-pkgdeps
 # @DESCRIPTION:
 # exported function: loads a package dependency in a form
 # cabal_package version
 ghc-pkgdeps() {
 	echo $($(ghc-getghcpkg) describe "${1}") \
 	| sed \
 			-e '/depends/,/^.*:/ !d' \
 			-e 's/\(.*\)-\(.*\)-\(.*\)/\1 \2/' \
 			-e 's/^.*://g'
 }
 
 # @FUNCTION: ghc-package_pkg_postinst
 # @DESCRIPTION:
 # updates package.cache after package install
 ghc-package_pkg_postinst() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-package_pkg_prerm
 # @DESCRIPTION:
 # updates package.cache after package deinstall
 ghc-package_pkg_prerm() {
 	ewarn "ghc-package.eclass: 'ghc-package_pkg_prerm()' is a noop"
 	ewarn "ghc-package.eclass: consider 'haskell-cabal_pkg_postrm()' instead"
 }
 
 # @FUNCTION: ghc-package_pkg_postrm
 # @DESCRIPTION:
 # updates package.cache after package deinstall
 ghc-package_pkg_postrm() {
 	ghc-recache-db
 }
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 3/5] ghc-package.eclass: allow EAPI=8
  2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 2/5] ghc-package.eclass: " Sergei Trofimovich
@ 2021-07-05 22:25 ` Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 4/5] haskell-cabal.eclass: " Sergei Trofimovich
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-05 22:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 eclass/ghc-package.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass
index 71e84af3444..e91fb2912f6 100644
--- a/eclass/ghc-package.eclass
+++ b/eclass/ghc-package.eclass
@@ -1,346 +1,346 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
 # "Gentoo's Haskell Language team" <haskell@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @AUTHOR:
 # Original Author: Andres Loeh <kosmikus@gentoo.org>
 # @BLURB: This eclass helps with the Glasgow Haskell Compiler's package configuration utility.
 # @DESCRIPTION:
 # Helper eclass to handle ghc installation/upgrade/deinstallation process.
 
 inherit multiprocessing
 
 # Maintain version-testing compatibility with ebuilds not using EAPI 7.
 case "${EAPI:-0}" in
-	7) ;;
+	7|8) ;;
 	6) inherit eapi7-ver ;;
 	*) die "EAPI ${EAPI} unsupported." ;;
 esac
 
 # GHC uses it's own native code generator. Portage's
 # QA check generates false positive because it assumes
 # presence of GCC-specific sections.
 #
 # Workaround false positiove by disabling the check completely.
 # bug #722078, bug #677600
 QA_FLAGS_IGNORED='.*'
 
 # @FUNCTION: ghc-getghc
 # @DESCRIPTION:
 # returns the name of the ghc executable
 ghc-getghc() {
 	if ! type -P ${HC:-ghc}; then
 		ewarn "ghc not found"
 		type -P false
 	fi
 }
 
 # @FUNCTION: ghc-getghcpkg
 # @INTERNAL
 # @DESCRIPTION:
 # Internal function determines returns the name of the ghc-pkg executable
 ghc-getghcpkg() {
 	if ! type -P ${HC_PKG:-ghc-pkg}; then
 		ewarn "ghc-pkg not found"
 		type -P false
 	fi
 }
 
 # @FUNCTION: ghc-getghcpkgbin
 # @DESCRIPTION:
 # returns the name of the ghc-pkg binary (ghc-pkg
 # itself usually is a shell script, and we have to
 # bypass the script under certain circumstances);
 # for Cabal, we add an empty global package config file,
 # because for some reason the global package file
 # must be specified
 ghc-getghcpkgbin() {
 	local empty_db="${T}/empty.conf.d" ghc_pkg="$(ghc-libdir)/bin/ghc-pkg"
 	if [[ ! -d ${empty_db} ]]; then
 		"${ghc_pkg}" init "${empty_db}" || die "Failed to initialize empty global db"
 	fi
 	echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${empty_db}"
 }
 
 # @FUNCTION: ghc-version
 # @DESCRIPTION:
 # returns upstream version of ghc
 # as reported by '--numeric-version'
 # Examples: "7.10.2", "7.9.20141222"
 _GHC_VERSION_CACHE=""
 ghc-version() {
 	if [[ -z "${_GHC_VERSION_CACHE}" ]]; then
 		_GHC_VERSION_CACHE="$($(ghc-getghc) --numeric-version)"
 	fi
 	echo "${_GHC_VERSION_CACHE}"
 }
 
 # @FUNCTION: ghc-pm-version
 # @DESCRIPTION:
 # returns package manager(PM) version of ghc
 # as reported by '$(best_version)'
 # Examples: "PM:7.10.2", "PM:7.10.2_rc1", "PM:7.8.4-r4"
 _GHC_PM_VERSION_CACHE=""
 ghc-pm-version() {
 	local pm_ghc_p
 
 	if [[ -z "${_GHC_PM_VERSION_CACHE}" ]]; then
 		pm_ghc_p=$(best_version dev-lang/ghc)
 		_GHC_PM_VERSION_CACHE="PM:${pm_ghc_p#dev-lang/ghc-}"
 	fi
 	echo "${_GHC_PM_VERSION_CACHE}"
 }
 
 # @FUNCTION: ghc-cabal-version
 # @DESCRIPTION:
 # return version of the Cabal library bundled with ghc
 ghc-cabal-version() {
 	# outputs in format: 'version: 1.18.1.5'
 	set -- `$(ghc-getghcpkg) --package-db=$(ghc-libdir)/package.conf.d.initial field Cabal version`
 	echo "$2"
 }
 
 # @FUNCTION: ghc-is-dynamic
 # @DESCRIPTION:
 # checks if ghc is built against dynamic libraries
 # binaries linked against GHC library (and using plugin loading)
 # have to be linked the same way:
 #    https://ghc.haskell.org/trac/ghc/ticket/10301
 ghc-is-dynamic() {
 	$(ghc-getghc) --info | grep "GHC Dynamic" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-supports-shared-libraries
 # @DESCRIPTION:
 # checks if ghc is built with support for building
 # shared libraries (aka '-dynamic' option)
 ghc-supports-shared-libraries() {
 	$(ghc-getghc) --info | grep "RTS ways" | grep -q "dyn"
 }
 
 # @FUNCTION: ghc-supports-threaded-runtime
 # @DESCRIPTION:
 # checks if ghc is built with support for threaded
 # runtime (aka '-threaded' option)
 ghc-supports-threaded-runtime() {
 	$(ghc-getghc) --info | grep "RTS ways" | grep -q "thr"
 }
 
 # @FUNCTION: ghc-supports-smp
 # @DESCRIPTION:
 # checks if ghc is built with support for multiple cores runtime
 ghc-supports-smp() {
 	$(ghc-getghc) --info | grep "Support SMP" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-supports-interpreter
 # @DESCRIPTION:
 # checks if ghc has interpreter mode (aka GHCi)
 # It usually means that ghc supports for template haskell.
 ghc-supports-interpreter() {
 	$(ghc-getghc) --info | grep "Have interpreter" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-supports-parallel-make
 # @DESCRIPTION:
 # checks if ghc has support for '--make -j' mode
 # The option was introduced in ghc-7.8-rc1.
 ghc-supports-parallel-make() {
 	$(ghc-getghc) --info | grep "Support parallel --make" | grep -q "YES"
 }
 
 # @FUNCTION: ghc-extractportageversion
 # @DESCRIPTION:
 # extract the version of a portage-installed package
 ghc-extractportageversion() {
 	local pkg
 	local version
 	pkg="$(best_version $1)"
 	version="${pkg#$1-}"
 	version="${version%-r*}"
 	version="${version%_pre*}"
 	echo "${version}"
 }
 
 # @FUNCTION: ghc-libdir
 # @DESCRIPTION:
 # returns the library directory
 _GHC_LIBDIR_CACHE=""
 ghc-libdir() {
 	if [[ -z "${_GHC_LIBDIR_CACHE}" ]]; then
 		_GHC_LIBDIR_CACHE="$($(ghc-getghc) --print-libdir)"
 	fi
 	echo "${_GHC_LIBDIR_CACHE}"
 }
 
 # @FUNCTION: ghc-make-args
 # @DESCRIPTION:
 # Returns default arguments passed along 'ghc --make'
 # build mode. Used mainly to enable parallel build mode.
 ghc-make-args() {
 	local ghc_make_args=()
 	# parallel on all available cores
 	if ghc-supports-smp && ghc-supports-parallel-make; then
 		# It should have been just -j$(makeopts_jobs)
 		# but GHC does not yet have nice defaults:
 		#    https://ghc.haskell.org/trac/ghc/ticket/9221#comment:57
 		# SMP is a requirement for parallel GC's gen0
 		# 'qb' balancing.
 		echo "-j$(makeopts_jobs) +RTS -A256M -qb0 -RTS"
 		ghc_make_args=()
 	fi
 	echo "${ghc_make_args[@]}"
 }
 
 # @FUNCTION: ghc-confdir
 # @DESCRIPTION:
 # returns the (Gentoo) library configuration directory, we
 # store here a hint for 'haskell-updater' about packages
 # installed for old ghc versions and current ones.
 ghc-confdir() {
 	echo "$(ghc-libdir)/gentoo"
 }
 
 # @FUNCTION: ghc-package-db
 # @DESCRIPTION:
 # returns the global package database directory
 ghc-package-db() {
 	echo "$(ghc-libdir)/package.conf.d"
 }
 
 # @FUNCTION: ghc-localpkgconfd
 # @DESCRIPTION:
 # returns the name of the local (package-specific)
 # package configuration file
 ghc-localpkgconfd() {
 	echo "${PF}.conf.d"
 }
 
 # @FUNCTION: ghc-package-exists
 # @DESCRIPTION:
 # tests if a ghc package exists
 ghc-package-exists() {
 	$(ghc-getghcpkg) describe "$1" > /dev/null 2>&1
 }
 
 # @FUNCTION: check-for-collisions
 # @DESCRIPTION:
 # makes sure no packages
 # have the same version as initial package setup
 check-for-collisions() {
 	local localpkgconf=$1
 	local checked_pkg
 	local initial_pkg_db="$(ghc-libdir)/package.conf.d.initial"
 
 	for checked_pkg in `$(ghc-getghcpkgbin) -f "${localpkgconf}" list --simple-output`
 	do
 		# should return empty output
 		local collided=`$(ghc-getghcpkgbin) -f ${initial_pkg_db} list --simple-output "${checked_pkg}"`
 
 		if [[ -n ${collided} ]]; then
 			eerror "Cabal package '${checked_pkg}' is shipped with '$(ghc-pm-version)' ('$(ghc-version)')."
 			eerror "Ebuild author forgot an entry in CABAL_CORE_LIB_GHC_PV='${CABAL_CORE_LIB_GHC_PV}'."
 			eerror "Found in ${initial_pkg_db}."
 			die
 		fi
 	done
 }
 
 # @FUNCTION: ghc-install-pkg
 # @DESCRIPTION:
 # moves the local (package-specific) package configuration
 # file to its final destination
 ghc-install-pkg() {
 	local localpkgconf="${T}/$(ghc-localpkgconfd)"
 	local pkg_path pkg pkg_db="${D}/$(ghc-package-db)" hint_db="${D}/$(ghc-confdir)"
 
 	$(ghc-getghcpkgbin) init "${localpkgconf}" || die "Failed to initialize empty local db"
 	for pkg_config_file in "$@"; do
 		$(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \
 				< "${pkg_config_file}" || die "failed to register ${pkg}"
 	done
 
 	check-for-collisions "${localpkgconf}"
 
 	mkdir -p "${pkg_db}" || die
 	for pkg_path in "${localpkgconf}"/*.conf; do
 		pkg=$(basename "${pkg_path}")
 		cp "${pkg_path}" "${pkg_db}/${pkg}" || die
 	done
 
 	mkdir -p "${hint_db}" || die
 	for pkg_config_file in "$@"; do
 		local pkg_name="gentoo-${CATEGORY}-${PF}-"$(basename "${pkg_config_file}")
 		cp "${pkg_config_file}" "${hint_db}/${pkg_name}" || die
 		chmod 0644 "${hint_db}/${pkg_name}" || die
 	done
 }
 
 # @FUNCTION: ghc-recache-db
 # @DESCRIPTION:
 # updates 'package.cache' binary cacne for registered '*.conf'
 # packages
 ghc-recache-db() {
 	einfo "Recaching GHC package DB"
 	$(ghc-getghcpkg) recache
 }
 
 # @FUNCTION: ghc-register-pkg
 # @DESCRIPTION:
 # registers all packages in the local (package-specific)
 # package configuration file
 ghc-register-pkg() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-reregister
 # @DESCRIPTION:
 # re-adds all available .conf files to the global
 # package conf file, to be used on a ghc reinstallation
 ghc-reregister() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-unregister-pkg
 # @DESCRIPTION:
 # unregisters a package configuration file
 ghc-unregister-pkg() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-pkgdeps
 # @DESCRIPTION:
 # exported function: loads a package dependency in a form
 # cabal_package version
 ghc-pkgdeps() {
 	echo $($(ghc-getghcpkg) describe "${1}") \
 	| sed \
 			-e '/depends/,/^.*:/ !d' \
 			-e 's/\(.*\)-\(.*\)-\(.*\)/\1 \2/' \
 			-e 's/^.*://g'
 }
 
 # @FUNCTION: ghc-package_pkg_postinst
 # @DESCRIPTION:
 # updates package.cache after package install
 ghc-package_pkg_postinst() {
 	ghc-recache-db
 }
 
 # @FUNCTION: ghc-package_pkg_prerm
 # @DESCRIPTION:
 # updates package.cache after package deinstall
 ghc-package_pkg_prerm() {
 	ewarn "ghc-package.eclass: 'ghc-package_pkg_prerm()' is a noop"
 	ewarn "ghc-package.eclass: consider 'haskell-cabal_pkg_postrm()' instead"
 }
 
 # @FUNCTION: ghc-package_pkg_postrm
 # @DESCRIPTION:
 # updates package.cache after package deinstall
 ghc-package_pkg_postrm() {
 	ghc-recache-db
 }
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 4/5] haskell-cabal.eclass: allow EAPI=8
  2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
                   ` (2 preceding siblings ...)
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 3/5] ghc-package.eclass: allow EAPI=8 Sergei Trofimovich
@ 2021-07-05 22:25 ` Sergei Trofimovich
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 5/5] dev-haskell/c2hs: bump up to 0.28.8, EAPI=8 example Sergei Trofimovich
  2021-07-10 11:12 ` [gentoo-dev] Re: [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
  5 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-05 22:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 eclass/haskell-cabal.eclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index f7a6d35e610..a858ddea3ec 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -1,757 +1,759 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
 # Haskell herd <haskell@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @AUTHOR:
 # Original author: Andres Loeh <kosmikus@gentoo.org>
 # Original author: Duncan Coutts <dcoutts@gentoo.org>
 # @BLURB: for packages that make use of the Haskell Common Architecture for Building Applications and Libraries (cabal)
 # @DESCRIPTION:
 # Basic instructions:
 #
 # Before inheriting the eclass, set CABAL_FEATURES to
 # reflect the tools and features that the package makes
 # use of.
 #
 # Currently supported features:
 #   haddock    --  for documentation generation
 #   hscolour   --  generation of colourised sources
 #   hoogle     --  generation of documentation search index
 #   profile    --  if package supports to build profiling-enabled libraries
 #   bootstrap  --  only used for the cabal package itself
 #   lib        --  the package installs libraries
 #   nocabaldep --  don't add dependency on cabal.
 #                  only used for packages that _must_ not pull the dependency
 #                  on cabal, but still use this eclass (e.g. haskell-updater).
 #   ghcdeps    --  constraint dependency on package to ghc onces
 #                  only used for packages that use libghc internally and _must_
 #                  not pull upper versions
 #   test-suite --  add support for cabal test-suites (introduced in Cabal-1.8)
 #   rebuild-after-doc-workaround -- enable doctest test failue workaround.
 #                  Symptom: when `./setup haddock` is run in a `build-type: Custom`
 #                  package it might cause cause the test-suite to fail with
 #                  errors like:
 #                  > <command line>: cannot satisfy -package-id singletons-2.7-3Z7pnljD8tU1NrslJodXmr
 #                  Workaround re-reginsters the package to avoid the failure
 #                  (and rebuilds changes).
 #                  FEATURE can be removed once https://github.com/haskell/cabal/issues/7213
 #                  is fixed.
 
-inherit eutils ghc-package multilib toolchain-funcs
+case "${EAPI:-0}" in
+	# eutils is for eqawarn
+	6|7) inherit eutils ;;
+	8) ;;
+	*) die "EAPI ${EAPI} unsupported." ;;
+esac
+
+inherit ghc-package multilib toolchain-funcs
+
+EXPORT_FUNCTIONS pkg_setup src_configure src_compile src_test src_install pkg_postinst pkg_postrm
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup configure'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_CONFIGURE_FLAGS="--enable-shared --enable-executable-dynamic"
 : ${CABAL_EXTRA_CONFIGURE_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_BUILD_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup build'.
 # example: /etc/portage/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v
 : ${CABAL_EXTRA_BUILD_FLAGS:=}
 
 # @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters for ghc when building
 # _only_ 'setup' binary bootstrap.
 # example: /etc/portage/make.conf: GHC_BOOTSTRAP_FLAGS=-dynamic to make
 # linking 'setup' faster.
 : ${GHC_BOOTSTRAP_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_HADDOCK_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup haddock'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_HADDOCK_FLAGS="--haddock-options=--latex --haddock-options=--pretty-html"
 : ${CABAL_EXTRA_HADDOCK_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_HOOGLE_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup haddock --hoogle'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_HOOGLE_FLAGS="--haddock-options=--show-all"
 : ${CABAL_EXTRA_HOOGLE_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_HSCOLOUR_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup hscolour'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_HSCOLOUR_FLAGS="--executables --tests"
 : ${CABAL_EXTRA_HSCOLOUR_FLAGS:=}
 
 
 # @ECLASS-VARIABLE: CABAL_EXTRA_TEST_FLAGS
 # @USER_VARIABLE
 # @DESCRIPTION:
 # User-specified additional parameters passed to 'setup test'.
 # example: /etc/portage/make.conf:
 #    CABAL_EXTRA_TEST_FLAGS="-v3 --show-details=streaming"
 : ${CABAL_EXTRA_TEST_FLAGS:=}
 
 # @ECLASS-VARIABLE: CABAL_DEBUG_LOOSENING
 # @DESCRIPTION:
 # Show debug output for 'cabal_chdeps' function if set.
 # Needs working 'diff'.
 : ${CABAL_DEBUG_LOOSENING:=}
 
 # @ECLASS-VARIABLE: CABAL_REPORT_OTHER_BROKEN_PACKAGES
 # @DESCRIPTION:
 # Show other broken packages if 'cabal configure' fails.
 # It should be normally enabled unless you know you are about
 # to try to compile a lot of broken packages. Default value: 'yes'
 # Set to anything else to disable.
 : ${CABAL_REPORT_OTHER_BROKEN_PACKAGES:=yes}
 
 # 'dev-haskell/cabal' passes those options with ./configure-based
 # configuration, but most packages don't need/don't accept it:
 # #515362, #515362
 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-hc --with-hc-pkg --with-gcc"
 
-case "${EAPI:-0}" in
-	6|7) ;;
-	*) die "EAPI ${EAPI} unsupported." ;;
-esac
-
-EXPORT_FUNCTIONS pkg_setup src_configure src_compile src_test src_install pkg_postinst pkg_postrm
-
 for feature in ${CABAL_FEATURES}; do
 	case ${feature} in
 		haddock)    CABAL_USE_HADDOCK=yes;;
 		hscolour)   CABAL_USE_HSCOLOUR=yes;;
 		hoogle)     CABAL_USE_HOOGLE=yes;;
 		profile)    CABAL_USE_PROFILE=yes;;
 		bootstrap)  CABAL_BOOTSTRAP=yes;;
 		lib)        CABAL_HAS_LIBRARIES=yes;;
 		nocabaldep) CABAL_FROM_GHC=yes;;
 		ghcdeps)    CABAL_GHC_CONSTRAINT=yes;;
 		test-suite) CABAL_TEST_SUITE=yes;;
 		rebuild-after-doc-workaround) CABAL_REBUILD_AFTER_DOC_WORKAROUND=yes;;
 
 		*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
 	esac
 done
 
 if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
 	IUSE="${IUSE} doc"
 fi
 
 if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then
 	IUSE="${IUSE} hscolour"
 	DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
 fi
 
 if [[ -n "${CABAL_USE_HOOGLE}" ]]; then
 	# enabled only in ::haskell
 	#IUSE="${IUSE} hoogle"
 	CABAL_USE_HOOGLE=
 fi
 
 if [[ -n "${CABAL_USE_PROFILE}" ]]; then
 	IUSE="${IUSE} profile"
 fi
 
 if [[ -n "${CABAL_TEST_SUITE}" ]]; then
 	IUSE="${IUSE} test"
 	RESTRICT+=" !test? ( test )"
 fi
 
 # returns the version of cabal currently in use.
 # Rarely it's handy to pin cabal version from outside.
 : ${_CABAL_VERSION_CACHE:=""}
 cabal-version() {
 	if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then
 		if [[ "${CABAL_BOOTSTRAP}" ]]; then
 			# We're bootstrapping cabal, so the cabal version is the version
 			# of this package itself.
 			_CABAL_VERSION_CACHE="${PV}"
 		elif [[ "${CABAL_FROM_GHC}" ]]; then
 			_CABAL_VERSION_CACHE="$(ghc-cabal-version)"
 		else
 			# We ask portage, not ghc, so that we only pick up
 			# portage-installed cabal versions.
 			_CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
 		fi
 	fi
 	echo "${_CABAL_VERSION_CACHE}"
 }
 
 cabal-bootstrap() {
 	local setupmodule
 	local cabalpackage
 	local setup_bootstrap_args=()
 
 	if [[ -f "${S}/Setup.lhs" ]]; then
 		setupmodule="${S}/Setup.lhs"
 	elif [[ -f "${S}/Setup.hs" ]]; then
 		setupmodule="${S}/Setup.hs"
 	else
 		eqawarn "No Setup.lhs or Setup.hs found. Either add Setup.hs to package or call cabal-mksetup from ebuild"
 		cabal-mksetup
 		setupmodule="${S}/Setup.hs"
 	fi
 
 	# We build the setup program using the latest version of
 	# cabal that we have installed
 	cabalpackage=Cabal-$(cabal-version)
 	einfo "Using cabal-$(cabal-version)."
 
 	if $(ghc-supports-threaded-runtime); then
 		# Cabal has a bug that deadlocks non-threaded RTS:
 		#     https://bugs.gentoo.org/537500
 		#     https://github.com/haskell/cabal/issues/2398
 		setup_bootstrap_args+=(-threaded)
 	fi
 
 	make_setup() {
 		set -- -package "${cabalpackage}" --make "${setupmodule}" \
 			$(ghc-make-args) \
 			"${setup_bootstrap_args[@]}" \
 			${HCFLAGS} \
 			${GHC_BOOTSTRAP_FLAGS} \
 			"$@" \
 			-o setup
 		echo $(ghc-getghc) "$@"
 		$(ghc-getghc) "$@"
 	}
 	if $(ghc-supports-shared-libraries); then
 		# # some custom build systems might use external libraries,
 		# # for which we don't have shared libs, so keep static fallback
 		# bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3
 		# http://hackage.haskell.org/trac/ghc/ticket/7062
 		# http://hackage.haskell.org/trac/ghc/ticket/3072
 		# ghc does not set RPATH for extralibs, thus we do it ourselves by hands
 		einfo "Prepending $(ghc-libdir) to LD_LIBRARY_PATH"
 		if [[ ${CHOST} != *-darwin* ]]; then
 			LD_LIBRARY_PATH="$(ghc-libdir)${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
 			export LD_LIBRARY_PATH
 		else
 			DYLD_LIBRARY_PATH="$(ghc-libdir)${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
 			export DYLD_LIBRARY_PATH
 		fi
 		{ make_setup -dynamic "$@" && ./setup --help >/dev/null; } ||
 		make_setup "$@" || die "compiling ${setupmodule} failed"
 	else
 		make_setup "$@" || die "compiling ${setupmodule} failed"
 	fi
 }
 
 cabal-mksetup() {
 	local setupdir=${1:-${S}}
 	local setup_src=${setupdir}/Setup.hs
 
 	rm -vf "${setupdir}"/Setup.{lhs,hs}
 	elog "Creating 'Setup.hs' for 'Simple' build type."
 
 	echo 'import Distribution.Simple; main = defaultMain' \
 		> "${setup_src}" || die "failed to create default Setup.hs"
 }
 
 haskell-cabal-run_verbose() {
 	echo "$@"
 	"$@" || die "failed: $@"
 }
 
 cabal-hscolour() {
 	haskell-cabal-run_verbose ./setup hscolour "$@"
 }
 
 cabal-haddock() {
 	haskell-cabal-run_verbose ./setup haddock "$@"
 }
 
 cabal-die-if-nonempty() {
 	local breakage_type=$1
 	shift
 
 	[[ "${#@}" == 0 ]] && return 0
 	eerror "Detected ${breakage_type} packages: ${@}"
 	die "//==-- Please, run 'haskell-updater' to fix ${breakage_type} packages --==//"
 }
 
 cabal-show-brokens() {
 	[[ ${CABAL_REPORT_OTHER_BROKEN_PACKAGES} != yes ]] && return 0
 
 	elog "ghc-pkg check: 'checking for other broken packages:'"
 	# pretty-printer
 	$(ghc-getghcpkg) check 2>&1 \
 		| egrep -v '^Warning: haddock-(html|interfaces): ' \
 		| egrep -v '^Warning: include-dirs: ' \
 		| head -n 20
 
 	cabal-die-if-nonempty 'broken' \
 		$($(ghc-getghcpkg) check --simple-output)
 }
 
 cabal-show-old() {
 	[[ ${CABAL_REPORT_OTHER_BROKEN_PACKAGES} != yes ]] && return 0
 
 	cabal-die-if-nonempty 'outdated' \
 		$("${EPREFIX}"/usr/sbin/haskell-updater --quiet --upgrade --list-only)
 }
 
 cabal-show-brokens-and-die() {
 	cabal-show-brokens
 	cabal-show-old
 
 	die "$@"
 }
 
 cabal-configure() {
 	local cabalconf=()
 
 	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
 		# We use the bundled with GHC version if exists
 		# Haddock is very picky about index files
 		# it generates for ghc's base and other packages.
 		local p=${EPREFIX}/usr/bin/haddock-ghc-$(ghc-version)
 		if [[ -f $p ]]; then
 			cabalconf+=(--with-haddock="${p}")
 		else
 			cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock)
 		fi
 	fi
 	if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
 		cabalconf+=(--enable-library-profiling)
 	fi
 
 	if [[ -n "${CABAL_TEST_SUITE}" ]]; then
 		cabalconf+=($(use_enable test tests))
 	fi
 
 	if [[ -n "${CABAL_GHC_CONSTRAINT}" ]]; then
 		cabalconf+=($(cabal-constraint "ghc"))
 	fi
 
 	cabalconf+=(--ghc-options="$(ghc-make-args)")
 
 	local option
 	for option in ${HCFLAGS}
 	do
 		cabalconf+=(--ghc-option="$option")
 	done
 
 	# toolchain
 	cabalconf+=(--with-ar="$(tc-getAR)")
 
 	# Building GHCi libs on ppc64 causes "TOC overflow".
 	if use ppc64; then
 		cabalconf+=(--disable-library-for-ghci)
 	fi
 
 	# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
 	# so translate LDFLAGS to ghc parameters (with mild filtering).
 	local flag
 	for flag in   $CFLAGS; do
 		case "${flag}" in
 			-flto|-flto=*)
 				# binutils does not support partial linking yet:
 				# https://github.com/gentoo-haskell/gentoo-haskell/issues/1110
 				# https://sourceware.org/PR12291
 				einfo "Filter '${flag}' out of CFLAGS (avoid lto partial linking)"
 				continue
 				;;
 		esac
 
 		cabalconf+=(--ghc-option="-optc$flag")
 	done
 	for flag in  $LDFLAGS; do
 		case "${flag}" in
 			-flto|-flto=*)
 				# binutils does not support partial linking yet:
 				# https://github.com/gentoo-haskell/gentoo-haskell/issues/1110
 				# https://sourceware.org/PR12291
 				einfo "Filter '${flag}' out of LDFLAGS (avoid lto partial linking)"
 				continue
 				;;
 		esac
 
 		cabalconf+=(--ghc-option="-optl$flag")
 	done
 
 	# disable executable stripping for the executables, as portage will
 	# strip by itself, and pre-stripping gives a QA warning.
 	# cabal versions previous to 1.4 does not strip executables, and does
 	# not accept the flag.
 	# this fixes numerous bugs, amongst them;
 	# bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
 	cabalconf+=(--disable-executable-stripping)
 
 	cabalconf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF})
 	# As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
 	# it's better if the configure chatter is in the build logs:
 	cabalconf+=(--verbose)
 
 	# We build shared version of our Cabal where ghc ships it's shared
 	# version of it. We will link ./setup as dynamic binary againt Cabal later.
 	[[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
 		$(ghc-supports-shared-libraries) && \
 			cabalconf+=(--enable-shared)
 
 	if $(ghc-supports-shared-libraries); then
 		# Experimental support for dynamically linked binaries.
 		# We are enabling it since 7.10.1_rc3
 		if ver_test "$(ghc-version)" -ge "7.10.0.20150316"; then
 			# we didn't enable it before as it was not stable on all arches
 			cabalconf+=(--enable-shared)
 			# Known to break on ghc-7.8/Cabal-1.18
 			# https://ghc.haskell.org/trac/ghc/ticket/9625
 			cabalconf+=(--enable-executable-dynamic)
 		fi
 	fi
 
 	# --sysconfdir appeared in Cabal-1.18+
 	if ./setup configure --help | grep -q -- --sysconfdir; then
 		cabalconf+=(--sysconfdir="${EPREFIX}"/etc)
 	fi
 
 	# appeared in Cabal-1.18+ (see '--disable-executable-stripping')
 	if ./setup configure --help | grep -q -- --disable-library-stripping; then
 		cabalconf+=(--disable-library-stripping)
 	fi
 
 	set -- configure \
 		--ghc --prefix="${EPREFIX}"/usr \
 		--with-compiler="$(ghc-getghc)" \
 		--with-hc-pkg="$(ghc-getghcpkg)" \
 		--prefix="${EPREFIX}"/usr \
 		--libdir="${EPREFIX}"/usr/$(get_libdir) \
 		--libsubdir=${P}/ghc-$(ghc-version) \
 		--datadir="${EPREFIX}"/usr/share/ \
 		--datasubdir=${P}/ghc-$(ghc-version) \
 		"${cabalconf[@]}" \
 		${CABAL_CONFIGURE_FLAGS} \
 		"$@" \
 		${CABAL_EXTRA_CONFIGURE_FLAGS}
 	echo ./setup "$@"
 	./setup "$@" || cabal-show-brokens-and-die "setup configure failed"
 }
 
 cabal-build() {
 	set --  build "$@" ${CABAL_EXTRA_BUILD_FLAGS}
 	echo ./setup "$@"
 	./setup "$@" \
 		|| die "setup build failed"
 }
 
 cabal-copy() {
 	set -- copy --destdir="${D}" "$@"
 	echo ./setup "$@"
 	./setup "$@" || die "setup copy failed"
 
 	# cabal is a bit eager about creating dirs,
 	# so remove them if they are empty
 	rmdir "${ED}/usr/bin" 2> /dev/null
 }
 
 cabal-pkg() {
 	# This does not actually register since we're using true instead
 	# of ghc-pkg. So it just leaves the .conf file and we can
 	# register that ourselves (if it exists).
 
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
 		# Newer cabal can generate a package conf for us:
 		./setup register --gen-pkg-config="${T}/${P}.conf"
 		if [[ -d "${T}/${P}.conf" ]]; then
 			ghc-install-pkg "${T}/${P}.conf"/*
 		else
 			ghc-install-pkg "${T}/${P}.conf"
 		fi
 	fi
 }
 
 # Some cabal libs are bundled along with some versions of ghc
 # eg filepath-1.0 comes with ghc-6.6.1
 # by putting CABAL_CORE_LIB_GHC_PV="6.6.1" in an ebuild we are declaring that
 # when building with this version of ghc, the ebuild is a dummy that is it will
 # install no files since the package is already included with ghc.
 # However portage still records the dependency and we can upgrade the package
 # to a later one that's not included with ghc.
 # You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1".
 # Those versions are taken as-is from ghc `--numeric-version`.
 # Package manager versions are also supported:
 #     CABAL_CORE_LIB_GHC_PV="7.10.* PM:7.8.4-r1".
 cabal-is-dummy-lib() {
 	local bin_ghc_version=$(ghc-version)
 	local pm_ghc_version=$(ghc-pm-version)
 
 	for version in ${CABAL_CORE_LIB_GHC_PV}; do
 		[[ "${bin_ghc_version}" == ${version} ]] && return 0
 		[[ "${pm_ghc_version}"  == ${version} ]] && return 0
 	done
 
 	return 1
 }
 
 # exported function: check if cabal is correctly installed for
 # the currently active ghc (we cannot guarantee this with portage)
 haskell-cabal_pkg_setup() {
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
 		[[ ${RDEPEND} == *dev-lang/ghc* ]] || eqawarn "QA Notice: A library does not have runtime dependency on dev-lang/ghc."
 	fi
 	if [[ -n "${CABAL_UNKNOWN}" ]]; then
 		eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
 	fi
 	if cabal-is-dummy-lib; then
 		einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
 	fi
 }
 
 haskell-cabal_src_configure() {
 	cabal-is-dummy-lib && return
 
 	pushd "${S}" > /dev/null || die
 
 	cabal-bootstrap
 
 	cabal-configure "$@"
 
 	popd > /dev/null || die
 }
 
 # exported function: nice alias
 cabal_src_configure() {
 	haskell-cabal_src_configure "$@"
 }
 
 # exported function: cabal-style bootstrap configure and compile
 cabal_src_compile() {
 	cabal-is-dummy-lib && return
 
 	cabal-build
 
 	if [[ -n "$CABAL_USE_HADDOCK" ]] && use doc; then
 		if [[ -n "$CABAL_USE_HSCOLOUR" ]] && use hscolour; then
 			# --hyperlink-source implies calling 'setup hscolour'
 			haddock_args+=(--hyperlink-source)
 		fi
 
 		cabal-haddock "${haddock_args[@]}" $CABAL_EXTRA_HADDOCK_FLAGS
 
 		if [[ -n "$CABAL_USE_HOOGLE" ]] && use hoogle; then
 			cabal-haddock --hoogle $CABAL_EXTRA_HOOGLE_FLAGS
 		fi
 		if [[ -n "${CABAL_REBUILD_AFTER_DOC_WORKAROUND}" ]]; then
 			ewarn "rebuild-after-doc-workaround is enabled. This is a"
 			ewarn "temporary worakround to deal with https://github.com/haskell/cabal/issues/7213"
 			ewarn "until the upstream issue can be resolved."
 			cabal-build
 		fi
 	else
 		if [[ -n "$CABAL_USE_HSCOLOUR" ]] && use hscolour; then
 			cabal-hscolour $CABAL_EXTRA_HSCOLOUR_FLAGS
 		fi
 
 		if [[ -n "$CABAL_USE_HOOGLE" ]] && use hoogle; then
 			ewarn "hoogle USE flag requires doc USE flag, building without hoogle"
 		fi
 	fi
 }
 
 haskell-cabal_src_compile() {
 	pushd "${S}" > /dev/null || die
 
 	cabal_src_compile "$@"
 
 	popd > /dev/null || die
 }
 
 haskell-cabal_src_test() {
 	local cabaltest=()
 
 	pushd "${S}" > /dev/null || die
 
 	if cabal-is-dummy-lib; then
 		einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}"
 	else
 		einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
 
 		# '--show-details=streaming' appeared in Cabal-1.20
 		if ./setup test --help | grep -q -- "'streaming'"; then
 			cabaltest+=(--show-details=streaming)
 		fi
 
 		set -- test \
 			"${cabaltest[@]}" \
 			${CABAL_TEST_FLAGS} \
 			"$@" \
 			${CABAL_EXTRA_TEST_FLAGS}
 		echo ./setup "$@"
 		./setup "$@" || die "cabal test failed"
 	fi
 
 	popd > /dev/null || die
 }
 
 # exported function: cabal-style copy and register
 cabal_src_install() {
 	if ! cabal-is-dummy-lib; then
 		cabal-copy
 		cabal-pkg
 	fi
 
 	# create a dummy local package conf file for haskell-updater
 	# if it does not exist (dummy libraries and binaries w/o libraries)
 	local ghc_confdir_with_prefix="$(ghc-confdir)"
 	# remove EPREFIX
 	dodir ${ghc_confdir_with_prefix#${EPREFIX}}
 	local hint_db="${D}/$(ghc-confdir)"
 	local hint_file="${hint_db}/gentoo-empty-${CATEGORY}-${PF}.conf"
 	mkdir -p "${hint_db}" || die
 	touch "${hint_file}" || die
 }
 
 haskell-cabal_src_install() {
 	pushd "${S}" > /dev/null || die
 
 	cabal_src_install
 
 	popd > /dev/null || die
 }
 
 haskell-cabal_pkg_postinst() {
 	ghc-package_pkg_postinst
 }
 
 haskell-cabal_pkg_postrm() {
 	ghc-package_pkg_postrm
 }
 
 # @FUNCTION: cabal_flag
 # @DESCRIPTION:
 # ebuild.sh:use_enable() taken as base
 #
 # Usage examples:
 #
 #     CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
 #  leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')
 #
 #     CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
 #  also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')
 #
 cabal_flag() {
 	if [[ -z "$1" ]]; then
 		echo "!!! cabal_flag() called without a parameter." >&2
 		echo "!!! cabal_flag() <USEFLAG> [<cabal_flagname>]" >&2
 		return 1
 	fi
 
 	local UWORD=${2:-$1}
 
 	if use "$1"; then
 		echo "--flags=${UWORD}"
 	else
 		echo "--flags=-${UWORD}"
 	fi
 
 	return 0
 }
 
 # @FUNCTION: cabal_chdeps
 # @DESCRIPTION:
 # Allows easier patching of $CABAL_FILE (${S}/${PN}.cabal by default)
 # depends
 #
 # Accepts argument list as pairs of substitutions: <from-string> <to-string>...
 #
 # Dies on error.
 #
 # Usage examples:
 #
 # src_prepare() {
 #    cabal_chdeps \
 #        'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7' \
 #        'containers ==0.4.*' 'containers >= 0.4 && < 0.6'
 #}
 # or
 # src_prepare() {
 #    CABAL_FILE=${S}/${MY_PN}.cabal cabal_chdeps \
 #        'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7'
 #    CABAL_FILE=${S}/${MY_PN}-tools.cabal cabal_chdeps \
 #        'base == 3.*' 'base >= 4.2 && < 4.7'
 #}
 #
 cabal_chdeps() {
 	local cabal_fn=${MY_PN:-${PN}}.cabal
 	local cf=${CABAL_FILE:-${S}/${cabal_fn}}
 	local from_ss # ss - substring
 	local to_ss
 	local orig_c # c - contents
 	local new_c
 
 	[[ -f $cf ]] || die "cabal file '$cf' does not exist"
 
 	orig_c=$(< "$cf")
 
 	while :; do
 		from_pat=$1
 		to_str=$2
 
 		[[ -n ${from_pat} ]] || break
 		[[ -n ${to_str} ]] || die "'${from_str}' does not have 'to' part"
 
 		einfo "CHDEP: '${from_pat}' -> '${to_str}'"
 
 		# escape pattern-like symbols
 		from_pat=${from_pat//\*/\\*}
 		from_pat=${from_pat//\[/\\[}
 
 		new_c=${orig_c//${from_pat}/${to_str}}
 
 		if [[ -n $CABAL_DEBUG_LOOSENING ]]; then
 			echo "${orig_c}" >"${T}/${cf}".pre
 			echo "${new_c}" >"${T}/${cf}".post
 			diff -u "${T}/${cf}".{pre,post}
 		fi
 
 		[[ "${orig_c}" == "${new_c}" ]] && die "no trigger for '${from_pat}'"
 		orig_c=${new_c}
 		shift
 		shift
 	done
 
 	echo "${new_c}" > "$cf" ||
 		die "failed to update"
 }
 
 # @FUNCTION: cabal-constraint
 # @DESCRIPTION:
 # Allowes to set contraint to the libraries that are
 # used by specified package
 cabal-constraint() {
 	while read p v ; do
 		echo "--constraint \"$p == $v\""
 	done < $(ghc-pkgdeps ${1})
 }
 
 # @FUNCTION: replace-hcflags
 # @USAGE: <old> <new>
 # @DESCRIPTION:
 # Replace the <old> flag with <new> in HCFLAGS. Accepts shell globs for <old>.
 # The implementation is picked from flag-o-matic.eclass:replace-flags()
 replace-hcflags() {
 	[[ $# != 2 ]] && die "Usage: replace-hcflags <old flag> <new flag>"
 
 	local f new=()
 	for f in ${HCFLAGS} ; do
 		# Note this should work with globs like -O*
 		if [[ ${f} == ${1} ]]; then
 			einfo "HCFLAGS: replacing '${f}' to '${2}'"
 			f=${2}
 		fi
 		new+=( "${f}" )
 	done
 	export HCFLAGS="${new[*]}"
 
 	return 0
 }
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 5/5] dev-haskell/c2hs: bump up to 0.28.8, EAPI=8 example
  2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
                   ` (3 preceding siblings ...)
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 4/5] haskell-cabal.eclass: " Sergei Trofimovich
@ 2021-07-05 22:25 ` Sergei Trofimovich
  2021-07-10 11:12 ` [gentoo-dev] Re: [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
  5 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-05 22:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 dev-haskell/c2hs/Manifest           |  1 +
 dev-haskell/c2hs/c2hs-0.28.8.ebuild | 41 +++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 dev-haskell/c2hs/c2hs-0.28.8.ebuild

diff --git a/dev-haskell/c2hs/Manifest b/dev-haskell/c2hs/Manifest
index ea522395f4f..17502636930 100644
--- a/dev-haskell/c2hs/Manifest
+++ b/dev-haskell/c2hs/Manifest
@@ -1 +1,2 @@
 DIST c2hs-0.28.7.tar.gz 207782 BLAKE2B a9f29506e6aaec3400d844ad85b2a6b6e1b87cb3c6c641665ab6bc5465903da8c2c82c3511b451e54cf30dfac61092dd323f8a2af48b5daa6081a4e9c5f00c9d SHA512 69c877349ae4864763d20664edae07a67aa1c55f5d4fccc3fcb6d06e94eb14d6b4b0201fc2840a9ebbc45a2a21ab55ad0e79f9cd88c00003df67abf5c1fd62d6
+DIST c2hs-0.28.8.tar.gz 207816 BLAKE2B 6d912fd93c6076ccd86ed62e075f1addb7b44378c82acc0cbaf04b6b91a2ed4530cde60a9139316d928a2867474bafde5c14aedb4ab9e78e5faaa99830276a71 SHA512 ff9119acecddd853f2f797385f971c249bcd92d4b141e8e7ea5f5d3e63aa257502c80ded2720a46e3186260026b94c9e518f08f8e452a64c9f888d0183ee1749
diff --git a/dev-haskell/c2hs/c2hs-0.28.8.ebuild b/dev-haskell/c2hs/c2hs-0.28.8.ebuild
new file mode 100644
index 00000000000..38703f4aa68
--- /dev/null
+++ b/dev-haskell/c2hs/c2hs-0.28.8.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# ebuild generated by hackport 0.6.7.9999
+
+CABAL_FEATURES="test-suite"
+inherit haskell-cabal
+
+DESCRIPTION="C->Haskell FFI tool that gives some cross-language type safety"
+HOMEPAGE="https://github.com/haskell/c2hs"
+SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="regression"
+
+RESTRICT=test # needs unprefixed 'cpp'
+
+RDEPEND="dev-haskell/dlist:=
+	>=dev-haskell/language-c-0.7.1:= <dev-haskell/language-c-0.10:=
+	>=dev-lang/ghc-8.4.3:=
+	regression? ( >=dev-haskell/shelly-1.9.0:= <dev-haskell/shelly-1.10.0:=
+			dev-haskell/text:=
+			>=dev-haskell/yaml-0.8:= )
+"
+DEPEND="${RDEPEND}
+	>=dev-haskell/cabal-2.2.0.1
+	test? ( dev-haskell/hunit
+		dev-haskell/test-framework
+		dev-haskell/test-framework-hunit
+		!regression? ( >=dev-haskell/shelly-1.9.0 <dev-haskell/shelly-1.10.0
+				dev-haskell/text ) )
+"
+
+src_configure() {
+	haskell-cabal_src_configure \
+		$(cabal_flag regression regression)
+}
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support Sergei Trofimovich
@ 2021-07-06  7:34   ` Ulrich Mueller
  2021-07-10 11:09     ` Sergei Trofimovich
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Mueller @ 2021-07-06  7:34 UTC (permalink / raw
  To: Sergei Trofimovich; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

>>>>> On Tue, 06 Jul 2021, Sergei Trofimovich wrote:
 
>  case "${EAPI:-0}" in

This could be just ${EAPI} now (and quotes were never necessary).

> -	0|1) ;;
> -	2|3|4|5|6|7) HASKELL_CABAL_EXPF+=" src_configure" ;;
> +	6|7) ;;
>  	*) die "EAPI ${EAPI} unsupported." ;;


I'd suggest to update to die message to what is used in other eclasses
(see toolchain-funcs.eclass for example):

	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;

>  esac

Same comment for the other eclasses of this series.

Ulrich

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support
  2021-07-06  7:34   ` Ulrich Mueller
@ 2021-07-10 11:09     ` Sergei Trofimovich
  0 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-10 11:09 UTC (permalink / raw
  To: Ulrich Mueller; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On Tue, 06 Jul 2021 09:34:14 +0200
Ulrich Mueller <ulm@gentoo.org> wrote:

> >>>>> On Tue, 06 Jul 2021, Sergei Trofimovich wrote:  
>  
> >  case "${EAPI:-0}" in  
> 
> This could be just ${EAPI} now (and quotes were never necessary).
> 
> > -	0|1) ;;
> > -	2|3|4|5|6|7) HASKELL_CABAL_EXPF+=" src_configure" ;;
> > +	6|7) ;;
> >  	*) die "EAPI ${EAPI} unsupported." ;;  
> 
> 
> I'd suggest to update to die message to what is used in other eclasses
> (see toolchain-funcs.eclass for example):
> 
> 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
> 
> >  esac  
> 
> Same comment for the other eclasses of this series.
> 
> Ulrich

Sounds good. Done both as:

--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -40,11 +40,11 @@
 #                  FEATURE can be removed once https://github.com/haskell/cabal/issues/7213
 #                  is fixed.

-case "${EAPI:-0}" in
+case ${EAPI} in
        # eutils is for eqawarn
        6|7) inherit eutils ;;
        8) ;;
-       *) die "EAPI ${EAPI} unsupported." ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac

 inherit ghc-package multilib toolchain-funcs


-- 

  Sergei

[-- Attachment #2: Цифровая подпись OpenPGP --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-dev] Re: [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal
  2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
                   ` (4 preceding siblings ...)
  2021-07-05 22:25 ` [gentoo-dev] [PATCH 5/5] dev-haskell/c2hs: bump up to 0.28.8, EAPI=8 example Sergei Trofimovich
@ 2021-07-10 11:12 ` Sergei Trofimovich
  5 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-07-10 11:12 UTC (permalink / raw
  To: gentoo-dev

On Mon,  5 Jul 2021 23:25:50 +0100
Sergei Trofimovich <slyfox@gentoo.org> wrote:

> The changes are mostly code removal. And example ebuild.
> 
> Sergei Trofimovich (6):
>   haskell-cabal.eclass: drop EAPI={0..5} support
>   ghc-package.eclass: drop EAPI={0..5} support
>   ghc-package.eclass: allow EAPI=8
>   haskell-cabal.eclass: allow EAPI=8
>   haskell-cabal.eclass: foo
>   dev-haskell/c2hs: bump up to 0.28.8, EAPI=8 example
> 
>  dev-haskell/c2hs/Manifest           |  1 +
>  dev-haskell/c2hs/c2hs-0.28.8.ebuild | 41 +++++++++++++++++++++++++++
>  eclass/ghc-package.eclass           |  6 ++--
>  eclass/haskell-cabal.eclass         | 43 ++++++++---------------------
>  4 files changed, 56 insertions(+), 35 deletions(-)
>  create mode 100644 dev-haskell/c2hs/c2hs-0.28.8.ebuild

Pushed to ::gentoo as:
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=891aa19d14688a95171dc6dcf14ce08d6ab237c5
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3feb01a7824b169ba1d35b997784c731fca9ac0f
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3cef7dc7c93537384dddf71cf96f57931467644d
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa8928997d917f74894c7013708c7c177a7bfa23
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fff0ee1b6c74df5f1598f5a2874fb67cfe09250b
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba01bd910d9667dbc7a1a80873ec3a23d897ed62
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df37ce46d2a17ed3c4225bce7c506931d98af59b

-- 

  Sergei


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-10 11:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-05 22:25 [gentoo-dev] [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich
2021-07-05 22:25 ` [gentoo-dev] [PATCH 1/5] haskell-cabal.eclass: drop EAPI={0..5} support Sergei Trofimovich
2021-07-06  7:34   ` Ulrich Mueller
2021-07-10 11:09     ` Sergei Trofimovich
2021-07-05 22:25 ` [gentoo-dev] [PATCH 2/5] ghc-package.eclass: " Sergei Trofimovich
2021-07-05 22:25 ` [gentoo-dev] [PATCH 3/5] ghc-package.eclass: allow EAPI=8 Sergei Trofimovich
2021-07-05 22:25 ` [gentoo-dev] [PATCH 4/5] haskell-cabal.eclass: " Sergei Trofimovich
2021-07-05 22:25 ` [gentoo-dev] [PATCH 5/5] dev-haskell/c2hs: bump up to 0.28.8, EAPI=8 example Sergei Trofimovich
2021-07-10 11:12 ` [gentoo-dev] Re: [PATCH 0/6] haskell eclass update to EAPI=8, old EAPI={0..5} removal Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox