summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-11-20 18:45:28 +0000
committerV3n3RiX <venerix@redcorelinux.org>2017-11-20 18:45:28 +0000
commit796cae72cf9ed18ba01256ac1f83a686a2a76036 (patch)
tree5ca737a2562d8c0a09fcfacd81d1f9004df37b00 /eclass
parent20d8e9cfb95a9f054d654ab6405e848807186aa0 (diff)
gentoo resync : 20.11.2017
Diffstat (limited to 'eclass')
-rw-r--r--eclass/out-of-source.eclass124
-rw-r--r--eclass/ruby-fakegem.eclass40
2 files changed, 139 insertions, 25 deletions
diff --git a/eclass/out-of-source.eclass b/eclass/out-of-source.eclass
new file mode 100644
index 000000000000..4d9c8d05fd64
--- /dev/null
+++ b/eclass/out-of-source.eclass
@@ -0,0 +1,124 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: out-of-source.eclass
+# @MAINTAINER:
+# Michał Górny <mgorny@gentoo.org>
+# @BLURB: convenient wrapper to build autotools packages out-of-source
+# @DESCRIPTION:
+# This eclass provides a minimalistic wrapper interface to easily
+# build autotools (and alike) packages out-of-source. It is meant
+# to resemble the interface used by multilib-minimal without actually
+# requiring the package to be multilib.
+#
+# For the simplest ebuilds, it is enough to inherit the eclass
+# and the new phase functions will automatically build the package
+# out-of-source. If you need to redefine one of the default phases
+# src_configure() through src_install(), you need to define
+# the matching sub-phases: my_src_configure(), my_src_compile(),
+# my_src_test() and/or my_src_install(). Those sub-phase functions
+# will be run inside the build directory. Additionally,
+# my_src_install_all() is provided to perform doc-install and other
+# common tasks that are done in source directory.
+#
+# Example use:
+# @CODE
+# inherit out-of-source
+#
+# my_src_configure() {
+# econf \
+# --disable-static
+# }
+# @CODE
+
+case ${EAPI} in
+ 6);;
+ *) die "EAPI ${EAPI:-0} unsupported (too old)";;
+esac
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+
+if [[ ! ${_OUT_OF_SOURCE_ECLASS} ]]; then
+
+# @FUNCTION: out-of-source_src_configure
+# @DESCRIPTION:
+# The default src_configure() implementation establishes a BUILD_DIR,
+# sets ECONF_SOURCE to the current directory (usually S), and runs
+# my_src_configure() (or the default) inside it.
+out-of-source_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # set some BUILD_DIR if we don't have one yet
+ : "${BUILD_DIR:=${WORKDIR}/${P}_build}"
+ local ECONF_SOURCE=${PWD}
+
+ mkdir -p "${BUILD_DIR}" || die
+ pushd "${BUILD_DIR}" >/dev/null || die
+ if declare -f my_src_configure >/dev/null ; then
+ my_src_configure
+ else
+ default_src_configure
+ fi
+ popd >/dev/null || die
+}
+
+# @FUNCTION: out-of-source_src_compile
+# @DESCRIPTION:
+# The default src_compile() implementation runs my_src_compile()
+# (or the default) inside the build directory.
+out-of-source_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ pushd "${BUILD_DIR}" >/dev/null || die
+ if declare -f my_src_compile >/dev/null ; then
+ my_src_compile
+ else
+ default_src_compile
+ fi
+ popd >/dev/null || die
+}
+
+# @FUNCTION: out-of-source_src_test
+# @DESCRIPTION:
+# The default src_test() implementation runs my_src_test()
+# (or the default) inside the build directory.
+out-of-source_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ pushd "${BUILD_DIR}" >/dev/null || die
+ if declare -f my_src_test >/dev/null ; then
+ my_src_test
+ else
+ default_src_test
+ fi
+ popd >/dev/null || die
+}
+
+# @FUNCTION: out-of-source_src_install
+# @DESCRIPTION:
+# The default src_install() implementation runs my_src_install()
+# (or the 'make install' part of the default) inside the build directory,
+# followed by a call to my_src_install_all() (or 'einstalldocs' part
+# of the default) in the original working directory.
+out-of-source_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ pushd "${BUILD_DIR}" >/dev/null || die
+ if declare -f my_src_install >/dev/null ; then
+ my_src_install
+ else
+ if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
+ emake DESTDIR="${D}" install
+ fi
+ fi
+ popd >/dev/null || die
+
+ if declare -f my_src_install_all >/dev/null ; then
+ my_src_install_all
+ else
+ einstalldocs
+ fi
+}
+
+_OUT_OF_SOURCE_ECLASS=1
+fi
diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index 2bdba3630ad2..57ff678cdf07 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -18,18 +18,18 @@ inherit ruby-ng
# @DESCRIPTION:
# Sets the Gem name for the generated fake gemspec.
# This variable MUST be set before inheriting the eclass.
-# RUBY_FAKEGEM_NAME="${PN}"
+RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_VERSION
# @DESCRIPTION:
# Sets the Gem version for the generated fake gemspec.
# This variable MUST be set before inheriting the eclass.
-# RUBY_FAKEGEM_VERSION="${PV}"
+RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_DOC
# @DESCRIPTION:
# Specify the rake(1) task to run to generate documentation.
-# RUBY_FAKEGEM_TASK_DOC="rdoc"
+RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_RECIPE_TEST
# @DESCRIPTION:
@@ -40,13 +40,13 @@ inherit ruby-ng
# - cucumber (calls ruby-ng_cucumber, adds dev-util/cucumber to the
# dependencies; does not work on JRuby).
# - none
-# RUBY_FAKEGEM_RECIPE_TEST="rake"
+RUBY_FAKEGEM_RECIPE_TEST="${RUBY_FAKEGEM_RECIPE_TEST-rake}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_TEST
# @DESCRIPTION:
# Specify the rake(1) task used for executing tests. Only valid
# if RUBY_FAKEGEM_RECIPE_TEST is set to "rake" (the default).
-# RUBY_FAKEGEM_TASK_TEST="test"
+RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_RECIPE_DOC
# @DESCRIPTION:
@@ -55,68 +55,58 @@ inherit ruby-ng
# - rdoc (calls `rdoc-2`, adds dev-ruby/rdoc to the dependencies);
# - yard (calls `yard`, adds dev-ruby/yard to the dependencies);
# - none
-# RUBY_FAKEGEM_RECIPE_DOC="rake"
+RUBY_FAKEGEM_RECIPE_DOC="${RUBY_FAKEGEM_RECIPE_DOC-rake}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_DOCDIR
+# @DEFAULT_UNSET
# @DESCRIPTION:
# Specify the directory under which the documentation is built;
# if empty no documentation will be installed automatically.
# Note: if RUBY_FAKEGEM_RECIPE_DOC is set to `rdoc`, this variable is
# hardwired to `doc`.
-# RUBY_FAKEGEM_DOCDIR=""
# @ECLASS-VARIABLE: RUBY_FAKEGEM_EXTRADOC
+# @DEFAULT_UNSET
# @DESCRIPTION:
# Extra documentation to install (readme, changelogs, …).
-# RUBY_FAKEGEM_EXTRADOC=""
# @ECLASS-VARIABLE: RUBY_FAKEGEM_DOC_SOURCES
# @DESCRIPTION:
# Allow settings defined sources to scan for documentation.
# This only applies if RUBY_FAKEGEM_DOC_TASK is set to `rdoc`.
-# RUBY_FAKEGEM_DOC_SOURCES="lib"
+RUBY_FAKEGEM_DOC_SOURCES="${RUBY_FAKEGEM_DOC_SOURCES-lib}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_BINWRAP
# @DESCRIPTION:
# Binaries to wrap around (relative to the RUBY_FAKEGEM_BINDIR directory)
-# RUBY_FAKEGEM_BINWRAP="*"
+RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_BINDIR
# @DESCRIPTION:
# Path that contains binaries to be binwrapped. Equivalent to the
# gemspec bindir option.
-# RUBY_FAKEGEM_BINDIR="bin"
+RUBY_FAKEGEM_BINDIR="${RUBY_FAKEGEM_BINDIR-bin}"
# @ECLASS-VARIABLE: RUBY_FAKEGEM_REQUIRE_PATHS
+# @DEFAULT_UNSET
# @DESCRIPTION:
# Extra require paths (beside lib) to add to the specification
-# RUBY_FAKEGEM_REQUIRE_PATHS=""
# @ECLASS-VARIABLE: RUBY_FAKEGEM_GEMSPEC
+# @DEFAULT_UNSET
# @DESCRIPTION:
# Filename of .gemspec file to install instead of generating a generic one.
-# RUBY_FAKEGEM_GEMSPEC=""
# @ECLASS-VARIABLE: RUBY_FAKEGEM_EXTRAINSTALL
# @DESCRIPTION:
# List of files and directories relative to the top directory that also
# get installed. Some gems provide extra files such as version information,
# Rails generators, or data that needs to be installed as well.
-# RUBY_FAKEGEM_EXTRAINSTALL=""
+RUBY_FAKEGEM_EXTRAINSTALL=""
-RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}"
-RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}"
-RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}"
-
-RUBY_FAKEGEM_RECIPE_DOC="${RUBY_FAKEGEM_RECIPE_DOC-rake}"
-RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}"
-RUBY_FAKEGEM_DOC_SOURCES="${RUBY_FAKEGEM_DOC_SOURCES-lib}"
-RUBY_FAKEGEM_RECIPE_TEST="${RUBY_FAKEGEM_RECIPE_TEST-rake}"
-RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}"
+RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}"
-RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}"
-RUBY_FAKEGEM_BINDIR="${RUBY_FAKEGEM_BINDIR-bin}"
[[ ${RUBY_FAKEGEM_TASK_DOC} == "" ]] && RUBY_FAKEGEM_RECIPE_DOC="none"