eclass: Drop unused eclasses

Drop also some eclass tests, so the unused eclasses won't show up in
grep or else.
This commit is contained in:
Krzesimir Nowak 2022-02-25 08:36:52 +01:00
parent 62c13ee678
commit 6301a72bbd
10 changed files with 0 additions and 2044 deletions

View File

@ -1,178 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: chromium-2.eclass
# @MAINTAINER:
# Chromium Herd <chromium@gentoo.org>
# @AUTHOR:
# Mike Gilbert <floppym@gentoo.org>
# @BLURB: Shared functions for chromium and google-chrome
inherit eutils linux-info
if [[ ${PN} == chromium ]]; then
IUSE+=" custom-cflags"
fi
# @FUNCTION: chromium_suid_sandbox_check_kernel_config
# @USAGE:
# @DESCRIPTION:
# Ensures the system kernel supports features needed for SUID sandbox to work.
chromium_suid_sandbox_check_kernel_config() {
has "${EAPI:-0}" 0 1 2 3 && die "EAPI=${EAPI} is not supported"
if [[ "${MERGE_TYPE}" == "source" || "${MERGE_TYPE}" == "binary" ]]; then
# Warn if the kernel does not support features needed for sandboxing.
# Bug #363987.
ERROR_PID_NS="PID_NS is required for sandbox to work"
ERROR_NET_NS="NET_NS is required for sandbox to work"
ERROR_USER_NS="USER_NS is required for sandbox to work"
ERROR_SECCOMP_FILTER="SECCOMP_FILTER is required for sandbox to work"
# Warn if the kernel does not support features needed for the browser to work
# (bug #552576, bug #556286).
ERROR_ADVISE_SYSCALLS="CONFIG_ADVISE_SYSCALLS is required for the renderer (bug #552576)"
ERROR_COMPAT_VDSO="CONFIG_COMPAT_VDSO causes segfaults (bug #556286)"
ERROR_GRKERNSEC="CONFIG_GRKERNSEC breaks sandbox (bug #613668)"
CONFIG_CHECK="~PID_NS ~NET_NS ~SECCOMP_FILTER ~USER_NS ~ADVISE_SYSCALLS ~!COMPAT_VDSO ~!GRKERNSEC"
check_extra_config
fi
}
# @ECLASS-VARIABLE: CHROMIUM_LANGS
# @DEFAULT_UNSET
# @DESCRIPTION:
# List of language packs available for this package.
_chromium_set_l10n_IUSE() {
[[ ${EAPI:-0} == 0 ]] && die "EAPI=${EAPI} is not supported"
local lang
for lang in ${CHROMIUM_LANGS}; do
# Default to enabled since we bundle them anyway.
# USE-expansion will take care of disabling the langs the user has not
# selected via L10N.
IUSE+=" +l10n_${lang}"
done
}
if [[ ${CHROMIUM_LANGS} ]]; then
_chromium_set_l10n_IUSE
fi
# @FUNCTION: chromium_remove_language_paks
# @USAGE:
# @DESCRIPTION:
# Removes pak files from the current directory for languages that the user has
# not selected via the L10N variable.
# Also performs QA checks to ensure CHROMIUM_LANGS has been set correctly.
chromium_remove_language_paks() {
local lang pak
# Look for missing pak files.
for lang in ${CHROMIUM_LANGS}; do
if [[ ! -e ${lang}.pak ]]; then
eqawarn "L10N warning: no .pak file for ${lang} (${lang}.pak not found)"
fi
done
# Bug 588198
rm -f fake-bidi.pak || die
rm -f fake-bidi.pak.info || die
# Look for extra pak files.
# Remove pak files that the user does not want.
for pak in *.pak; do
lang=${pak%.pak}
if [[ ${lang} == en-US ]]; then
continue
fi
if ! has ${lang} ${CHROMIUM_LANGS}; then
eqawarn "L10N warning: no ${lang} in LANGS"
continue
fi
if ! use l10n_${lang}; then
rm "${pak}" || die
rm -f "${pak}.info" || die
fi
done
}
chromium_pkg_die() {
if [[ "${EBUILD_PHASE}" != "compile" ]]; then
return
fi
# Prevent user problems like bug #348235.
if ( shopt -s extglob; is-flagq '-g?(gdb)?([1-9])' ); then
ewarn
ewarn "You have enabled debug info (i.e. -g or -ggdb in your CFLAGS/CXXFLAGS)."
ewarn "This produces very large build files causes the linker to consume large"
ewarn "amounts of memory."
ewarn
ewarn "Please try removing -g{,gdb} before reporting a bug."
ewarn
fi
# ccache often causes bogus compile failures, especially when the cache gets
# corrupted.
if has ccache ${FEATURES}; then
ewarn
ewarn "You have enabled ccache. Please try disabling ccache"
ewarn "before reporting a bug."
ewarn
fi
# No ricer bugs.
if use_if_iuse custom-cflags; then
ewarn
ewarn "You have enabled the custom-cflags USE flag."
ewarn "Please disable it before reporting a bug."
ewarn
fi
# If the system doesn't have enough memory, the compilation is known to
# fail. Print info about memory to recognize this condition.
einfo
einfo "$(grep MemTotal /proc/meminfo)"
einfo "$(grep SwapTotal /proc/meminfo)"
einfo
}
# @VARIABLE: EGYP_CHROMIUM_COMMAND
# @DESCRIPTION:
# Path to the gyp_chromium script.
: ${EGYP_CHROMIUM_COMMAND:=build/gyp_chromium}
# @VARIABLE: EGYP_CHROMIUM_DEPTH
# @DESCRIPTION:
# Depth for egyp_chromium.
: ${EGYP_CHROMIUM_DEPTH:=.}
# @FUNCTION: egyp_chromium
# @USAGE: [gyp arguments]
# @DESCRIPTION:
# Calls EGYP_CHROMIUM_COMMAND with depth EGYP_CHROMIUM_DEPTH and given
# arguments. The full command line is echoed for logging.
egyp_chromium() {
set -- "${EGYP_CHROMIUM_COMMAND}" --depth="${EGYP_CHROMIUM_DEPTH}" "$@"
echo "$@"
"$@"
}
# @FUNCTION: gyp_use
# @USAGE: <USE flag> [GYP flag] [true suffix] [false suffix]
# @DESCRIPTION:
# If USE flag is set, echo -D[GYP flag]=[true suffix].
#
# If USE flag is not set, echo -D[GYP flag]=[false suffix].
#
# [GYP flag] defaults to use_[USE flag] with hyphens converted to underscores.
#
# [true suffix] defaults to 1. [false suffix] defaults to 0.
gyp_use() {
local gypflag="-D${2:-use_${1//-/_}}="
usex "$1" "${gypflag}" "${gypflag}" "${3-1}" "${4-0}"
}

View File

@ -1,201 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
case "${EAPI:-0}" in
0|1|2|3|4)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
5|6|7)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
;;
esac
# @ECLASS: cuda.eclass
# @MAINTAINER:
# Justin Lecher <jlec@gentoo.org>
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Common functions for cuda packages
# @DESCRIPTION:
# This eclass contains functions to be used with cuda package. Currently it is
# setting and/or sanitizing NVCCFLAGS, the compiler flags for nvcc. This is
# automatically done and exported in src_prepare() or manually by calling
# cuda_sanatize.
# @EXAMPLE:
# inherit cuda
if [[ -z ${_CUDA_ECLASS} ]]; then
inherit flag-o-matic toolchain-funcs
[[ ${EAPI} == [56] ]] && inherit eapi7-ver
# @ECLASS-VARIABLE: NVCCFLAGS
# @DESCRIPTION:
# nvcc compiler flags (see nvcc --help), which should be used like
# CFLAGS for c compiler
: ${NVCCFLAGS:=-O2}
# @ECLASS-VARIABLE: CUDA_VERBOSE
# @DESCRIPTION:
# Being verbose during compilation to see underlying commands
: ${CUDA_VERBOSE:=true}
# @FUNCTION: cuda_gccdir
# @USAGE: [-f]
# @RETURN: gcc bindir compatible with current cuda, optionally (-f) prefixed with "--compiler-bindir "
# @DESCRIPTION:
# Helper for determination of the latest gcc bindir supported by
# then current nvidia cuda toolkit.
#
# Example:
# @CODE
# cuda_gccdir -f
# -> --compiler-bindir "/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3"
# @CODE
cuda_gccdir() {
debug-print-function ${FUNCNAME} "$@"
local dirs gcc_bindir ver vers="" flag
# Currently we only support the gnu compiler suite
if ! tc-is-gcc ; then
ewarn "Currently we only support the gnu compiler suite"
return 2
fi
while [[ "$1" ]]; do
case $1 in
-f)
flag="--compiler-bindir "
;;
*)
;;
esac
shift
done
if ! vers="$(cuda-config -s)"; then
eerror "Could not execute cuda-config"
eerror "Make sure >=dev-util/nvidia-cuda-toolkit-4.2.9-r1 is installed"
die "cuda-config not found"
fi
if [[ -z ${vers} ]]; then
die "Could not determine supported gcc versions from cuda-config"
fi
# Try the current gcc version first
ver=$(gcc-version)
if [[ -n "${ver}" ]] && [[ ${vers} =~ ${ver} ]]; then
dirs=( ${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/${ver}*/ )
gcc_bindir="${dirs[${#dirs[@]}-1]}"
fi
if [[ -z ${gcc_bindir} ]]; then
ver=$(best_version "sys-devel/gcc")
ver=$(ver_cut 1-2 "${ver##*sys-devel/gcc-}")
if [[ -n "${ver}" ]] && [[ ${vers} =~ ${ver} ]]; then
dirs=( ${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/${ver}*/ )
gcc_bindir="${dirs[${#dirs[@]}-1]}"
fi
fi
for ver in ${vers}; do
if has_version "=sys-devel/gcc-${ver}*"; then
dirs=( ${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/${ver}*/ )
gcc_bindir="${dirs[${#dirs[@]}-1]}"
fi
done
if [[ -n ${gcc_bindir} ]]; then
if [[ -n ${flag} ]]; then
echo "${flag}\"${gcc_bindir%/}\""
else
echo "${gcc_bindir%/}"
fi
return 0
else
eerror "Only gcc version(s) ${vers} are supported,"
eerror "of which none is installed"
die "Only gcc version(s) ${vers} are supported"
return 1
fi
}
# @FUNCTION: cuda_sanitize
# @DESCRIPTION:
# Correct NVCCFLAGS by adding the necessary reference to gcc bindir and
# passing CXXFLAGS to underlying compiler without disturbing nvcc.
cuda_sanitize() {
debug-print-function ${FUNCNAME} "$@"
local rawldflags=$(raw-ldflags)
# Be verbose if wanted
[[ "${CUDA_VERBOSE}" == true ]] && NVCCFLAGS+=" -v"
# Tell nvcc where to find a compatible compiler
NVCCFLAGS+=" $(cuda_gccdir -f)"
# Tell nvcc which flags should be used for underlying C compiler
NVCCFLAGS+=" --compiler-options \"${CXXFLAGS}\" --linker-options \"${rawldflags// /,}\""
debug-print "Using ${NVCCFLAGS} for cuda"
export NVCCFLAGS
}
# @FUNCTION: cuda_add_sandbox
# @USAGE: [-w]
# @DESCRIPTION:
# Add nvidia dev nodes to the sandbox predict list.
# with -w, add to the sandbox write list.
cuda_add_sandbox() {
debug-print-function ${FUNCNAME} "$@"
local i
for i in /dev/nvidia*; do
if [[ $1 == '-w' ]]; then
addwrite $i
else
addpredict $i
fi
done
}
# @FUNCTION: cuda_toolkit_version
# @DESCRIPTION:
# echo the installed version of dev-util/nvidia-cuda-toolkit
cuda_toolkit_version() {
debug-print-function ${FUNCNAME} "$@"
local v
v="$(best_version dev-util/nvidia-cuda-toolkit)"
v="${v##*cuda-toolkit-}"
ver_cut 1-2 "${v}"
}
# @FUNCTION: cuda_cudnn_version
# @DESCRIPTION:
# echo the installed version of dev-libs/cudnn
cuda_cudnn_version() {
debug-print-function ${FUNCNAME} "$@"
local v
v="$(best_version dev-libs/cudnn)"
v="${v##*cudnn-}"
ver_cut 1-2 "${v}"
}
# @FUNCTION: cuda_src_prepare
# @DESCRIPTION:
# Sanitise and export NVCCFLAGS by default
cuda_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
cuda_sanitize
}
EXPORT_FUNCTIONS src_prepare
_CUDA_ECLASS=1
fi

View File

@ -1,151 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: mate.eclass
# @MAINTAINER:
# mate@gentoo.org
# @AUTHOR:
# Authors: NP-Hardass <NP-Hardass@gentoo.org> based upon the gnome2
# and autotools-utils eclasses
# @SUPPORTED_EAPIS: 6
# @BLURB: Provides phases for MATE based packages.
# @DESCRIPTION:
# Exports portage base functions used by ebuilds written for packages using the
# MATE framework. Occassionally acts as a wrapper to gnome2 due to the
# fact that MATE is a GNOME fork. For additional functions, see gnome2-utils.eclass.
# Check EAPI only
case "${EAPI:-0}" in
6) ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
# Inherit happens below after declaration of GNOME2_LA_PUNT
# @ECLASS-VARIABLE: MATE_LA_PUNT
# @DESCRIPTION:
# Available values for MATE_LA_PUNT:
# - "no": will not clean any .la files
# - "yes": will run prune_libtool_files --modules
# - If it is not set, it will run prune_libtool_files
# MATE_LA_PUNT is a stub to GNOME2_LA_PUNT
GNOME2_LA_PUNT=${MATE_LA_PUNT:-""}
inherit gnome2 autotools mate-desktop.org
case "${EAPI:-0}" in
6) EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
# Autotools requires our MATE m4 files
DEPEND=">=mate-base/mate-common-${MATE_BRANCH}"
# @FUNCTION: mate_py_cond_func_wrap
# @DESCRIPTION:
# Wraps a function for conditional python use, to run for each
# python implementation in the build directory.
# This function should only be used if the ebuild also inherits the
# python-r1 eclass
mate_py_cond_func_wrap() {
if [[ ! ${_PYTHON_R1} ]]; then
die "This function requires the inheritence of the python-r1 eclass"
fi
if use python; then
python_foreach_impl run_in_build_dir "$@"
else
$@
fi
}
# @ECLASS-VARIABLE: MATE_FORCE_AUTORECONF
# @DESCRIPTION:
# Available values for MATE_FORCE_AUTORECONF:
# - true: will always run eautoreconf
# - false: will default to automatic detect
# - If it is not set, it will default to false
: ${MATE_FORCE_AUTORECONF:="false"}
# @FUNCTION: ematedocize
# @DESCRIPTION:
# A wrapper around mate-doc-common
ematedocize() {
ebegin "Running mate-doc-common --copy"
mate-doc-common --copy || die
eend $?
}
# @FUNCTION: want_mate_doc
# @DESCRIPTION:
# Returns true/false based on whether eautoreconf should call
# ematedocize
want_mate_doc() {
grep -q USE_COMMON_DOC_BUILD autogen.sh
}
# @FUNCTION: mate_src_prepare
# @DESCRIPTION:
# Call gnome2_src_prepare to handle environment setup and patching, then
# call eautoreconf if necessary
mate_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
local force_autoreconf=${MATE_FORCE_AUTORECONF}
[[ ${PV} == 9999 ]] && force_autoreconf="true"
gen_chksum() {
find '(' -name 'Makefile.am' \
-o -name 'configure.ac' \
-o -name 'configure.in' ')' \
-exec cksum {} + | sort -k2
}
local chksum=$(gen_chksum)
gnome2_src_prepare "$@"
if [[ "${force_autoreconf}" == "true" ]] || [[ ${chksum} != $(gen_chksum) ]]; then
want_mate_doc && ematedocize
AT_NOELIBTOOLIZE="yes" eautoreconf # gnome2_src_prepare calls elibtoolize
fi
}
# @FUNCTION: mate_src_configure
# @DESCRIPTION:
# MATE specific configure handling
# Stub to gnome2_src_configure()
mate_src_configure() {
gnome2_src_configure "$@"
}
# @FUNCTION: mate_src_install
# @DESCRIPTION:
# MATE specific install. Stub to gnome2_src_install
mate_src_install() {
gnome2_src_install "$@"
}
# @FUNCTION: mate_pkg_preinst
# @DESCRIPTION:
# Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst
# Stub to gnome2_pkg_preinst
mate_pkg_preinst() {
gnome2_pkg_preinst "$@"
}
# @FUNCTION: mate_pkg_postinst
# @DESCRIPTION:
# Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime
# database updates.
# Stub to gnome2_pkg_postinst
mate_pkg_postinst() {
gnome2_pkg_postinst "$@"
}
# @FUNCTION: mate_pkg_postrm
# @DESCRIPTION:
# Handle scrollkeeper, GSettings, Icons, desktop and mime database updates.
# Stub to gnome2_pkg_postrm
mate_pkg_postrm() {
gnome2_pkg_postrm "$@"
}

View File

@ -1,85 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: php-ext-pecl-r3.eclass
# @MAINTAINER:
# Gentoo PHP team <php-bugs@gentoo.org>
# @BLURB: A uniform way to install PECL extensions
# @DESCRIPTION:
# This eclass should be used by all dev-php/pecl-* ebuilds as a uniform
# way of installing PECL extensions. For more information about PECL,
# see https://pecl.php.net/
# @ECLASS-VARIABLE: PHP_EXT_PECL_PKG
# @DESCRIPTION:
# Set in ebuild before inheriting this eclass if the tarball name
# differs from ${PN/pecl-/} so that SRC_URI and HOMEPAGE get set
# correctly by the eclass.
#
# Setting this variable manually also affects PHP_EXT_NAME and ${S}
# unless you override those in ebuild. If that is not desired, please
# use PHP_EXT_PECL_FILENAME instead.
[[ -z "${PHP_EXT_PECL_PKG}" ]] && PHP_EXT_PECL_PKG="${PN/pecl-/}"
# @ECLASS-VARIABLE: PHP_EXT_PECL_FILENAME
# @DEFAULT_UNSET
# @DESCRIPTION:
# Set in ebuild before inheriting this eclass if the tarball name
# differs from "${PN/pecl-/}-${PV}.tgz" so that SRC_URI gets set
# correctly by the eclass.
#
# Unlike PHP_EXT_PECL_PKG, setting this variable does not affect
# HOMEPAGE, PHP_EXT_NAME or ${S}.
# Set PHP_EXT_NAME for php-ext-source-r3.eclass.
[[ -z "${PHP_EXT_NAME}" ]] && PHP_EXT_NAME="${PHP_EXT_PECL_PKG}"
# Try to guess the upstream name of the package/version. We only use
# this variable temporarily before unsetting it.
PHP_EXT_PECL_PKG_V="${PHP_EXT_PECL_PKG}-${PV/_/}"
# It's important that we determine and set $S before we inherit below.
S="${WORKDIR}/${PHP_EXT_PECL_PKG_V}"
inherit php-ext-source-r3
EXPORT_FUNCTIONS src_install src_test
if [[ -z "${PHP_EXT_PECL_FILENAME}" ]] ; then
SRC_URI="https://pecl.php.net/get/${PHP_EXT_PECL_PKG_V}.tgz"
else
SRC_URI="https://pecl.php.net/get/${PHP_EXT_PECL_FILENAME}"
fi
# Don't leave this laying around in the environment.
unset PHP_EXT_PECL_PKG_V
HOMEPAGE="https://pecl.php.net/${PHP_EXT_PECL_PKG}"
# @FUNCTION: php-ext-pecl-r3_src_install
# @DESCRIPTION:
# Install a standard PECL package. First we delegate to
# php-ext-source-r3.eclass, and then we attempt to install examples
# found in a standard location.
php-ext-pecl-r3_src_install() {
php-ext-source-r3_src_install
if in_iuse examples && use examples ; then
dodoc -r examples
fi
}
# @FUNCTION: php-ext-pecl-r3_src_test
# @DESCRIPTION:
# Run tests delivered with the PECL package. Phpize will have generated
# a run-tests.php file to be executed by `make test`. We only need to
# force the test suite to run in non-interactive mode.
php-ext-pecl-r3_src_test() {
for slot in $(php_get_slots); do
php_init_slot_env "${slot}"
NO_INTERACTION="yes" emake test
done
}

View File

@ -1,259 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: rebar.eclass
# @MAINTAINER:
# Amadeusz Żołnowski <aidecoe@gentoo.org>
# @AUTHOR:
# Amadeusz Żołnowski <aidecoe@gentoo.org>
# @SUPPORTED_EAPIS: 6
# @BLURB: Build Erlang/OTP projects using dev-util/rebar.
# @DESCRIPTION:
# An eclass providing functions to build Erlang/OTP projects using
# dev-util/rebar.
#
# rebar is a tool which tries to resolve dependencies itself which is by
# cloning remote git repositories. Dependant projects are usually expected to
# be in sub-directory 'deps' rather than looking at system Erlang lib
# directory. Projects relying on rebar usually don't have 'install' make
# targets. The eclass workarounds some of these problems. It handles
# installation in a generic way for Erlang/OTP structured projects.
case "${EAPI:-0}" in
0|1|2|3|4|5)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
6)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
;;
esac
EXPORT_FUNCTIONS src_prepare src_compile src_test src_install
RDEPEND="dev-lang/erlang"
DEPEND="${RDEPEND}
dev-util/rebar
>=sys-apps/gawk-4.1"
# @ECLASS-VARIABLE: REBAR_APP_SRC
# @DESCRIPTION:
# Relative path to .app.src description file.
REBAR_APP_SRC="${REBAR_APP_SRC-src/${PN}.app.src}"
# @FUNCTION: get_erl_libs
# @RETURN: the path to Erlang lib directory
# @DESCRIPTION:
# Get the full path without EPREFIX to Erlang lib directory.
get_erl_libs() {
echo "/usr/$(get_libdir)/erlang/lib"
}
# @FUNCTION: _rebar_find_dep
# @INTERNAL
# @USAGE: <project_name>
# @RETURN: full path with EPREFIX to a Erlang package/project on success,
# code 1 when dependency is not found and code 2 if multiple versions of
# dependency are found.
# @DESCRIPTION:
# Find a Erlang package/project by name in Erlang lib directory. Project
# directory is usually suffixed with version. It is matched to '<project_name>'
# or '<project_name>-*'.
_rebar_find_dep() {
local pn="$1"
local p
local result
pushd "${EPREFIX}$(get_erl_libs)" >/dev/null || return 1
for p in ${pn} ${pn}-*; do
if [[ -d ${p} ]]; then
# Ensure there's at most one matching.
[[ ${result} ]] && return 2
result="${p}"
fi
done
popd >/dev/null || die
[[ ${result} ]] || return 1
echo "${result}"
}
# @FUNCTION: rebar_disable_coverage
# @USAGE: [<rebar_config>]
# @DESCRIPTION:
# Disable coverage in rebar.config. This is a workaround for failing coverage.
# Coverage is not relevant in this context, so there's no harm to disable it,
# although the issue should be fixed.
rebar_disable_coverage() {
debug-print-function ${FUNCNAME} "${@}"
local rebar_config="${1:-rebar.config}"
sed -e 's/{cover_enabled, true}/{cover_enabled, false}/' \
-i "${rebar_config}" \
|| die "failed to disable coverage in ${rebar_config}"
}
# @FUNCTION: erebar
# @USAGE: <targets>
# @DESCRIPTION:
# Run rebar with verbose flag. Die on failure.
erebar() {
debug-print-function ${FUNCNAME} "${@}"
(( $# > 0 )) || die "erebar: at least one target is required"
local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
rebar -v skip_deps=true "$@" || die -n "rebar $@ failed"
}
# @FUNCTION: rebar_fix_include_path
# @USAGE: <project_name> [<rebar_config>]
# @DESCRIPTION:
# Fix path in rebar.config to 'include' directory of dependant project/package,
# so it points to installation in system Erlang lib rather than relative 'deps'
# directory.
#
# <rebar_config> is optional. Default is 'rebar.config'.
#
# The function dies on failure.
rebar_fix_include_path() {
debug-print-function ${FUNCNAME} "${@}"
local pn="$1"
local rebar_config="${2:-rebar.config}"
local erl_libs="${EPREFIX}$(get_erl_libs)"
local p
p="$(_rebar_find_dep "${pn}")" \
|| die "failed to unambiguously resolve dependency of '${pn}'"
gawk -i inplace \
-v erl_libs="${erl_libs}" -v pn="${pn}" -v p="${p}" '
/^{[[:space:]]*erl_opts[[:space:]]*,/, /}[[:space:]]*\.$/ {
pattern = "\"(./)?deps/" pn "/include\"";
if (match($0, "{i,[[:space:]]*" pattern "[[:space:]]*}")) {
sub(pattern, "\"" erl_libs "/" p "/include\"");
}
print $0;
next;
}
1
' "${rebar_config}" || die "failed to fix include paths in ${rebar_config} for '${pn}'"
}
# @FUNCTION: rebar_remove_deps
# @USAGE: [<rebar_config>]
# @DESCRIPTION:
# Remove dependencies list from rebar.config and deceive build rules that any
# dependencies are already fetched and built. Otherwise rebar tries to fetch
# dependencies and compile them.
#
# <rebar_config> is optional. Default is 'rebar.config'.
#
# The function dies on failure.
rebar_remove_deps() {
debug-print-function ${FUNCNAME} "${@}"
local rebar_config="${1:-rebar.config}"
mkdir -p "${S}/deps" && :>"${S}/deps/.got" && :>"${S}/deps/.built" || die
gawk -i inplace '
/^{[[:space:]]*deps[[:space:]]*,/, /}[[:space:]]*\.$/ {
if ($0 ~ /}[[:space:]]*\.$/) {
print "{deps, []}.";
}
next;
}
1
' "${rebar_config}" || die "failed to remove deps from ${rebar_config}"
}
# @FUNCTION: rebar_set_vsn
# @USAGE: [<version>]
# @DESCRIPTION:
# Set version in project description file if it's not set.
#
# <version> is optional. Default is PV stripped from version suffix.
#
# The function dies on failure.
rebar_set_vsn() {
debug-print-function ${FUNCNAME} "${@}"
local version="${1:-${PV%_*}}"
sed -e "s/vsn, git/vsn, \"${version}\"/" \
-i "${S}/${REBAR_APP_SRC}" \
|| die "failed to set version in src/${PN}.app.src"
}
# @FUNCTION: rebar_src_prepare
# @DESCRIPTION:
# Prevent rebar from fetching and compiling dependencies. Set version in
# project description file if it's not set.
#
# Existence of rebar.config is optional, but file description file must exist
# at 'src/${PN}.app.src'.
rebar_src_prepare() {
debug-print-function ${FUNCNAME} "${@}"
default
rebar_set_vsn
if [[ -f rebar.config ]]; then
rebar_disable_coverage
rebar_remove_deps
fi
}
# @FUNCTION: rebar_src_configure
# @DESCRIPTION:
# Configure with ERL_LIBS set.
rebar_src_configure() {
debug-print-function ${FUNCNAME} "${@}"
local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
default
}
# @FUNCTION: rebar_src_compile
# @DESCRIPTION:
# Compile project with rebar.
rebar_src_compile() {
debug-print-function ${FUNCNAME} "${@}"
erebar compile
}
# @FUNCTION: rebar_src_test
# @DESCRIPTION:
# Run unit tests.
rebar_src_test() {
debug-print-function ${FUNCNAME} "${@}"
erebar eunit
}
# @FUNCTION: rebar_src_install
# @DESCRIPTION:
# Install BEAM files, include headers, executables and native libraries.
# Install standard docs like README or defined in DOCS variable.
#
# Function expects that project conforms to Erlang/OTP structure.
rebar_src_install() {
debug-print-function ${FUNCNAME} "${@}"
local bin
local dest="$(get_erl_libs)/${P}"
insinto "${dest}"
doins -r ebin
[[ -d include ]] && doins -r include
[[ -d bin ]] && for bin in bin/*; do dobin "$bin"; done
if [[ -d priv ]]; then
cp -pR priv "${ED}${dest}/" || die "failed to install priv/"
fi
einstalldocs
}

View File

@ -1,181 +0,0 @@
#!/bin/bash
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
EAPI=6
inherit rebar
EPREFIX="${tmpdir}/fakeroot"
S="${WORKDIR}/${P}"
setup() {
mkdir -p "${S}" || die
for pkg in foo-0.1.0 bar-0.1.0; do
mkdir -p "${EPREFIX}$(get_erl_libs)/${pkg}/include" || die
done
cat <<EOF >"${S}/typical.config" || die
%%% Comment
{erl_opts, [debug_info, {src_dirs, ["src"]},
{i, "include"},
{i, "deps/foo/include"},
{i, "../foo/include"}]}.
{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
EOF
cat <<EOF >"${S}/typical.config.expected" || die
%%% Comment
{erl_opts, [debug_info, {src_dirs, ["src"]},
{i, "include"},
{i, "${EPREFIX}$(get_erl_libs)/foo-0.1.0/include"},
{i, "../foo/include"}]}.
{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
EOF
cat <<EOF >"${S}/inc_one_line.config" || die
%%% Comment
{erl_opts, [debug_info, {src_dirs, ["src"]}, {i, "include"}, {i, "deps/foo/include"}, {i, "../foo/include"}]}.
{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
EOF
cat <<EOF >"${S}/inc_one_line.config.expected" || die
%%% Comment
{erl_opts, [debug_info, {src_dirs, ["src"]}, {i, "include"}, {i, "${EPREFIX}$(get_erl_libs)/foo-0.1.0/include"}, {i, "../foo/include"}]}.
{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
EOF
}
test_typical_config() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp typical.config rebar.config || die
# Run unit
(rebar_fix_include_path foo)
unit_rc=$?
# Test result
diff rebar.config typical.config.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
test_typical_config_with_different_name() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp typical.config other.config || die
# Run unit
(rebar_fix_include_path foo other.config)
unit_rc=$?
# Test result
diff other.config typical.config.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
test_multiple_versions() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp typical.config rebar.config || die
mkdir -p "${EPREFIX}$(get_erl_libs)/foo-1.0.0/include" || die
# Run unit
(rebar_fix_include_path foo 2>/dev/null)
unit_rc=$?
# Test result
diff rebar.config typical.config
diff_rc=$?
# Clean up
rm -r "${EPREFIX}$(get_erl_libs)/foo-1.0.0" || die
[[ ${unit_rc}${diff_rc} = 10 ]]
}
test_not_found() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp typical.config rebar.config || die
# Run unit
(rebar_fix_include_path fo 2>/dev/null)
unit_rc=$?
# Test result
diff rebar.config typical.config
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 10 ]]
}
test_includes_in_one_line() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp inc_one_line.config rebar.config || die
# Run unit
(rebar_fix_include_path foo)
unit_rc=$?
# Test result
diff rebar.config inc_one_line.config.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
setup
tbegin "rebar_fix_include_path deals with typical config"
test_typical_config
tend $?
tbegin "rebar_fix_include_path deals with typical config with different name"
test_typical_config_with_different_name
tend $?
tbegin "rebar_fix_include_path fails on multiple versions of dependency"
test_multiple_versions
tend $?
tbegin "rebar_fix_include_path fails if dependency is not found"
test_not_found
tend $?
tbegin "rebar_fix_include_path deals with all includes in one line"
test_includes_in_one_line
tend $?
texit

View File

@ -1,121 +0,0 @@
#!/bin/bash
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
EAPI=6
inherit rebar
EPREFIX="${tmpdir}/fakeroot"
S="${WORKDIR}/${P}"
setup() {
mkdir -p "${S}" || die
cat <<EOF >"${S}/rebar.config.expected" || die
%%% Comment
{port_specs, [{"priv/lib/esip_drv.so", ["c_src/esip_codec.c"]}]}.
{deps, []}.
{clean_files, ["c_src/esip_codec.gcda", "c_src/esip_codec.gcno"]}.
EOF
cat <<EOF >"${S}/typical.config" || die
%%% Comment
{port_specs, [{"priv/lib/esip_drv.so", ["c_src/esip_codec.c"]}]}.
{deps, [{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.3"}}},
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.3"}}},
{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.3"}}}]}.
{clean_files, ["c_src/esip_codec.gcda", "c_src/esip_codec.gcno"]}.
EOF
cat <<EOF >"${S}/deps_one_line.config" || die
%%% Comment
{port_specs, [{"priv/lib/esip_drv.so", ["c_src/esip_codec.c"]}]}.
{deps, [{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.3"}}}, {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.3"}}}, {p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.3"}}}]}.
{clean_files, ["c_src/esip_codec.gcda", "c_src/esip_codec.gcno"]}.
EOF
}
test_typical_config() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp typical.config rebar.config || die
# Run unit
(rebar_remove_deps)
unit_rc=$?
# Test result
diff rebar.config rebar.config.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
test_typical_config_with_different_name() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp typical.config other.config || die
# Run unit
(rebar_remove_deps other.config)
unit_rc=$?
# Test result
diff other.config rebar.config.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
test_deps_in_one_line() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp deps_one_line.config rebar.config || die
# Run unit
(rebar_remove_deps)
unit_rc=$?
# Test result
diff rebar.config rebar.config.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
setup
tbegin "rebar_remove_deps deals with typical config"
test_typical_config
tend $?
tbegin "rebar_remove_deps deals with typical config with different name"
test_typical_config_with_different_name
tend $?
tbegin "rebar_remove_deps deals with all deps in one line"
test_deps_in_one_line
tend $?
texit

View File

@ -1,114 +0,0 @@
#!/bin/bash
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
EAPI=6
inherit rebar
EPREFIX="${tmpdir}/fakeroot"
S="${WORKDIR}/${P}"
setup() {
mkdir -p "${S}/src" || die
cat <<EOF >"${S}/app.src.expected" || die
%%% Comment
{application, esip,
[{description, "ProcessOne SIP server component in Erlang"},
{vsn, "0"},
{modules, []},
{registered, []},
EOF
cat <<EOF >"${S}/app.src" || die
%%% Comment
{application, esip,
[{description, "ProcessOne SIP server component in Erlang"},
{vsn, git},
{modules, []},
{registered, []},
EOF
}
test_typical_app_src() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp app.src "src/${PN}.app.src" || die
# Run unit
(rebar_set_vsn)
unit_rc=$?
# Test result
diff "src/${PN}.app.src" app.src.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
test_app_src_missing() {
local unit_rc
# Prepare
cd "${S}" || die
rm -f "src/${PN}.app.src" || die
# Run unit
(rebar_set_vsn 2>/dev/null)
unit_rc=$?
[[ ${unit_rc} = 1 ]]
}
test_set_custom_version() {
local diff_rc
local unit_rc
# Prepare
cd "${S}" || die
cp app.src "src/${PN}.app.src" || die
cat <<EOF >"${S}/custom_app.src.expected" || die
%%% Comment
{application, esip,
[{description, "ProcessOne SIP server component in Erlang"},
{vsn, "1.2.3"},
{modules, []},
{registered, []},
EOF
# Run unit
(rebar_set_vsn 1.2.3)
unit_rc=$?
# Test result
diff "src/${PN}.app.src" custom_app.src.expected
diff_rc=$?
[[ ${unit_rc}${diff_rc} = 00 ]]
}
setup
tbegin "rebar_set_vsn deals with typical app.src"
test_typical_app_src
tend $?
tbegin "rebar_set_vsn fails when app.src is missing"
test_app_src_missing
tend $?
tbegin "rebar_set_vsn sets custom version in app.src"
test_set_custom_version
tend $?
texit

View File

@ -1,614 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vdr-plugin-2.eclass
# @MAINTAINER:
# Gentoo VDR Project <vdr@gentoo.org>
# @AUTHOR:
# Matthias Schwarzott <zzam@gentoo.org>
# Joerg Bornkessel <hd_brummy@gentoo.org>
# Christian Ruppert <idl0r@gentoo.org>
# (undisclosed contributors)
# @SUPPORTED_EAPIS: 4 5 6
# @BLURB: common vdr plugin ebuild functions
# @DESCRIPTION:
# Eclass for easing maintenance of vdr plugin ebuilds
# @ECLASS-VARIABLE: VDR_CONFD_FILE
# @DEFAULT_UNSET
# @DESCRIPTION:
# A plugin config file can be specified through the $VDR_CONFD_FILE variable, it
# defaults to ${FILESDIR}/confd. Each config file will be installed as e.g.
# ${D}/etc/conf.d/vdr.${VDRPLUGIN}
# @ECLASS-VARIABLE: VDR_RCADDON_FILE
# @DEFAULT_UNSET
# @DESCRIPTION:
# Installing rc-addon files is basically the same as for plugin config files
# (see above), it's just using the $VDR_RCADDON_FILE variable instead.
# The default value when $VDR_RCADDON_FILE is undefined is:
# ${FILESDIR}/rc-addon.sh and will be installed as
# ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh
#
# The rc-addon files will be sourced by the startscript when the specific plugin
# has been enabled.
# rc-addon files may be used to prepare everything that is necessary for the
# plugin start/stop, like passing extra command line options and so on.
#
# NOTE: rc-addon files must be valid shell scripts!
# @ECLASS-VARIABLE: GENTOO_VDR_CONDITIONAL
# @DEFAULT_UNSET
# @DESCRIPTION:
# This is a hack for ebuilds like vdr-xineliboutput that want to
# conditionally install a vdr-plugin
# @ECLASS-VARIABLE: PO_SUBDIR
# @DEFAULT_UNSET
# @DESCRIPTION:
# By default, translation are found in"${S}"/po but this
# default can be overridden by defining PO_SUBDIR.
#
# Example:
# @CODE
# PO_SUBDIR="bla foo/bla"
# @CODE
# @FUNCTION: fix_vdr_libsi_include
# @DESCRIPTION:
# Plugins failed on compile with wrong path of libsi includes,
# this can be fixed by 'function + space separated list of files'
#
# Example:
# @CODE
# fix_vdr_libsi_include bla.c foo.c
# @CODE
# @FUNCTION: vdr_remove_i18n_include
# @DESCRIPTION:
# Compile will fail if plugin still use the old i18n language handling,
# most parts are fixed by vdr-plugin-2.eclass internal functions itself.
# Remove unneeded i18.n includes from files, if they are still wrong there,
# this can be fixed by 'function + space separated list of files"
#
# Example:
# @CODE
# vdr_remove_i18n_include bla.n foo.n
# @CODE
# Applying your own local/user patches:
# This is done by using the
# (EAPI = 4,5) epatch_user() function of the eutils.eclass,
# (EAPI = 6,7) eapply_user function integrated in EAPI = 6.
# Simply add your patches into one of these directories:
# /etc/portage/patches/<CATEGORY>/<PF|P|PN>/
# Quote: where the first of these three directories to exist will be the one to
# use, ignoring any more general directories which might exist as well.
#
# For more details about it please take a look at the eutils.class.
[[ ${EAPI} == [45] ]] && inherit multilib
[[ ${EAPI} == [456] ]] && inherit eutils
inherit flag-o-matic toolchain-funcs unpacker
case ${EAPI:-0} in
4|5|6|7)
;;
*) die "EAPI ${EAPI} unsupported."
;;
esac
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config
IUSE=""
# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
VDRPLUGIN="${PN/#vdrplugin-/}"
VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
VDRPLUGIN="${VDRPLUGIN/%-cvs/}"
DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on vdr-plugin-2.eclass)"
# Works in most cases
S="${WORKDIR}/${VDRPLUGIN}-${PV}"
# depend on headers for DVB-driver
COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2"
DEPEND="${COMMON_DEPEND}
virtual/linuxtv-dvb-headers"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-vdr-0.0.2"
if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
IUSE="${IUSE} vdr"
DEPEND="vdr? ( ${DEPEND} )"
RDEPEND="vdr? ( ${RDEPEND} )"
fi
# New method of storing plugindb
# Called from src_install
# file maintained by normal portage-methods
vdr_create_plugindb_file() {
local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
insinto "${NEW_VDRPLUGINDB_DIR}"
# BUG: portage-2.1.4_rc9 will delete the EBUILD= line, so we cannot use this code.
# cat <<-EOT > "${D}/${DB_FILE}"
# VDRPLUGIN_DB=1
# CREATOR=ECLASS
# EBUILD=${CATEGORY}/${PN}
# EBUILD_V=${PVR}
# EOT
# obsolet? fix me later...
{
echo "VDRPLUGIN_DB=1"
echo "CREATOR=ECLASS"
echo "EBUILD=${CATEGORY}/${PN}"
echo "EBUILD_V=${PVR}"
echo "PLUGINS=\"$@\""
} > "${D%/}/${DB_FILE}"
}
vdr_create_header_checksum_file() {
# Danger: Not using $ROOT here, as compile will also not use it !!!
# If vdr in $ROOT and / differ, plugins will not run anyway
local CHKSUM="header-md5-vdr"
if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
elif type -p md5sum >/dev/null 2>&1; then
(
cd "${VDR_INCLUDE_DIR}"
md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
) > "${CHKSUM}"
else
die "Could not create md5 checksum of headers"
fi
insinto "${VDR_CHECKSUM_DIR}"
local p_name
for p_name; do
newins "${CHKSUM}" "header-md5-${p_name}"
done
}
fix_vdr_libsi_include() {
eqawarn "Fixing include of libsi-headers"
local f
for f; do
sed -i "${f}" \
-e '/#include/s:"\(.*libsi.*\)":<\1>:' \
-e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
done
}
vdr_patchmakefile() {
einfo "Patching Makefile"
[[ -e Makefile ]] || die "Makefile of plugin can not be found!"
cp Makefile "${WORKDIR}"/Makefile.before
# plugin makefiles use VDRDIR in strange ways
# assumptions:
# 1. $(VDRDIR) contains Make.config
# 2. $(VDRDIR) contains config.h
# 3. $(VDRDIR)/include/vdr contains the headers
# 4. $(VDRDIR) contains main vdr Makefile
# 5. $(VDRDIR)/locale exists
# 6. $(VDRDIR) allows to access vdr source files
#
# We only have one directory (for now /usr/include/vdr),
# that contains vdr-headers and Make.config.
# To satisfy 1-3 we do this:
# Set VDRDIR=/usr/include/vdr
# Set VDRINCDIR=/usr/include
# Change $(VDRDIR)/include to $(VDRINCDIR)
sed -i Makefile \
-e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
-e "/^VDRDIR/a VDRINCDIR = ${VDR_INCLUDE_DIR%/vdr}" \
-e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
\
-e 's:-I$(DVBDIR)/include::' \
-e 's:-I$(DVBDIR)::'
if ! grep -q APIVERSION Makefile; then
ebegin " Converting to APIVERSION"
sed -i Makefile \
-e 's:^APIVERSION = :APIVERSION ?= :' \
-e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
-e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
eend $?
fi
# Correcting Compile-Flags
# Do not overwrite CXXFLAGS, add LDFLAGS if missing
sed -i Makefile \
-e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
-e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
# Disabling file stripping, the package manager takes care of it
sed -i Makefile \
-e '/@.*strip/d' \
-e '/strip \$(LIBDIR)\/\$@/d' \
-e 's/STRIP.*=.*$/STRIP = true/'
# Use a file instead of a variable as single-stepping via ebuild
# destroys environment.
touch "${WORKDIR}"/.vdr-plugin_makefile_patched
}
vdr_gettext_missing() {
# plugins without converting to gettext
local GETTEXT_MISSING=$( grep xgettext Makefile )
if [[ -z ${GETTEXT_MISSING} ]]; then
eqawarn "Plugin isn't converted to gettext handling!"
fi
}
vdr_detect_po_dir() {
# helper function
[[ -f po ]] && local po_dir="${S}"
local po_subdir=( ${S}/${PO_SUBDIR} )
local f
pofile_dir=( ${po_dir} ${po_subdir[*]} )
}
vdr_linguas_support() {
# Patching Makefile for linguas support.
# Only locales, enabled through the LINGUAS (make.conf) variable will be
# compiled and installed.
einfo "Patching for Linguas support"
einfo "available Languages for ${P} are:"
vdr_detect_po_dir
for f in ${pofile_dir[*]}; do
PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
einfo "LINGUAS=\"${PLUGIN_LINGUAS}\""
sed -i ${f}/Makefile \
-e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \
|| die "sed failed for Linguas"
done
strip-linguas ${PLUGIN_LINGUAS} en
}
vdr_i18n() {
# i18n handling was deprecated since >=media-video/vdr-1.5.9,
# finally with >=media-video/vdr-1.7.27 it has been dropped entirely and some
# plugins will fail to compile because they're still using the old variant.
# Simply remove the i18n.o object from Makefile (OBJECT) and
# remove "static const tI18nPhrase*" from i18n.h.
vdr_gettext_missing
local I18N_OBJECT=$( grep i18n.o Makefile )
if [[ -n ${I18N_OBJECT} ]]; then
if [[ "${KEEP_I18NOBJECT:-no}" = "yes" ]]; then
eqawarn "Forced to keep i18n.o"
else
sed -i "s:i18n.o::g" Makefile
eqawarn "OBJECT i18n.o found, removed per sed"
fi
fi
local I18N_STRING=$( [[ -e i18n.h ]] && grep tI18nPhrase i18n.h )
if [[ -n ${I18N_STRING} ]]; then
sed -i "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const tI18nPhrase:" i18n.h
eqawarn "obsolete tI18nPhrase found, disabled per sed, please recheck"
fi
}
vdr_remove_i18n_include() {
# remove uneeded i18.n includes
local f
for f; do
sed -i "${f}" \
-e "s:^#include[[:space:]]*\"i18n.h\"://:"
done
eqawarn "removed i18n.h include in ${@}"
}
vdr-plugin-2_print_enable_command() {
local p_name c=0 l=""
for p_name in ${vdr_plugin_list}; do
c=$(( c+1 ))
l="$l ${p_name#vdr-}"
done
elog
case $c in
1) elog "Installed plugin${l}" ;;
*) elog "Installed $c plugins:${l}" ;;
esac
elog "To activate a plugin execute this command:"
elog "\teselect vdr-plugin enable <plugin_name> ..."
elog
}
has_vdr() {
[[ -f "${VDR_INCLUDE_DIR}"/config.h ]]
}
## exported functions
vdr-plugin-2_pkg_setup() {
# missing ${chost}- tag
tc-export CC CXX
# -fPIC is needed for shared objects on some platforms (amd64 and others)
append-flags -fPIC
# Plugins need to be compiled with position independent code, otherwise linking
# VDR against it will fail
# depricated if fi, as we have only >=vdr-2 in the tree, fix me later...
if has_version ">=media-video/vdr-1.7.13"; then
append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
fi
# Where should the plugins live in the filesystem
VDR_PLUGIN_DIR=$(pkg-config --variable=libdir vdr)
VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
VDR_RC_DIR="/usr/share/vdr/rcscript"
# Pathes to includes
VDR_INCLUDE_DIR="/usr/include/vdr"
DVB_INCLUDE_DIR="/usr/include"
TMP_LOCALE_DIR="${WORKDIR}/tmp-locale"
LOCDIR=$(pkg-config --variable=locdir vdr)
if ! has_vdr; then
# set to invalid values to detect abuses
VDRVERSION="eclass_no_vdr_installed"
APIVERSION="eclass_no_vdr_installed"
if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]] && ! use vdr; then
einfo "VDR not found!"
else
# if vdr is required
die "VDR not found!"
fi
return
fi
VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
APIVERSION=$(pkg-config --variable=apiversion vdr)
einfo "Compiling against"
einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
if [[ -n "${VDR_LOCAL_PATCHES_DIR}" ]]; then
eerror "Using VDR_LOCAL_PATCHES_DIR is deprecated!"
eerror "Please move all your patches into"
eerror "${EROOT%/}/etc/portage/patches/${CATEGORY}/${P}"
eerror "and remove or unset the VDR_LOCAL_PATCHES_DIR variable."
die
fi
}
vdr-plugin-2_src_util() {
while [ "$1" ]; do
case "$1" in
all)
vdr-plugin-2_src_util unpack add_local_patch patchmakefile linguas_patch i18n
;;
prepare)
vdr-plugin-2_src_util add_local_patch patchmakefile linguas_patch i18n
;;
unpack)
unpacker_src_unpack
;;
add_local_patch)
cd "${S}" || die "Could not change to plugin-source-directory (src_util)"
if [[ ${EAPI} != [45] ]]; then
eapply_user
else
epatch_user
fi
;;
patchmakefile)
cd "${S}" || die "Could not change to plugin-source-directory (src_util)"
vdr_patchmakefile
;;
i18n)
vdr_i18n
;;
linguas_patch)
vdr_linguas_support
;;
esac
shift
done
}
vdr-plugin-2_src_unpack() {
if [[ -z ${VDR_INCLUDE_DIR} ]]; then
eerror "Wrong use of vdr-plugin-2.eclass."
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_unpack."
echo
eerror "Please report this at bugs.gentoo.org."
die "vdr-plugin-2_src_unpack not called!"
fi
if [ -z "$1" ]; then
vdr-plugin-2_src_util unpack
else
vdr-plugin-2_src_util $@
fi
}
vdr-plugin-2_src_prepare() {
if [[ -z ${VDR_INCLUDE_DIR} ]]; then
eerror "Wrong use of vdr-plugin-2.eclass."
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_prepare."
echo
eerror "Please report this at bugs.gentoo.org."
die "vdr-plugin-2_src_prepare not called!"
fi
[[ ${EAPI} == [45] ]] && [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
[[ ${EAPI} != [45] ]] && [[ ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
debug-print "$FUNCNAME: applying user patches"
vdr-plugin-2_src_util prepare
}
vdr-plugin-2_src_compile() {
[ -z "$1" ] && vdr-plugin-2_src_compile compile
while [ "$1" ]; do
case "$1" in
compile)
if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then
eerror "Wrong use of vdr-plugin-2.eclass."
eerror "An ebuild for a vdr-plugin will not work without"
eerror "calling vdr-plugin-2_src_compile to patch the Makefile."
echo
eerror "Please report this at bugs.gentoo.org."
die "vdr-plugin-2_src_compile not called!"
fi
cd "${S}" || die "could not change to plugin source directory (src_compile)"
emake all ${BUILD_PARAMS} \
LOCALEDIR="${TMP_LOCALE_DIR}" \
LOCDIR="${TMP_LOCALE_DIR}" \
LIBDIR="${S}" \
TMPDIR="${T}" \
|| die "emake all failed"
;;
esac
shift
done
}
vdr-plugin-2_src_install() {
if [[ -z ${VDR_INCLUDE_DIR} ]]; then
eerror "Wrong use of vdr-plugin-2.eclass."
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_install."
echo
eerror "Please report this at bugs.gentoo.org."
die "vdr-plugin-2_src_install not called!"
fi
cd "${WORKDIR}" || die "could not change to plugin workdir directory (src_install)"
if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
local mname="${P}-Makefile"
cp "${S}"/Makefile "${mname}.patched"
cp Makefile.before "${mname}.before"
diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff"
insinto "/usr/share/vdr/maintainer-data/makefile-changes"
doins "${mname}.diff"
insinto "/usr/share/vdr/maintainer-data/makefile-before"
doins "${mname}.before"
insinto "/usr/share/vdr/maintainer-data/makefile-patched"
doins "${mname}.patched"
fi
cd "${S}" || die "could not change to plugin source directory (src_install)"
local SOFILE_STRING=$(grep SOFILE Makefile)
if [[ -n ${SOFILE_STRING} ]]; then
emake install \
${BUILD_PARAMS} \
TMPDIR="${T}" \
DESTDIR="${D%/}" \
|| die "emake install (makefile target) failed"
else
eqawarn "Plugin use still the old Makefile handling"
insinto "${VDR_PLUGIN_DIR}"
doins libvdr-*.so.*
fi
if [[ -d ${TMP_LOCALE_DIR} ]]; then
einfo "Installing locales"
cd "${TMP_LOCALE_DIR}" || die "could not change to TMP_LOCALE_DIR"
local linguas
for linguas in ${LINGUAS[*]}; do
insinto "${LOCDIR}"
cp -r --parents ${linguas}* ${D%/}/${LOCDIR}
done
fi
cd "${D%/}/usr/$(get_libdir)/vdr/plugins" || die "could not change to D/usr/libdir/vdr/plugins"
# create list of all created plugin libs
vdr_plugin_list=""
local p_name
for p in libvdr-*.so.*; do
p_name="${p%.so*}"
p_name="${p_name#lib}"
vdr_plugin_list="${vdr_plugin_list} ${p_name}"
done
cd "${S}" || die "could not change to plugin source directory (src_install)"
vdr_create_header_checksum_file ${vdr_plugin_list}
vdr_create_plugindb_file ${vdr_plugin_list}
if [[ ${EAPI} != [45] ]]; then
einstalldocs
else
local docfile
for docfile in README* HISTORY CHANGELOG; do
[[ -f ${docfile} ]] && dodoc ${docfile}
done
fi
# if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
[[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd
if [[ -n ${VDR_CONFD_FILE} ]]; then
newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN}
fi
# if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it
[[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh
if [[ -n ${VDR_RCADDON_FILE} ]]; then
insinto "${VDR_RC_DIR}"
newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
fi
}
vdr-plugin-2_pkg_postinst() {
vdr-plugin-2_print_enable_command
if [[ -n "${VDR_CONFD_FILE}" ]]; then
elog "Please have a look at the config-file"
elog "\t/etc/conf.d/vdr.${VDRPLUGIN}"
elog
fi
}
vdr-plugin-2_pkg_postrm() {
:
}
vdr-plugin-2_pkg_config() {
:
}

View File

@ -1,140 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: wxwidgets.eclass
# @MAINTAINER:
# wxwidgets@gentoo.org
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
# @BLURB: Manages build configuration for wxGTK-using packages.
# @DESCRIPTION:
# This eclass sets up the proper environment for ebuilds using the wxGTK
# libraries. Ebuilds using wxPython do not need to inherit this eclass.
#
# More specifically, this eclass controls the configuration chosen by the
# /usr/bin/wx-config wrapper.
#
# Using the eclass is simple:
#
# - set WX_GTK_VER equal to a SLOT of wxGTK
# - call setup-wxwidgets()
#
# The configuration chosen is based on the version required and the flags
# wxGTK was built with.
if [[ -z ${_WXWIDGETS_ECLASS} ]]; then
case ${EAPI} in
0|1|2|3|4|5)
inherit eutils flag-o-matic multilib
# This was used to set up a sane default for ebuilds so they could
# avoid calling need-wxwidgets if they didn't need a particular build.
# This was a bad idea for a couple different reasons, and because
# get_libdir() is now illegal in global scope in EAPI 6 we can't do it
# anymore. All ebuilds must now use setup-wxwidgets and this code is
# only here for backwards compatability.
if [[ -z ${WX_CONFIG} ]]; then
if [[ -n ${WX_GTK_VER} ]]; then
for _wxtoolkit in mac gtk2 base; do
# newer versions don't have a seperate debug config
for _wxdebug in xxx release- debug-; do
_wxconf="${_wxtoolkit}-unicode-${_wxdebug/xxx/}${WX_GTK_VER}"
[[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${_wxconf} ]] \
|| continue
WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${_wxconf}"
WX_ECLASS_CONFIG="${WX_CONFIG}"
break
done
[[ -n ${WX_CONFIG} ]] && break
done
[[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
fi
fi
unset _wxtoolkit
unset _wxdebug
unset _wxconf
;;
6)
inherit flag-o-matic multilib
;;
*)
die "EAPI=${EAPI:-0} is not supported"
;;
esac
# @FUNCTION: setup-wxwidgets
# @DESCRIPTION:
#
# Call this in your ebuild to set up the environment for wxGTK. Besides
# controlling the wx-config wrapper this exports WX_CONFIG containing
# the path to the config in case it needs to be passed to a build system.
#
# In wxGTK-2.9 and later it also controls the level of debugging output
# from the libraries. In these versions debugging features are enabled
# by default and need to be disabled at the package level. Because this
# causes many warning dialogs to pop up during runtime we add -DNDEBUG to
# CPPFLAGS to disable debugging features (unless your ebuild has a debug
# USE flag and it's enabled). If you don't like this behavior you can set
# WX_DISABLE_NDEBUG to override it.
#
# See: http://docs.wxwidgets.org/trunk/overview_debugging.html
setup-wxwidgets() {
local wxtoolkit wxdebug wxconf
[[ -z ${WX_GTK_VER} ]] \
&& die "WX_GTK_VER must be set before calling $FUNCNAME."
case "${WX_GTK_VER}" in
3.0-gtk3)
wxtoolkit=gtk3
if [[ -z ${WX_DISABLE_NDEBUG} ]]; then
( in_iuse debug && use debug ) || append-cppflags -DNDEBUG
fi
;;
2.9|3.0)
wxtoolkit=gtk2
if [[ -z ${WX_DISABLE_NDEBUG} ]]; then
( in_iuse debug && use debug ) || append-cppflags -DNDEBUG
fi
;;
2.8)
wxtoolkit=gtk2
wxdebug="release-"
has_version x11-libs/wxGTK:${WX_GTK_VER}[debug] && wxdebug="debug-"
;;
*)
die "Invalid WX_GTK_VER: must be set to a valid wxGTK SLOT"
;;
esac
# toolkit overrides
if has_version "x11-libs/wxGTK:${WX_GTK_VER}[aqua]"; then
wxtoolkit="mac"
elif ! has_version "x11-libs/wxGTK:${WX_GTK_VER}[X]"; then
wxtoolkit="base"
fi
wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
[[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]] \
&& die "Failed to find configuration ${wxconf}"
export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
export WX_ECLASS_CONFIG="${WX_CONFIG}"
echo
einfo "Requested wxWidgets: ${WX_GTK_VER}"
einfo "Using wxWidgets: ${wxconf}"
echo
}
# deprecated
need-wxwidgets() {
setup-wxwidgets
}
_WXWIDGETS_ECLASS=1
fi