eclass: Drop unused eclasses

This commit is contained in:
Krzesimir Nowak 2022-02-17 13:48:16 +01:00
parent 1b5c552814
commit f76f12dba7
18 changed files with 0 additions and 4040 deletions

View File

@ -1,162 +0,0 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License, v2 or later
# @ECLASS: ant-tasks.eclass
# @MAINTAINER:
# java@gentoo.org
# @AUTHOR:
# Vlastimil Babka <caster@gentoo.org>
# @BLURB: Eclass for building dev-java/ant-* packages
# @DESCRIPTION:
# This eclass provides functionality and default ebuild variables for building
# dev-java/ant-* packages easily.
case "${EAPI:-0}" in
0|1|2|3|4|5)
die "ant-tasks.eclass: EAPI ${EAPI} is too old."
;;
6|7)
;;
*)
die "ant-tasks.eclass: EAPI ${EAPI} is not supported yet."
;;
esac
# we set ant-core dep ourselves, restricted
JAVA_ANT_DISABLE_ANT_CORE_DEP=true
# rewriting build.xml for are the testcases has no reason atm
JAVA_PKG_BSFIX_ALL=no
inherit java-pkg-2 java-ant-2
[[ ${EAPI:-0} -eq 6 ]] && inherit eapi7-ver
EXPORT_FUNCTIONS src_unpack src_compile src_install
# @ECLASS-VARIABLE: ANT_TASK_JDKVER
# @DESCRIPTION:
# Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.8, can
# be overridden from ebuild BEFORE inheriting this eclass.
ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.8}
# @ECLASS-VARIABLE: ANT_TASK_JREVER
# @DESCRIPTION:
# Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.8, can
# be overridden from ebuild BEFORE inheriting this eclass.
ANT_TASK_JREVER=${ANT_TASK_JREVER-1.8}
# @ECLASS-VARIABLE: ANT_TASK_NAME
# @DESCRIPTION:
# The name of this ant task as recognized by ant's build.xml, derived from $PN
# by removing the ant- prefix. Read-only.
ANT_TASK_NAME="${PN#ant-}"
# @ECLASS-VARIABLE: ANT_TASK_DEPNAME
# @DESCRIPTION:
# Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
# that this one depends on. Defaults to the name of ant task, ebuild can
# override it before inheriting this eclass.
ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
# @ECLASS-VARIABLE: ANT_TASK_DISABLE_VM_DEPS
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set, no JDK/JRE deps are added.
# @VARIABLE: ANT_TASK_PV
# @INTERNAL
# Version of ant-core this task is intended to register and thus load with.
ANT_TASK_PV="${PV}"
# default for final releases
MY_PV=${PV}
UPSTREAM_PREFIX="mirror://apache/ant/source"
GENTOO_PREFIX="https://dev.gentoo.org/~fordfrog/distfiles"
# source/workdir name
MY_P="apache-ant-${MY_PV}"
# Default values for standard ebuild variables, can be overridden from ebuild.
DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
HOMEPAGE="http://ant.apache.org/"
SRC_URI="${UPSTREAM_PREFIX}/${MY_P}-src.tar.bz2
${GENTOO_PREFIX}/ant-${PV}-gentoo.tar.bz2"
LICENSE="Apache-2.0"
SLOT="0"
RDEPEND="~dev-java/ant-core-${PV}:0"
DEPEND="${RDEPEND}"
if [[ -z "${ANT_TASK_DISABLE_VM_DEPS}" ]]; then
RDEPEND+=" >=virtual/jre-${ANT_TASK_JREVER}"
DEPEND+=" >=virtual/jdk-${ANT_TASK_JDKVER}"
fi
# Would run the full ant test suite for every ant task
RESTRICT="test"
S="${WORKDIR}/${MY_P}"
# @FUNCTION: ant-tasks_src_unpack
# @USAGE: [ base ] [ jar-dep ] [ all ]
# @DESCRIPTION:
# The function Is split into two parts, defaults to both of them ('all').
#
# base: performs the unpack, build.xml replacement and symlinks ant.jar from
# ant-core
#
# jar-dep: symlinks the jar file(s) from dependency package
ant-tasks_src_unpack() {
[[ -z "${1}" ]] && ant-tasks_src_unpack all
while [[ -n "${1}" ]]; do
case ${1} in
base)
unpack ${A}
cd "${S}"
# replace build.xml with our modified for split building
if [ -e "${WORKDIR}"/${PV}-build.patch ] ; then
eapply "${WORKDIR}"/${PV}-build.patch
else
mv -f "${WORKDIR}"/build.xml .
fi
cd lib
# remove bundled xerces
rm -f *.jar
# ant.jar to build against
java-pkg_jar-from --build-only ant-core ant.jar;;
jar-dep)
# get jar from the dependency package
if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
java-pkg_jar-from ${ANT_TASK_DEPNAME}
fi;;
all)
ant-tasks_src_unpack base jar-dep;;
esac
shift
done
}
# @FUNCTION: ant-tasks_src_compile
# @DESCRIPTION:
# Compiles the jar with installed ant-core.
ant-tasks_src_compile() {
ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
}
# @FUNCTION: ant-tasks_src_install
# @DESCRIPTION:
# Installs the jar and registers its presence for the ant launcher script.
# Version param ensures it won't get loaded (thus break) when ant-core is
# updated to newer version.
ant-tasks_src_install() {
java-pkg_dojar build/lib/${PN}.jar
java-pkg_register-ant-task --version "${ANT_TASK_PV}"
# create the compatibility symlink
dodir /usr/share/ant/lib
dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
}

View File

@ -1,143 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: dotnet.eclass
# @MAINTAINER: dotnet@gentoo.org
# @SUPPORTED_EAPIS: 1 2 3 4 5 6 7
# @BLURB: common settings and functions for mono and dotnet related packages
# @DESCRIPTION:
# The dotnet eclass contains common environment settings that are useful for
# dotnet packages. Currently, it provides no functions, just exports
# MONO_SHARED_DIR and sets LC_ALL in order to prevent errors during compilation
# of dotnet packages.
case ${EAPI:-0} in
0) die "this eclass doesn't support EAPI 0" ;;
1|2|3) ;;
*) ;; #if [[ ${USE_DOTNET} ]]; then REQUIRED_USE="|| (${USE_DOTNET})"; fi;;
esac
inherit eutils versionator mono-env
# @ECLASS-VARIABLE: USE_DOTNET
# @DESCRIPTION:
# Use flags added to IUSE
DEPEND+=" dev-lang/mono"
# SET default use flags according on DOTNET_TARGETS
for x in ${USE_DOTNET}; do
case ${x} in
net45) if [[ ${DOTNET_TARGETS} == *net45* ]]; then IUSE+=" +net45"; else IUSE+=" net45"; fi;;
net40) if [[ ${DOTNET_TARGETS} == *net40* ]]; then IUSE+=" +net40"; else IUSE+=" net40"; fi;;
net35) if [[ ${DOTNET_TARGETS} == *net35* ]]; then IUSE+=" +net35"; else IUSE+=" net35"; fi;;
net20) if [[ ${DOTNET_TARGETS} == *net20* ]]; then IUSE+=" +net20"; else IUSE+=" net20"; fi;;
esac
done
# @FUNCTION: dotnet_pkg_setup
# @DESCRIPTION:
# This function set FRAMEWORK.
dotnet_pkg_setup() {
for x in ${USE_DOTNET} ; do
case ${x} in
net45) if use net45; then F="4.5"; fi;;
net40) if use net40; then F="4.0"; fi;;
net35) if use net35; then F="3.5"; fi;;
net20) if use net20; then F="2.0"; fi;;
esac
if [[ -z ${FRAMEWORK} ]]; then
if [[ ${F} ]]; then
FRAMEWORK="${F}";
fi
else
version_is_at_least "${F}" "${FRAMEWORK}" || FRAMEWORK="${F}"
fi
done
if [[ -z ${FRAMEWORK} ]]; then
FRAMEWORK="4.0"
fi
einfo " -- USING .NET ${FRAMEWORK} FRAMEWORK -- "
}
# >=mono-0.92 versions using mcs -pkg:foo-sharp require shared memory, so we set the
# shared dir to ${T} so that ${T}/.wapi can be used during the install process.
export MONO_SHARED_DIR="${T}"
# Building mono, nant and many other dotnet packages is known to fail if LC_ALL
# variable is not set to C. To prevent this all mono related packages will be
# build with LC_ALL=C (see bugs #146424, #149817)
export LC_ALL=C
# Monodevelop-using applications need this to be set or they will try to create config
# files in the user's ~ dir.
export XDG_CONFIG_HOME="${T}"
# Fix bug 83020:
# "Access Violations Arise When Emerging Mono-Related Packages with MONO_AOT_CACHE"
unset MONO_AOT_CACHE
# @FUNCTION: exbuild
# @DESCRIPTION:
# Run xbuild with Release configuration and configurated FRAMEWORK.
exbuild() {
elog "xbuild ""$@"" /p:Configuration=Release /tv:4.0 /p:TargetFrameworkVersion=v""${FRAMEWORK}"" || die"
xbuild "$@" /p:Configuration=Release /tv:4.0 /p:TargetFrameworkVersion=v"${FRAMEWORK}" || die
}
# @FUNCTION: egacinstall
# @DESCRIPTION:
# Install package to GAC.
egacinstall() {
use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}"
gacutil -i "${1}" \
-root "${ED}"/usr/$(get_libdir) \
-gacdir /usr/$(get_libdir) \
-package ${2:-${GACPN:-${PN}}} \
|| die "installing ${1} into the Global Assembly Cache failed"
}
# @FUNCTION: dotnet_multilib_comply
# @DESCRIPTION:
# multilib comply
dotnet_multilib_comply() {
use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}"
local dir finddirs=() mv_command=${mv_command:-mv}
if [[ -d "${ED}/usr/lib" && "$(get_libdir)" != "lib" ]]
then
if ! [[ -d "${ED}"/usr/"$(get_libdir)" ]]
then
mkdir "${ED}"/usr/"$(get_libdir)" || die "Couldn't mkdir ${ED}/usr/$(get_libdir)"
fi
${mv_command} "${ED}"/usr/lib/* "${ED}"/usr/"$(get_libdir)"/ || die "Moving files into correct libdir failed"
rm -rf "${ED}"/usr/lib
for dir in "${ED}"/usr/"$(get_libdir)"/pkgconfig "${ED}"/usr/share/pkgconfig
do
if [[ -d "${dir}" && "$(find "${dir}" -name '*.pc')" != "" ]]
then
pushd "${dir}" &> /dev/null
sed -i -r -e 's:/(lib)([^a-zA-Z0-9]|$):/'"$(get_libdir)"'\2:g' \
*.pc \
|| die "Sedding some sense into pkgconfig files failed."
popd "${dir}" &> /dev/null
fi
done
if [[ -d "${ED}/usr/bin" ]]
then
for exe in "${ED}/usr/bin"/*
do
if [[ "$(file "${exe}")" == *"shell script text"* ]]
then
sed -r -i -e ":/lib(/|$): s:/lib(/|$):/$(get_libdir)\1:" \
"${exe}" || die "Sedding some sense into ${exe} failed"
fi
done
fi
fi
}
EXPORT_FUNCTIONS pkg_setup

View File

@ -1,254 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: font.eclass
# @MAINTAINER:
# fonts@gentoo.org
# @BLURB: Eclass to make font installation uniform
case ${EAPI:-0} in
0|1|2|3|4|5|6) ;;
*) die "EAPI ${EAPI} is not supported by font.eclass." ;;
esac
inherit eutils
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: FONT_SUFFIX
# @DEFAULT_UNSET
# @REQUIRED
# @DESCRIPTION:
# Space delimited list of font suffixes to install.
FONT_SUFFIX=${FONT_SUFFIX:-}
# @ECLASS-VARIABLE: FONT_S
# @REQUIRED
# @DESCRIPTION:
# Space delimited list of directories containing the fonts.
FONT_S=${FONT_S:-${S}}
# @ECLASS-VARIABLE: FONT_PN
# @DESCRIPTION:
# Font name (ie. last part of FONTDIR).
FONT_PN=${FONT_PN:-${PN}}
# @ECLASS-VARIABLE: FONTDIR
# @DESCRIPTION:
# Full path to installation directory.
FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
# @ECLASS-VARIABLE: FONT_CONF
# @DEFAULT_UNSET
# @DESCRIPTION:
# Array containing fontconfig conf files to install.
FONT_CONF=( "" )
# @ECLASS-VARIABLE: DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Space delimited list of docs to install.
# We always install these:
# COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt
DOCS=${DOCS:-}
IUSE="X"
DEPEND="X? (
|| ( >=x11-apps/mkfontscale-1.2.0 x11-apps/mkfontdir )
media-fonts/encodings
)"
RDEPEND=""
# @FUNCTION: font_xfont_config
# @DESCRIPTION:
# Generate Xorg font files (mkfontscale/mkfontdir).
font_xfont_config() {
local dir_name
if has X ${IUSE//+} && use X ; then
dir_name="${1:-${FONT_PN}}"
ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
"${ED}${FONTDIR}/${1//${S}/}"
eend $?
if [[ -e fonts.alias ]] ; then
doins fonts.alias
fi
fi
}
# @FUNCTION: font_fontconfig
# @DESCRIPTION:
# Install fontconfig conf files given in FONT_CONF.
font_fontconfig() {
local conffile
if [[ -n ${FONT_CONF[@]} ]]; then
insinto /etc/fonts/conf.avail/
for conffile in "${FONT_CONF[@]}"; do
[[ -e ${conffile} ]] && doins ${conffile}
done
fi
}
# @FUNCTION: font_cleanup_dirs
# @DESCRIPTION:
# Remove font directories containing only generated files.
font_cleanup_dirs() {
local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
# fonts.alias isn't generated but it's a special case (see below).
local d f g generated candidate otherfile
ebegin "Cleaning up font directories"
find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
candidate=false
otherfile=false
for f in "${d}"/*; do
generated=false
# make sure this is a file and not a subdir
[[ -e ${f} || -L ${f} ]] || continue
for g in ${genfiles}; do
if [[ ${f##*/} == ${g} ]]; then
# this is a generated file
generated=true
break
fi
done
# if the file is a generated file then we know this is a font dir (as
# opposed to something like encodings or util) and a candidate for
# removal. if it's not generated then it's an "otherfile".
${generated} && candidate=true || otherfile=true
# if the directory is both a candidate for removal and contains at
# least one "otherfile" then don't remove it.
[[ ${candidate} == ${otherfile} ]] && break
done
# if in the end we only have generated files, purge the directory.
if [[ ${candidate} == true && ${otherfile} == false ]]; then
# we don't want to remove fonts.alias files that were installed by
# media-fonts/font-alias. any other fonts.alias files will have
# already been unmerged with their packages.
for g in ${genfiles}; do
[[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] \
&& rm "${d}"/${g}
done
# if there's nothing left remove the directory
find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
fi
done
eend 0
}
# @FUNCTION: font_pkg_setup
# @DESCRIPTION:
# The font pkg_setup function.
# Collision protection and Prefix compat for eapi < 3.
font_pkg_setup() {
# Prefix compat
case ${EAPI:-0} in
0|1|2)
if ! use prefix; then
EPREFIX=
ED=${D}
EROOT=${ROOT}
[[ ${EROOT} = */ ]] || EROOT+="/"
fi
;;
esac
# make sure we get no collisions
# setup is not the nicest place, but preinst doesn't cut it
[[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
}
# @FUNCTION: font_src_install
# @DESCRIPTION:
# The font src_install function.
font_src_install() {
local dir suffix commondoc
set -- ${FONT_S:-${S}}
if [[ $# -gt 1 ]]; then
# if we have multiple FONT_S elements then we want to recreate the dir
# structure
for dir in ${FONT_S}; do
pushd "${dir}" > /dev/null
insinto "${FONTDIR}/${dir//${S}/}"
for suffix in ${FONT_SUFFIX}; do
doins *.${suffix}
done
font_xfont_config "${dir}"
popd > /dev/null
done
else
pushd "${FONT_S}" > /dev/null
insinto "${FONTDIR}"
for suffix in ${FONT_SUFFIX}; do
doins *.${suffix}
done
font_xfont_config
popd > /dev/null
fi
font_fontconfig
[[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
# install common docs
for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
[[ -s ${commondoc} ]] && dodoc ${commondoc}
done
}
# @FUNCTION: font_pkg_postinst
# @DESCRIPTION:
# The font pkg_postinst function.
font_pkg_postinst() {
# unreadable font files = fontconfig segfaults
find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
| xargs -0 chmod -v 0644 2>/dev/null
if [[ -n ${FONT_CONF[@]} ]]; then
local conffile
echo
elog "The following fontconfig configuration files have been installed:"
elog
for conffile in "${FONT_CONF[@]}"; do
if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
elog " $(basename ${conffile})"
fi
done
elog
elog "Use \`eselect fontconfig\` to enable/disable them."
echo
fi
if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
ebegin "Updating global fontcache"
fc-cache -fs
eend $?
else
einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
fi
}
# @FUNCTION: font_pkg_postrm
# @DESCRIPTION:
# The font pkg_postrm function.
font_pkg_postrm() {
font_cleanup_dirs
# unreadable font files = fontconfig segfaults
find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
| xargs -0 chmod -v 0644 2>/dev/null
if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
ebegin "Updating global fontcache"
fc-cache -fs
eend $?
else
einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
fi
}

View File

@ -1,320 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Variables to specify in an ebuild which uses this eclass:
# GAME - (doom3, quake4 or ut2004, etc), unless ${PN} starts with e.g. "doom3-"
# MOD_DESC - Description for the mod
# MOD_NAME - Creates a command-line wrapper and desktop icon for the mod
# MOD_DIR - Subdirectory name for the mod, if applicable
# MOD_ICON - Custom icon for the mod, instead of the default
inherit eutils games
EXPORT_FUNCTIONS src_install pkg_postinst
[[ -z ${GAME} ]] && GAME=${PN%%-*}
case ${GAME} in
doom3)
GAME_PKGS="games-fps/doom3"
GAME_DIRS=( "${GAMES_PREFIX_OPT}"/doom3 )
GAME_NAME="Doom 3"
GAME_BIN="doom3"
GAME_ICON="doom3"
DED_PKGS=""
DED_BIN="doom3-ded"
DED_OPTS="+set dedicated 1 +exec server.cfg"
DED_CFG_DIR=".doom3"
SELECT_MOD="+set fs_game "
;;
enemy-territory)
GAME_PKGS="games-fps/enemy-territory"
GAME_DIRS=( "${GAMES_PREFIX_OPT}"/enemy-territory )
GAME_NAME="Enemy Territory"
GAME_BIN="et"
GAME_ICON="ET"
DED_PKGS=""
DED_BIN="et-ded"
DED_OPTS="+set dedicated 1 +exec server.cfg"
DED_CFG_DIR=".etwolf"
SELECT_MOD="+set fs_game "
;;
quake3)
GAME_PKGS="games-fps/quake3 games-fps/quake3-bin"
GAME_DIRS=( "${GAMES_DATADIR}"/quake3 "${GAMES_PREFIX_OPT}"/quake3 )
GAME_NAME="Quake III"
GAME_BIN="quake3"
GAME_ICON="quake3"
DED_PKGS=""
DED_BIN="quake3-ded"
DED_OPTS="+set dedicated 1 +exec server.cfg"
DED_CFG_DIR=".q3a"
SELECT_MOD="+set fs_game "
;;
quake4)
GAME_PKGS="games-fps/quake4-bin"
GAME_DIRS=( "${GAMES_PREFIX_OPT}"/quake4 )
GAME_NAME="Quake 4"
GAME_BIN="quake4"
GAME_ICON="/usr/share/pixmaps/quake4.bmp"
DED_PKGS=""
DED_BIN="quake4-ded"
DED_OPTS="+set dedicated 1 +exec server.cfg"
DED_CFG_DIR=".quake4"
SELECT_MOD="+set fs_game "
;;
ut2003)
GAME_PKGS="games-fps/ut2003"
GAME_DIRS=( "${GAMES_PREFIX_OPT}"/ut2003 )
GAME_NAME="UT2003"
GAME_BIN="ut2003"
GAME_ICON="ut2003"
DED_PKGS=""
DED_BIN="ucc"
DED_OPTS=""
DED_CFG_DIR=""
SELECT_MOD="-mod="
;;
ut2004)
GAME_PKGS="games-fps/ut2004"
GAME_DIRS=( "${GAMES_PREFIX_OPT}"/{ut2004,ut2004-ded} )
GAME_NAME="UT2004"
GAME_BIN="ut2004"
GAME_ICON="ut2004"
DED_PKGS="games-server/ut2004-ded"
DED_BIN="ut2004-ded"
DED_OPTS=""
DED_CFG_DIR=""
SELECT_MOD="-mod="
;;
*)
eerror "This game is either not supported or you must set the GAME"
eerror "variable to the proper game."
die "games-mods.eclass: unsupported GAME"
;;
esac
MOD_BIN="${GAME_BIN}-${PN/${GAME}-}"
MOD_DED_BIN="${MOD_BIN}-ded"
games-mods_get_rdepend() {
local pkgs
if [[ ${1} == "--ded" ]] ; then
pkgs=( ${DED_PKGS} ${GAME_PKGS} )
else
pkgs=( ${GAME_PKGS} )
fi
[[ ${#pkgs[@]} -gt 1 ]] && echo -n "|| ( "
case ${EAPI:-0} in
0|1) echo -n "${pkgs[@]}" ;;
[23456])
local p
if [[ ${1} == "--ded" ]] ; then
echo -n "${DED_PKGS}"
for p in ${GAME_PKGS} ; do
echo -n " ${p}[dedicated]"
done
else
for p in ${GAME_PKGS} ; do
echo -n " || ( ${p}[opengl] ${p}[-dedicated] )"
done
fi
;;
*) die "EAPI ${EAPI} not supported"
esac
[[ ${#pkgs[@]} -gt 1 ]] && echo -n " )"
}
DESCRIPTION="${GAME_NAME} ${MOD_NAME} - ${MOD_DESC}"
SLOT="0"
IUSE="dedicated opengl"
RESTRICT="mirror strip"
DEPEND="app-arch/unzip"
RDEPEND="dedicated? ( $(games-mods_get_rdepend --ded) )
opengl? ( $(games-mods_get_rdepend) )
!dedicated? ( !opengl? ( $(games-mods_get_rdepend) ) )"
S=${WORKDIR}
INS_DIR=${GAMES_DATADIR}/${GAME}
games-mods_use_opengl() {
[[ -z ${MOD_DIR} ]] && return 1
if use opengl || ! use dedicated ; then
# Use opengl by default
return 0
fi
return 1
}
games-mods_use_dedicated() {
[[ -z ${MOD_DIR} ]] && return 1
use dedicated && return 0 || return 1
}
games-mods_dosyms() {
# We are installing everything for these mods into ${INS_DIR},
# ${GAMES_DATADIR}/${GAME} in most cases, and symlinking it
# into ${GAMES_PREFIX_OPT}/${GAME} for each game. This should
# allow us to support both binary and source-based games easily.
local dir
for dir in "${GAME_DIRS[@]}" ; do
[[ -z ${dir} || ${INS_DIR} == ${dir} ]] && continue
pushd "${D}/${INS_DIR}" > /dev/null || die "pushd failed"
local i
for i in * ; do
if [[ -d ${i} ]] ; then
if [[ ${i} == ${MOD_DIR} ]] ; then
dosym "${INS_DIR}/${i}" "${dir}/${i}" \
|| die "dosym ${i} failed"
else
local f
while read f ; do
dosym "${INS_DIR}/${f}" "${dir}/${f}" \
|| die "dosym ${f} failed"
done < <(find "${i}" -type f)
fi
elif [[ -f ${i} ]] ; then
dosym "${INS_DIR}/${i}" "${dir}/${i}" \
|| die "dosym ${i} failed"
else
die "${i} shouldn't be there"
fi
done
popd > /dev/null || die "popd failed"
done
}
games-mods_make_initd() {
cat <<EOF > "${T}"/${MOD_DED_BIN}
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Generated by games-mods.eclass
depend() {
need net
}
start() {
ebegin "Starting ${MOD_DED_BIN}"
start-stop-daemon --start --quiet --background --make-pidfile \\
--pidfile /var/run/${MOD_DED_BIN}.pid \\
--chuid \${${MOD_DED_BIN//-/_}_user}:\${${MOD_DED_BIN//-/_}_group} \\
--env HOME="\${${MOD_DED_BIN//-/_}_home}" \\
--exec "${GAMES_BINDIR}/${MOD_DED_BIN}" \\
-- \${${MOD_DED_BIN//-/_}_opts}
eend \$?
}
stop() {
ebegin "Stopping ${MOD_DED_BIN}"
start-stop-daemon --stop \\
--pidfile /var/run/${MOD_DED_BIN}.pid
eend \$?
}
EOF
doinitd "${T}"/${MOD_DED_BIN} || die "doinitd failed"
}
games-mods_make_confd() {
cat <<-EOF > "${T}"/${MOD_DED_BIN}
# User and group the server should run as
${MOD_DED_BIN//-/_}_user="${GAMES_USER_DED}"
${MOD_DED_BIN//-/_}_group="${GAMES_GROUP}"
# Directory to use for HOME
${MOD_DED_BIN//-/_}_home="${GAMES_PREFIX}"
# Any extra options you want to pass to the dedicated server
${MOD_DED_BIN//-/_}_opts=""
EOF
doconfd "${T}"/${MOD_DED_BIN} || die "doconfd failed"
}
games-mods_src_install() {
if games-mods_use_opengl ; then
if [[ -n ${MOD_ICON} ]] ; then
# Install custom icon
local ext=${MOD_ICON##*.}
if [[ -f ${MOD_ICON} ]] ; then
newicon "${MOD_ICON}" ${PN}.${ext} || die "newicon failed"
else
newicon ${MOD_DIR}/"${MOD_ICON}" ${PN}.${ext} \
|| die "newicon failed"
fi
case ${ext} in
bmp|ico)
MOD_ICON=/usr/share/pixmaps/${PN}.${ext}
;;
*)
MOD_ICON=${PN}
;;
esac
else
# Use the game's standard icon
MOD_ICON=${GAME_ICON}
fi
games_make_wrapper ${MOD_BIN} "${GAME_BIN} ${SELECT_MOD}${MOD_DIR}"
make_desktop_entry ${MOD_BIN} "${GAME_NAME} - ${MOD_NAME}" "${MOD_ICON}"
# Since only quake3 has both a binary and a source-based install,
# we only look for quake3 here.
case ${GAME} in
quake3)
if has_version games-fps/quake3-bin ; then
games_make_wrapper ${GAME_BIN}-bin-${PN/${GAME}-} \
"${GAME_BIN}-bin ${SELECT_MOD}${MOD_DIR}"
fi
make_desktop_entry ${GAME_BIN}-bin-${PN/${GAME}-} \
"${GAME_NAME} - ${MOD_NAME} (binary)" "${MOD_ICON}"
;;
esac
fi
# We expect anything not wanted to have been deleted by the ebuild
insinto "${INS_DIR}"
doins -r * || die "doins -r failed"
games-mods_dosyms
if games-mods_use_dedicated ; then
if [[ -f ${FILESDIR}/server.cfg ]] ; then
insinto "${GAMES_SYSCONFDIR}"/${GAME}/${MOD_DIR}
doins "${FILESDIR}"/server.cfg || die "doins server.cfg failed"
dosym "${GAMES_SYSCONFDIR}"/${GAME}/${MOD_DIR}/server.cfg \
"${GAMES_PREFIX}"/${DED_CFG_DIR}/${MOD_DIR}/server.cfg \
|| die "dosym server.cfg failed"
fi
games_make_wrapper ${MOD_DED_BIN} \
"\"${GAMES_BINDIR}/${DED_BIN}\" ${SELECT_MOD}${MOD_DIR} ${DED_OPTS}"
games-mods_make_initd
games-mods_make_confd
fi
prepgamesdirs
}
games-mods_pkg_postinst() {
games_pkg_postinst
if games-mods_use_opengl ; then
elog "To play this mod run:"
elog " ${MOD_BIN}"
fi
if games-mods_use_dedicated ; then
elog "To launch a dedicated server run:"
elog " ${MOD_DED_BIN}"
elog "To launch the server at startup run:"
elog " rc-update add ${MOD_DED_BIN} default"
fi
}

View File

@ -1,396 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: games.eclass
# @MAINTAINER:
# Games team <games@gentoo.org>
# @SUPPORTED_EAPIS: 0 1 2 3 4 5
# @BLURB: Standardizing the install of games.
# @DESCRIPTION:
# This eclass makes sure that games are consistently handled in gentoo.
# It installs game files by default in FHS-compatible directories
# like /usr/share/games and sets more restrictive permissions in order
# to avoid some security bugs.
#
# The installation directories as well as the user and group files are
# installed as can be controlled by the user. See the variables like
# GAMES_BINDIR, GAMES_USER etc. below. These are NOT supposed to be set
# by ebuilds!
#
# For a general guide on writing games ebuilds, see:
# https://wiki.gentoo.org/wiki/Project:Games/Ebuild_howto
#
# WARNING: This eclass is DEPRECATED and must not be used by new games
# ebuilds, bug #574082. When writing game ebuilds, no specific eclass
# is needed. For more details, see the QA team policies page:
# https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Policies#Games
if [[ -z ${_GAMES_ECLASS} ]]; then
_GAMES_ECLASS=1
inherit base multilib toolchain-funcs eutils user
case ${EAPI:-0} in
0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst pkg_postinst ;;
2|3|4|5) EXPORT_FUNCTIONS pkg_setup src_configure src_compile pkg_preinst pkg_postinst ;;
*) die "games.eclass is banned in EAPI=${EAPI}, see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Policies#Games" ;;
esac
if [[ ${CATEGORY}/${PN} != "games-misc/games-envd" ]] ; then
# environment file
RDEPEND="games-misc/games-envd"
fi
# @ECLASS-VARIABLE: GAMES_PREFIX
# @DESCRIPTION:
# Prefix where to install games, mostly used by GAMES_BINDIR. Games data should
# still go into GAMES_DATADIR. May be set by the user.
GAMES_PREFIX=${GAMES_PREFIX:-/usr/games}
# @ECLASS-VARIABLE: GAMES_PREFIX_OPT
# @DESCRIPTION:
# Prefix where to install precompiled/blob games, usually followed by
# package name. May be set by the user.
GAMES_PREFIX_OPT=${GAMES_PREFIX_OPT:-/opt}
# @ECLASS-VARIABLE: GAMES_DATADIR
# @DESCRIPTION:
# Base directory where to install game data files, usually followed by
# package name. May be set by the user.
GAMES_DATADIR=${GAMES_DATADIR:-/usr/share/games}
# @ECLASS-VARIABLE: GAMES_DATADIR_BASE
# @DESCRIPTION:
# Similar to GAMES_DATADIR, but only used when a package auto appends 'games'
# to the path. May be set by the user.
GAMES_DATADIR_BASE=${GAMES_DATADIR_BASE:-/usr/share}
# @ECLASS-VARIABLE: GAMES_SYSCONFDIR
# @DESCRIPTION:
# Where to install global games configuration files, usually followed by
# package name. May be set by the user.
GAMES_SYSCONFDIR=${GAMES_SYSCONFDIR:-/etc/games}
# @ECLASS-VARIABLE: GAMES_STATEDIR
# @DESCRIPTION:
# Where to install/store global variable game data, usually followed by
# package name. May be set by the user.
GAMES_STATEDIR=${GAMES_STATEDIR:-/var/games}
# @ECLASS-VARIABLE: GAMES_LOGDIR
# @DESCRIPTION:
# Where to store global game log files, usually followed by
# package name. May be set by the user.
GAMES_LOGDIR=${GAMES_LOGDIR:-/var/log/games}
# @ECLASS-VARIABLE: GAMES_BINDIR
# @DESCRIPTION:
# Where to install the game binaries. May be set by the user. This is in PATH.
GAMES_BINDIR=${GAMES_BINDIR:-${GAMES_PREFIX}/bin}
# @ECLASS-VARIABLE: GAMES_ENVD
# @INTERNAL
# @DESCRIPTION:
# The games environment file name which sets games specific LDPATH and PATH.
GAMES_ENVD="90games"
# @ECLASS-VARIABLE: GAMES_USER
# @DESCRIPTION:
# The USER who owns all game files and usually has write permissions.
# May be set by the user.
GAMES_USER=${GAMES_USER:-root}
# @ECLASS-VARIABLE: GAMES_USER_DED
# @DESCRIPTION:
# The USER who owns all game files related to the dedicated server part
# of a package. May be set by the user.
GAMES_USER_DED=${GAMES_USER_DED:-games}
# @ECLASS-VARIABLE: GAMES_GROUP
# @DESCRIPTION:
# The GROUP that owns all game files and usually does not have
# write permissions. May be set by the user.
# If you want games world-executable, then you can at least set this variable
# to 'users' which is almost the same.
GAMES_GROUP=${GAMES_GROUP:-games}
# @FUNCTION: games_get_libdir
# @DESCRIPTION:
# Gets the directory where to install games libraries. This is in LDPATH.
games_get_libdir() {
echo ${GAMES_PREFIX}/$(get_libdir)
}
# @FUNCTION: egamesconf
# @USAGE: [<args>...]
# @DESCRIPTION:
# Games equivalent to 'econf' for autotools based build systems. It passes
# the necessary games specific directories automatically.
egamesconf() {
# handle verbose build log pre-EAPI5
local _gamesconf
if has "${EAPI:-0}" 0 1 2 3 4 ; then
if grep -q -s disable-silent-rules "${ECONF_SOURCE:-.}"/configure ; then
_gamesconf="--disable-silent-rules"
fi
fi
# bug 493954
if grep -q -s datarootdir "${ECONF_SOURCE:-.}"/configure ; then
_gamesconf="${_gamesconf} --datarootdir=/usr/share"
fi
econf \
--prefix="${GAMES_PREFIX}" \
--libdir="$(games_get_libdir)" \
--datadir="${GAMES_DATADIR}" \
--sysconfdir="${GAMES_SYSCONFDIR}" \
--localstatedir="${GAMES_STATEDIR}" \
${_gamesconf} \
"$@"
}
# @FUNCTION: gameswrapper
# @USAGE: <command> [<args>...]
# @INTERNAL
# @DESCRIPTION:
# Wraps an install command like dobin, dolib etc, so that
# it has GAMES_PREFIX as prefix.
gameswrapper() {
# dont want to pollute calling env
(
into "${GAMES_PREFIX}"
cmd=$1
shift
${cmd} "$@"
)
}
# @FUNCTION: dogamesbin
# @USAGE: <path>...
# @DESCRIPTION:
# Install one or more games binaries.
dogamesbin() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: dogamessbin
# @USAGE: <path>...
# @DESCRIPTION:
# Install one or more games system binaries.
dogamessbin() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: dogameslib
# @USAGE: <path>...
# @DESCRIPTION:
# Install one or more games libraries.
dogameslib() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: dogameslib.a
# @USAGE: <path>...
# @DESCRIPTION:
# Install one or more static games libraries.
dogameslib.a() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: dogameslib.so
# @USAGE: <path>...
# @DESCRIPTION:
# Install one or more shared games libraries.
dogameslib.so() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: newgamesbin
# @USAGE: <path> <newname>
# @DESCRIPTION:
# Install one games binary with a new name.
newgamesbin() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: newgamessbin
# @USAGE: <path> <newname>
# @DESCRIPTION:
# Install one system games binary with a new name.
newgamessbin() { gameswrapper ${FUNCNAME/games} "$@"; }
# @FUNCTION: games_make_wrapper
# @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
# @DESCRIPTION:
# Create a shell wrapper script named wrapper in installpath
# (defaults to the games 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.
games_make_wrapper() { gameswrapper ${FUNCNAME/games_} "$@"; }
# @FUNCTION: gamesowners
# @USAGE: [<args excluding owner/group>...] <path>...
# @DESCRIPTION:
# Run 'chown' with the given args on the given files. Owner and
# group are GAMES_USER and GAMES_GROUP and must not be passed
# as args.
gamesowners() { chown ${GAMES_USER}:${GAMES_GROUP} "$@"; }
# @FUNCTION: gamesperms
# @USAGE: <path>...
# @DESCRIPTION:
# Run 'chmod' with games specific permissions on the given files.
gamesperms() { chmod u+rw,g+r-w,o-rwx "$@"; }
# @FUNCTION: prepgamesdirs
# @DESCRIPTION:
# Fix all permissions/owners of files in games related directories,
# usually called at the end of src_install().
prepgamesdirs() {
local dir f mode
for dir in \
"${GAMES_PREFIX}" "${GAMES_PREFIX_OPT}" "${GAMES_DATADIR}" \
"${GAMES_SYSCONFDIR}" "${GAMES_STATEDIR}" "$(games_get_libdir)" \
"${GAMES_BINDIR}" "$@"
do
[[ ! -d ${D}/${dir} ]] && continue
(
gamesowners -R "${D}/${dir}"
find "${D}/${dir}" -type d -print0 | xargs -0 chmod 750
mode=o-rwx,g+r,g-w
[[ ${dir} = ${GAMES_STATEDIR} ]] && mode=o-rwx,g+r
find "${D}/${dir}" -type f -print0 | xargs -0 chmod $mode
# common trees should not be games owned #264872 #537580
fowners root:0 "${dir}"
fperms 755 "${dir}"
if [[ ${dir} == "${GAMES_PREFIX}" \
|| ${dir} == "${GAMES_PREFIX_OPT}" ]] ; then
for d in $(get_libdir) bin ; do
# check if dirs exist to avoid "nonfatal" option
if [[ -e ${D}/${dir}/${d} ]] ; then
fowners root:0 "${dir}/${d}"
fperms 755 "${dir}/${d}"
fi
done
fi
) &>/dev/null
f=$(find "${D}/${dir}" -perm +4000 -a -uid 0 2>/dev/null)
if [[ -n ${f} ]] ; then
eerror "A game was detected that is setuid root!"
eerror "${f}"
die "refusing to merge a setuid root game"
fi
done
[[ -d ${D}/${GAMES_BINDIR} ]] || return 0
find "${D}/${GAMES_BINDIR}" -maxdepth 1 -type f -exec chmod 750 '{}' \;
}
# @FUNCTION: games_pkg_setup
# @DESCRIPTION:
# Export some toolchain specific variables and create games related groups
# and users. This function is exported as pkg_setup().
games_pkg_setup() {
tc-export CC CXX LD AR RANLIB
enewgroup "${GAMES_GROUP}" 35
[[ ${GAMES_USER} != "root" ]] \
&& enewuser "${GAMES_USER}" 35 -1 "${GAMES_PREFIX}" "${GAMES_GROUP}"
[[ ${GAMES_USER_DED} != "root" ]] \
&& enewuser "${GAMES_USER_DED}" 36 /bin/bash "${GAMES_PREFIX}" "${GAMES_GROUP}"
# Dear portage team, we are so sorry. Lots of love, games team.
# See Bug #61680
[[ ${USERLAND} != "GNU" ]] && return 0
[[ $(egetshell "${GAMES_USER_DED}") == "/bin/false" ]] \
&& usermod -s /bin/bash "${GAMES_USER_DED}"
}
# @FUNCTION: games_src_configure
# @DESCRIPTION:
# Runs egamesconf if there is a configure file.
# This function is exported as src_configure().
games_src_configure() {
[[ -x "${ECONF_SOURCE:-.}"/configure ]] && egamesconf
}
# @FUNCTION: games_src_compile
# @DESCRIPTION:
# Runs base_src_make(). This function is exported as src_compile().
games_src_compile() {
case ${EAPI:-0} in
0|1) games_src_configure ;;
esac
base_src_make
}
# @FUNCTION: games_pkg_preinst
# @DESCRIPTION:
# Synchronizes GAMES_STATEDIR of the ebuild image with the live filesystem.
games_pkg_preinst() {
local f
while read f ; do
if [[ -e ${ROOT}/${GAMES_STATEDIR}/${f} ]] ; then
cp -p \
"${ROOT}/${GAMES_STATEDIR}/${f}" \
"${D}/${GAMES_STATEDIR}/${f}" \
|| die "cp failed"
# make the date match the rest of the install
touch "${D}/${GAMES_STATEDIR}/${f}"
fi
done < <(find "${D}/${GAMES_STATEDIR}" -type f -printf '%P\n' 2>/dev/null)
}
# @FUNCTION: games_pkg_postinst
# @DESCRIPTION:
# Prints some warnings and infos, also related to games groups.
games_pkg_postinst() {
if [[ -z "${GAMES_SHOW_WARNING}" ]] ; then
ewarn "Remember, in order to play games, you have to"
ewarn "be in the '${GAMES_GROUP}' group."
echo
case ${CHOST} in
*-darwin*) ewarn "Just run 'niutil -appendprop / /groups/games users <USER>'";;
*-freebsd*|*-dragonfly*) ewarn "Just run 'pw groupmod ${GAMES_GROUP} -m <USER>'";;
*) ewarn "Just run 'gpasswd -a <USER> ${GAMES_GROUP}', then have <USER> re-login.";;
esac
echo
einfo "For more info about Gentoo gaming in general, see our website:"
einfo " https://games.gentoo.org/"
echo
fi
}
# @FUNCTION: games_ut_unpack
# @USAGE: <directory or file to unpack>
# @DESCRIPTION:
# Unpack .uz2 files for UT2003/UT2004.
games_ut_unpack() {
local ut_unpack="$1"
local f=
if [[ -z ${ut_unpack} ]] ; then
die "You must provide an argument to games_ut_unpack"
fi
if [[ -f ${ut_unpack} ]] ; then
uz2unpack "${ut_unpack}" "${ut_unpack%.uz2}" \
|| die "uncompressing file ${ut_unpack}"
fi
if [[ -d ${ut_unpack} ]] ; then
while read f ; do
uz2unpack "${ut_unpack}/${f}" "${ut_unpack}/${f%.uz2}" \
|| die "uncompressing file ${f}"
rm -f "${ut_unpack}/${f}" || die "deleting compressed file ${f}"
done < <(find "${ut_unpack}" -maxdepth 1 -name '*.uz2' -printf '%f\n' 2>/dev/null)
fi
}
# @FUNCTION: games_umod_unpack
# @USAGE: <file to unpack>
# @DESCRIPTION:
# Unpacks .umod/.ut2mod/.ut4mod files for UT/UT2003/UT2004.
# Don't forget to set 'dir' and 'Ddir'.
games_umod_unpack() {
local umod=$1
mkdir -p "${Ddir}"/System
cp "${dir}"/System/{ucc-bin,{Manifest,Def{ault,User}}.ini,{Engine,Core,zlib,ogg,vorbis}.so,{Engine,Core}.int} "${Ddir}"/System
cd "${Ddir}"/System
UT_DATA_PATH=${Ddir}/System ./ucc-bin umodunpack -x "${S}/${umod}" -nohomedir &> /dev/null \
|| die "uncompressing file ${umod}"
rm -f "${Ddir}"/System/{ucc-bin,{Manifest,Def{ault,User},User,UT200{3,4}}.ini,{Engine,Core,zlib,ogg,vorbis}.so,{Engine,Core}.int,ucc.log} &>/dev/null \
|| die "Removing temporary files"
}
fi

View File

@ -1,85 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: golang-build.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Eclass for compiling go packages.
# @DESCRIPTION:
# This eclass provides default src_compile, src_test and src_install
# functions for software written in the Go programming language.
inherit golang-base
case "${EAPI:-0}" in
5|6|7)
;;
*)
die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})"
;;
esac
EXPORT_FUNCTIONS src_compile src_install src_test
if [[ -z ${_GOLANG_BUILD} ]]; then
_GOLANG_BUILD=1
# @ECLASS-VARIABLE: EGO_BUILD_FLAGS
# @DEFAULT_UNSET
# @DESCRIPTION:
# This allows you to pass build flags to the Go compiler. These flags
# are common to the "go build" and "go install" commands used below.
# Please emerge dev-lang/go and run "go help build" for the
# documentation for these flags.
#
# Example:
# @CODE
# EGO_BUILD_FLAGS="-ldflags \"-X main.version ${PV}\""
# @CODE
# @ECLASS-VARIABLE: EGO_PN
# @REQUIRED
# @DESCRIPTION:
# This is the import path for the go package(s) to build. Please emerge
# dev-lang/go and read "go help importpath" for syntax.
#
# Example:
# @CODE
# EGO_PN=github.com/user/package
# @CODE
golang-build_src_compile() {
debug-print-function ${FUNCNAME} "$@"
ego_pn_check
set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
GOCACHE="${T}/go-cache" \
go build -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
echo "$@"
"$@" || die
}
golang-build_src_install() {
debug-print-function ${FUNCNAME} "$@"
ego_pn_check
set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
echo "$@"
"$@" || die
golang_install_pkgs
}
golang-build_src_test() {
debug-print-function ${FUNCNAME} "$@"
ego_pn_check
set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
go test -v -work -x "${EGO_PN}"
echo "$@"
"$@" || die
}
fi

View File

@ -1,426 +0,0 @@
# Copyright 2004-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-ant-2.eclass
# @MAINTAINER:
# java@gentoo.org
# @AUTHOR:
# kiorky (kiorky@cryptelium.net), Petteri Räty (betelgeuse@gentoo.org)
# @BLURB: eclass for ant based Java packages
# @DESCRIPTION:
# Eclass for Ant-based Java packages. Provides support for both automatic and
# manual manipulation of build.xml files. Should be inherited after java-pkg-2
# or java-pkg-opt-2 eclass.
inherit java-utils-2 multilib
# This eclass provides functionality for Java packages which use
# ant to build. In particular, it will attempt to fix build.xml files, so that
# they use the appropriate 'target' and 'source' attributes.
# @ECLASS-VARIABLE: WANT_ANT_TASKS
# @DEFAULT_UNSET
# @DESCRIPTION:
# An $IFS separated list of ant tasks.
# Ebuild can specify this variable before inheriting java-ant-2 eclass to
# determine ANT_TASKS it needs. They will be automatically translated to
# DEPEND variable and ANT_TASKS variable. JAVA_PKG_FORCE_ANT_TASKS can override
# ANT_TASKS set by WANT_ANT_TASKS, but not the DEPEND due to caching.
# Ebuilds that need to depend conditionally on certain tasks and specify them
# differently for different eant calls can't use this simplified approach.
# You also cannot specify version or anything else than ant-*.
#
# @CODE
# WANT_ANT_TASKS="ant-junit ant-trax"
# @CODE
#The implementation of dependencies is handled by java-utils-2.eclass
#WANT_ANT_TASKS
# @ECLASS-VARIABLE: JAVA_ANT_DISABLE_ANT_CORE_DEP
# @DEFAULT_UNSET
# @DESCRIPTION:
# Setting this variable non-empty before inheriting java-ant-2 disables adding
# dev-java/ant-core into DEPEND.
if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then
JAVA_ANT_E_DEPEND+=" >=dev-java/ant-core-1.8.2"
[[ "${EAPI:-0}" != 0 ]] && JAVA_ANT_E_DEPEND+=":0"
fi
# add ant tasks specified in WANT_ANT_TASKS to DEPEND
local ANT_TASKS_DEPEND;
ANT_TASKS_DEPEND="$(java-pkg_ant-tasks-depend)"
# check that java-pkg_ant-tasks-depend didn't fail
if [[ $? != 0 ]]; then
eerror "${ANT_TASKS_DEPEND}"
die "java-pkg_ant-tasks-depend() failed"
fi
# We need some tools from javatoolkit. We also need ant dependencies
# constructed above.
JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND}
${ANT_TASKS_DEPEND}
>=dev-java/javatoolkit-0.3.0-r2"
# this eclass must be inherited after java-pkg-2 or java-pkg-opt-2
# if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag
if has java-pkg-opt-2 ${INHERITED}; then
JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )"
elif ! has java-pkg-2 ${INHERITED}; then
eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
fi
DEPEND="${JAVA_ANT_E_DEPEND}"
# @ECLASS-VARIABLE: JAVA_PKG_BSFIX
# @DESCRIPTION:
# Should we attempt to 'fix' ant build files to include the source/target
# attributes when calling javac?
JAVA_PKG_BSFIX=${JAVA_PKG_BSFIX:-"on"}
# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_ALL
# @DESCRIPTION:
# If we're fixing build files, should we try to fix all the ones we can find?
JAVA_PKG_BSFIX_ALL=${JAVA_PKG_BSFIX_ALL:-"yes"}
# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_NAME
# @DESCRIPTION:
# Filename of build files to fix/search for
JAVA_PKG_BSFIX_NAME=${JAVA_PKG_BSFIX_NAME:-"build.xml"}
# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_TARGET_TAGS
# @DESCRIPTION:
# Targets to fix the 'source' attribute in
JAVA_PKG_BSFIX_TARGET_TAGS=${JAVA_PKG_BSFIX_TARGET_TAGS:-"javac xjavac javac.preset"}
# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_SOURCE_TAGS
# @DESCRIPTION:
# Targets to fix the 'target' attribute in
JAVA_PKG_BSFIX_SOURCE_TAGS=${JAVA_PKG_BSFIX_SOURCE_TAGS:-"javadoc javac xjavac javac.preset"}
# @ECLASS-VARIABLE: JAVA_ANT_CLASSPATH_TAGS
# @DESCRIPTION:
# Targets to add the classpath attribute to
JAVA_ANT_CLASSPATH_TAGS="javac xjavac"
# @ECLASS-VARIABLE: JAVA_ANT_IGNORE_SYSTEM_CLASSES
# @DEFAULT_UNSET
# @DESCRIPTION:
# When set, <available> Ant tasks are rewritten to ignore Ant's runtime classpath.
case "${EAPI:-0}" in
0|1) : ;;
*) EXPORT_FUNCTIONS src_configure ;;
esac
# @FUNCTION: java-ant-2_src_configure
# @DESCRIPTION:
# src_configure rewrites the build.xml files automatically, unless EAPI is undefined, 0 or 1.
java-ant-2_src_configure() {
# if java support is optional, don't perform this when the USE flag is off
if has java-pkg-opt-2 ${INHERITED}; then
use ${JAVA_PKG_OPT_USE} || return
fi
# eant will call us unless called by Portage
[[ -e "${T}/java-ant-2_src_configure-run" ]] && return
[[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] \
&& java-ant_ignore-system-classes "${S}/build.xml"
java-ant_bsfix
touch "${T}/java-ant-2_src_configure-run"
}
# @FUNCTION: java-ant_bsfix
# @INTERNAL
# @DESCRIPTION:
# Attempts to fix build files.
#
# @CODE
# Affected by variables:
# JAVA_PKG_BSFIX
# JAVA_PKG_BSFIX_ALL
# JAVA_PKG_BSFIX_NAME,
# @CODE
java-ant_bsfix() {
debug-print-function ${FUNCNAME} $*
[[ "${JAVA_PKG_BSFIX}" != "on" ]] && return
if ! java-pkg_needs-vm; then
echo "QA Notice: Package is using java-ant, but doesn't depend on a Java VM"
fi
pushd "${S}" >/dev/null || die
local find_args=""
[[ "${JAVA_PKG_BSFIX_ALL}" == "yes" ]] || find_args="-maxdepth 1"
find_args="${find_args} -type f ( -name ${JAVA_PKG_BSFIX_NAME// / -o -name } )"
local bsfix_these=() line
while IFS= read -r -d $'\0' line; do
bsfix_these+=( "${line}" )
done < <(find . ${find_args} -print0)
[[ "${bsfix_these[@]}" ]] && java-ant_bsfix_files "${bsfix_these[@]}"
popd > /dev/null || die
}
# @FUNCTION: java-ant_bsfix_files
# @USAGE: <path/to/first/build.xml> [path/to/second.build.xml ...]
# @DESCRIPTION:
# Attempts to fix named build files.
#
# @CODE
# Affected by variables:
# JAVA_PKG_BSFIX_SOURCE_TAGS
# JAVA_PKG_BSFIX_TARGET_TAGS
# JAVA_ANT_REWRITE_CLASSPATH
# JAVA_ANT_JAVADOC_INPUT_DIRS: Where we can find java sources for javadoc
# input. Can be a space separated list of
# directories
# JAVA_ANT_BSFIX_EXTRA_ARGS: You can use this to pass extra variables to the
# rewriter if you know what you are doing.
# @CODE
#
# If JAVA_ANT_JAVADOC_INPUT_DIRS is set, we will turn on the adding of a basic
# javadoc target to the ant's build.xml with the javadoc xml-rewriter feature.
# Then we will set EANT DOC TARGET to the added javadoc target
# NOTE: the variable JAVA_ANT_JAVADOC_OUTPUT_DIR points where we will
# generate the javadocs. This is a read-only variable, dont change it.
# When changing this function, make sure that it works with paths with spaces in
# them.
java-ant_bsfix_files() {
debug-print-function ${FUNCNAME} $*
[[ ${#} = 0 ]] && die "${FUNCNAME} called without arguments"
local want_source="$(java-pkg_get-source)"
local want_target="$(java-pkg_get-target)"
debug-print "${FUNCNAME}: target: ${want_target} source: ${want_source}"
if [ -z "${want_source}" -o -z "${want_target}" ]; then
eerror "Could not find valid -source/-target values"
eerror "Please file a bug about this on bugs.gentoo.org"
die "Could not find valid -source/-target values"
else
local files=()
for file in "${@}"; do
debug-print "${FUNCNAME}: ${file}"
if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
cp "${file}" "${file}.orig" || die "failed to copy ${file}"
fi
if [[ ! -w "${file}" ]]; then
chmod u+w "${file}" || die "chmod u+w ${file} failed"
fi
files+=( -f "${file}" )
done
local rewriter3="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py"
local rewriter4="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/build-xml-rewrite"
if [[ -x ${rewriter4} && ${JAVA_ANT_ENCODING} ]]; then
[[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] && local gcp="-g"
[[ ${JAVA_ANT_ENCODING} ]] && local enc="-e ${JAVA_ANT_ENCODING}"
echo "cElementTree rewriter"
debug-print "${rewriter4} extra args: ${gcp} ${enc}"
${rewriter4} ${gcp} ${enc} \
-c "${JAVA_PKG_BSFIX_SOURCE_TAGS}" source ${want_source} \
-c "${JAVA_PKG_BSFIX_TARGET_TAGS}" target ${want_target} \
"${@}" || die "build-xml-rewrite failed"
else
debug-print "Using third generation rewriter"
echo "Rewriting attributes"
local bsfix_extra_args=()
# WARNING KEEP THE ORDER, ESPECIALLY FOR CHANGED ATTRIBUTES!
if [[ -n ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
local cp_tags="${JAVA_ANT_CLASSPATH_TAGS// / -e }"
bsfix_extra_args+=( -g -e ${cp_tags} )
bsfix_extra_args+=( -a classpath -v '${gentoo.classpath}' )
fi
if [[ -n ${JAVA_ANT_JAVADOC_INPUT_DIRS} ]]; then
if [[ -n ${JAVA_ANT_JAVADOC_OUTPUT_DIR} ]]; then
die "Do not define JAVA_ANT_JAVADOC_OUTPUT_DIR!"
fi
# Where will our generated javadoc go.
readonly JAVA_ANT_JAVADOC_OUTPUT_DIR="${WORKDIR}/gentoo_javadoc"
mkdir -p "${JAVA_ANT_JAVADOC_OUTPUT_DIR}" || die
if has doc ${IUSE}; then
if use doc; then
if [[ -z ${EANT_DOC_TARGET} ]]; then
EANT_DOC_TARGET="gentoojavadoc"
else
die "You can't use javadoc adding and set EANT_DOC_TARGET too."
fi
for dir in ${JAVA_ANT_JAVADOC_INPUT_DIRS};do
if [[ ! -d ${dir} ]]; then
eerror "This dir: ${dir} doesnt' exists"
die "You must specify directories for javadoc input/output dirs."
fi
done
bsfix_extra_args+=( --javadoc --source-directory )
# filter third/double spaces
JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
bsfix_extra_args+=( ${JAVA_ANT_JAVADOC_INPUT_DIRS// / --source-directory } )
bsfix_extra_args+=( --output-directory "${JAVA_ANT_JAVADOC_OUTPUT_DIR}" )
fi
else
die "You need to have doc in IUSE when using JAVA_ANT_JAVADOC_INPUT_DIRS"
fi
fi
[[ -n ${JAVA_ANT_BSFIX_EXTRA_ARGS} ]] \
&& bsfix_extra_args+=( ${JAVA_ANT_BSFIX_EXTRA_ARGS} )
debug-print "bsfix_extra_args: ${bsfix_extra_args[*]}"
${rewriter3} "${files[@]}" \
-c --source-element ${JAVA_PKG_BSFIX_SOURCE_TAGS// / --source-element } \
--source-attribute source --source-value ${want_source} \
--target-element ${JAVA_PKG_BSFIX_TARGET_TAGS// / --target-element } \
--target-attribute target --target-value ${want_target} \
--target-attribute nowarn --target-value yes \
"${bsfix_extra_args[@]}" \
|| die "xml-rewrite-3 failed: ${file}"
fi
if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
for file in "${@}"; do
diff -NurbB "${file}.orig" "${file}"
done
fi
fi
return 0 # so that the 1 for diff doesn't get reported
}
# @FUNCTION: java-ant_bsfix_one
# @USAGE: <path/to/build.xml>
# @DESCRIPTION:
# Attempts to fix named build file.
#
# @CODE
# Affected by variables:
# JAVA_PKG_BSFIX_SOURCE_TAGS
# JAVA_PKG_BSFIX_TARGET_TAGS
# @CODE
java-ant_bsfix_one() {
debug-print-function ${FUNCNAME} $*
if [ -z "${1}" ]; then
eerror "${FUNCNAME} needs one argument"
die "${FUNCNAME} needs one argument"
fi
java-ant_bsfix_files "${1}"
}
# @FUNCTION: java-ant_rewrite-classpath
# @USAGE: [path/to/build.xml]
# @DESCRIPTION:
# Adds 'classpath="${gentoo.classpath}"' to specified build file.
#
# Affected by:
# JAVA_ANT_CLASSPATH_TAGS
#
# Parameter defaults to build.xml when not specified
java-ant_rewrite-classpath() {
debug-print-function ${FUNCNAME} $*
local file="${1}"
[[ -z "${1}" ]] && file=build.xml
[[ ${#} -gt 1 ]] && die "${FUNCNAME} currently can only rewrite one file."
echo "Adding gentoo.classpath to ${file}"
debug-print "java-ant_rewrite-classpath: ${file}"
cp "${file}" "${file}.orig" || die "failed to copy ${file}"
chmod u+w "${file}"
java-ant_xml-rewrite -f "${file}" --change \
-e ${JAVA_ANT_CLASSPATH_TAGS// / -e } -a classpath -v '${gentoo.classpath}'
if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
diff -NurbB "${file}.orig" "${file}"
fi
}
# @FUNCTION: java-ant_ignore-system-classes
# @USAGE: [path/to/build.xml]
# @DESCRIPTION:
# Makes the available task ignore classes in the system classpath
# Parameter defaults to build.xml when not specified
java-ant_ignore-system-classes() {
debug-print-function ${FUNCNAME} $*
local file=${1:-build.xml}
echo "Changing ignoresystemclasses to true for available tasks in ${file}"
java-ant_xml-rewrite -f "${file}" --change \
-e available -a ignoresystemclasses -v "true"
}
# @FUNCTION: java-ant_xml-rewrite
# @USAGE: <xml rewriter arguments>
# @DESCRIPTION:
# Run the right xml-rewrite binary with the given arguments
java-ant_xml-rewrite() {
local gen2="${EPREFIX}/usr/bin/xml-rewrite-2.py"
local gen2_1="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-2.py"
# gen1 is deprecated
if [[ -x "${gen2}" ]]; then
${gen2} "${@}" || die "${gen2} failed"
elif [[ -x "${gen2_1}" ]]; then
${gen2_1} "${@}" || die "${gen2_1} failed"
else
eerror "No binary for rewriting found."
eerror "Do you have dev-java/javatoolkit installed?"
die "xml-rewrite not found"
fi
}
# @FUNCTION: java-ant_rewrite-bootclasspath
# @USAGE: <version> [path/to/build.xml] [prepend] [append]
# @DESCRIPTION:
# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
# bootclasspath package of given version.
#
# @CODE
# Affected by:
# JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
#
# Parameters:
# $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
# of the current JDK
# $2 - path to desired build.xml file, defaults to 'build.xml'
# $3 - (optional) what to prepend the bootclasspath with (to override)
# $4 - (optional) what to append to the bootclasspath
# @CODE
java-ant_rewrite-bootclasspath() {
local version="${1}"
local file="${2-build.xml}"
local extra_before="${3}"
local extra_after="${4}"
local bcp="$(java-pkg_get-bootclasspath "${version}")"
if [[ -n "${extra_before}" ]]; then
bcp="${extra_before}:${bcp}"
fi
if [[ -n "${extra_after}" ]]; then
bcp="${bcp}:${extra_after}"
fi
java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
-a bootclasspath -v "${bcp}"
}

View File

@ -1,277 +0,0 @@
# Copyright 2007-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-osgi.eclass
# @MAINTAINER:
# java@gentoo.org
# @AUTHOR:
# Java maintainers (java@gentoo.org)
# @BLURB: Java OSGi eclass
# @DESCRIPTION:
# This eclass provides functionality which is used by packages that need to be
# OSGi compliant. This means that the generated jars will have special headers
# in their manifests. Currently this is used only by Eclipse-3.3 - later we
# could extend this so that Gentoo Java system would be fully OSGi compliant.
inherit java-utils-2
# @ECLASS-VARIABLE: _OSGI_T
# @INTERNAL
# @DESCRIPTION:
# We define _OSGI_T so that it does not contain a slash at the end.
# According to Paludis guys, there is currently a proposal for EAPIs that
# would require all variables to end with a slash.
_OSGI_T="${T/%\//}"
# must get Diego to commit something like this to portability.eclass
_canonicalise() {
if type -p realpath > /dev/null; then
realpath "${@}"
elif type -p readlink > /dev/null; then
readlink -f "${@}"
else
# can't die, subshell
eerror "No readlink nor realpath found, cannot canonicalise"
fi
}
# @FUNCTION: _java-osgi_plugin
# @USAGE: <plugin name>
# @INTERNAL
# @DESCRIPTION:
# This is an internal function, not to be called directly.
#
# @CODE
# _java-osgi_plugin "JSch"
# @CODE
#
# @param $1 - bundle name
_java-osgi_plugin() {
# We hardcode Gentoo as the vendor name
cat > "${_OSGI_T}/tmp_jar/plugin.properties" <<-EOF
bundleName="${1}"
vendorName="Gentoo"
EOF
}
# @FUNCTION: _java-osgi_makejar
# @USAGE: <jar name> <symbolic name> <bundle name> <header name>
# @INTERNAL
# @DESCRIPTION:
# This is an internal function, not to be called directly.
#
# @CODE
# _java-osgi_makejar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true"
# @CODE
#
# @param $1 - name of jar to repackage with OSGi
# @param $2 - bundle symbolic name
# @param $3 - bundle name
# @param $4 - export-package header
_java-osgi_makejar() {
debug-print-function ${FUNCNAME} "$@"
(( ${#} < 4 )) && die "Four arguments are needed for _java-osgi_makejar()"
local absoluteJarPath="$(_canonicalise ${1})"
local jarName="$(basename ${1})"
mkdir "${_OSGI_T}/tmp_jar" || die "Unable to create directory ${_OSGI_T}/tmp_jar"
[[ -d "${_OSGI_T}/osgi" ]] || mkdir "${_OSGI_T}/osgi" || die "Unable to create directory ${_OSGI_T}/osgi"
cd "${_OSGI_T}/tmp_jar" && jar xf "${absoluteJarPath}" && cd - > /dev/null \
|| die "Unable to uncompress correctly the original jar"
cat > "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" <<-EOF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-Vendor: %vendorName
Bundle-Localization: plugin
Bundle-SymbolicName: ${2}
Bundle-Version: ${PV}
Export-Package: ${4}
EOF
_java-osgi_plugin "${3}"
jar cfm "${_OSGI_T}/osgi/${jarName}" "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" \
-C "${_OSGI_T}/tmp_jar/" . > /dev/null || die "Unable to recreate the OSGi compliant jar"
rm -rf "${_OSGI_T}/tmp_jar"
}
# @FUNCTION: @java-osgi_dojar
# @USAGE: <jar name> <symbolic name> <bundle name> <header name>
# @DESCRIPTION:
# Rewrites a jar, and produce an OSGi compliant jar from arguments given on the command line.
# The arguments given correspond to the minimal set of headers
# that must be present on a Manifest file of an OSGi package.
# If you need more headers, you should use the *-fromfile functions below,
# that create the Manifest from a file.
# It will call java-pkg_dojar at the end.
#
# @CODE
# java-osgi_dojar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true"
# @CODE
#
# @param $1 - name of jar to repackage with OSGi
# @param $2 - bundle symbolic name
# @param $3 - bundle name
# @param $4 - export-package-header
java-osgi_dojar() {
debug-print-function ${FUNCNAME} "$@"
local jarName="$(basename ${1})"
_java-osgi_makejar "$@"
java-pkg_dojar "${_OSGI_T}/osgi/${jarName}"
}
# @FUNCTION: java-osgi_newjar
# @USAGE: <jar name> <symbolic name> <bundle name> <header name>
# @DESCRIPTION:
# Rewrites a jar, and produce an OSGi compliant jar.
# The arguments given correspond to the minimal set of headers
# that must be present on a Manifest file of an OSGi package.
# If you need more headers, you should use the *-fromfile functions below,
# that create the Manifest from a file.
# It will call java-pkg_newjar at the end.
#
# @CODE
# java-osgi_newjar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true"
# @CODE
#
# @param $1 - name of jar to repackage with OSGi
# @param $2 (optional) - name of the target jar. It will default to package name if not specified.
# @param $3 - bundle symbolic name
# @param $4 - bundle name
# @param $5 - export-package header
java-osgi_newjar() {
debug-print-function ${FUNCNAME} "$@"
local jarName="$(basename $1)"
if (( ${#} > 4 )); then
_java-osgi_makejar "${1}" "${3}" "${4}" "${5}"
java-pkg_newjar "${_OSGI_T}/osgi/${jarName}" "${2}"
else
_java-osgi_makejar "$@"
java-pkg_newjar "${_OSGI_T}/osgi/${jarName}"
fi
}
# @FUNCTION:_java-osgi_makejar-fromfile
# @USAGE: <jar to repackage with OSGi> <Manifest file> <bundle name> <version rewriting>
# @INTERNAL
# @DESCRIPTION:
# This is an internal function, not to be called directly.
#
# @CODE
# _java-osgi_makejar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "JSch" 1
# @CODE
#
# @param $1 - name of jar to repackage with OSGi
# @param $2 - path to the Manifest file
# @param $3 - bundle name
# @param $4 - automatic version rewriting (0 or 1)
_java-osgi_makejar-fromfile() {
debug-print-function ${FUNCNAME} "$@"
((${#} < 4)) && die "Four arguments are needed for _java-osgi_makejar-fromfile()"
local absoluteJarPath="$(_canonicalise ${1})"
local jarName="$(basename ${1})"
mkdir "${_OSGI_T}/tmp_jar" || die "Unable to create directory ${_OSGI_T}/tmp_jar"
[[ -d "${_OSGI_T}/osgi" ]] || mkdir "${_OSGI_T}/osgi" || die "Unable to create directory ${_OSGI_T}/osgi"
cd "${_OSGI_T}/tmp_jar" && jar xf "${absoluteJarPath}" && cd - > /dev/null \
|| die "Unable to uncompress correctly the original jar"
[[ -e "${2}" ]] || die "Manifest file ${2} not found"
# We automatically change the version if automatic version rewriting is on
if (( ${4} )); then
cat "${2}" | sed "s/Bundle-Version:.*/Bundle-Version: ${PV}/" > \
"${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF"
else
cat "${2}" > "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF"
fi
_java-osgi_plugin "${3}"
jar cfm "${_OSGI_T}/osgi/${jarName}" "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" \
-C "${_OSGI_T}/tmp_jar/" . > /dev/null || die "Unable to recreate the OSGi compliant jar"
rm -rf "${_OSGI_T}/tmp_jar"
}
# @FUNCTION: java-osgi_newjar-fromfile
# @USAGE: <jar to repackage with OSGi> <Manifest file> <bundle name> <version rewriting>
# @DESCRIPTION:
# This function produces an OSGi compliant jar from a given manifest file.
# The Manifest Bundle-Version header will be replaced by the current version
# of the package, unless the --no-auto-version option is given.
# It will call java-pkg_newjar at the end.
#
# @CODE
# java-osgi_newjar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "Standard Widget Toolkit for GTK 2.0"
# @CODE
#
# @param $opt
# --no-auto-version - This option disables automatic rewriting of the
# version in the Manifest file
#
# @param $1 - name of jar to repackage with OSGi
# @param $2 (optional) - name of the target jar. It will default to package name if not specified.
# @param $3 - path to the Manifest file
# @param $4 - bundle name
java-osgi_newjar-fromfile() {
debug-print-function ${FUNCNAME} "$@"
local versionRewriting=1
if [[ "${1}" == "--no-auto-version" ]]; then
versionRewriting=0
shift
fi
local jarName="$(basename ${1})"
if (( ${#} > 3 )); then
_java-osgi_makejar-fromfile "${1}" "${3}" "${4}" "${versionRewriting}"
java-pkg_newjar "${_OSGI_T}/osgi/${jarName}" "${2}"
else
_java-osgi_makejar-fromfile "$@" "${versionRewriting}"
java-pkg_newjar "${_OSGI_T}/osgi/${jarName}"
fi
}
# @FUNCTION: java-osgi_dojar-fromfile
# @USAGE: <jar to repackage with OSGi> <Manifest file> <bundle name>
# @DESCRIPTION:
# This function produces an OSGi compliant jar from a given manifestfile.
# The Manifest Bundle-Version header will be replaced by the current version
# of the package, unless the --no-auto-version option is given.
# It will call java-pkg_dojar at the end.
#
# @CODE
# java-osgi_dojar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "Standard Widget Toolkit for GTK 2.0"
# @CODE
#
# @param $opt
# --no-auto-version - This option disables automatic rewriting of the
# version in the Manifest file
#
# @param $1 - name of jar to repackage with OSGi
# @param $2 - path to the Manifest file
# @param $3 - bundle name
java-osgi_dojar-fromfile() {
debug-print-function ${FUNCNAME} "$@"
local versionRewriting=1
if [[ "${1}" == "--no-auto-version" ]]; then
versionRewriting=0
shift
fi
local jarName="$(basename ${1})"
_java-osgi_makejar-fromfile "$@" "${versionRewriting}"
java-pkg_dojar "${_OSGI_T}/osgi/${jarName}"
}

View File

@ -1,155 +0,0 @@
# Copyright 2004-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-pkg-2.eclass
# @MAINTAINER:
# java@gentoo.org
# @AUTHOR:
# Thomas Matthijs <axxo@gentoo.org>
# @BLURB: Eclass for Java Packages
# @DESCRIPTION:
# This eclass should be inherited for pure Java packages, or by packages which
# need to use Java.
inherit java-utils-2
# @ECLASS-VARIABLE: JAVA_PKG_IUSE
# @DEFAULT_UNSET
# @DESCRIPTION:
# Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that
# the eclass can automatically add the needed dependencies for the java-pkg_do*
# functions.
IUSE="${JAVA_PKG_IUSE}"
# Java packages need java-config, and a fairly new release of Portage.
# JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
DEPEND="${JAVA_PKG_E_DEPEND}"
# Nothing special for RDEPEND... just the same as DEPEND.
RDEPEND="${DEPEND}"
# Commons packages follow the same rules so do it here
if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then
HOMEPAGE="http://commons.apache.org/${PN#commons-}/"
SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz"
fi
case "${EAPI:-0}" in
0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;;
*) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;;
esac
# @FUNCTION: java-pkg-2_pkg_setup
# @DESCRIPTION:
# pkg_setup initializes the Java environment
java-pkg-2_pkg_setup() {
java-pkg_init
}
# @FUNCTION: java-pkg-2_src_prepare
# @DESCRIPTION:
# wrapper for java-utils-2_src_prepare
java-pkg-2_src_prepare() {
java-utils-2_src_prepare
}
# @FUNCTION: java-pkg-2_src_compile
# @DESCRIPTION:
# Default src_compile for java packages
#
# @CODE
# Variables:
# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
# EANT_DOC_TARGET - the target to build extra docs under the doc use flag
# (default: javadoc; declare empty to disable completely)
# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
# EANT_EXTRA_ARGS - extra arguments to pass to eant
# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment
# @CODE
java-pkg-2_src_compile() {
if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
# auto generate classpath
java-pkg_gen-cp EANT_GENTOO_CLASSPATH
[[ "${EANT_FILTER_COMPILER}" ]] && \
java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
local antflags="${EANT_BUILD_TARGET:=jar}"
if has doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then
antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
fi
local tasks
[[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}"
ANT_TASKS="${tasks:-${ANT_TASKS}}" \
eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}"
else
echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
fi
}
# @FUNCTION: java-pkg-2_src_test
# @DESCRIPTION:
# src_test, not exported.
java-pkg-2_src_test() {
[[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
if [[ ${EANT_TEST_TARGET} ]] || < "${EANT_BUILD_XML}" tr -d "\n" | grep -Eq "<target\b[^>]*\bname=[\"']test[\"']"; then
local opts task_re junit_re pkg
if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
fi
if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH}"
fi
ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
task_re="\bdev-java/ant-junit(4)?(-[^:]+)?(:\S+)\b"
junit_re="\bdev-java/junit(-[^:]+)?(:\S+)\b"
if [[ ${DEPEND} =~ ${task_re} ]]; then
pkg="ant-junit${BASH_REMATCH[1]}${BASH_REMATCH[3]}"
pkg="${pkg%:0}"
if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
ANT_TASKS="${ANT_TASKS} ${pkg}"
else
ANT_TASKS="${pkg}"
fi
elif [[ ${DEPEND} =~ ${junit_re} ]]; then
pkg="junit${BASH_REMATCH[2]}"
pkg="${pkg%:0}"
opts="-Djunit.jar=\"$(java-pkg_getjar ${pkg} junit.jar)\""
if [[ ${EANT_GENTOO_CLASSPATH} ]]; then
EANT_GENTOO_CLASSPATH+=",${pkg}"
else
EANT_GENTOO_CLASSPATH="${pkg}"
fi
fi
eant ${opts} -f "${EANT_BUILD_XML}" \
${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
else
echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
fi
}
# @FUNCTION: java-pkg-2_pkg_preinst
# @DESCRIPTION:
# wrapper for java-utils-2_pkg_preinst
java-pkg-2_pkg_preinst() {
java-utils-2_pkg_preinst
}

View File

@ -1,161 +0,0 @@
# Copyright 2004-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-pkg-simple.eclass
# @MAINTAINER:
# java@gentoo.org
# @AUTHOR:
# Java maintainers (java@gentoo.org)
# @BLURB: Eclass for packaging Java software with ease.
# @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.
inherit java-utils-2
if ! has java-pkg-2 ${INHERITED}; then
eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2"
fi
EXPORT_FUNCTIONS src_compile src_install
# We are only interested in finding all java source files, wherever they may be.
S="${WORKDIR}"
# @ECLASS-VARIABLE: JAVA_GENTOO_CLASSPATH
# @DEFAULT_UNSET
# @DESCRIPTION:
# Comma or space separated list of java packages to include in the
# class path. The packages will also be registered as runtime
# dependencies of this new package. Dependencies will be calculated
# transitively. See "java-config -l" for appropriate package names.
#
# @CODE
# JAVA_GENTOO_CLASSPATH="foo,bar-2"
# @CODE
# @ECLASS-VARIABLE: JAVA_GENTOO_CLASSPATH_EXTRA
# @DEFAULT_UNSET
# @DESCRIPTION:
# Extra list of colon separated path elements to be put on the
# classpath when compiling sources.
# @ECLASS-VARIABLE: JAVA_SRC_DIR
# @DEFAULT_UNSET
# @DESCRIPTION:
# Directories relative to ${S} which contain the sources of the
# application. The default of "" will be treated mostly as ${S}
# itself. For the generated source package (if source is listed in
# ${JAVA_PKG_IUSE}), it is important that these directories are
# actually the roots of the corresponding source trees.
#
# @CODE
# JAVA_SRC_DIR="src/java/org/gentoo"
# @CODE
# @ECLASS-VARIABLE: JAVA_ENCODING
# @DESCRIPTION:
# The character encoding used in the source files.
: ${JAVA_ENCODING:=UTF-8}
# @ECLASS-VARIABLE: JAVAC_ARGS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Additional arguments to be passed to javac.
# @ECLASS-VARIABLE: JAVADOC_ARGS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Additional arguments to be passed to javadoc.
# @ECLASS-VARIABLE: JAVA_JAR_FILENAME
# @DESCRIPTION:
# The name of the jar file to create and install.
: ${JAVA_JAR_FILENAME:=${PN}.jar}
# @FUNCTION: java-pkg-simple_src_compile
# @DESCRIPTION:
# src_compile for simple bare source java packages. Finds all *.java
# sources in ${JAVA_SRC_DIR}, compiles them with the classpath
# calculated from ${JAVA_GENTOO_CLASSPATH}, and packages the resulting
# classes to ${JAVA_JAR_FILENAME}.
java-pkg-simple_src_compile() {
local sources=sources.lst classes=target/classes apidoc=target/api
# auto generate classpath
java-pkg_gen-cp JAVA_GENTOO_CLASSPATH
# gather sources
find ${JAVA_SRC_DIR:-*} -name \*.java > ${sources}
mkdir -p ${classes} || die "Could not create target directory"
# compile
local classpath="${JAVA_GENTOO_CLASSPATH_EXTRA}" dependency
for dependency in ${JAVA_GENTOO_CLASSPATH}; do
classpath="${classpath}:$(java-pkg_getjars ${dependency})" \
|| die "getjars failed for ${dependency}"
done
while [[ $classpath = *::* ]]; do classpath="${classpath//::/:}"; done
classpath=${classpath%:}
classpath=${classpath#:}
debug-print "CLASSPATH=${classpath}"
ejavac -d ${classes} -encoding ${JAVA_ENCODING} \
${classpath:+-classpath ${classpath}} ${JAVAC_ARGS} \
@${sources}
# javadoc
if has doc ${JAVA_PKG_IUSE} && use doc; then
mkdir -p ${apidoc}
ejavadoc -d ${apidoc} \
-encoding ${JAVA_ENCODING} -docencoding UTF-8 -charset UTF-8 \
${classpath:+-classpath ${classpath}} ${JAVADOC_ARGS:- -quiet} \
@${sources} || die "javadoc failed"
fi
# package
local jar_args="cf ${JAVA_JAR_FILENAME}"
if [[ -e ${classes}/META-INF/MANIFEST.MF ]]; then
jar_args="cfm ${JAVA_JAR_FILENAME} ${classes}/META-INF/MANIFEST.MF"
fi
jar ${jar_args} -C ${classes} . || die "jar failed"
}
# @FUNCTION: java-pkg-simple_src_install
# @DESCRIPTION:
# src_install for simple single jar java packages. Simply packages the
# contents from the target directory and installs it as
# ${JAVA_JAR_FILENAME}. If the file target/META-INF/MANIFEST.MF exists,
# it is used as the manifest of the created jar.
java-pkg-simple_src_install() {
local sources=sources.lst classes=target/classes apidoc=target/api
# main jar
java-pkg_dojar ${JAVA_JAR_FILENAME}
# javadoc
if has doc ${JAVA_PKG_IUSE} && use doc; then
java-pkg_dojavadoc ${apidoc}
fi
# dosrc
if has source ${JAVA_PKG_IUSE} && use source; then
local srcdirs=""
if [[ ${JAVA_SRC_DIR} ]]; then
local parent child
for parent in ${JAVA_SRC_DIR}; do
for child in ${parent}/*; do
srcdirs="${srcdirs} ${child}"
done
done
else
# take all directories actually containing any sources
srcdirs="$(cut -d/ -f1 ${sources} | sort -u)"
fi
java-pkg_dosrc ${srcdirs}
fi
}

View File

@ -1,54 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-virtuals-2.eclass
# @MAINTAINER:
# java@gentoo.org
# @AUTHOR:
# Original Author: Alistair John Bush <ali_bush@gentoo.org>
# @BLURB: Java virtuals eclass
# @DESCRIPTION:
# To provide a default (and only) src_install function for ebuilds in the
# java-virtuals category.
inherit java-utils-2
DEPEND=">=dev-java/java-config-2.2.0-r3"
RDEPEND="${DEPEND}"
S="${WORKDIR}"
EXPORT_FUNCTIONS src_install
# @FUNCTION: java-virtuals-2_src_install
# @DESCRIPTION:
# default src_install
java-virtuals-2_src_install() {
java-virtuals-2_do_write
}
# @FUNCTION: java-pkg_do_virtuals_write
# @INTERNAL
# @DESCRIPTION:
# Writes the virtual env file out to disk.
java-virtuals-2_do_write() {
java-pkg_init_paths_
dodir "${JAVA_PKG_VIRTUALS_PATH}"
{
if [[ -n "${JAVA_VIRTUAL_PROVIDES}" ]]; then
echo "PROVIDERS=\"${JAVA_VIRTUAL_PROVIDES}\""
fi
if [[ -n "${JAVA_VIRTUAL_VM}" ]]; then
echo "VM=\"${JAVA_VIRTUAL_VM}\""
fi
if [[ -n "${JAVA_VIRTUAL_VM_CLASSPATH}" ]]; then
echo "VM_CLASSPATH=\"${JAVA_VIRTUAL_VM_CLASSPATH}\""
fi
echo "MULTI_PROVIDER=\"${JAVA_VIRTUAL_MULTI=FALSE}\""
} > "${JAVA_PKG_VIRTUAL_PROVIDER}"
}

View File

@ -1,56 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# @ECLASS: leechcraft.eclass
# @MAINTAINER:
# 0xd34df00d@gmail.com
# @AUTHOR:
# 0xd34df00d@gmail.com
# NightNord@niifaq.ru
# @SUPPORTED_EAPIS: 6 7
# @BLURB: Common functions and setup utilities for the LeechCraft app
# @DESCRIPTION:
# The leechcraft eclass contains a common set of functions and steps
# needed to build LeechCraft core or its plugins.
#
# Though this eclass seems to be small at the moment, it seems like a
# good idea to make all plugins inherit from it, since all plugins
# have mostly the same configuring/build process.
#
# Thanks for original eclass to Andrian Nord <NightNord@niifaq.ru>.
#
# Only EAPI >=6 is supported
case ${EAPI:-0} in
6|7) ;;
*) die "EAPI not supported, bug ebuild mantainer" ;;
esac
inherit cmake-utils
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/0xd34df00d/leechcraft.git"
inherit git-r3
else
DEPEND="app-arch/xz-utils"
SRC_URI="https://dist.leechcraft.org/LeechCraft/${PV}/leechcraft-${PV}.tar.xz"
S="${WORKDIR}/leechcraft-${PV}"
fi
HOMEPAGE="https://leechcraft.org/"
LICENSE="Boost-1.0"
# @ECLASS-VARIABLE: LEECHCRAFT_PLUGIN_CATEGORY
# @DEFAULT_UNSET
# @DESCRIPTION:
# Set this to the category of the plugin, if any.
: ${LEECHCRAFT_PLUGIN_CATEGORY:=}
if [[ "${LEECHCRAFT_PLUGIN_CATEGORY}" ]]; then
CMAKE_USE_DIR="${S}"/src/plugins/${LEECHCRAFT_PLUGIN_CATEGORY}/${PN#lc-}
elif [[ ${PN} != lc-core ]]; then
CMAKE_USE_DIR="${S}"/src/plugins/${PN#lc-}
else
CMAKE_USE_DIR="${S}"/src
fi

View File

@ -1,125 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# @ECLASS: mozextension.eclass
# @MAINTAINER:
# Mozilla team <mozilla@gentoo.org>
# @BLURB: Install extensions for use in mozilla products.
#
if [[ ! ${_MOZEXTENSION} ]]; then
# @ECLASS-VARIABLE: MOZEXTENSION_TARGET
# @DESCRIPTION:
# This variable allows the installation path for xpi_install
# to be overridden from the default app-global extensions path.
# Default is empty, which installs to predetermined hard-coded
# paths specified in the eclass.
: ${MOZEXTENSION_TARGET:=""}
inherit eutils
DEPEND="app-arch/unzip"
mozversion_extension_location() {
case ${PN} in
firefox|firefox-bin|palemoon)
if [[ $(get_version_component_range 1) -ge 21 ]] ; then
return 0
fi
;;
esac
return 1
}
xpi_unpack() {
local xpi xpiname srcdir
# Not gonna use ${A} as we are looking for a specific option being passed to function
# You must specify which xpi to use
[[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack"
for xpi in "$@"; do
einfo "Unpacking ${xpi} to ${PWD}"
xpiname=$(basename ${xpi%.*})
if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
srcdir="${DISTDIR}/"
fi
[[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist"
case "${xpi##*.}" in
ZIP|zip|jar|xpi)
mkdir "${WORKDIR}/${xpiname}" && \
unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
;;
*)
einfo "unpack ${xpi}: file format not recognized. Ignoring."
;;
esac
done
}
xpi_install() {
local emid
# You must tell xpi_install which xpi to use
[[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack"
x="${1}"
#cd ${x}
# determine id for extension
if [[ -f "${x}"/install.rdf ]]; then
emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
|| die "failed to determine extension id from install.rdf"
elif [[ -f "${x}"/manifest.json ]]; then
emid="$( sed -n 's/.*"id": "\(.*\)",/\1/p' "${x}"/manifest.json )" \
|| die "failed to determine extension id from manifest.json"
else
die "failed to determine extension id"
fi
if [[ -n ${MOZEXTENSION_TARGET} ]]; then
insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/}/${emid}
elif $(mozversion_extension_location) ; then
insinto "${MOZILLA_FIVE_HOME}"/browser/extensions/${emid}
else
insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
fi
doins -r "${x}"/* || die "failed to copy extension"
}
xpi_copy() {
local emid
# You must tell xpi_install which xpi to use
[[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack"
x="${1}"
#cd ${x}
# determine id for extension
if [[ -f "${x}"/install.rdf ]]; then
emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
|| die "failed to determine extension id from install.rdf"
elif [[ -f "${x}"/manifest.json ]]; then
emid="$( sed -n 's/.*"id": "\([^"]*\)",.*/\1/p' "${x}"/manifest.json )" \
|| die "failed to determine extension id from manifest.json"
else
die "failed to determine extension id"
fi
if [[ -n ${MOZEXTENSION_TARGET} ]]; then
insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/}
elif $(mozversion_extension_location) ; then
insinto "${MOZILLA_FIVE_HOME}"/browser/extensions
else
insinto "${MOZILLA_FIVE_HOME}"/extensions
fi
newins "${DISTDIR%/}"/${x##*/}.xpi ${emid}.xpi
}
_MOZEXTENSION=1
fi

View File

@ -1,256 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Author: Kevin F. Quinn <kevquinn@gentoo.org>
# Packages: app-dicts/myspell-*
# Maintainer: maintainer-needed@gentoo.org
inherit multilib
EXPORT_FUNCTIONS src_install pkg_preinst pkg_postinst
IUSE=""
SLOT="0"
# tar, gzip, bzip2 are included in the base profile, but not unzip
DEPEND="app-arch/unzip"
# Dictionaries don't have any runtime dependencies
# Myspell dictionaries can be used by hunspell, openoffice and others
RDEPEND=""
# The destination directory for myspell dictionaries
MYSPELL_DICTBASE="/usr/share/myspell"
# Legacy variable for dictionaries installed before eselect-oodict existed
# so has to remain for binpkg support. This variable is unmaintained -
# if you have a problem with it, emerge app-eselect/eselect-oodict.
# The location for openoffice softlinks
MYSPELL_OOOBASE="/usr/lib/openoffice/share/dict/ooo"
# set array "fields" to the elements of $1, separated by $2.
# This saves having to muck about with IFS all over the place.
set_fields() {
local old_IFS
old_IFS="${IFS}"
IFS=$2
fields=($1)
IFS="${old_IFS}"
}
# language is the second element of the ebuild name
# myspell-<lang>-<version>
get_myspell_lang() {
local fields
set_fields "${P}" "-"
echo ${fields[1]}
}
get_myspell_suffixes() {
case $1 in
DICT) echo ".aff .dic" ;;
HYPH) echo ".dic" ;;
THES) echo ".dat .idx" ;;
esac
}
# OOo dictionary files are held on the mirrors, rather than
# being fetched direct from the OOo site as upstream doesn't
# change the name when they rebuild the dictionaries.
# <lang>-<country>.zip becomes myspell-<lang>-<country>-version.zip
get_myspell_ooo_uri() {
local files fields newfile filestem srcfile dict uris
files=()
uris=""
for dict in \
"${MYSPELL_SPELLING_DICTIONARIES[@]}" \
"${MYSPELL_HYPHENATION_DICTIONARIES[@]}" \
"${MYSPELL_THESAURUS_DICTIONARIES[@]}"; do
set_fields "${dict}" ","
newfile=${fields[4]// }
for file in "${files[@]}"; do
[[ ${file} == ${newfile} ]] && continue 2
done
filestem=${newfile/.zip}
files=("${files[@]}" "${newfile}")
srcfile="myspell-${filestem}-${PV}.zip"
[[ -z ${uris} ]] &&
uris="mirror://gentoo/${srcfile}" ||
uris="${uris} mirror://gentoo/${srcfile}"
done
echo "${uris}"
}
[[ -z ${SRC_URI} ]] && SRC_URI=$(get_myspell_ooo_uri)
# Format of dictionary.lst files (from OOo standard
# dictionary.lst file):
#
# List of All Dictionaries to be Loaded by OpenOffice
# ---------------------------------------------------
# Each Entry in the list have the following space delimited fields
#
# Field 0: Entry Type "DICT" - spellchecking dictionary
# "HYPH" - hyphenation dictionary
# "THES" - thesaurus files
#
# Field 1: Language code from Locale "en" or "de" or "pt" ...
#
# Field 2: Country Code from Locale "US" or "GB" or "PT"
#
# Field 3: Root name of file(s) "en_US" or "hyph_de" or "th_en_US"
# (do not add extensions to the name)
# Format of MYSPELL_[SPELLING|HYPHENATION|THESAURUS]_DICTIONARIES:
#
# Field 0: Language code
# Field 1: Country code
# Field 2: Root name of dictionary files
# Field 3: Description
# Field 4: Archive filename
#
# This format is from the available.lst, hyphavail.lst and
# thesavail.lst files on the openoffice.org repository.
myspell_src_install() {
local filen fields entry dictlst
cd "${WORKDIR}"
# Install the dictionary, hyphenation and thesaurus files.
# Create dictionary.lst.<lang> file containing the parts of
# OOo's dictionary.lst file for this language, indicating
# which dictionaries are relevant for each country variant
# of the language.
insinto ${MYSPELL_DICTBASE}
dictlst="dictionary.lst.$(get_myspell_lang)"
echo "# Autogenerated by ${CATEGORY}/${P}" > ${dictlst}
for entry in "${MYSPELL_SPELLING_DICTIONARIES[@]}"; do
set_fields "${entry}" ","
echo "DICT ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
doins ${fields[2]}.aff || die "Missing ${fields[2]}.aff"
doins ${fields[2]}.dic || die "Missing ${fields[2]}.dic"
done
for entry in "${MYSPELL_HYPHENATION_DICTIONARIES[@]}"; do
set_fields "${entry}" ","
echo "HYPH ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
doins ${fields[2]}.dic || die "Missing ${fields[2]}.dic"
done
for entry in "${MYSPELL_THESAURUS_DICTIONARIES[@]}"; do
set_fields "${entry}" ","
echo "THES ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
doins ${fields[2]}.dat || die "Missing ${fields[2]}.dat"
doins ${fields[2]}.idx || die "Missing ${fields[2]}.idx"
done
doins ${dictlst} || die "Failed to install ${dictlst}"
# Install any txt files (usually README.txt) as documentation
for filen in *.txt; do
[[ -s ${filen} ]] && dodoc ${filen}
done
}
# Add entries in dictionary.lst.<lang> to OOo dictionary.lst
# and create softlinks indicated by dictionary.lst.<lang>
myspell_pkg_postinst() {
# Update for known applications
if has_version ">=app-eselect/eselect-oodict-20060706"; then
if has_version app-office/openoffice; then
eselect oodict set myspell-$(get_myspell_lang)
fi
if has_version app-office/openoffice-bin; then
# On AMD64, openoffice-bin is 32-bit so force ABI
has_multilib_profile && ABI=x86
eselect oodict set myspell-$(get_myspell_lang) --libdir $(get_libdir)
fi
return
fi
if has_version app-eselect/eselect-oodict; then
eselect oodict set myspell-$(get_myspell_lang)
return
fi
# Legacy code for dictionaries installed before eselect-oodict existed
# so has to remain for binpkg support. This code is unmaintained -
# if you have a problem with it, emerge app-eselect/eselect-oodict.
[[ -d ${MYSPELL_OOOBASE} ]] || return
# This stuff is here, not in src_install, as the softlinks are
# deliberately _not_ listed in the package database.
local dictlst entry fields prefix suffix suffixes filen
# Note; can only reach this point if ${MYSPELL_DICTBASE}/${dictlst}
# was successfully installed
dictlst="dictionary.lst.$(get_myspell_lang)"
while read entry; do
fields=(${entry})
[[ ${fields[0]:0:1} == "#" ]] && continue
[[ -f ${MYSPELL_OOOBASE}/dictionary.lst ]] || \
touch ${MYSPELL_OOOBASE}/dictionary.lst
grep "^${fields[0]} ${fields[1]} ${fields[2]} " \
${MYSPELL_OOOBASE}/dictionary.lst > /dev/null 2>&1 ||
echo "${entry}" >> ${MYSPELL_OOOBASE}/dictionary.lst
for suffix in $(get_myspell_suffixes ${fields[0]}); do
filen="${fields[3]}${suffix}"
[[ -h ${MYSPELL_OOOBASE}/${filen} ]] &&
rm -f ${MYSPELL_OOOBASE}/${filen}
[[ ! -f ${MYSPELL_OOOBASE}/${filen} ]] &&
ln -s ${MYSPELL_DICTBASE}/${filen} \
${MYSPELL_OOOBASE}/${filen}
done
done < ${MYSPELL_DICTBASE}/${dictlst}
}
# Remove softlinks and entries in dictionary.lst - uses
# dictionary.<lang>.lst from /usr/share/myspell
# Done in preinst (prerm happens after postinst, which overwrites
# the dictionary.<lang>.lst file)
myspell_pkg_preinst() {
# Update for known applications
if has_version ">=app-eselect/eselect-oodict-20060706"; then
if has_version app-office/openoffice; then
# When building from source, the default library path is correct
eselect oodict unset myspell-$(get_myspell_lang)
fi
if has_version app-office/openoffice-bin; then
# On AMD64, openoffice-bin is 32-bit, so get 32-bit library directory
has_multilib_profile && ABI=x86
eselect oodict unset myspell-$(get_myspell_lang) --libdir $(get_libdir)
fi
eselect oodict unset myspell-$(get_myspell_lang) --libdir $(get_libdir)
return
fi
# Previous versions of eselect-oodict didn't cater for -bin on amd64
if has_version app-eselect/eselect-oodict; then
eselect oodict unset myspell-$(get_myspell_lang)
return
fi
# Legacy code for dictionaries installed before eselect-oodict existed
# Don't delete this; needed for uninstalls and binpkg support.
# This code is unmaintained - if you have a problem with it,
# emerge app-eselect/eselect-oodict.
local filen dictlst entry fields removeentry suffix
dictlst="dictionary.lst.$(get_myspell_lang)"
[[ -d ${MYSPELL_OOOBASE} ]] || return
[[ -f ${MYSPELL_DICTBASE}/${dictlst} ]] || return
while read entry; do
fields=(${entry})
[[ ${fields[0]:0:1} == "#" ]] && continue
[[ ${fields[3]} == "" ]] && continue
# Remove entry from dictionary.lst
sed -i -e "/^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$/ { d }" \
${MYSPELL_OOOBASE}/dictionary.lst
# See if any other entries in dictionary.lst match the current
# dictionary type and filename
grep "^${fields[0]} .* ${fields[3]}$" ${MYSPELL_OOOBASE}/dictionary.lst \
2>&1 > /dev/null && continue
# If no other entries match, remove relevant symlinks
for suffix in $(get_myspell_suffixes ${fields[0]}); do
filen="${fields[3]}${suffix}"
ewarn "Removing entry ${MYSPELL_OOOBASE}/${filen}"
[[ -h ${MYSPELL_OOOBASE}/${filen} ]] &&
rm -f ${MYSPELL_OOOBASE}/${filen}
done
done < ${MYSPELL_DICTBASE}/${dictlst}
}

View File

@ -1,378 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: php-ext-source-r2.eclass
# @MAINTAINER:
# Gentoo PHP team <php-bugs@gentoo.org>
# @AUTHOR:
# Author: Tal Peer <coredumb@gentoo.org>
# Author: Stuart Herbert <stuart@gentoo.org>
# Author: Luca Longinotti <chtekk@gentoo.org>
# Author: Jakub Moc <jakub@gentoo.org> (documentation)
# Author: Ole Markus With <olemarkus@gentoo.org>
# @SUPPORTED_EAPIS: 4 5
# @BLURB: A unified interface for compiling and installing standalone PHP extensions.
# @DESCRIPTION:
# This eclass provides a unified interface for compiling and installing standalone
# PHP extensions (modules).
inherit autotools multilib
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
DEPEND=">=sys-devel/m4-1.4.3
>=sys-devel/libtool-1.5.18"
RDEPEND=""
# Because of USE deps, we require at least EAPI 2
case ${EAPI} in
4|5) ;;
*)
die "php-ext-source-r2 is not compatible with EAPI=${EAPI}"
esac
# @ECLASS-VARIABLE: PHP_EXT_NAME
# @REQUIRED
# @DESCRIPTION:
# The extension name. This must be set, otherwise the eclass dies.
# Only automagically set by php-ext-pecl-r2.eclass, so unless your ebuild
# inherits that eclass, you must set this manually before inherit.
[[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-source-r2 eclass"
# @ECLASS-VARIABLE: PHP_EXT_INI
# @DESCRIPTION:
# Controls whether or not to add a line to php.ini for the extension.
# Defaults to "yes" and should not be changed in most cases.
[[ -z "${PHP_EXT_INI}" ]] && PHP_EXT_INI="yes"
# @ECLASS-VARIABLE: PHP_EXT_ZENDEXT
# @DESCRIPTION:
# Controls whether the extension is a ZendEngine extension or not.
# Defaults to "no" and if you don't know what is it, you don't need it.
[[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no"
# @ECLASS-VARIABLE: USE_PHP
# @REQUIRED
# @DESCRIPTION:
# Lists the PHP slots compatibile the extension is compatibile with
# Example:
# @CODE
# USE_PHP="php5-5 php5-6"
# @CODE
[[ -z "${USE_PHP}" ]] && die "USE_PHP is not set for the php-ext-source-r2 eclass"
# @ECLASS-VARIABLE: PHP_EXT_OPTIONAL_USE
# @DESCRIPTION:
# If set, this is the USE flag that the PHP dependencies are behind
# Most commonly set as PHP_EXT_OPTIONAL_USE=php to get the dependencies behind
# USE=php.
# @ECLASS-VARIABLE: PHP_EXT_S
# @DESCRIPTION:
# The relative location of the temporary build directory for the PHP extension within
# the source package. This is useful for packages that bundle the PHP extension.
# Defaults to ${S}
[[ -z "${PHP_EXT_S}" ]] && PHP_EXT_S="${S}"
#Make sure at least one target is installed.
REQUIRED_USE="${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }|| ( "
for target in ${USE_PHP}; do
IUSE="${IUSE} php_targets_${target}"
target=${target/+}
REQUIRED_USE+="php_targets_${target} "
slot=${target/php}
slot=${slot/-/.}
PHPDEPEND="${PHPDEPEND}
php_targets_${target}? ( dev-lang/php:${slot} )"
done
REQUIRED_USE+=") ${PHP_EXT_OPTIONAL_USE:+ )}"
RDEPEND="${RDEPEND}
${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }
${PHPDEPEND}
${PHP_EXT_OPTIONAL_USE:+ )}"
DEPEND="${DEPEND}
${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }
${PHPDEPEND}
${PHP_EXT_OPTIONAL_USE:+ )}
"
# @FUNCTION: php-ext-source-r2_src_unpack
# @DESCRIPTION:
# runs standard src_unpack + _phpize
# @ECLASS-VARIABLE: PHP_EXT_SKIP_PHPIZE
# @DESCRIPTION:
# phpize will be run by default for all ebuilds that use
# php-ext-source-r2_src_unpack
# Set PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run phpize.
php-ext-source-r2_src_unpack() {
unpack ${A}
local slot orig_s="${PHP_EXT_S}"
for slot in $(php_get_slots); do
cp -r "${orig_s}" "${WORKDIR}/${slot}" || die "Failed to copy source ${orig_s} to PHP target directory"
done
}
php-ext-source-r2_src_prepare() {
local slot orig_s="${PHP_EXT_S}"
for slot in $(php_get_slots); do
php_init_slot_env ${slot}
php-ext-source-r2_phpize
done
}
# @FUNCTION: php-ext-source-r2_phpize
# @DESCRIPTION:
# Runs phpize and autotools in addition to the standard src_unpack
php-ext-source-r2_phpize() {
if [[ "${PHP_EXT_SKIP_PHPIZE}" != 'yes' ]] ; then
# Create configure out of config.m4. We use autotools_run_tool
# to avoid some warnings about WANT_AUTOCONF and
# WANT_AUTOMAKE (see bugs #329071 and #549268).
autotools_run_tool ${PHPIZE}
# force run of libtoolize and regeneration of related autotools
# files (bug 220519)
rm aclocal.m4
eautoreconf
fi
}
# @FUNCTION: php-ext-source-r2_src_configure
# @DESCRIPTION:
# Takes care of standard configure for PHP extensions (modules).
# @ECLASS-VARIABLE: my_conf
# @DESCRIPTION:
# Set this in the ebuild to pass configure options to econf.
php-ext-source-r2_src_configure() {
# net-snmp creates this file #385403
addpredict /usr/share/snmp/mibs/.index
addpredict /var/lib/net-snmp/mib_indexes
local slot
for slot in $(php_get_slots); do
php_init_slot_env ${slot}
# Set the correct config options
econf --with-php-config=${PHPCONFIG} ${my_conf} || die "Unable to configure code to compile"
done
}
# @FUNCTION: php-ext-source-r2_src_compile
# @DESCRIPTION:
# Takes care of standard compile for PHP extensions (modules).
php-ext-source-r2_src_compile() {
# net-snmp creates this file #324739
addpredict /usr/share/snmp/mibs/.index
addpredict /var/lib/net-snmp/mib_indexes
# shm extension createss a semaphore file #173574
addpredict /session_mm_cli0.sem
local slot
for slot in $(php_get_slots); do
php_init_slot_env ${slot}
emake || die "Unable to make code"
done
}
# @FUNCTION: php-ext-source-r2_src_install
# @DESCRIPTION:
# Takes care of standard install for PHP extensions (modules).
# @ECLASS-VARIABLE: DOCS
# @DESCRIPTION:
# Set in ebuild if you wish to install additional, package-specific documentation.
php-ext-source-r2_src_install() {
local slot
for slot in $(php_get_slots); do
php_init_slot_env ${slot}
# Let's put the default module away. Strip $EPREFIX from
# $EXT_DIR before calling newins (which handles EPREFIX itself).
insinto "${EXT_DIR#$EPREFIX}"
newins "modules/${PHP_EXT_NAME}.so" "${PHP_EXT_NAME}.so" || die "Unable to install extension"
local doc
for doc in ${DOCS} ; do
[[ -s ${doc} ]] && dodoc ${doc}
done
INSTALL_ROOT="${D}" emake install-headers
done
php-ext-source-r2_createinifiles
}
php_get_slots() {
local s slot
for slot in ${USE_PHP}; do
use php_targets_${slot} && s+=" ${slot/-/.}"
done
echo $s
}
php_init_slot_env() {
libdir=$(get_libdir)
PHPIZE="${EPREFIX}/usr/${libdir}/${1}/bin/phpize"
PHPCONFIG="${EPREFIX}/usr/${libdir}/${1}/bin/php-config"
PHPCLI="${EPREFIX}/usr/${libdir}/${1}/bin/php"
PHPCGI="${EPREFIX}/usr/${libdir}/${1}/bin/php-cgi"
PHP_PKG="$(best_version =dev-lang/php-${1:3}*)"
PHPPREFIX="${EPREFIX}/usr/${libdir}/${slot}"
EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
PHP_CURRENTSLOT=${1:3}
PHP_EXT_S="${WORKDIR}/${1}"
cd "${PHP_EXT_S}"
}
php-ext-source-r2_buildinilist() {
# Work out the list of <ext>.ini files to edit/add to
if [[ -z "${PHPSAPILIST}" ]] ; then
PHPSAPILIST="apache2 cli cgi fpm embed phpdbg"
fi
PHPINIFILELIST=""
local x
for x in ${PHPSAPILIST} ; do
if [[ -f "${EPREFIX}/etc/php/${x}-${1}/php.ini" ]] ; then
PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-${1}/ext/${PHP_EXT_NAME}.ini"
fi
done
PHPFULLINIFILELIST="${PHPFULLINIFILELIST} ${PHPINIFILELIST}"
}
# @FUNCTION: php-ext-source-r2_createinifiles
# @DESCRIPTION:
# Builds ini files for every enabled slot and SAPI
php-ext-source-r2_createinifiles() {
local slot
for slot in $(php_get_slots); do
php_init_slot_env ${slot}
# Pull in the PHP settings
# Build the list of <ext>.ini files to edit/add to
php-ext-source-r2_buildinilist ${slot}
# Add the needed lines to the <ext>.ini files
local file
if [[ "${PHP_EXT_INI}" = "yes" ]] ; then
for file in ${PHPINIFILELIST}; do
php-ext-source-r2_addextension "${PHP_EXT_NAME}.so" "${file}"
done
fi
# Symlink the <ext>.ini files from ext/ to ext-active/
local inifile
for inifile in ${PHPINIFILELIST} ; do
if [[ -n "${PHP_EXT_INIFILE}" ]]; then
cat "${FILESDIR}/${PHP_EXT_INIFILE}" >> "${ED}/${inifile}"
einfo "Added content of ${FILESDIR}/${PHP_EXT_INIFILE} to ${inifile}"
fi
inidir="${inifile/${PHP_EXT_NAME}.ini/}"
inidir="${inidir/ext/ext-active}"
dodir "/${inidir}"
dosym "/${inifile}" "/${inifile/ext/ext-active}"
done
# Add support for installing PHP files into a version dependant directory
PHP_EXT_SHARED_DIR="${EPREFIX}/usr/share/php/${PHP_EXT_NAME}"
done
}
php-ext-source-r2_addextension() {
if [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then
# We need the full path for ZendEngine extensions
# and we need to check for debugging enabled!
if has_version "dev-lang/php:${PHP_CURRENTSLOT}[threads]" ; then
if has_version "dev-lang/php:${PHP_CURRENTSLOT}[debug]" ; then
ext_type="zend_extension_debug_ts"
else
ext_type="zend_extension_ts"
fi
ext_file="${EXT_DIR}/${1}"
else
if has_version "dev-lang/php:${PHP_CURRENTSLOT}[debug]"; then
ext_type="zend_extension_debug"
else
ext_type="zend_extension"
fi
ext_file="${EXT_DIR}/${1}"
fi
# php-5.3 unifies zend_extension loading and just requires the
# zend_extension keyword with no suffix
# TODO: drop previous code and this check once <php-5.3 support is
# discontinued
if has_version '>=dev-lang/php-5.3' ; then
ext_type="zend_extension"
fi
else
# We don't need the full path for normal extensions!
ext_type="extension"
ext_file="${1}"
fi
php-ext-source-r2_addtoinifile "${ext_type}" "${ext_file}" "${2}" "Extension added"
}
# $1 - Setting name
# $2 - Setting value
# $3 - File to add to
# $4 - Sanitized text to output
php-ext-source-r2_addtoinifile() {
local inifile="${WORKDIR}/${3}"
if [[ ! -d $(dirname ${inifile}) ]] ; then
mkdir -p $(dirname ${inifile})
fi
# Are we adding the name of a section?
if [[ ${1:0:1} == "[" ]] ; then
echo "${1}" >> "${inifile}"
my_added="${1}"
else
echo "${1}=${2}" >> "${inifile}"
my_added="${1}=${2}"
fi
if [[ -z "${4}" ]] ; then
einfo "Added '${my_added}' to /${3}"
else
einfo "${4} to /${3}"
fi
insinto /$(dirname ${3})
doins "${inifile}"
}
# @FUNCTION: php-ext-source-r2_addtoinifiles
# @USAGE: <setting name> <setting value> [message to output]; or just [section name]
# @DESCRIPTION:
# Add value settings to php.ini file installed by the extension (module).
# You can also add a [section], see examples below.
#
# @CODE
# Add some settings for the extension:
#
# php-ext-source-r2_addtoinifiles "zend_optimizer.optimization_level" "15"
# php-ext-source-r2_addtoinifiles "zend_optimizer.enable_loader" "0"
# php-ext-source-r2_addtoinifiles "zend_optimizer.disable_licensing" "0"
#
# Adding values to a section in php.ini file installed by the extension:
#
# php-ext-source-r2_addtoinifiles "[Debugger]"
# php-ext-source-r2_addtoinifiles "debugger.enabled" "on"
# php-ext-source-r2_addtoinifiles "debugger.profiler_enabled" "on"
# @CODE
php-ext-source-r2_addtoinifiles() {
local x
for x in ${PHPFULLINIFILELIST} ; do
php-ext-source-r2_addtoinifile "${1}" "${2}" "${x}" "${3}"
done
}

View File

@ -1,119 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: s6.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
# @SUPPORTED_EAPIS: 5 6
# @BLURB: helper functions to install s6 services
# @DESCRIPTION:
# This eclass provides helpers to install s6 services.
# @EXAMPLE:
#
# @CODE
# inherit s6
#
# src_install() {
# ...
# s6_install_service myservice "${FILESDIR}"/run-s6 "${FILESDIR}"/finish-s6
# ...
# If you want a service to be logged, install the log service as
# shown here.
# s6_install_service myservice/log "${FILESDIR}"/log-run-s6 \
# "${FILESDIR}"/log-finish-s6
# ...
# }
# @CODE
case ${EAPI:-0} in
5|6) ;;
*) die "${ECLASS}.eclass: API in EAPI ${EAPI} not yet established" ;;
esac
# @FUNCTION: _s6_get_servicedir
# @INTERNAL
# @DESCRIPTION:
# Get unprefixed servicedir.
_s6_get_servicedir() {
echo /var/svc.d
}
# @FUNCTION: s6_get_servicedir
# @DESCRIPTION:
# Output the path for the s6 service directory (not including ${D}).
s6_get_servicedir() {
debug-print-function ${FUNCNAME} "${@}"
echo "${EPREFIX}$(_s6_get_servicedir)"
}
# @FUNCTION: s6_install_service
# @USAGE: servicename run finish
# @DESCRIPTION:
# Install an s6 service.
# servicename is the name of the service.
# run is the run script for the service.
# finish is the optional finish script for the service.
s6_install_service() {
debug-print-function ${FUNCNAME} "${@}"
local name="$1"
local run="$2"
local finish="$3"
[[ $name ]] ||
die "${ECLASS}.eclass: you must specify the s6 service name"
[[ $run ]] ||
die "${ECLASS}.eclass: you must specify the s6 service run script"
(
local servicepath="$(_s6_get_servicedir)/$name"
exeinto "$servicepath"
newexe "$run" run
[[ $finish ]] && newexe "$finish" finish
)
}
# @FUNCTION: s6_service_down
# @USAGE: servicename
# @DESCRIPTION:
# Install the "down" flag so this service will not be started by
# default.
# servicename is the name of the service.
s6_service_down() {
debug-print-function ${FUNCNAME} "${@}"
local name="$1"
[[ $name ]] ||
die "${ECLASS}.eclass: you must specify the s6 service name"
(
touch "$T"/down || die
local servicepath="$(_s6_get_servicedir)/$name"
insinto "$servicepath"
doins "$T"/down
)
}
# @FUNCTION: s6_service_nosetsid
# @USAGE: servicename
# @DESCRIPTION:
# Install the "nosetsid" flag so this service will not be made a session
# leader.
# servicename is the name of the service.
s6_service_nosetsid() {
debug-print-function ${FUNCNAME} "${@}"
local name="$1"
[[ $name ]] ||
die "${ECLASS}.eclass: you must specify the s6 service name"
(
touch "$T"/nosetsid || die
local servicepath="$(_s6_get_servicedir)/$name"
insinto "$servicepath"
doins "$T"/nosetsid
)
}

View File

@ -1,502 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
# @SUPPORTED_EAPIS: 0 1 2 3 4 5
#
# We install binutils into CTARGET-VERSION specific directories. This lets
# us easily merge multiple versions for multiple targets (if we wish) and
# then switch the versions on the fly (with `binutils-config`).
#
# binutils-9999 -> live git
# binutils-9999_preYYMMDD -> nightly snapshot date YYMMDD
# binutils-# -> normal release
if [[ -n ${BINUTILS_TYPE} ]] ; then
BTYPE=${BINUTILS_TYPE}
else
case ${PV} in
9999_pre*) BTYPE="snap";;
*.*.90) BTYPE="snap";;
*.*.*.*.*) BTYPE="hjlu";;
*) BTYPE="rel";;
esac
fi
case ${BTYPE} in
snap)
BVER=${PV/9999_pre}
;;
*)
BVER=${BINUTILS_VER:-${PV}}
;;
esac
inherit eutils libtool flag-o-matic gnuconfig multilib versionator unpacker
case ${EAPI:-0} in
0|1)
EXPORT_FUNCTIONS src_unpack src_compile src_test src_install pkg_postinst pkg_postrm ;;
2|3|4|5)
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm ;;
*) die "unsupported EAPI ${EAPI}" ;;
esac
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} == ${CHOST} ]] ; then
if [[ ${CATEGORY} == cross-* ]] ; then
export CTARGET=${CATEGORY#cross-}
fi
fi
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
DESCRIPTION="Tools necessary to build programs"
HOMEPAGE="https://sourceware.org/binutils/"
case ${BTYPE} in
snap)
SRC_URI="ftp://gcc.gnu.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2
ftp://sourceware.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2" ;;
hjlu)
SRC_URI="https://www.kernel.org/pub/linux/devel/binutils/binutils-${BVER}.tar."
version_is_at_least 2.21.51.0.5 && SRC_URI+="xz" || SRC_URI+="bz2" ;;
rel) SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.bz2" ;;
esac
add_src_uri() {
[[ -z $2 ]] && return
local a=$1
if version_is_at_least 2.22.52.0.2 ; then
a+=".xz"
else
a+=".bz2"
fi
set -- mirror://gentoo https://dev.gentoo.org/~vapier/dist https://dev.gentoo.org/~tamiko/distfiles https://dev.gentoo.org/~dilfridge/distfiles
SRC_URI="${SRC_URI} ${@/%//${a}}"
}
PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${BVER}}
add_src_uri binutils-${PATCH_BINUTILS_VER}-patches-${PATCHVER}.tar ${PATCHVER}
add_src_uri binutils-${PATCH_BINUTILS_VER}-uclibc-patches-${UCLIBC_PATCHVER}.tar ${UCLIBC_PATCHVER}
add_src_uri elf2flt-${ELF2FLT_VER}.tar ${ELF2FLT_VER}
if version_is_at_least 2.18 ; then
LICENSE="|| ( GPL-3 LGPL-3 )"
else
LICENSE="|| ( GPL-2 LGPL-2 )"
fi
IUSE="cxx multitarget nls static-libs test vanilla"
if version_is_at_least 2.19 && ! version_is_at_least 2.26 ; then
IUSE+=" zlib"
fi
SLOT="${BVER}"
RDEPEND=">=sys-devel/binutils-config-3"
if in_iuse zlib ; then
RDEPEND+=" zlib? ( sys-libs/zlib )"
elif version_is_at_least 2.26 ; then
RDEPEND+=" sys-libs/zlib"
fi
DEPEND="${RDEPEND}
test? ( dev-util/dejagnu )
nls? ( sys-devel/gettext )
sys-devel/flex
virtual/yacc"
if is_cross ; then
# The build assumes the host has libiberty and such when cross-compiling
# its build tools. We should probably make binutils itself build a local
# copy to use, but until then, be lazy.
DEPEND+=" >=sys-libs/binutils-libs-${PV}"
fi
S=${WORKDIR}/binutils-${BVER}
LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
INCPATH=${LIBPATH}/include
DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
MY_BUILDDIR=${WORKDIR}/build
if is_cross ; then
BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER}
else
BINPATH=/usr/${CTARGET}/binutils-bin/${BVER}
fi
tc-binutils_unpack() {
unpacker ${A}
mkdir -p "${MY_BUILDDIR}"
[[ -d ${WORKDIR}/patch ]] && mkdir "${WORKDIR}"/patch/skip
}
# In case the ebuild wants to add a few of their own.
PATCHES=()
tc-binutils_apply_patches() {
cd "${S}"
if ! use vanilla ; then
if [[ -n ${PATCHVER} ]] ; then
EPATCH_SOURCE=${WORKDIR}/patch
if [[ ${CTARGET} == mips* ]] ; then
# remove gnu-hash for mips (bug #233233)
EPATCH_EXCLUDE+=" 77_all_generate-gnu-hash.patch"
fi
[[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \
&& EPATCH_SUFFIX="patch.bz2" \
|| EPATCH_SUFFIX="patch"
epatch
fi
if [[ -n ${UCLIBC_PATCHVER} ]] ; then
EPATCH_SOURCE=${WORKDIR}/uclibc-patches
[[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \
&& EPATCH_SUFFIX="patch.bz2" \
|| EPATCH_SUFFIX="patch"
EPATCH_MULTI_MSG="Applying uClibc fixes ..." \
epatch
elif [[ ${CTARGET} == *-uclibc* ]] ; then
# starting with binutils-2.17.50.0.17, we no longer need
# uClibc patchsets :D
if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
die "sorry, but this binutils doesn't yet support uClibc :("
fi
fi
[[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
# Make sure our explicit libdir paths don't get clobbered. #562460
sed -i \
-e 's:@bfdlibdir@:@libdir@:g' \
-e 's:@bfdincludedir@:@includedir@:g' \
{bfd,opcodes}/Makefile.in || die
epatch_user
fi
# fix locale issues if possible #122216
if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
einfo "Fixing misc issues in configure files"
for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
ebegin " Updating ${f/${S}\/}"
patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
|| eerror "Please file a bug about this"
eend $?
done
fi
# fix conflicts with newer glibc #272594
if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
fi
# Fix po Makefile generators
sed -i \
-e '/^datadir = /s:$(prefix)/@DATADIRNAME@:@datadir@:' \
-e '/^gnulocaledir = /s:$(prefix)/share:$(datadir):' \
*/po/Make-in || die "sed po's failed"
# Run misc portage update scripts
gnuconfig_update
elibtoolize --portage --no-uclibc
}
toolchain-binutils_src_unpack() {
tc-binutils_unpack
case ${EAPI:-0} in
0|1) toolchain-binutils_src_prepare ;;
esac
}
toolchain-binutils_src_prepare() {
tc-binutils_apply_patches
}
_eprefix_init() {
has "${EAPI:-0}" 0 1 2 && ED=${D} EPREFIX= EROOT=${ROOT}
}
# Intended for ebuilds to override to set their own versioning information.
toolchain-binutils_bugurl() {
printf "https://bugs.gentoo.org/"
}
toolchain-binutils_pkgversion() {
printf "Gentoo ${BVER}"
[[ -n ${PATCHVER} ]] && printf " p${PATCHVER}"
}
toolchain-binutils_src_configure() {
_eprefix_init
# make sure we filter $LINGUAS so that only ones that
# actually work make it through #42033
strip-linguas -u */po
# keep things sane
strip-flags
local x
echo
for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
einfo "$(printf '%10s' ${x}:) ${!x}"
done
echo
cd "${MY_BUILDDIR}"
local myconf=()
# enable gold if available (installed as ld.gold)
if use cxx ; then
if grep -q 'enable-gold=default' "${S}"/configure ; then
myconf+=( --enable-gold )
# old ways - remove when 2.21 is stable
elif grep -q 'enable-gold=both/ld' "${S}"/configure ; then
myconf+=( --enable-gold=both/ld )
elif grep -q 'enable-gold=both/bfd' "${S}"/configure ; then
myconf+=( --enable-gold=both/bfd )
fi
if grep -q -e '--enable-plugins' "${S}"/ld/configure ; then
myconf+=( --enable-plugins )
fi
fi
use nls \
&& myconf+=( --without-included-gettext ) \
|| myconf+=( --disable-nls )
if in_iuse zlib ; then
# older versions did not have an explicit configure flag
export ac_cv_search_zlibVersion=$(usex zlib -lz no)
myconf+=( $(use_with zlib) )
elif version_is_at_least 2.26 ; then
myconf+=( --with-system-zlib )
fi
# For bi-arch systems, enable a 64bit bfd. This matches
# the bi-arch logic in toolchain.eclass. #446946
# We used to do it for everyone, but it's slow on 32bit arches. #438522
case $(tc-arch) in
ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
esac
use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
is_cross && myconf+=(
--with-sysroot="${EPREFIX}"/usr/${CTARGET}
--enable-poison-system-directories
)
# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
# on everyone in alpha (for now), we'll just enable it when possible
has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
myconf+=(
--prefix="${EPREFIX}"/usr
--host=${CHOST}
--target=${CTARGET}
--datadir="${EPREFIX}"${DATAPATH}
--infodir="${EPREFIX}"${DATAPATH}/info
--mandir="${EPREFIX}"${DATAPATH}/man
--bindir="${EPREFIX}"${BINPATH}
--libdir="${EPREFIX}"${LIBPATH}
--libexecdir="${EPREFIX}"${LIBPATH}
--includedir="${EPREFIX}"${INCPATH}
--enable-obsolete
--enable-shared
--enable-threads
# Newer versions (>=2.27) offer a configure flag now.
--enable-relro
# Newer versions (>=2.24) make this an explicit option. #497268
--enable-install-libiberty
--disable-werror
--with-bugurl="$(toolchain-binutils_bugurl)"
--with-pkgversion="$(toolchain-binutils_pkgversion)"
$(use_enable static-libs static)
${EXTRA_ECONF}
# Disable modules that are in a combined binutils/gdb tree. #490566
--disable-{gdb,libdecnumber,readline,sim}
# Strip out broken static link flags.
# https://gcc.gnu.org/PR56750
--without-stage1-ldflags
)
echo ./configure "${myconf[@]}"
"${S}"/configure "${myconf[@]}" || die
# Prevent makeinfo from running in releases. It may not always be
# installed, and older binutils may fail with newer texinfo.
# Besides, we never patch the doc files anyways, so regenerating
# in the first place is useless. #193364
# For older versions, it means we don't get any info pages at all.
# Oh well, tough luck. #294617
if [[ -e ${S}/gas/doc/as.info ]] || ! version_is_at_least 2.24 ; then
sed -i \
-e '/^MAKEINFO/s:=.*:= true:' \
Makefile || die
fi
}
toolchain-binutils_src_compile() {
_eprefix_init
case ${EAPI:-0} in
0|1) toolchain-binutils_src_configure ;;
esac
cd "${MY_BUILDDIR}"
emake all || die "emake failed"
# only build info pages if we user wants them, and if
# we have makeinfo (may not exist when we bootstrap)
if type -p makeinfo > /dev/null ; then
emake info || die "make info failed"
fi
# we nuke the manpages when we're left with junk
# (like when we bootstrap, no perl -> no manpages)
find . -name '*.1' -a -size 0 -delete
# elf2flt only works on some arches / targets
if [[ -n ${ELF2FLT_VER} ]] && [[ ${CTARGET} == *linux* || ${CTARGET} == *-elf* ]] ; then
cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER}
local x supported_arches=$(sed -n '/defined(TARGET_/{s:^.*TARGET_::;s:)::;p}' elf2flt.c | sort -u)
for x in ${supported_arches} UNSUPPORTED ; do
[[ ${CTARGET} == ${x}* ]] && break
done
if [[ ${x} != "UNSUPPORTED" ]] ; then
append-flags -I"${S}"/include
myconf+=(
--with-bfd-include-dir=${MY_BUILDDIR}/bfd
--with-libbfd=${MY_BUILDDIR}/bfd/libbfd.a
--with-libiberty=${MY_BUILDDIR}/libiberty/libiberty.a
--with-binutils-ldscript-dir="${EPREFIX}"${LIBPATH}/ldscripts
)
echo ./configure "${myconf[@]}"
./configure "${myconf[@]}" || die
emake || die "make elf2flt failed"
fi
fi
}
toolchain-binutils_src_test() {
cd "${MY_BUILDDIR}"
emake -k check || die "check failed :("
}
toolchain-binutils_src_install() {
_eprefix_init
local x d
cd "${MY_BUILDDIR}"
emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install || die
rm -rf "${ED}"/${LIBPATH}/bin
use static-libs || find "${ED}" -name '*.la' -delete
# Newer versions of binutils get fancy with ${LIBPATH} #171905
cd "${ED}"/${LIBPATH}
for d in ../* ; do
[[ ${d} == ../${BVER} ]] && continue
mv ${d}/* . || die
rmdir ${d} || die
done
# Now we collect everything intp the proper SLOT-ed dirs
# When something is built to cross-compile, it installs into
# /usr/$CHOST/ by default ... we have to 'fix' that :)
if is_cross ; then
cd "${ED}"/${BINPATH}
for x in * ; do
mv ${x} ${x/${CTARGET}-}
done
if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
rm -r "${ED}"/usr/${CHOST}/{include,lib}
fi
fi
insinto ${INCPATH}
local libiberty_headers=(
# Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
demangle.h
dyn-string.h
fibheap.h
hashtab.h
libiberty.h
objalloc.h
splay-tree.h
)
doins "${libiberty_headers[@]/#/${S}/include/}" || die
if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
rm -r "${ED}"/${LIBPATH}/lib
fi
# Insert elf2flt where appropriate
if [[ -x ${WORKDIR}/elf2flt-${ELF2FLT_VER}/elf2flt ]] ; then
cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER}
insinto ${LIBPATH}/ldscripts
doins elf2flt.ld || die "doins elf2flt.ld failed"
exeinto ${BINPATH}
doexe elf2flt flthdr || die "doexe elf2flt flthdr failed"
mv "${ED}"/${BINPATH}/{ld,ld.real} || die
newexe ld-elf2flt ld || die "doexe ld-elf2flt failed"
newdoc README README.elf2flt
fi
# Generate an env.d entry for this binutils
insinto /etc/env.d/binutils
cat <<-EOF > "${T}"/env.d
TARGET="${CTARGET}"
VER="${BVER}"
LIBPATH="${EPREFIX}${LIBPATH}"
EOF
newins "${T}"/env.d ${CTARGET}-${BVER}
# Handle documentation
if ! is_cross ; then
cd "${S}"
dodoc README
docinto bfd
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
docinto binutils
dodoc binutils/ChangeLog binutils/NEWS binutils/README
docinto gas
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
docinto gprof
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
docinto ld
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
docinto libiberty
dodoc libiberty/ChangeLog* libiberty/README
docinto opcodes
dodoc opcodes/ChangeLog*
fi
# Remove shared info pages
rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
# Trim all empty dirs
find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
}
toolchain-binutils_pkg_postinst() {
_eprefix_init
# Make sure this ${CTARGET} has a binutils version selected
[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
binutils-config ${CTARGET}-${BVER}
}
toolchain-binutils_pkg_postrm() {
_eprefix_init
local current_profile=$(binutils-config -c ${CTARGET})
# If no other versions exist, then uninstall for this
# target ... otherwise, switch to the newest version
# Note: only do this if this version is unmerged. We
# rerun binutils-config if this is a remerge, as
# we want the mtimes on the symlinks updated (if
# it is the same as the current selected profile)
if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
choice=${choice//$'\n'/ }
choice=${choice/* }
if [[ -z ${choice} ]] ; then
binutils-config -u ${CTARGET}
else
binutils-config ${choice}
fi
elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
binutils-config ${CTARGET}-${BVER}
fi
}

View File

@ -1,171 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vala.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @AUTHOR:
# Alexandre Rostovtsev <tetromino@gentoo.org>
# @SUPPORTED_EAPIS: 1 2 3 4 5 6 7
# @BLURB: Sets up the environment for using a specific version of vala.
# @DESCRIPTION:
# This eclass sets up commonly used environment variables for using a specific
# version of dev-lang/vala to configure and build a package. It is needed for
# packages whose build systems assume the existence of certain unversioned vala
# executables, pkgconfig files, etc., which Gentoo does not provide.
#
# This eclass provides one phase function: src_prepare.
inherit eutils multilib
case "${EAPI:-0}" in
0) die "EAPI=0 is not supported" ;;
1) ;;
*) EXPORT_FUNCTIONS src_prepare ;;
esac
# @ECLASS-VARIABLE: VALA_MIN_API_VERSION
# @DESCRIPTION:
# Minimum vala API version (e.g. 0.36).
VALA_MIN_API_VERSION=${VALA_MIN_API_VERSION:-0.36}
# @ECLASS-VARIABLE: VALA_MAX_API_VERSION
# @DESCRIPTION:
# Maximum vala API version (e.g. 0.36).
VALA_MAX_API_VERSION=${VALA_MAX_API_VERSION:-0.44}
# @ECLASS-VARIABLE: VALA_USE_DEPEND
# @DEFAULT_UNSET
# @DESCRIPTION:
# USE dependencies that vala must be built with (e.g. vapigen).
# @FUNCTION: vala_api_versions
# @DESCRIPTION:
# Outputs a list of vala API versions from VALA_MAX_API_VERSION down to
# VALA_MIN_API_VERSION.
vala_api_versions() {
[[ ${VALA_MIN_API_VERSION} =~ ^0\.[[:digit:]]+$ ]] || die "Invalid syntax of VALA_MIN_API_VERSION"
[[ ${VALA_MAX_API_VERSION} =~ ^0\.[[:digit:]]+$ ]] || die "Invalid syntax of VALA_MAX_API_VERSION"
local minimal_supported_minor_version minor_version
# Dependency atoms are not generated for Vala versions older than 0.${minimal_supported_minor_version}.
minimal_supported_minor_version="36"
for ((minor_version = ${VALA_MAX_API_VERSION#*.}; minor_version >= ${VALA_MIN_API_VERSION#*.}; minor_version = minor_version - 2)); do
# 0.38 was never in main tree; remove the special case once minimal_supported_minor_version >= 40
if ((minor_version >= minimal_supported_minor_version)) && ((minor_version != 38)); then
echo "0.${minor_version}"
fi
done
}
# Outputs VALA_USE_DEPEND as a a USE-dependency string
_vala_use_depend() {
local u="" vala_use
if [[ -n ${VALA_USE_DEPEND} ]]; then
for vala_use in ${VALA_USE_DEPEND}; do
case ${vala_use} in
vapigen) u="${u},${vala_use}(+)" ;;
valadoc) u="${u},${vala_use}(-)" ;;
esac
done
u="[${u#,}]"
fi
echo -n "${u}"
}
# @FUNCTION: vala_depend
# @DESCRIPTION:
# Outputs a ||-dependency string on vala from VALA_MAX_API_VERSION down to
# VALA_MIN_API_VERSION
vala_depend() {
local u v
u=$(_vala_use_depend)
echo -n "|| ("
for v in $(vala_api_versions); do
echo -n " dev-lang/vala:${v}${u}"
done
echo " )"
}
# @FUNCTION: vala_best_api_version
# @DESCRIPTION:
# Returns the highest installed vala API version satisfying
# VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
vala_best_api_version() {
local u v
u=$(_vala_use_depend)
for v in $(vala_api_versions); do
has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return
done
}
# @FUNCTION: vala_src_prepare
# @USAGE: [--ignore-use] [--vala-api-version api_version]
# @DESCRIPTION:
# Sets up the environment variables and pkgconfig files for the
# specified API version, or, if no version is specified, for the
# highest installed vala API version satisfying
# VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
# Is a no-op if called without --ignore-use when USE=-vala.
# Dies if the USE check is passed (or ignored) and a suitable vala
# version is not available.
vala_src_prepare() {
local p d valafoo version ignore_use
while [[ $1 ]]; do
case $1 in
"--ignore-use" )
ignore_use=1 ;;
"--vala-api-version" )
shift
version=$1
[[ ${version} ]] || die "'--vala-api-version' option requires API version parameter."
esac
shift
done
if [[ -z ${ignore_use} ]]; then
in_iuse vala && ! use vala && return 0
fi
if [[ ${version} ]]; then
has_version "dev-lang/vala:${version}" || die "No installed vala:${version}"
else
version=$(vala_best_api_version)
[[ ${version} ]] || die "No installed vala in $(vala_depend)"
fi
export VALAC=$(type -P valac-${version})
valafoo=$(type -P vala-gen-introspect-${version})
[[ ${valafoo} ]] && export VALA_GEN_INTROSPECT="${valafoo}"
valafoo=$(type -P vapigen-${version})
[[ ${valafoo} ]] && export VAPIGEN="${valafoo}"
valafoo=$(type -P valadoc-${version})
[[ ${valafoo} ]] && has valadoc ${VALA_USE_DEPEND} && export VALADOC="${valafoo}"
valafoo="${EPREFIX}/usr/share/vala/Makefile.vapigen"
[[ -e ${valafoo} ]] && export VAPIGEN_MAKEFILE="${valafoo}"
export VAPIGEN_VAPIDIR="${EPREFIX}/usr/share/vala/vapi"
mkdir -p "${T}/pkgconfig" || die "mkdir failed"
for p in libvala vapigen; do
for d in "${EPREFIX}/usr/$(get_libdir)/pkgconfig" "${EPREFIX}/usr/share/pkgconfig"; do
if [[ -e ${d}/${p}-${version}.pc ]]; then
ln -s "${d}/${p}-${version}.pc" "${T}/pkgconfig/${p}.pc" || die "ln failed"
break
fi
done
done
: ${PKG_CONFIG_PATH:="${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig"}
export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
}