mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-01 18:42:22 +02:00
eclass: Drop unused eclasses
This commit is contained in:
parent
2489a9690d
commit
b076f42d73
@ -1,384 +0,0 @@
|
|||||||
# Copyright 1999-2018 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
# @ECLASS: autotools-utils.eclass
|
|
||||||
# @MAINTAINER:
|
|
||||||
# Maciej Mrozowski <reavertm@gentoo.org>
|
|
||||||
# Michał Górny <mgorny@gentoo.org>
|
|
||||||
# @SUPPORTED_EAPIS: 2 3 4 5
|
|
||||||
# @BLURB: common ebuild functions for autotools-based packages
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# autotools-utils.eclass is autotools.eclass(5) and base.eclass(5) wrapper
|
|
||||||
# providing all inherited features along with econf arguments as Bash array,
|
|
||||||
# out of source build with overridable build dir location, static archives
|
|
||||||
# handling, libtool files removal.
|
|
||||||
#
|
|
||||||
# Please note that autotools-utils does not support mixing of its phase
|
|
||||||
# functions with regular econf/emake calls. If necessary, please call
|
|
||||||
# autotools-utils_src_compile instead of the latter.
|
|
||||||
#
|
|
||||||
# @EXAMPLE:
|
|
||||||
# Typical ebuild using autotools-utils.eclass:
|
|
||||||
#
|
|
||||||
# @CODE
|
|
||||||
# EAPI="2"
|
|
||||||
#
|
|
||||||
# inherit autotools-utils
|
|
||||||
#
|
|
||||||
# DESCRIPTION="Foo bar application"
|
|
||||||
# HOMEPAGE="http://example.org/foo/"
|
|
||||||
# SRC_URI="mirror://sourceforge/foo/${P}.tar.bz2"
|
|
||||||
#
|
|
||||||
# LICENSE="LGPL-2.1"
|
|
||||||
# KEYWORDS=""
|
|
||||||
# SLOT="0"
|
|
||||||
# IUSE="debug doc examples qt4 static-libs tiff"
|
|
||||||
#
|
|
||||||
# CDEPEND="
|
|
||||||
# media-libs/libpng:0
|
|
||||||
# qt4? (
|
|
||||||
# dev-qt/qtcore:4
|
|
||||||
# dev-qt/qtgui:4
|
|
||||||
# )
|
|
||||||
# tiff? ( media-libs/tiff:0 )
|
|
||||||
# "
|
|
||||||
# RDEPEND="${CDEPEND}
|
|
||||||
# !media-gfx/bar
|
|
||||||
# "
|
|
||||||
# DEPEND="${CDEPEND}
|
|
||||||
# doc? ( app-doc/doxygen )
|
|
||||||
# "
|
|
||||||
#
|
|
||||||
# # bug 123456
|
|
||||||
# AUTOTOOLS_IN_SOURCE_BUILD=1
|
|
||||||
#
|
|
||||||
# DOCS=(AUTHORS ChangeLog README "Read me.txt" TODO)
|
|
||||||
#
|
|
||||||
# PATCHES=(
|
|
||||||
# "${FILESDIR}/${P}-gcc44.patch" # bug 123458
|
|
||||||
# "${FILESDIR}/${P}-as-needed.patch"
|
|
||||||
# "${FILESDIR}/${P}-unbundle_libpng.patch"
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
# src_configure() {
|
|
||||||
# local myeconfargs=(
|
|
||||||
# $(use_enable debug)
|
|
||||||
# $(use_with qt4)
|
|
||||||
# $(use_enable threads multithreading)
|
|
||||||
# $(use_with tiff)
|
|
||||||
# )
|
|
||||||
# autotools-utils_src_configure
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# src_compile() {
|
|
||||||
# autotools-utils_src_compile
|
|
||||||
# use doc && autotools-utils_src_compile docs
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# src_install() {
|
|
||||||
# use doc && HTML_DOCS=("${BUILD_DIR}/apidocs/html/")
|
|
||||||
# autotools-utils_src_install
|
|
||||||
# if use examples; then
|
|
||||||
# dobin "${BUILD_DIR}"/foo_example{1,2,3} \\
|
|
||||||
# || die 'dobin examples failed'
|
|
||||||
# fi
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# @CODE
|
|
||||||
|
|
||||||
# Keep variable names synced with cmake-utils and the other way around!
|
|
||||||
|
|
||||||
case ${EAPI:-0} in
|
|
||||||
6) die "${ECLASS}.eclass is banned in EAPI ${EAPI}";;
|
|
||||||
4|5) ;;
|
|
||||||
*) die "EAPI=${EAPI} is not supported" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: AUTOTOOLS_AUTORECONF
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Set to a non-empty value before calling inherit to enable running autoreconf
|
|
||||||
# in src_prepare() and adding autotools dependencies.
|
|
||||||
#
|
|
||||||
# This is usually necessary when using live sources or applying patches
|
|
||||||
# modifying configure.ac or Makefile.am files. Note that in the latter case
|
|
||||||
# setting this variable is obligatory even though the eclass will work without
|
|
||||||
# it (to add the necessary dependencies).
|
|
||||||
#
|
|
||||||
# The eclass will try to determine the correct autotools to run including a few
|
|
||||||
# external tools: gettext, glib-gettext, intltool, gtk-doc, gnome-doc-prepare.
|
|
||||||
# If your tool is not supported, please open a bug and we'll add support for it.
|
|
||||||
#
|
|
||||||
# Note that dependencies are added for autoconf, automake and libtool only.
|
|
||||||
# If your package needs one of the external tools listed above, you need to add
|
|
||||||
# appropriate packages to DEPEND yourself.
|
|
||||||
[[ ${AUTOTOOLS_AUTORECONF} ]] || : ${AUTOTOOLS_AUTO_DEPEND:=no}
|
|
||||||
|
|
||||||
# eutils for eqawarn, path_exists
|
|
||||||
inherit autotools epatch eutils libtool ltprune
|
|
||||||
|
|
||||||
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: BUILD_DIR
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Build directory, location where all autotools generated files should be
|
|
||||||
# placed. For out of source builds it defaults to ${WORKDIR}/${P}_build.
|
|
||||||
#
|
|
||||||
# This variable has been called AUTOTOOLS_BUILD_DIR formerly.
|
|
||||||
# It is set under that name for compatibility.
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Set to enable in-source build.
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: ECONF_SOURCE
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Specify location of autotools' configure script. By default it uses ${S}.
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: DOCS
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Array containing documents passed to dodoc command.
|
|
||||||
#
|
|
||||||
# In EAPIs 4+, can list directories as well.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# @CODE
|
|
||||||
# DOCS=( NEWS README )
|
|
||||||
# @CODE
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: HTML_DOCS
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Array containing documents passed to dohtml command.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# @CODE
|
|
||||||
# HTML_DOCS=( doc/html/ )
|
|
||||||
# @CODE
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: PATCHES
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# PATCHES array variable containing all various patches to be applied.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# @CODE
|
|
||||||
# PATCHES=( "${FILESDIR}"/${P}-mypatch.patch )
|
|
||||||
# @CODE
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: AUTOTOOLS_PRUNE_LIBTOOL_FILES
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Sets the mode of pruning libtool files. The values correspond to
|
|
||||||
# prune_libtool_files parameters, with leading dashes stripped.
|
|
||||||
#
|
|
||||||
# Defaults to pruning the libtool files when static libraries are not
|
|
||||||
# installed or can be linked properly without them. Libtool files
|
|
||||||
# for modules (plugins) will be kept in case plugin loader needs them.
|
|
||||||
#
|
|
||||||
# If set to 'modules', the .la files for modules will be removed
|
|
||||||
# as well. This is often the preferred option.
|
|
||||||
#
|
|
||||||
# If set to 'all', all .la files will be removed unconditionally. This
|
|
||||||
# option is discouraged and shall be used only if 'modules' does not
|
|
||||||
# remove the files.
|
|
||||||
#
|
|
||||||
# If set to 'none', no .la files will be pruned ever. Use in corner
|
|
||||||
# cases only.
|
|
||||||
|
|
||||||
# Determine using IN or OUT source build
|
|
||||||
_check_build_dir() {
|
|
||||||
: ${ECONF_SOURCE:=${S}}
|
|
||||||
# Respect both the old variable and the new one, depending
|
|
||||||
# on which one was set by the ebuild.
|
|
||||||
if [[ ! ${BUILD_DIR} && ${AUTOTOOLS_BUILD_DIR} ]]; then
|
|
||||||
eqawarn "The AUTOTOOLS_BUILD_DIR variable has been renamed to BUILD_DIR."
|
|
||||||
eqawarn "Please migrate the ebuild to use the new one."
|
|
||||||
|
|
||||||
# In the next call, both variables will be set already
|
|
||||||
# and we'd have to know which one takes precedence.
|
|
||||||
_RESPECT_AUTOTOOLS_BUILD_DIR=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${_RESPECT_AUTOTOOLS_BUILD_DIR} ]]; then
|
|
||||||
BUILD_DIR=${AUTOTOOLS_BUILD_DIR:-${WORKDIR}/${P}_build}
|
|
||||||
else
|
|
||||||
if [[ -n ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
|
|
||||||
: ${BUILD_DIR:=${ECONF_SOURCE}}
|
|
||||||
else
|
|
||||||
: ${BUILD_DIR:=${WORKDIR}/${P}_build}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Backwards compatibility for getting the value.
|
|
||||||
AUTOTOOLS_BUILD_DIR=${BUILD_DIR}
|
|
||||||
echo ">>> Working in BUILD_DIR: \"${BUILD_DIR}\""
|
|
||||||
}
|
|
||||||
|
|
||||||
# @FUNCTION: autotools-utils_src_prepare
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# The src_prepare function.
|
|
||||||
#
|
|
||||||
# Supporting PATCHES array and user patches. See base.eclass(5) for reference.
|
|
||||||
autotools-utils_src_prepare() {
|
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
|
||||||
|
|
||||||
local want_autoreconf=${AUTOTOOLS_AUTORECONF}
|
|
||||||
|
|
||||||
[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
|
|
||||||
|
|
||||||
at_checksum() {
|
|
||||||
find '(' -name 'Makefile.am' \
|
|
||||||
-o -name 'configure.ac' \
|
|
||||||
-o -name 'configure.in' ')' \
|
|
||||||
-exec cksum {} + | sort -k2
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ ! ${want_autoreconf} ]] && local checksum=$(at_checksum)
|
|
||||||
epatch_user
|
|
||||||
if [[ ! ${want_autoreconf} ]]; then
|
|
||||||
if [[ ${checksum} != $(at_checksum) ]]; then
|
|
||||||
einfo 'Will autoreconfigure due to user patches applied.'
|
|
||||||
want_autoreconf=yep
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ ${want_autoreconf} ]] && eautoreconf
|
|
||||||
elibtoolize --patch-only
|
|
||||||
}
|
|
||||||
|
|
||||||
# @FUNCTION: autotools-utils_src_configure
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# The src_configure function. For out of source build it creates build
|
|
||||||
# directory and runs econf there. Configuration parameters defined
|
|
||||||
# in myeconfargs are passed here to econf. Additionally following USE
|
|
||||||
# flags are known:
|
|
||||||
#
|
|
||||||
# IUSE="static-libs" passes --enable-shared and either --disable-static/--enable-static
|
|
||||||
# to econf respectively.
|
|
||||||
|
|
||||||
# @VARIABLE: myeconfargs
|
|
||||||
# @DEFAULT_UNSET
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Optional econf arguments as Bash array. Should be defined before calling src_configure.
|
|
||||||
# @CODE
|
|
||||||
# src_configure() {
|
|
||||||
# local myeconfargs=(
|
|
||||||
# --disable-readline
|
|
||||||
# --with-confdir="/etc/nasty foo confdir/"
|
|
||||||
# $(use_enable debug cnddebug)
|
|
||||||
# $(use_enable threads multithreading)
|
|
||||||
# )
|
|
||||||
# autotools-utils_src_configure
|
|
||||||
# }
|
|
||||||
# @CODE
|
|
||||||
autotools-utils_src_configure() {
|
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
|
||||||
|
|
||||||
[[ -z ${myeconfargs+1} || $(declare -p myeconfargs) == 'declare -a'* ]] \
|
|
||||||
|| die 'autotools-utils.eclass: myeconfargs has to be an array.'
|
|
||||||
|
|
||||||
# Common args
|
|
||||||
local econfargs=()
|
|
||||||
|
|
||||||
_check_build_dir
|
|
||||||
if "${ECONF_SOURCE}"/configure --help 2>&1 | grep -q '^ *--docdir='; then
|
|
||||||
econfargs+=(
|
|
||||||
--docdir="${EPREFIX}"/usr/share/doc/${PF}
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle static-libs found in IUSE, disable them by default
|
|
||||||
if in_iuse static-libs; then
|
|
||||||
econfargs+=(
|
|
||||||
--enable-shared
|
|
||||||
$(use_enable static-libs static)
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Append user args
|
|
||||||
econfargs+=("${myeconfargs[@]}")
|
|
||||||
|
|
||||||
mkdir -p "${BUILD_DIR}" || die
|
|
||||||
pushd "${BUILD_DIR}" > /dev/null || die
|
|
||||||
econf "${econfargs[@]}" "$@"
|
|
||||||
popd > /dev/null || die
|
|
||||||
}
|
|
||||||
|
|
||||||
# @FUNCTION: autotools-utils_src_compile
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# The autotools src_compile function, invokes emake in specified BUILD_DIR.
|
|
||||||
autotools-utils_src_compile() {
|
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
|
||||||
|
|
||||||
_check_build_dir
|
|
||||||
pushd "${BUILD_DIR}" > /dev/null || die
|
|
||||||
emake "$@" || die 'emake failed'
|
|
||||||
popd > /dev/null || die
|
|
||||||
}
|
|
||||||
|
|
||||||
# @FUNCTION: autotools-utils_src_install
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# The autotools src_install function. Runs emake install, unconditionally
|
|
||||||
# removes unnecessary static libs (based on shouldnotlink libtool property)
|
|
||||||
# and removes unnecessary libtool files when static-libs USE flag is defined
|
|
||||||
# and unset.
|
|
||||||
#
|
|
||||||
# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference.
|
|
||||||
autotools-utils_src_install() {
|
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
|
||||||
|
|
||||||
_check_build_dir
|
|
||||||
pushd "${BUILD_DIR}" > /dev/null || die
|
|
||||||
emake DESTDIR="${D}" "$@" install || die "emake install failed"
|
|
||||||
popd > /dev/null || die
|
|
||||||
|
|
||||||
# XXX: support installing them from builddir as well?
|
|
||||||
if declare -p DOCS &>/dev/null; then
|
|
||||||
# an empty list == don't install anything
|
|
||||||
if [[ ${DOCS[@]} ]]; then
|
|
||||||
# dies by itself
|
|
||||||
dodoc -r "${DOCS[@]}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local f
|
|
||||||
# same list as in PMS
|
|
||||||
for f in README* ChangeLog AUTHORS NEWS TODO CHANGES \
|
|
||||||
THANKS BUGS FAQ CREDITS CHANGELOG; do
|
|
||||||
if [[ -s ${f} ]]; then
|
|
||||||
dodoc "${f}" || die "(default) dodoc ${f} failed"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [[ ${HTML_DOCS} ]]; then
|
|
||||||
dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove libtool files and unnecessary static libs
|
|
||||||
local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES}
|
|
||||||
if [[ ${prune_ltfiles} != none ]]; then
|
|
||||||
prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# @FUNCTION: autotools-utils_src_test
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# The autotools src_test function. Runs emake check in build directory.
|
|
||||||
autotools-utils_src_test() {
|
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
|
||||||
|
|
||||||
_check_build_dir
|
|
||||||
pushd "${BUILD_DIR}" > /dev/null || die
|
|
||||||
|
|
||||||
if make -ni check "${@}" &>/dev/null; then
|
|
||||||
emake check "${@}" || die 'emake check failed.'
|
|
||||||
elif make -ni test "${@}" &>/dev/null; then
|
|
||||||
emake test "${@}" || die 'emake test failed.'
|
|
||||||
fi
|
|
||||||
|
|
||||||
popd > /dev/null || die
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
# Copyright 1999-2017 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
# @ECLASS: epunt-cxx.eclass
|
|
||||||
# @MAINTAINER:
|
|
||||||
# base-system@gentoo.org
|
|
||||||
# @BLURB: A function to punt C++ compiler checks from autoconf
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Support for punting C++ compiler checks from autoconf (based
|
|
||||||
# on ELT-patches).
|
|
||||||
|
|
||||||
if [[ -z ${_EPUNT_CXX_ECLASS} ]]; then
|
|
||||||
|
|
||||||
# eutils for eqawarn
|
|
||||||
inherit eutils
|
|
||||||
|
|
||||||
DEPEND=">=app-portage/elt-patches-20170317"
|
|
||||||
|
|
||||||
# @FUNCTION: epunt_cxx
|
|
||||||
# @USAGE: [dir to scan]
|
|
||||||
# @DESCRIPTION:
|
|
||||||
# Many configure scripts wrongly bail when a C++ compiler could not be
|
|
||||||
# detected. If dir is not specified, then it defaults to ${S}.
|
|
||||||
#
|
|
||||||
# https://bugs.gentoo.org/73450
|
|
||||||
epunt_cxx() {
|
|
||||||
local dir=$1
|
|
||||||
[[ -z ${dir} ]] && dir=${S}
|
|
||||||
ebegin "Removing useless C++ checks"
|
|
||||||
local f p any_found
|
|
||||||
while IFS= read -r -d '' f; do
|
|
||||||
for p in "${EPREFIX}/usr/share/elt-patches"/nocxx/*.patch ; do
|
|
||||||
if patch --no-backup-if-mismatch -p1 "${f}" "${p}" >/dev/null ; then
|
|
||||||
any_found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done < <(find "${dir}" -name configure -print0)
|
|
||||||
|
|
||||||
if [[ -z ${any_found} ]]; then
|
|
||||||
eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt)."
|
|
||||||
fi
|
|
||||||
eend 0
|
|
||||||
}
|
|
||||||
|
|
||||||
_EPUNT_CXX_ECLASS=1
|
|
||||||
fi #_EPUNT_CXX_ECLASS
|
|
@ -1,381 +0,0 @@
|
|||||||
# 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-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.
|
|
||||||
#
|
|
||||||
# Note that since this eclass always inherits lua-utils as well, in ebuilds
|
|
||||||
# using the former there is no need to explicitly inherit the latter in order
|
|
||||||
# to use helper functions such as lua_get_CFLAGS.
|
|
||||||
#
|
|
||||||
# @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
|
|
||||||
|
|
||||||
if [[ ${_LUA_SINGLE_R0} ]]; then
|
|
||||||
die 'lua.eclass cannot be used with lua-single.eclass.'
|
|
||||||
fi
|
|
||||||
|
|
||||||
inherit multibuild lua-utils
|
|
||||||
|
|
||||||
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: 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_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_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 "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
_LUA_R0=1
|
|
||||||
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
|
|
Loading…
x
Reference in New Issue
Block a user