summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2016-09-13 22:21:29 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2016-09-13 22:26:38 +0100
commita2d669ef498c0372a1792d97a3084c82e3278e38 (patch)
tree3a7e4f11c680537a851473f69836c983a662b150 /eclass
parentlxde-base/lxappearance: Remove old versions (diff)
downloadgentoo-a2d669ef498c0372a1792d97a3084c82e3278e38.tar.gz
gentoo-a2d669ef498c0372a1792d97a3084c82e3278e38.tar.bz2
gentoo-a2d669ef498c0372a1792d97a3084c82e3278e38.zip
haskell-cabal.eclass: drop unused CABAL_FEATURES="alex happy c2hs cpphs"
While at it: - dropped internal 'ghc-sanecabal()' helper - factored out parallelism setup to new 'ghc-make-args()' function - building initial Setup binary now also uses 'ghc-make-args()' - dropped unused CABAL_MIN_VERSION global variable Fixed bug in 'ghc-make-args()' to work on NOSMP ports of GHC: We use 'qb0' to enable parallel GC. Parallel GC requires SMP support and threaded runtime. Reported by iota__ on arm/ghc-8 where there is support for parallel make but not the SMP support: ,("Host platform","arm-unknown-linux") ,("Support SMP","NO") ,("Support parallel --make","YES") ,("RTS ways","l debug thr... Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ghc-package.eclass35
-rw-r--r--eclass/haskell-cabal.eclass73
2 files changed, 27 insertions, 81 deletions
diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass
index 5466c0b5b20d..7efa2c838449 100644
--- a/eclass/ghc-package.eclass
+++ b/eclass/ghc-package.eclass
@@ -11,7 +11,7 @@
# @DESCRIPTION:
# Helper eclass to handle ghc installation/upgrade/deinstallation process.
-inherit versionator
+inherit multiprocessing versionator
# @FUNCTION: ghc-getghc
# @DESCRIPTION:
@@ -106,20 +106,6 @@ ghc-cabal-version() {
fi
}
-# @FUNCTION: ghc-sanecabal
-# @DESCRIPTION:
-# check if a standalone Cabal version is available for the
-# currently used ghc; takes minimal version of Cabal as
-# an optional argument
-ghc-sanecabal() {
- local f
- local version
- if [[ -z "$1" ]]; then version="1.0.1"; else version="$1"; fi
- for f in $(ghc-confdir)/cabal-*; do
- [[ -f "${f}" ]] && version_is_at_least "${version}" "${f#*cabal-}" && return
- done
- return 1
-}
# @FUNCTION: ghc-is-dynamic
# @DESCRIPTION:
# checks if ghc is built against dynamic libraries
@@ -193,6 +179,25 @@ ghc-libdir() {
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
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index 94ef7f35ad75..f5d5b85100eb 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -20,13 +20,8 @@
# haddock -- for documentation generation
# hscolour -- generation of colourised sources
# hoogle -- generation of documentation search index
-# alex -- lexer/scanner generator
-# happy -- parser generator
-# c2hs -- C interface generator
-# cpphs -- C preprocessor clone written in Haskell
# profile -- if package supports to build profiling-enabled libraries
# bootstrap -- only used for the cabal package itself
-# bin -- the package installs binaries
# lib -- the package installs libraries
# nocabaldep -- don't add dependency on cabal.
# only used for packages that _must_ not pull the dependency
@@ -36,7 +31,7 @@
# not pull upper versions
# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8)
-inherit eutils ghc-package multilib multiprocessing
+inherit eutils ghc-package multilib
# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
# @DESCRIPTION:
@@ -91,17 +86,16 @@ for feature in ${CABAL_FEATURES}; do
haddock) CABAL_USE_HADDOCK=yes;;
hscolour) CABAL_USE_HSCOLOUR=yes;;
hoogle) CABAL_USE_HOOGLE=yes;;
- alex) CABAL_USE_ALEX=yes;;
- happy) CABAL_USE_HAPPY=yes;;
- c2hs) CABAL_USE_C2HS=yes;;
- cpphs) CABAL_USE_CPPHS=yes;;
profile) CABAL_USE_PROFILE=yes;;
bootstrap) CABAL_BOOTSTRAP=yes;;
- bin) CABAL_HAS_BINARIES=yes;;
lib) CABAL_HAS_LIBRARIES=yes;;
nocabaldep) CABAL_FROM_GHC=yes;;
ghcdeps) CABAL_GHC_CONSTRAINT=yes;;
test-suite) CABAL_TEST_SUITE=yes;;
+
+ # does nothing, removed 2016-09-04
+ bin) ;;
+
*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
esac
done
@@ -130,22 +124,6 @@ if [[ -n "${CABAL_USE_HOOGLE}" ]]; then
CABAL_USE_HOOGLE=
fi
-if [[ -n "${CABAL_USE_ALEX}" ]]; then
- DEPEND="${DEPEND} dev-haskell/alex"
-fi
-
-if [[ -n "${CABAL_USE_HAPPY}" ]]; then
- DEPEND="${DEPEND} dev-haskell/happy"
-fi
-
-if [[ -n "${CABAL_USE_C2HS}" ]]; then
- DEPEND="${DEPEND} dev-haskell/c2hs"
-fi
-
-if [[ -n "${CABAL_USE_CPPHS}" ]]; then
- DEPEND="${DEPEND} dev-haskell/cpphs"
-fi
-
if [[ -n "${CABAL_USE_PROFILE}" ]]; then
IUSE="${IUSE} profile"
fi
@@ -154,15 +132,6 @@ if [[ -n "${CABAL_TEST_SUITE}" ]]; then
IUSE="${IUSE} test"
fi
-# We always use a standalone version of Cabal, rather than the one that comes
-# with GHC. But of course we can't depend on cabal when building cabal itself.
-if [[ -z ${CABAL_MIN_VERSION} ]]; then
- CABAL_MIN_VERSION=1.1.4
-fi
-if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then
- DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
-fi
-
# returns the version of cabal currently in use.
# Rarely it's handy to pin cabal version from outside.
: ${_CABAL_VERSION_CACHE:=""}
@@ -198,13 +167,6 @@ cabal-bootstrap() {
setupmodule="${S}/Setup.hs"
fi
- if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
- eerror "The package dev-haskell/cabal is not correctly installed for"
- eerror "the currently active version of ghc ($(ghc-version)). Please"
- eerror "run haskell-updater or re-build dev-haskell/cabal."
- die "cabal is not correctly installed"
- fi
-
# We build the setup program using the latest version of
# cabal that we have installed
cabalpackage=Cabal-$(cabal-version)
@@ -219,6 +181,7 @@ cabal-bootstrap() {
make_setup() {
set -- -package "${cabalpackage}" --make "${setupmodule}" \
+ $(ghc-make-args) \
"${setup_bootstrap_args[@]}" \
${HCFLAGS} \
${GHC_BOOTSTRAP_FLAGS} \
@@ -350,20 +313,7 @@ cabal-configure() {
if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
cabalconf+=(--enable-library-profiling)
fi
- if [[ -n "${CABAL_USE_ALEX}" ]]; then
- cabalconf+=(--with-alex=${EPREFIX}/usr/bin/alex)
- fi
- if [[ -n "${CABAL_USE_HAPPY}" ]]; then
- cabalconf+=(--with-happy=${EPREFIX}/usr/bin/happy)
- fi
-
- if [[ -n "${CABAL_USE_C2HS}" ]]; then
- cabalconf+=(--with-c2hs=${EPREFIX}/usr/bin/c2hs)
- fi
- if [[ -n "${CABAL_USE_CPPHS}" ]]; then
- cabalconf+=(--with-cpphs=${EPREFIX}/usr/bin/cpphs)
- fi
if [[ -n "${CABAL_TEST_SUITE}" ]]; then
cabalconf+=($(use_enable test tests))
fi
@@ -372,13 +322,7 @@ cabal-configure() {
cabalconf+=($(cabal-constraint "ghc"))
fi
- # parallel on all available cores
- if 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
- cabalconf+=(--ghc-options="-j$(makeopts_jobs) +RTS -A256M -qb0 -RTS")
- fi
+ cabalconf+=(--ghc-options="$(ghc-make-args)")
local option
for option in ${HCFLAGS}
@@ -515,9 +459,6 @@ 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 [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
- eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES."
- fi
if [[ -n "${CABAL_UNKNOWN}" ]]; then
eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
fi