summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin35940 -> 36588 bytes
-rw-r--r--eclass/acct-group.eclass18
-rw-r--r--eclass/acct-user.eclass18
-rw-r--r--eclass/chromium-2.eclass4
-rw-r--r--eclass/edos2unix.eclass21
-rw-r--r--eclass/eutils.eclass179
-rw-r--r--eclass/gnome2.eclass2
-rw-r--r--eclass/go-module.eclass2
-rw-r--r--eclass/java-pkg-simple.eclass25
-rw-r--r--eclass/l10n.eclass54
-rw-r--r--eclass/ltprune.eclass4
-rw-r--r--eclass/lua.eclass710
-rw-r--r--eclass/mate.eclass4
-rw-r--r--eclass/multilib-build.eclass14
-rw-r--r--eclass/multilib.eclass30
-rw-r--r--eclass/oasis.eclass5
-rw-r--r--eclass/optfeature.eclass63
-rw-r--r--eclass/s6.eclass4
-rw-r--r--eclass/systemd.eclass8
-rw-r--r--eclass/toolchain.eclass77
-rw-r--r--eclass/wrapper.eclass59
21 files changed, 1070 insertions, 231 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 589bed4dc60e..7ad89561b3b0 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 5550e4a2fb10..19a378e0b061 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019 Gentoo Authors
+# Copyright 2019-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: acct-group.eclass
@@ -80,7 +80,7 @@ S=${WORKDIR}
# << Phase functions >>
-EXPORT_FUNCTIONS pkg_pretend pkg_preinst
+EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
# @FUNCTION: acct-group_pkg_pretend
# @DESCRIPTION:
@@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
fi
}
+# @FUNCTION: acct-group_src_install
+# @DESCRIPTION:
+# Installs sysusers.d file for the group.
+acct-group_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ insinto /usr/lib/sysusers.d
+ newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
+ printf "g\t%q\t%q\n" \
+ "${ACCT_GROUP_NAME}" \
+ "${ACCT_GROUP_ID/#-*/-}"
+ )
+}
+
# @FUNCTION: acct-group_pkg_preinst
# @DESCRIPTION:
# Creates the group if it does not exist yet.
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index e82f3c56dbbe..56a4e83e8bfc 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019 Gentoo Authors
+# Copyright 2019-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: acct-user.eclass
@@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
# @FUNCTION: acct-user_src_install
# @DESCRIPTION:
# Installs a keep-file into the user's home directory to ensure it is
-# owned by the package.
+# owned by the package, and sysusers.d file.
acct-user_src_install() {
debug-print-function ${FUNCNAME} "${@}"
@@ -321,6 +321,20 @@ acct-user_src_install() {
# created yet
keepdir "${ACCT_USER_HOME}"
fi
+
+ insinto /usr/lib/sysusers.d
+ newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
+ printf "u\t%q\t%q\t%q\t%q\t%q\n" \
+ "${ACCT_USER_NAME}" \
+ "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
+ "${DESCRIPTION//[:,=]/;}" \
+ "${ACCT_USER_HOME}" \
+ "${ACCT_USER_SHELL/#-*/-}"
+ if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
+ printf "m\t${ACCT_USER_NAME}\t%q\n" \
+ "${ACCT_USER_GROUPS[@]:1}"
+ fi
+ )
}
# @FUNCTION: acct-user_pkg_preinst
diff --git a/eclass/chromium-2.eclass b/eclass/chromium-2.eclass
index c9cfe5acebee..b3d63f302d05 100644
--- a/eclass/chromium-2.eclass
+++ b/eclass/chromium-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: chromium-2.eclass
@@ -126,7 +126,7 @@ chromium_pkg_die() {
fi
# No ricer bugs.
- if use_if_iuse custom-cflags; then
+ if in_iuse custom-cflags && use custom-cflags; then
ewarn
ewarn "You have enabled the custom-cflags USE flag."
ewarn "Please disable it before reporting a bug."
diff --git a/eclass/edos2unix.eclass b/eclass/edos2unix.eclass
new file mode 100644
index 000000000000..8b774844cb8a
--- /dev/null
+++ b/eclass/edos2unix.eclass
@@ -0,0 +1,21 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: edos2unix.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: convert files from DOS CRLF to UNIX LF line endings
+
+# @FUNCTION: edos2unix
+# @USAGE: <file> [more files ...]
+# @DESCRIPTION:
+# A handy replacement for dos2unix, recode, fixdos, etc... This allows
+# you to remove all of these text utilities from DEPEND variables
+# because this is a script based solution. Just give it a list of files
+# to convert and they will all be changed from the DOS CRLF format to
+# the UNIX LF format.
+
+edos2unix() {
+ [[ $# -eq 0 ]] && return 0
+ sed -i 's/\r$//' -- "$@" || die
+}
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 20dec774f2f5..20ebe31c10a4 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,9 +1,10 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: eutils.eclass
# @MAINTAINER:
# base-system@gentoo.org
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
# @BLURB: many extra (but common) functions that are used in ebuilds
# @DESCRIPTION:
# The eutils eclass contains a suite of functions that complement
@@ -13,24 +14,32 @@
#
# Due to the nature of this eclass, some functions may have maintainers
# different from the overall eclass!
+#
+# This eclass is DEPRECATED and must not be inherited by any new ebuilds
+# or eclasses. Use the more specific split eclasses instead, or native
+# package manager functions when available.
if [[ -z ${_EUTILS_ECLASS} ]]; then
_EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses
case ${EAPI:-0} in
-0|1|2|3|4|5|6)
- inherit desktop epatch estack ltprune multilib preserve-libs \
- toolchain-funcs vcs-clean
- ;;
+ 0|1|2|3|4|5|6)
+ inherit desktop edos2unix epatch estack l10n ltprune multilib \
+ preserve-libs toolchain-funcs vcs-clean wrapper
+ ;;
+ 7) inherit edos2unix l10n wrapper ;;
+ *) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
esac
# @FUNCTION: emktemp
# @USAGE: [temp dir]
# @DESCRIPTION:
-# Cheap replacement for when debianutils (and thus mktemp)
-# does not exist on the users system.
+# Cheap replacement for when coreutils (and thus mktemp) does not exist
+# on the user's system.
emktemp() {
+ eqawarn "emktemp is deprecated. Create a temporary file in \${T} instead."
+
local exe="touch"
[[ $1 == -d ]] && exe="mkdir" && shift
local topdir=$1
@@ -60,114 +69,6 @@ emktemp() {
fi
}
-# @FUNCTION: edos2unix
-# @USAGE: <file> [more files ...]
-# @DESCRIPTION:
-# A handy replacement for dos2unix, recode, fixdos, etc... This allows you
-# to remove all of these text utilities from DEPEND variables because this
-# is a script based solution. Just give it a list of files to convert and
-# they will all be changed from the DOS CRLF format to the UNIX LF format.
-edos2unix() {
- [[ $# -eq 0 ]] && return 0
- sed -i 's/\r$//' -- "$@" || die
-}
-
-# @FUNCTION: strip-linguas
-# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
-# @DESCRIPTION:
-# Make sure that LINGUAS only contains languages that
-# a package can support. The first form allows you to
-# specify a list of LINGUAS. The -i builds a list of po
-# files found in all the directories and uses the
-# intersection of the lists. The -u builds a list of po
-# files found in all the directories and uses the union
-# of the lists.
-strip-linguas() {
- local ls newls nols
- if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
- local op=$1; shift
- ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
- local d f
- for d in "$@" ; do
- if [[ ${op} == "-u" ]] ; then
- newls=${ls}
- else
- newls=""
- fi
- for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
- if [[ ${op} == "-i" ]] ; then
- has ${f} ${ls} && newls="${newls} ${f}"
- else
- has ${f} ${ls} || newls="${newls} ${f}"
- fi
- done
- ls=${newls}
- done
- else
- ls="$@"
- fi
-
- nols=""
- newls=""
- for f in ${LINGUAS} ; do
- if has ${f} ${ls} ; then
- newls="${newls} ${f}"
- else
- nols="${nols} ${f}"
- fi
- done
- [[ -n ${nols} ]] \
- && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
- export LINGUAS=${newls:1}
-}
-
-# @FUNCTION: make_wrapper
-# @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
-# @DESCRIPTION:
-# Create a shell wrapper script named wrapper in installpath
-# (defaults to the bindir) to execute target (default of wrapper) by
-# first optionally setting LD_LIBRARY_PATH to the colon-delimited
-# libpaths followed by optionally changing directory to chdir.
-make_wrapper() {
- local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
- local tmpwrapper=$(emktemp)
- has "${EAPI:-0}" 0 1 2 && local EPREFIX=""
-
- (
- echo '#!/bin/sh'
- if [[ -n ${libdir} ]] ; then
- local var
- if [[ ${CHOST} == *-darwin* ]] ; then
- var=DYLD_LIBRARY_PATH
- else
- var=LD_LIBRARY_PATH
- fi
- cat <<-EOF
- if [ "\${${var}+set}" = "set" ] ; then
- export ${var}="\${${var}}:${EPREFIX}${libdir}"
- else
- export ${var}="${EPREFIX}${libdir}"
- fi
- EOF
- fi
- [[ -n ${chdir} ]] && printf 'cd "%s" &&\n' "${EPREFIX}${chdir}"
- # We don't want to quote ${bin} so that people can pass complex
- # things as ${bin} ... "./someprog --args"
- printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}"
- ) > "${tmpwrapper}"
- chmod go+rx "${tmpwrapper}"
-
- if [[ -n ${path} ]] ; then
- (
- exeopts -m 0755
- exeinto "${path}"
- newexe "${tmpwrapper}" "${wrapper}"
- ) || die
- else
- newbin "${tmpwrapper}" "${wrapper}" || die
- fi
-}
-
path_exists() {
eerror "path_exists has been removed. Please see the following post"
eerror "for a replacement snippet:"
@@ -182,55 +83,13 @@ path_exists() {
#
# Note that this function should not be used in the global scope.
use_if_iuse() {
+ eqawarn "use_if_iuse is deprecated."
+ eqawarn "Define it as a local function, or inline it:"
+ eqawarn " in_iuse foo && use foo"
in_iuse $1 || return 1
use $1
}
-# @FUNCTION: optfeature
-# @USAGE: <short description> <package atom to match> [other atoms]
-# @DESCRIPTION:
-# Print out a message suggesting an optional package (or packages)
-# not currently installed which provides the described functionality.
-#
-# The following snippet would suggest app-misc/foo for optional foo support,
-# app-misc/bar or app-misc/baz[bar] for optional bar support
-# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
-# @CODE
-# optfeature "foo support" app-misc/foo
-# optfeature "bar support" app-misc/bar app-misc/baz[bar]
-# optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
-# @CODE
-optfeature() {
- debug-print-function ${FUNCNAME} "$@"
- local i j msg
- local desc=$1
- local flag=0
- shift
- for i; do
- for j in ${i}; do
- if has_version "${j}"; then
- flag=1
- else
- flag=0
- break
- fi
- done
- if [[ ${flag} -eq 1 ]]; then
- break
- fi
- done
- if [[ ${flag} -eq 0 ]]; then
- for i; do
- msg=" "
- for j in ${i}; do
- msg+=" ${j} and"
- done
- msg="${msg:0: -4} for ${desc}"
- elog "${msg}"
- done
- fi
-}
-
case ${EAPI:-0} in
0|1|2|3|4)
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
index a16fc916c6d2..1a4ff451df32 100644
--- a/eclass/gnome2.eclass
+++ b/eclass/gnome2.eclass
@@ -296,7 +296,7 @@ gnome2_src_install() {
if has ${EAPI:-0} 4; then
if [[ "${GNOME2_LA_PUNT}" != "no" ]]; then
ebegin "Removing .la files"
- if ! use_if_iuse static-libs ; then
+ if ! in_iuse static-libs || ! use static-libs ; then
find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed"
fi
eend
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 7b66c3e2b1ed..c9a7ab12eaf0 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -338,7 +338,7 @@ _go-module_src_unpack_verify_gosum() {
die "go-module_set_globals must be called in global scope"
fi
- cd "${S}"
+ cd "${S}" || die "cd failed"
# Cleanup the modules before starting anything else
# This will print 'downloading' messages, but it's accessing content from
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index 560db83d77bc..a1ab0afb3162 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2015 Gentoo Foundation
+# Copyright 2004-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-pkg-simple.eclass
@@ -10,11 +10,10 @@
# @DESCRIPTION:
# This class is intended to build pure Java packages from Java sources
# without the use of any build instructions shipped with the sources.
-# There is no support for resources besides the generated class files,
-# or for generating source files, or for controlling the META-INF of
-# the resulting jar, although these issues may be addressed by an
-# ebuild by putting corresponding files into the target directory
-# before calling the src_compile function of this eclass.
+# There is no support for generating source files, or for controlling
+# the META-INF of the resulting jar, although these issues may be
+# addressed by an ebuild by putting corresponding files into the target
+# directory before calling the src_compile function of this eclass.
inherit java-utils-2
@@ -73,7 +72,7 @@ fi
# @ECLASS-VARIABLE: JAVA_NEEDS_TOOLS
# @DEFAULT_UNSET
# @DESCRIPTION:
-# add tools.jar to the gentoo.classpath. Should only be used
+# Add tools.jar to the gentoo.classpath. Should only be used
# for build-time purposes, the dependency is not recorded to
# package.env.
@@ -188,7 +187,7 @@ fi
# It is almost equivalent to ${JAVA_RESOURCE_DIRS} in src_test.
# @FUNCTION: java-pkg-simple_getclasspath
-# @USAGE: java-pkg-simple_getclasspath [--runtime-only]
+# @USAGE: java-pkg-simple_getclasspath
# @INTERNAL
# @DESCRIPTION:
# Get proper ${classpath} from ${JAVA_GENTOO_CLASSPATH_EXTRA},
@@ -196,12 +195,12 @@ fi
# ${JAVA_GENTOO_CLASSPATH}. We use it inside
# java-pkg-simple_src_compile and java-pkg-simple_src_test.
#
-# Note that if you need to define a "classpath" variable before
+# Note that the variable "classpath" needs to be defined before
# calling this function.
java-pkg-simple_getclasspath() {
debug-print-function ${FUNCNAME} $*
- local denpendency
+ local dependency
local deep_jars="--with-dependencies"
local buildonly_jars="--build-only"
@@ -242,7 +241,7 @@ java-pkg-simple_getclasspath() {
# @INTERNAL
# @DESCRIPTION:
# use japi-compliance-checker the ensure the compabitily of \*.class files,
-# Besides, use pkgdiff to ensure the compabilty of resources.
+# Besides, use pkgdiff to ensure the compatibility of resources.
java-pkg-simple_test_with_pkgdiff_() {
debug-print-function ${FUNCNAME} $*
@@ -418,7 +417,7 @@ java-pkg-simple_src_test() {
local tests_to_run classpath
# do not continue if the USE FLAG 'test' is explicitly unset
- # or no ${JAVA_TESTING_FRSerializingCAMEWORKS} specified
+ # or no ${JAVA_TESTING_FRAMEWORKS} is specified
if ! has test ${JAVA_PKG_IUSE}; then
return
elif ! use test; then
@@ -459,7 +458,7 @@ java-pkg-simple_src_test() {
tests_to_run=${tests_to_run//\//.}
# exclude extra test classes, usually corner cases
- # that the code above cannot handle
+ # that the code above cannot handle
for class in "${JAVA_TEST_EXCLUDES[@]}"; do
tests_to_run=${tests_to_run//${class}}
done
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index 0b2d287afa7f..7bd8f382fbe3 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: l10n.eclass
@@ -14,6 +14,9 @@
# determining the cross-section between the user's set LINGUAS and what
# is offered by the package.
+if [[ -z ${_L10N_ECLASS} ]]; then
+_L10N_ECLASS=1
+
# @ECLASS-VARIABLE: PLOCALES
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -120,3 +123,52 @@ l10n_get_locales() {
fi
printf "%s" "${locs}"
}
+
+# @FUNCTION: strip-linguas
+# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
+# @DESCRIPTION:
+# Make sure that LINGUAS only contains languages that a package can
+# support. The first form allows you to specify a list of LINGUAS.
+# The -i builds a list of po files found in all the directories and uses
+# the intersection of the lists. The -u builds a list of po files found
+# in all the directories and uses the union of the lists.
+strip-linguas() {
+ local ls newls nols
+ if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
+ local op=$1; shift
+ ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
+ local d f
+ for d in "$@" ; do
+ if [[ ${op} == "-u" ]] ; then
+ newls=${ls}
+ else
+ newls=""
+ fi
+ for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
+ if [[ ${op} == "-i" ]] ; then
+ has ${f} ${ls} && newls="${newls} ${f}"
+ else
+ has ${f} ${ls} || newls="${newls} ${f}"
+ fi
+ done
+ ls=${newls}
+ done
+ else
+ ls="$@"
+ fi
+
+ nols=""
+ newls=""
+ for f in ${LINGUAS} ; do
+ if has ${f} ${ls} ; then
+ newls="${newls} ${f}"
+ else
+ nols="${nols} ${f}"
+ fi
+ done
+ [[ -n ${nols} ]] \
+ && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
+ export LINGUAS=${newls:1}
+}
+
+fi
diff --git a/eclass/ltprune.eclass b/eclass/ltprune.eclass
index d8e93b6fb4b3..7374716e6dd2 100644
--- a/eclass/ltprune.eclass
+++ b/eclass/ltprune.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: ltprune.eclass
@@ -11,7 +11,7 @@
#
# Discouraged. Whenever possible, please use much simpler:
# @CODE
-# find "${D}" -name '*.la' -type f -delete || die
+# find "${ED}" -name '*.la' -delete || die
# @CODE
if [[ -z ${_LTPRUNE_ECLASS} ]]; then
diff --git a/eclass/lua.eclass b/eclass/lua.eclass
new file mode 100644
index 000000000000..7dccba6980a0
--- /dev/null
+++ b/eclass/lua.eclass
@@ -0,0 +1,710 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: lua.eclass
+# @MAINTAINER:
+# William Hubbs <williamh@gentoo.org>
+# Marek Szuba <marecki@gentoo.org>
+# @AUTHOR:
+# Marek Szuba <marecki@gentoo.org>
+# Based on python{,-utils}-r1.eclass by Michał Górny <mgorny@gentoo.org> et al.
+# @SUPPORTED_EAPIS: 7
+# @BLURB: A common eclass for Lua packages
+# @DESCRIPTION:
+# A common eclass providing helper functions to build and install
+# packages supporting being installed for multiple Lua implementations.
+#
+# This eclass sets correct IUSE. Modification of REQUIRED_USE has to
+# be done by the author of the ebuild (but LUA_REQUIRED_USE is
+# provided for convenience, see below). The eclass exports LUA_DEPS
+# and LUA_USEDEP so you can create correct dependencies for your
+# package easily. It also provides methods to easily run a command for
+# each enabled Lua implementation and duplicate the sources for them.
+#
+# Please note that for the time being this eclass does NOT support luajit.
+#
+# @EXAMPLE:
+# @CODE
+# EAPI=7
+#
+# LUA_COMPAT=( lua5-{1..3} )
+#
+# inherit lua
+#
+# [...]
+#
+# REQUIRED_USE="${LUA_REQUIRED_USE}"
+# DEPEND="${LUA_DEPS}"
+# RDEPEND="${DEPEND}
+# dev-lua/foo[${LUA_USEDEP}]"
+# BDEPEND="virtual/pkgconfig"
+#
+# lua_src_install() {
+# emake LUA_VERSION="$(lua_get_version)" install
+# }
+#
+# src_install() {
+# lua_foreach_impl lua_src_install
+# }
+# @CODE
+
+case ${EAPI:-0} in
+ 0|1|2|3|4|5|6)
+ die "Unsupported EAPI=${EAPI} (too old) for ${ECLASS}"
+ ;;
+ 7)
+ ;;
+ *)
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+ ;;
+esac
+
+if [[ ! ${_LUA_R0} ]]; then
+
+inherit multibuild toolchain-funcs
+
+fi
+
+# @ECLASS-VARIABLE: LUA_COMPAT
+# @REQUIRED
+# @PRE_INHERIT
+# @DESCRIPTION:
+# This variable contains a list of Lua implementations the package
+# supports. It must be set before the `inherit' call. It has to be
+# an array.
+#
+# Example:
+# @CODE
+# LUA_COMPAT=( lua5-1 lua5-2 lua5-3 )
+# @CODE
+#
+# Please note that you can also use bash brace expansion if you like:
+# @CODE
+# LUA_COMPAT=( lua5-{1..3} )
+# @CODE
+
+# @ECLASS-VARIABLE: LUA_COMPAT_OVERRIDE
+# @USER_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# This variable can be used when working with ebuilds to override
+# the in-ebuild LUA_COMPAT. It is a string listing all
+# the implementations which package will be built for. It need be
+# specified in the calling environment, and not in ebuilds.
+#
+# It should be noted that in order to preserve metadata immutability,
+# LUA_COMPAT_OVERRIDE does not affect IUSE nor dependencies.
+# The state of LUA_TARGETS is ignored, and all the implementations
+# in LUA_COMPAT_OVERRIDE are built. Dependencies need to be satisfied
+# manually.
+#
+# Example:
+# @CODE
+# LUA_COMPAT_OVERRIDE='lua5-2' emerge -1v dev-lua/foo
+# @CODE
+
+# @ECLASS-VARIABLE: LUA_REQ_USE
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# The list of USE flags required to be enabled on the chosen Lua
+# implementations, formed as a USE-dependency string. It should be valid
+# for all implementations in LUA_COMPAT, so it may be necessary to
+# use USE defaults.
+# This must be set before calling `inherit'.
+#
+# Example:
+# @CODE
+# LUA_REQ_USE="deprecated"
+# @CODE
+#
+# It will cause the Lua dependencies to look like:
+# @CODE
+# lua_targets_luaX-Y? ( dev-lang/lua:X.Y[deprecated] )
+# @CODE
+
+# @ECLASS-VARIABLE: BUILD_DIR
+# @OUTPUT_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The current build directory. In global scope, it is supposed to
+# contain an initial build directory; if unset, it defaults to ${S}.
+#
+# In functions run by lua_foreach_impl(), the BUILD_DIR is locally
+# set to an implementation-specific build directory. That path is
+# created through appending a hyphen and the implementation name
+# to the final component of the initial BUILD_DIR.
+#
+# Example value:
+# @CODE
+# ${WORKDIR}/foo-1.3-lua5-1
+# @CODE
+
+# @ECLASS-VARIABLE: ELUA
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The executable name of the current Lua interpreter. This variable is set
+# automatically in functions called by lua_foreach_impl().
+#
+# Example value:
+# @CODE
+# lua5.1
+# @CODE
+
+# @ECLASS-VARIABLE: LUA
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The absolute path to the current Lua interpreter. This variable is set
+# automatically in functions called by lua_foreach_impl().
+#
+# Example value:
+# @CODE
+# /usr/bin/lua5.1
+# @CODE
+
+# @ECLASS-VARIABLE: LUA_DEPS
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# This is an eclass-generated Lua dependency string for all
+# implementations listed in LUA_COMPAT.
+#
+# Example use:
+# @CODE
+# RDEPEND="${LUA_DEPS}
+# dev-foo/mydep"
+# DEPEND="${RDEPEND}"
+# @CODE
+#
+# Example value:
+# @CODE
+# lua_targets_lua5-1? ( dev-lang/lua:5.1 )
+# lua_targets_lua5-2? ( dev-lang/lua:5.2 )
+# @CODE
+
+# @ECLASS-VARIABLE: LUA_REQUIRED_USE
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# This is an eclass-generated required-use expression which ensures at
+# least one Lua implementation has been enabled.
+#
+# This expression should be utilized in an ebuild by including it in
+# REQUIRED_USE, optionally behind a use flag.
+#
+# Example use:
+# @CODE
+# REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
+# @CODE
+#
+# Example value:
+# @CODE
+# || ( lua_targets_lua5-1 lua_targets_lua5-2 )
+# @CODE
+
+# @ECLASS-VARIABLE: LUA_USEDEP
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# This is an eclass-generated USE-dependency string which can be used to
+# depend on another Lua package being built for the same Lua
+# implementations.
+#
+# Example use:
+# @CODE
+# RDEPEND="dev-lua/foo[${LUA_USEDEP}]"
+# @CODE
+#
+# Example value:
+# @CODE
+# lua_targets_lua5-1(-)?,lua_targets_lua5-2(-)?
+# @CODE
+
+if [[ ! ${_LUA_R0} ]]; then
+
+# @FUNCTION: _lua_export
+# @USAGE: [<impl>] <variables>...
+# @INTERNAL
+# @DESCRIPTION:
+# Set and export the Lua implementation-relevant variables passed
+# as parameters.
+#
+# The optional first parameter may specify the requested Lua
+# implementation (either as LUA_TARGETS value, e.g. lua5-2,
+# or an ELUA one, e.g. lua5.2). If no implementation passed,
+# the current one will be obtained from ${ELUA}.
+_lua_export() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local impl var
+
+ case "${1}" in
+ lua*)
+ impl=${1/-/.}
+ shift
+ ;;
+ *)
+ impl=${ELUA}
+ if [[ -z ${impl} ]]; then
+ die "_lua_export called without a Lua implementation and ELUA is unset"
+ fi
+ ;;
+ esac
+ debug-print "${FUNCNAME}: implementation: ${impl}"
+
+ for var; do
+ case "${var}" in
+ ELUA)
+ export ELUA=${impl}
+ debug-print "${FUNCNAME}: ELUA = ${ELUA}"
+ ;;
+ LUA)
+ export LUA="${EPREFIX}"/usr/bin/${impl}
+ debug-print "${FUNCNAME}: LUA = ${LUA}"
+ ;;
+ LUA_CFLAGS)
+ local val
+
+ val=$($(tc-getPKG_CONFIG) --cflags ${impl}) || die
+
+ export LUA_CFLAGS=${val}
+ debug-print "${FUNCNAME}: LUA_CFLAGS = ${LUA_CFLAGS}"
+ ;;
+ LUA_CMOD_DIR)
+ local val
+
+ val=$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD ${impl}) || die
+
+ export LUA_CMOD_DIR=${val}
+ debug-print "${FUNCNAME}: LUA_CMOD_DIR = ${LUA_CMOD_DIR}"
+ ;;
+ LUA_LIBS)
+ local val
+
+ val=$($(tc-getPKG_CONFIG) --libs ${impl}) || die
+
+ export LUA_LIBS=${val}
+ debug-print "${FUNCNAME}: LUA_LIBS = ${LUA_LIBS}"
+ ;;
+ LUA_LMOD_DIR)
+ local val
+
+ val=$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD ${impl}) || die
+
+ export LUA_LMOD_DIR=${val}
+ debug-print "${FUNCNAME}: LUA_LMOD_DIR = ${LUA_LMOD_DIR}"
+ ;;
+ LUA_PKG_DEP)
+ local d
+ case ${impl} in
+ lua*)
+ LUA_PKG_DEP="dev-lang/lua:${impl#lua}"
+ ;;
+ *)
+ die "Invalid implementation: ${impl}"
+ ;;
+ esac
+
+ # use-dep
+ if [[ ${LUA_REQ_USE} ]]; then
+ LUA_PKG_DEP+=[${LUA_REQ_USE}]
+ fi
+
+ export LUA_PKG_DEP
+ debug-print "${FUNCNAME}: LUA_PKG_DEP = ${LUA_PKG_DEP}"
+ ;;
+ LUA_VERSION)
+ local val
+
+ val=$($(tc-getPKG_CONFIG) --modversion ${impl}) || die
+
+ export LUA_VERSION=${val}
+ debug-print "${FUNCNAME}: LUA_VERSION = ${LUA_VERSION}"
+ ;;
+ *)
+ die "_lua_export: unknown variable ${var}"
+ ;;
+ esac
+ done
+}
+
+# @FUNCTION: _lua_validate_useflags
+# @INTERNAL
+# @DESCRIPTION:
+# Enforce the proper setting of LUA_TARGETS, if LUA_COMPAT_OVERRIDE
+# is not in effect. If it is, just warn that the flags will be ignored.
+_lua_validate_useflags() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ ${LUA_COMPAT_OVERRIDE} ]]; then
+ if [[ ! ${_LUA_COMPAT_OVERRIDE_WARNED} ]]; then
+ ewarn "WARNING: LUA_COMPAT_OVERRIDE in effect. The following Lua"
+ ewarn "implementations will be enabled:"
+ ewarn
+ ewarn " ${LUA_COMPAT_OVERRIDE}"
+ ewarn
+ ewarn "Dependencies won't be satisfied, and LUA_TARGETS will be ignored."
+ _LUA_COMPAT_OVERRIDE_WARNED=1
+ fi
+ # we do not use flags with LCO
+ return
+ fi
+
+ local i
+
+ for i in "${_LUA_SUPPORTED_IMPLS[@]}"; do
+ use "lua_targets_${i}" && return 0
+ done
+
+ eerror "No Lua implementation selected for the build. Please add one"
+ eerror "of the following values to your LUA_TARGETS"
+ eerror "(in make.conf or package.use):"
+ eerror
+ eerror "${LUA_COMPAT[@]}"
+ echo
+ die "No supported Lua implementation in LUA_TARGETS."
+}
+
+# @FUNCTION: _lua_obtain_impls
+# @INTERNAL
+# @DESCRIPTION:
+# Set up the enabled implementation list.
+_lua_obtain_impls() {
+ _lua_validate_useflags
+
+ if [[ ${LUA_COMPAT_OVERRIDE} ]]; then
+ MULTIBUILD_VARIANTS=( ${LUA_COMPAT_OVERRIDE} )
+ return
+ fi
+
+ MULTIBUILD_VARIANTS=()
+
+ local impl
+ for impl in "${_LUA_SUPPORTED_IMPLS[@]}"; do
+ has "${impl}" "${LUA_COMPAT[@]}" && \
+ use "lua_targets_${impl}" && MULTIBUILD_VARIANTS+=( "${impl}" )
+ done
+}
+
+
+# @FUNCTION: _lua_multibuild_wrapper
+# @USAGE: <command> [<args>...]
+# @INTERNAL
+# @DESCRIPTION:
+# Initialize the environment for the Lua implementation selected
+# for multibuild.
+_lua_multibuild_wrapper() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local -x ELUA LUA
+ _lua_export "${MULTIBUILD_VARIANT}" ELUA LUA
+ local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
+ _lua_wrapper_setup
+
+ "${@}"
+}
+
+# @FUNCTION: _lua_wrapper_setup
+# @USAGE: [<path> [<impl>]]
+# @INTERNAL
+# @DESCRIPTION:
+# Create proper Lua executables and pkg-config wrappers
+# (if available) in the directory named by <path>. Set up PATH
+# and PKG_CONFIG_PATH appropriately. <path> defaults to ${T}/${ELUA}.
+#
+# The wrappers will be created for implementation named by <impl>,
+# or for one named by ${ELUA} if no <impl> passed.
+#
+# If the named directory contains a lua symlink already, it will
+# be assumed to contain proper wrappers already and only environment
+# setup will be done. If wrapper update is requested, the directory
+# shall be removed first.
+_lua_wrapper_setup() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local workdir=${1:-${T}/${ELUA}}
+ local impl=${2:-${ELUA}}
+
+ [[ ${workdir} ]] || die "${FUNCNAME}: no workdir specified."
+ [[ ${impl} ]] || die "${FUNCNAME}: no impl nor ELUA specified."
+
+ if [[ ! -x ${workdir}/bin/lua ]]; then
+ mkdir -p "${workdir}"/{bin,pkgconfig} || die
+
+ # Clean up, in case we were supposed to do a cheap update
+ rm -f "${workdir}"/bin/lua{,c} || die
+ rm -f "${workdir}"/pkgconfig/lua.pc || die
+
+ local ELUA LUA
+ _lua_export "${impl}" ELUA LUA
+
+ # Lua interpreter and compiler
+ ln -s "${EPREFIX}"/usr/bin/${ELUA} "${workdir}"/bin/lua || die
+ ln -s "${EPREFIX}"/usr/bin/${ELUA/a/ac} "${workdir}"/bin/luac || die
+
+ # pkg-config
+ ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${ELUA}.pc \
+ "${workdir}"/pkgconfig/lua.pc || die
+ fi
+
+ # Now, set the environment.
+ # But note that ${workdir} may be shared with something else,
+ # and thus already on top of PATH.
+ if [[ ${PATH##:*} != ${workdir}/bin ]]; then
+ PATH=${workdir}/bin${PATH:+:${PATH}}
+ fi
+ if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
+ PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
+ fi
+ export PATH PKG_CONFIG_PATH
+}
+
+# @FUNCTION: lua_copy_sources
+# @DESCRIPTION:
+# Create a single copy of the package sources for each enabled Lua
+# implementation.
+#
+# The sources are always copied from initial BUILD_DIR (or S if unset)
+# to implementation-specific build directory matching BUILD_DIR used by
+# lua_foreach_abi().
+lua_copy_sources() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local MULTIBUILD_VARIANTS
+ _lua_obtain_impls
+
+ multibuild_copy_sources
+}
+
+# @FUNCTION: lua_foreach_impl
+# @USAGE: <command> [<args>...]
+# @DESCRIPTION:
+# Run the given command for each of the enabled Lua implementations.
+# If additional parameters are passed, they will be passed through
+# to the command.
+#
+# The function will return 0 status if all invocations succeed.
+# Otherwise, the return code from first failing invocation will
+# be returned.
+#
+# For each command being run, ELUA, LUA and BUILD_DIR are set
+# locally, and the former two are exported to the command environment.
+lua_foreach_impl() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local MULTIBUILD_VARIANTS
+ _lua_obtain_impls
+
+ multibuild_foreach_variant _lua_multibuild_wrapper "${@}"
+}
+
+# @FUNCTION: lua_get_CFLAGS
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the compiler flags for building against Lua,
+# for the given implementation. If no implementation is provided,
+# ${ELUA} will be used.
+#
+# Please note that this function requires Lua and pkg-config installed,
+# and therefore proper build-time dependencies need be added to the ebuild.
+lua_get_CFLAGS() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _lua_export "${@}" LUA_CFLAGS
+ echo "${LUA_CFLAGS}"
+}
+
+# @FUNCTION: lua_get_cmod_dir
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the name of the directory into which compiled Lua
+# modules are installed, for the given implementation. If no implementation
+# is provided, ${ELUA} will be used.
+#
+# Please note that this function requires Lua and pkg-config installed,
+# and therefore proper build-time dependencies need be added to the ebuild.
+lua_get_cmod_dir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _lua_export "${@}" LUA_CMOD_DIR
+ echo "${LUA_CMOD_DIR}"
+}
+
+# @FUNCTION: lua_get_LIBS
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the compiler flags for linking against Lua,
+# for the given implementation. If no implementation is provided,
+# ${ELUA} will be used.
+#
+# Please note that this function requires Lua and pkg-config installed,
+# and therefore proper build-time dependencies need be added to the ebuild.
+lua_get_LIBS() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _lua_export "${@}" LUA_LIBS
+ echo "${LUA_LIBS}"
+}
+
+# @FUNCTION: lua_get_lmod_dir
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the name of the directory into which native-Lua
+# modules are installed, for the given implementation. If no implementation
+# is provided, ${ELUA} will be used.
+#
+# Please note that this function requires Lua and pkg-config installed,
+# and therefore proper build-time dependencies need be added to the ebuild.
+lua_get_lmod_dir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _lua_export "${@}" LUA_LMOD_DIR
+ echo "${LUA_LMOD_DIR}"
+}
+
+# @FUNCTION: lua_get_version
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the full version number of the given Lua implementation.
+# If no implementation is provided, ${ELUA} will be used.
+#
+# Please note that this function requires Lua and pkg-config installed,
+# and therefore proper build-time dependencies need be added to the ebuild.
+lua_get_version() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _lua_export "${@}" LUA_VERSION
+ echo "${LUA_VERSION}"
+}
+
+_LUA_R0=1
+fi
+
+# @ECLASS-VARIABLE: _LUA_ALL_IMPLS
+# @INTERNAL
+# @DESCRIPTION:
+# All supported Lua implementations, most preferred last
+_LUA_ALL_IMPLS=(
+ lua5-1
+ lua5-2
+ lua5-3
+ lua5-4
+)
+readonly _LUA_ALL_IMPLS
+
+# @FUNCTION: _lua_set_impls
+# @INTERNAL
+# @DESCRIPTION:
+# Check LUA_COMPAT for well-formedness and validity, then set
+# two global variables:
+#
+# - _LUA_SUPPORTED_IMPLS containing valid implementations supported
+# by the ebuild (LUA_COMPAT minus dead implementations),
+#
+# - and _LUA_UNSUPPORTED_IMPLS containing valid implementations that
+# are not supported by the ebuild.
+#
+# Implementations in both variables are ordered using the pre-defined
+# eclass implementation ordering.
+#
+# This function must only be called once.
+_lua_set_impls() {
+ local i
+
+ if ! declare -p LUA_COMPAT &>/dev/null; then
+ die 'LUA_COMPAT not declared.'
+ fi
+ if [[ $(declare -p LUA_COMPAT) != "declare -a"* ]]; then
+ die 'LUA_COMPAT must be an array.'
+ fi
+
+ local supp=() unsupp=()
+
+ for i in "${_LUA_ALL_IMPLS[@]}"; do
+ if has "${i}" "${LUA_COMPAT[@]}"; then
+ supp+=( "${i}" )
+ else
+ unsupp+=( "${i}" )
+ fi
+ done
+
+ if [[ ! ${supp[@]} ]]; then
+ die "No supported implementation in LUA_COMPAT."
+ fi
+
+ if [[ ${_LUA_SUPPORTED_IMPLS[@]} ]]; then
+ # set once already, verify integrity
+ if [[ ${_LUA_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
+ eerror "Supported impls (LUA_COMPAT) changed between inherits!"
+ eerror "Before: ${_LUA_SUPPORTED_IMPLS[*]}"
+ eerror "Now : ${supp[*]}"
+ die "_LUA_SUPPORTED_IMPLS integrity check failed"
+ fi
+ if [[ ${_LUA_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
+ eerror "Unsupported impls changed between inherits!"
+ eerror "Before: ${_LUA_UNSUPPORTED_IMPLS[*]}"
+ eerror "Now : ${unsupp[*]}"
+ die "_LUA_UNSUPPORTED_IMPLS integrity check failed"
+ fi
+ else
+ _LUA_SUPPORTED_IMPLS=( "${supp[@]}" )
+ _LUA_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
+ readonly _LUA_SUPPORTED_IMPLS _LUA_UNSUPPORTED_IMPLS
+ fi
+}
+
+# @FUNCTION: _lua_set_globals
+# @INTERNAL
+# @DESCRIPTION:
+# Sets all the global output variables provided by this eclass.
+# This function must be called once, in global scope.
+_lua_set_globals() {
+ local deps i LUA_PKG_DEP
+
+ _lua_set_impls
+
+ for i in "${_LUA_SUPPORTED_IMPLS[@]}"; do
+ _lua_export "${i}" LUA_PKG_DEP
+ deps+="lua_targets_${i}? ( ${LUA_PKG_DEP} ) "
+ done
+
+ local flags=( "${_LUA_SUPPORTED_IMPLS[@]/#/lua_targets_}" )
+ local optflags=${flags[@]/%/(-)?}
+
+ local requse="|| ( ${flags[*]} )"
+ local usedep=${optflags// /,}
+
+ if [[ ${LUA_DEPS+1} ]]; then
+ # IUSE is magical, so we can't really check it
+ # (but we verify LUA_COMPAT already)
+
+ if [[ ${LUA_DEPS} != "${deps}" ]]; then
+ eerror "LUA_DEPS have changed between inherits (LUA_REQ_USE?)!"
+ eerror "Before: ${LUA_DEPS}"
+ eerror "Now : ${deps}"
+ die "LUA_DEPS integrity check failed"
+ fi
+
+ # these two are formality -- they depend on LUA_COMPAT only
+ if [[ ${LUA_REQUIRED_USE} != ${requse} ]]; then
+ eerror "LUA_REQUIRED_USE have changed between inherits!"
+ eerror "Before: ${LUA_REQUIRED_USE}"
+ eerror "Now : ${requse}"
+ die "LUA_REQUIRED_USE integrity check failed"
+ fi
+
+ if [[ ${LUA_USEDEP} != "${usedep}" ]]; then
+ eerror "LUA_USEDEP have changed between inherits!"
+ eerror "Before: ${LUA_USEDEP}"
+ eerror "Now : ${usedep}"
+ die "LUA_USEDEP integrity check failed"
+ fi
+ else
+ IUSE=${flags[*]}
+
+ LUA_DEPS=${deps}
+ LUA_REQUIRED_USE=${requse}
+ LUA_USEDEP=${usedep}
+ readonly LUA_DEPS LUA_REQUIRED_USE
+ fi
+}
+
+_lua_set_globals
+unset -f _lua_set_globals _lua_set_impls
diff --git a/eclass/mate.eclass b/eclass/mate.eclass
index d7dd2dbceec0..34d5e47acc22 100644
--- a/eclass/mate.eclass
+++ b/eclass/mate.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: mate.eclass
@@ -120,7 +120,7 @@ mate_src_configure() {
local mateconf=()
# Pass --disable-static whenever possible
- if ! use_if_iuse static-libs; then
+ if ! in_iuse static-libs || ! use static-libs; then
if grep -q "enable-static" "${ECONF_SOURCE:-.}"/configure; then
mateconf+=( --disable-static )
fi
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 620bdcedce58..21ca275c3c77 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -49,6 +49,8 @@ _MULTILIB_FLAGS=(
# abi_ppc_64:ppc64
abi_riscv_lp64d:lp64d
abi_riscv_lp64:lp64
+ abi_riscv_ilp32d:ilp32d
+ abi_riscv_ilp32:ilp32
abi_s390_32:s390
abi_s390_64:s390x
)
@@ -492,12 +494,18 @@ multilib_prepare_wrappers() {
# error "abi_mips_o32 not supported by the package."
# endif
#elif defined(__riscv)
-# if defined(__riscv_float_abi_double)
+# if (__riscv_xlen == 64) && defined(__riscv_float_abi_double)
# error "abi_riscv_lp64d not supported by the package."
-# elif defined(__riscv_float_abi_single)
+# elif (__riscv_xlen == 64) && defined(__riscv_float_abi_single)
# error "abi_riscv_lp64f not supported by the package."
-# else
+# elif (__riscv_xlen == 64)
# error "abi_riscv_lp64 not supported by the package."
+# elif (__riscv_xlen == 32) && defined(__riscv_float_abi_double)
+# error "abi_riscv_ilp32d not supported by the package."
+# elif (__riscv_xlen == 32) && defined(__riscv_float_abi_single)
+# error "abi_riscv_ilp32f not supported by the package."
+# else
+# error "abi_riscv_ilp32 not supported by the package."
# endif
#elif defined(__sparc__)
# if defined(__arch64__)
diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index 342d21a2e1c3..9c7042fcd299 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -397,19 +397,43 @@ multilib_env() {
: ${DEFAULT_ABI=ppc64}
;;
riscv64*)
- export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d}
+ export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d -march=rv64imafdc}
export CHOST_lp64d=${CTARGET}
export CTARGET_lp64d=${CTARGET}
export LIBDIR_lp64d="lib64/lp64d"
- export CFLAGS_lp64=${CFLAGS_lp64--mabi=lp64}
+ export CFLAGS_lp64=${CFLAGS_lp64--mabi=lp64 -march=rv64imac}
export CHOST_lp64=${CTARGET}
export CTARGET_lp64=${CTARGET}
export LIBDIR_lp64="lib64/lp64"
- : ${MULTILIB_ABIS=lp64d lp64}
+ export CFLAGS_ilp32d=${CFLAGS_ilp32d--mabi=ilp32d -march=rv32imafdc}
+ export CHOST_ilp32d=${CTARGET/riscv64/riscv32}
+ export CTARGET_ilp32d=${CTARGET/riscv64/riscv32}
+ export LIBDIR_ilp32d="lib32/ilp32d"
+
+ export CFLAGS_ilp32=${CFLAGS_ilp32--mabi=ilp32 -march=rv32imac}
+ export CHOST_ilp32=${CTARGET/riscv64/riscv32}
+ export CTARGET_ilp32=${CTARGET/riscv64/riscv32}
+ export LIBDIR_ilp32="lib32/ilp32"
+
+ : ${MULTILIB_ABIS=lp64d lp64 ilp32d ilp32}
: ${DEFAULT_ABI=lp64d}
;;
+ riscv32*)
+ export CFLAGS_ilp32d=${CFLAGS_ilp32d--mabi=ilp32d}
+ export CHOST_ilp32d=${CTARGET}
+ export CTARGET_ilp32d=${CTARGET}
+ export LIBDIR_ilp32d="lib32/ilp32d"
+
+ export CFLAGS_ilp32=${CFLAGS_ilp32--mabi=ilp32 -march=rv32imac}
+ export CHOST_ilp32=${CTARGET}
+ export CTARGET_ilp32=${CTARGET}
+ export LIBDIR_ilp32="lib32/ilp32"
+
+ : ${MULTILIB_ABIS=ilp32d ilp32}
+ : ${DEFAULT_ABI=ilp32d}
+ ;;
s390x*)
export CFLAGS_s390=${CFLAGS_s390--m31} # the 31 is not a typo
export CHOST_s390=${CTARGET/s390x/s390}
diff --git a/eclass/oasis.eclass b/eclass/oasis.eclass
index 3071243265b2..bcc46b4af326 100644
--- a/eclass/oasis.eclass
+++ b/eclass/oasis.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: oasis.eclass
@@ -6,7 +6,7 @@
# maintainer-needed@gentoo.org
# @AUTHOR:
# Original Author: Alexis Ballier <aballier@gentoo.org>
-# @SUPPORTED_EAPIS: 3 4 5 6 7
+# @SUPPORTED_EAPIS: 3 4 5
# @BLURB: Provides common ebuild phases for oasis-based packages.
# @DESCRIPTION:
# Provides common ebuild phases for oasis-based packages.
@@ -51,6 +51,7 @@
inherit multilib findlib eutils base
+# Implicitly limited to EAPI 5 or earlier because of base.eclass
case ${EAPI:-0} in
0|1|2) die "You need at least EAPI-3 to use oasis.eclass";;
3|4) RDEPEND=">=dev-lang/ocaml-3.12[ocamlopt?]";;
diff --git a/eclass/optfeature.eclass b/eclass/optfeature.eclass
new file mode 100644
index 000000000000..1943ae37bf5e
--- /dev/null
+++ b/eclass/optfeature.eclass
@@ -0,0 +1,63 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: optfeature.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: Advertise optional functionality that might be useful to users
+
+case ${EAPI:-0} in
+ [0-7]) ;;
+ *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
+esac
+
+if [[ -z ${_OPTFEATURE_ECLASS} ]]; then
+_OPTFEATURE_ECLASS=1
+
+# @FUNCTION: optfeature
+# @USAGE: <short description> <package atom to match> [other atoms]
+# @DESCRIPTION:
+# Print out a message suggesting an optional package (or packages)
+# not currently installed which provides the described functionality.
+#
+# The following snippet would suggest app-misc/foo for optional foo support,
+# app-misc/bar or app-misc/baz[bar] for optional bar support
+# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
+# @CODE
+# optfeature "foo support" app-misc/foo
+# optfeature "bar support" app-misc/bar app-misc/baz[bar]
+# optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
+# @CODE
+optfeature() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local i j msg
+ local desc=$1
+ local flag=0
+ shift
+ for i; do
+ for j in ${i}; do
+ if has_version "${j}"; then
+ flag=1
+ else
+ flag=0
+ break
+ fi
+ done
+ if [[ ${flag} -eq 1 ]]; then
+ break
+ fi
+ done
+ if [[ ${flag} -eq 0 ]]; then
+ for i; do
+ msg=" "
+ for j in ${i}; do
+ msg+=" ${j} and"
+ done
+ msg="${msg:0: -4} for ${desc}"
+ elog "${msg}"
+ done
+ fi
+}
+
+fi
diff --git a/eclass/s6.eclass b/eclass/s6.eclass
index 245df1e11187..aab66726094d 100644
--- a/eclass/s6.eclass
+++ b/eclass/s6.eclass
@@ -4,7 +4,7 @@
# @ECLASS: s6.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6
+# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: helper functions to install s6 services
# @DESCRIPTION:
# This eclass provides helpers to install s6 services.
@@ -26,7 +26,7 @@
# @CODE
case ${EAPI:-0} in
- 5|6) ;;
+ 5|6|7) ;;
*) die "${ECLASS}.eclass: API in EAPI ${EAPI} not yet established" ;;
esac
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index 04f277e94d64..09ea71bbfdc5 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -240,6 +240,8 @@ systemd_install_serviced() {
# @FUNCTION: systemd_dotmpfilesd
# @USAGE: <tmpfilesd>...
# @DESCRIPTION:
+# Deprecated in favor of tmpfiles.eclass.
+#
# Install systemd tmpfiles.d files. Uses doins, thus it is fatal
# in EAPI 4 and non-fatal in earlier EAPIs.
systemd_dotmpfilesd() {
@@ -260,6 +262,8 @@ systemd_dotmpfilesd() {
# @FUNCTION: systemd_newtmpfilesd
# @USAGE: <old-name> <new-name>.conf
# @DESCRIPTION:
+# Deprecated in favor of tmpfiles.eclass.
+#
# Install systemd tmpfiles.d file under a new name. Uses newins, thus it
# is fatal in EAPI 4 and non-fatal in earlier EAPIs.
systemd_newtmpfilesd() {
@@ -435,6 +439,8 @@ systemd_is_booted() {
# @FUNCTION: systemd_tmpfiles_create
# @USAGE: <tmpfilesd> ...
# @DESCRIPTION:
+# Deprecated in favor of tmpfiles.eclass.
+#
# Invokes systemd-tmpfiles --create with given arguments.
# Does nothing if ROOT != / or systemd-tmpfiles is not in PATH.
# This function should be called from pkg_postinst.
@@ -448,7 +454,7 @@ systemd_tmpfiles_create() {
[[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst"
[[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename"
- [[ ${ROOT} == / ]] || return 0
+ [[ ${ROOT:-/} == / ]] || return 0
type systemd-tmpfiles &> /dev/null || return 0
systemd-tmpfiles --create "${@}"
}
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 6fb3eb941a2c..32996a2f8f71 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -398,10 +398,13 @@ SRC_URI=$(get_gcc_src_uri)
#---->> pkg_pretend <<----
toolchain_pkg_pretend() {
- if ! use_if_iuse cxx ; then
- use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
- use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
- use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
+ if ! _tc_use_if_iuse cxx ; then
+ _tc_use_if_iuse go && \
+ ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
+ _tc_use_if_iuse objc++ && \
+ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
+ _tc_use_if_iuse gcj && \
+ ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
fi
want_minispecs
@@ -461,7 +464,8 @@ toolchain_src_prepare() {
*) die "Update toolchain_src_prepare() for ${EAPI}." ;;
esac
- if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
+ if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \
+ && ! use vanilla ; then
make_gcc_hard
fi
@@ -481,7 +485,7 @@ toolchain_src_prepare() {
fi
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it
- if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then
+ if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then
if tc_version_is_at_least 4.5 ; then
einfo "Copying ecj-4.5.jar"
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
@@ -578,13 +582,13 @@ make_gcc_hard() {
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
if tc_version_is_at_least 6.0 ; then
- if use_if_iuse pie ; then
+ if _tc_use_if_iuse pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi
- if use_if_iuse ssp ; then
+ if _tc_use_if_iuse ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
- if use_if_iuse hardened ; then
+ if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, like:
# -fstack-clash-protection
# -z now
@@ -594,7 +598,7 @@ make_gcc_hard() {
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
else
- if use_if_iuse hardened ; then
+ if _tc_use_if_iuse hardened ; then
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
if hardened_gcc_works ; then
@@ -830,12 +834,12 @@ toolchain_src_configure() {
fi
# Build compiler itself using LTO
- if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
+ if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
confgcc+=( --with-build-config=bootstrap-lto )
fi
# Support to disable pch when building libstdcxx
- if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
+ if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
fi
@@ -1124,13 +1128,13 @@ toolchain_src_configure() {
fi
if tc_version_is_at_least 4.0 ; then
- if use_if_iuse libssp ; then
+ if _tc_use_if_iuse libssp ; then
confgcc+=( --enable-libssp )
else
if hardened_gcc_is_stable ssp; then
export gcc_cv_libc_provides_ssp=yes
fi
- if use_if_iuse ssp; then
+ if _tc_use_if_iuse ssp; then
# On some targets USE="ssp -libssp" is an invalid
# configuration as target libc does not provide
# stack_chk_* functions. Do not disable libssp there.
@@ -1569,7 +1573,7 @@ gcc_do_make() {
# resulting binaries natively ^^;
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
else
- if tc_version_is_at_least 3.3 && use_if_iuse pgo; then
+ if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
else
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
@@ -1623,7 +1627,7 @@ gcc_do_make() {
emake -C gcc gnattools
fi
- if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then
+ if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then
if type -p doxygen > /dev/null ; then
if tc_version_is_at_least 4.3 ; then
cd "${CTARGET}"/libstdc++-v3/doc
@@ -2220,44 +2224,48 @@ gcc-lang-supported() {
has $1 ${TOOLCHAIN_ALLOWED_LANGS}
}
+_tc_use_if_iuse() {
+ in_iuse $1 && use $1
+}
+
is_ada() {
gcc-lang-supported ada || return 1
- use_if_iuse ada
+ _tc_use_if_iuse ada
}
is_cxx() {
gcc-lang-supported 'c++' || return 1
- use_if_iuse cxx
+ _tc_use_if_iuse cxx
}
is_d() {
gcc-lang-supported d || return 1
- use_if_iuse d
+ _tc_use_if_iuse d
}
is_f77() {
gcc-lang-supported f77 || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_f95() {
gcc-lang-supported f95 || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_fortran() {
gcc-lang-supported fortran || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_gcj() {
gcc-lang-supported java || return 1
- use_if_iuse cxx && use_if_iuse gcj
+ _tc_use_if_iuse cxx && _tc_use_if_iuse gcj
}
is_go() {
gcc-lang-supported go || return 1
- use_if_iuse cxx && use_if_iuse go
+ _tc_use_if_iuse cxx && _tc_use_if_iuse go
}
is_jit() {
@@ -2266,22 +2274,22 @@ is_jit() {
# to generate code for a target. On target like avr
# libgcclit.so can't link at all: bug #594572
is_crosscompile && return 1
- use_if_iuse jit
+ _tc_use_if_iuse jit
}
is_multilib() {
tc_version_is_at_least 3 || return 1
- use_if_iuse multilib
+ _tc_use_if_iuse multilib
}
is_objc() {
gcc-lang-supported objc || return 1
- use_if_iuse objc
+ _tc_use_if_iuse objc
}
is_objcxx() {
gcc-lang-supported 'obj-c++' || return 1
- use_if_iuse cxx && use_if_iuse objc++
+ _tc_use_if_iuse cxx && _tc_use_if_iuse objc++
}
# Grab a variable from the build system (taken from linux-info.eclass)
@@ -2306,12 +2314,12 @@ hardened_gcc_works() {
[[ ${CTARGET} == *-freebsd* ]] && return 1
want_pie || return 1
- use_if_iuse nopie && return 1
+ _tc_use_if_iuse nopie && return 1
hardened_gcc_is_stable pie
return $?
elif [[ $1 == "ssp" ]] ; then
[[ -n ${SPECS_VER} ]] || return 1
- use_if_iuse nossp && return 1
+ _tc_use_if_iuse nossp && return 1
hardened_gcc_is_stable ssp
return $?
else
@@ -2349,12 +2357,12 @@ want_minispecs() {
if tc_version_is_at_least 6.0 ; then
return 0
fi
- if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then
+ if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then
if ! want_pie ; then
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
elif use vanilla ; then
ewarn "You will not get hardened features if you have the vanilla USE-flag."
- elif use_if_iuse nopie && use_if_iuse nossp ; then
+ elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then
ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
elif ! hardened_gcc_works ; then
ewarn "Your $(tc-arch) arch is not supported."
@@ -2368,11 +2376,12 @@ want_minispecs() {
}
want_pie() {
- ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1
+ ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \
+ && _tc_use_if_iuse nopie && return 1
[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
tc_version_is_at_least 4.3.2 && return 1
[[ -z ${PIE_VER} ]] && return 1
- use_if_iuse nopie || return 0
+ _tc_use_if_iuse nopie || return 0
return 1
}
diff --git a/eclass/wrapper.eclass b/eclass/wrapper.eclass
new file mode 100644
index 000000000000..399c7cc269d4
--- /dev/null
+++ b/eclass/wrapper.eclass
@@ -0,0 +1,59 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: wrapper.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: create a shell wrapper script
+
+if [[ -z ${_WRAPPER_ECLASS} ]]; then
+_WRAPPER_ECLASS=1
+
+# @FUNCTION: make_wrapper
+# @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
+# @DESCRIPTION:
+# Create a shell wrapper script named wrapper in installpath
+# (defaults to the bindir) to execute target (default of wrapper)
+# by first optionally setting LD_LIBRARY_PATH to the colon-delimited
+# libpaths followed by optionally changing directory to chdir.
+make_wrapper() {
+ local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
+ local tmpwrapper="${T}/tmp.wrapper.${wrapper##*/}"
+ has "${EAPI:-0}" 0 1 2 && local EPREFIX=""
+
+ (
+ echo '#!/bin/sh'
+ if [[ -n ${libdir} ]] ; then
+ local var
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ var=DYLD_LIBRARY_PATH
+ else
+ var=LD_LIBRARY_PATH
+ fi
+ cat <<-EOF
+ if [ "\${${var}+set}" = "set" ] ; then
+ export ${var}="\${${var}}:${EPREFIX}${libdir}"
+ else
+ export ${var}="${EPREFIX}${libdir}"
+ fi
+ EOF
+ fi
+ [[ -n ${chdir} ]] && printf 'cd "%s" &&\n' "${EPREFIX}${chdir}"
+ # We don't want to quote ${bin} so that people can pass complex
+ # things as ${bin} ... "./someprog --args"
+ printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}"
+ ) > "${tmpwrapper}"
+ chmod go+rx "${tmpwrapper}"
+
+ if [[ -n ${path} ]] ; then
+ (
+ exeopts -m 0755
+ exeinto "${path}"
+ newexe "${tmpwrapper}" "${wrapper}"
+ ) || die
+ else
+ newbin "${tmpwrapper}" "${wrapper}" || die
+ fi
+}
+
+fi