eclass/*: pull in portage/ eclasses

Pull in all the eclasses that we don't have in portage-stable/.

BUG=chromium-os:26016
TEST=build_packages+build_image boots x86
TEST=`cbuildbot amd64-generic-full` works
TEST=`cbuildbot arm-generic-full` works
TEST=`cbuildbot x86-generic-full` works
TEST=`cbuildbot chromiumos-sdk` works

Change-Id: I96cb773a19f2344d3df21235f347b2c7158fd143
Reviewed-on: https://gerrit.chromium.org/gerrit/16153
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-02-02 17:58:02 -05:00 committed by Gerrit
parent 33439af72c
commit bc9660ce32
193 changed files with 41085 additions and 0 deletions

View File

@ -0,0 +1,138 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.15 2008/09/10 08:10:31 pva Exp $
# @ECLASS: alternatives.eclass
# @MAINTAINER:
#
# Original author : Alastair Tse <liquidx@gentoo.org> (03 Oct 2003)
# @BLURB: Creates symlink to the latest version of multiple slotted packages.
# @DESCRIPTION:
# When a package is SLOT'ed, very often we need to have a symlink to the
# latest version. However, depending on the order the user has merged them,
# more often than not, the symlink maybe clobbered by the older versions.
#
# This eclass provides a convenience function that needs to be given a
# list of alternatives (descending order of recent-ness) and the symlink.
# It will choose the latest version it can find installed and create
# the desired symlink.
#
# There are two ways to use this eclass. First is by declaring two variables
# $SOURCE and $ALTERNATIVES where $SOURCE is the symlink to be created and
# $ALTERNATIVES is a list of alternatives. Second way is the use the function
# alternatives_makesym() like the example below.
# @EXAMPLE:
# pkg_postinst() {
# alternatives_makesym "/usr/bin/python" "/usr/bin/python2.3" "/usr/bin/python2.2"
# }
#
# The above example will create a symlink at /usr/bin/python to either
# /usr/bin/python2.3 or /usr/bin/python2.2. It will choose python2.3 over
# python2.2 if both exist.
#
# Alternatively, you can use this function:
#
# pkg_postinst() {
# alternatives_auto_makesym "/usr/bin/python" "/usr/bin/python[0-9].[0-9]"
# }
#
# This will use bash pathname expansion to fill a list of alternatives it can
# link to. It is probably more robust against version upgrades. You should
# consider using this unless you are want to do something special.
# @ECLASS-VARIABLE: SOURCE
# @DESCRIPTION:
# The symlink to be created
# @ECLASS-VARIABLE: ALTERNATIVES
# @DESCRIPTION:
# The list of alternatives
# @FUNCTION: alternatives_auto_makesym
# @DESCRIPTION:
# automatic deduction based on a symlink and a regex mask
alternatives_auto_makesym() {
local SYMLINK REGEX ALT myregex
SYMLINK=$1
REGEX=$2
if [ "${REGEX:0:1}" != "/" ]
then
#not an absolute path:
#inherit the root directory of our main link path for our regex search
myregex="${SYMLINK%/*}/${REGEX}"
else
myregex=${REGEX}
fi
# sort a space delimited string by converting it to a multiline list
# and then run sort -r over it.
# make sure we use ${ROOT} because otherwise stage-building will break
ALT="$(for i in $(echo ${ROOT}${myregex}); do echo ${i#${ROOT}}; done | sort -r)"
alternatives_makesym ${SYMLINK} ${ALT}
}
alternatives_makesym() {
local ALTERNATIVES=""
local SYMLINK=""
local alt pref
# usage: alternatives_makesym <resulting symlink> [alternative targets..]
SYMLINK=$1
# this trick removes the trailing / from ${ROOT}
pref=$(echo ${ROOT} | sed 's:/$::')
shift
ALTERNATIVES=$@
# step through given alternatives from first to last
# and if one exists, link it and finish.
for alt in ${ALTERNATIVES}; do
if [ -f "${pref}${alt}" ]; then
#are files in same directory?
if [ "${alt%/*}" = "${SYMLINK%/*}" ]
then
#yes; strip leading dirname from alt to create relative symlink
einfo "Linking ${alt} to ${pref}${SYMLINK} (relative)"
ln -sf ${alt##*/} ${pref}${SYMLINK}
else
#no; keep absolute path
einfo "Linking ${alt} to ${pref}${SYMLINK} (absolute)"
ln -sf ${pref}${alt} ${pref}${SYMLINK}
fi
break
fi
done
# report any errors
if [ ! -L ${pref}${SYMLINK} ]; then
ewarn "Unable to establish ${pref}${SYMLINK} symlink"
else
# we need to check for either the target being in relative path form
# or absolute path form
if [ ! -f "`dirname ${pref}${SYMLINK}`/`readlink ${pref}${SYMLINK}`" -a \
! -f "`readlink ${pref}${SYMLINK}`" ]; then
ewarn "Removing dead symlink ${pref}${SYMLINK}"
rm -f ${pref}${SYMLINK}
fi
fi
}
# @FUNCTION: alernatives-pkg_postinst
# @DESCRIPTION:
# The alternatives pkg_postinst, this function will be exported
alternatives_pkg_postinst() {
if [ -n "${ALTERNATIVES}" -a -n "${SOURCE}" ]; then
alternatives_makesym ${SOURCE} ${ALTERNATIVES}
fi
}
# @FUNCTION: alternatives_pkg_postrm
# @DESCRIPTION:
# The alternatives pkg_postrm, this function will be exported
alternatives_pkg_postrm() {
if [ -n "${ALTERNATIVES}" -a -n "${SOURCE}" ]; then
alternatives_makesym ${SOURCE} ${ALTERNATIVES}
fi
}
EXPORT_FUNCTIONS pkg_postinst pkg_postrm

View File

@ -0,0 +1,182 @@
# Eclass for building dev-java/ant-* packages
#
# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Vlastimil Babka <caster@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.8 2009/02/08 16:12:16 serkan Exp $
# 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 versionator java-pkg-2 java-ant-2
EXPORT_FUNCTIONS src_unpack src_compile src_install
# -----------------------------------------------------------------------------
# @eclass-begin
# @eclass-shortdesc Eclass for building dev-java/ant-* packages
# @eclass-maintainer java@gentoo.org
#
# This eclass provides functionality and default ebuild variables for building
# dev-java/ant-* packages easily.
#
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# @variable-preinherit ANT_TASK_JDKVER
# @variable-default 1.4
#
# Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.4, can
# be overriden from ebuild BEFORE inheriting this eclass.
# -----------------------------------------------------------------------------
ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.4}
# -----------------------------------------------------------------------------
# @variable-preinherit ANT_TASK_JREVER
# @variable-default 1.4
#
# Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.4, can
# be overriden from ebuild BEFORE inheriting this eclass.
# -----------------------------------------------------------------------------
ANT_TASK_JREVER=${ANT_TASK_JREVER-1.4}
# -----------------------------------------------------------------------------
# @variable-internal ANT_TASK_NAME
# @variable-default the rest of $PN after "ant-"
#
# The name of this ant task as recognized by ant's build.xml, derived from $PN.
# -----------------------------------------------------------------------------
ANT_TASK_NAME="${PN#ant-}"
# -----------------------------------------------------------------------------
# @variable-preinherit ANT_TASK_DEPNAME
# @variable-default $ANT_TASK_NAME
#
# 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}}
# -----------------------------------------------------------------------------
# @variable-internal ANT_TASK_PV
# @variable-default Just the number in $PV without any beta/RC suffixes
#
# Version of ant-core this task is intended to register and thus load with.
# -----------------------------------------------------------------------------
ANT_TASK_PV="${PV}"
# special care for beta/RC releases
if [[ ${PV} == *beta2* ]]; then
MY_PV=${PV/_beta2/beta}
UPSTREAM_PREFIX="http://people.apache.org/dist/ant/v1.7.1beta2/src"
GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
ANT_TASK_PV=$(get_version_component_range 1-3)
elif [[ ${PV} == *_rc* ]]; then
MY_PV=${PV/_rc/RC}
UPSTREAM_PREFIX="http://dev.gentoo.org/~caster/distfiles"
GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
ANT_TASK_PV=$(get_version_component_range 1-3)
else
# default for final releases
MY_PV=${PV}
UPSTREAM_PREFIX="mirror://apache/ant/source"
GENTOO_PREFIX="mirror://gentoo"
fi
# source/workdir name
MY_P="apache-ant-${MY_PV}"
# -----------------------------------------------------------------------------
# Default values for standard ebuild variables, can be overriden 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"
IUSE=""
RDEPEND=">=virtual/jre-${ANT_TASK_JREVER}
~dev-java/ant-core-${PV}"
DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER}
${RDEPEND}"
# we need direct blockers with old ant-tasks for file collisions - bug #252324
if version_is_at_least 1.7.1 ; then
DEPEND="${DEPEND}
!dev-java/ant-tasks"
fi
# Would run the full ant test suite for every ant task
RESTRICT="test"
S="${WORKDIR}/${MY_P}"
# ------------------------------------------------------------------------------
# @eclass-src_unpack
#
# 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
mv -f "${WORKDIR}"/build.xml .
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
}
# ------------------------------------------------------------------------------
# @eclass-src_compile
#
# Compiles the jar with installed ant-core.
# ------------------------------------------------------------------------------
ant-tasks_src_compile() {
ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
}
# ------------------------------------------------------------------------------
# @eclass-src_install
#
# 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
if version_is_at_least 1.7.1_beta2; then
dodir /usr/share/ant/lib
dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
fi
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/aolserver.eclass,v 1.9 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,581 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.20 2010/03/05 09:01:07 hollow Exp $
EAPI="2"
# @ECLASS: apache-2.eclass
# @MAINTAINER:
# apache-devs@gentoo.org
# @BLURB: Provides a common set of functions for apache-2.x ebuilds
# @DESCRIPTION:
# This eclass handles apache-2.x ebuild functions such as LoadModule generation
# and inter-module dependency checking.
inherit autotools eutils flag-o-matic multilib ssl-cert
# ==============================================================================
# INTERNAL VARIABLES
# ==============================================================================
# @ECLASS-VARIABLE: GENTOO_PATCHNAME
# @DESCRIPTION:
# This internal variable contains the prefix for the patch tarball.
# Defaults to the full name and version (including revision) of the package.
# If you want to override this in an ebuild, use:
# ORIG_PR="(revision of Gentoo stuff you want)"
# GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}"
[[ -n "$GENTOO_PATCHNAME" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
# @ECLASS-VARIABLE: GENTOO_PATCHDIR
# @DESCRIPTION:
# This internal variable contains the working directory where patches and config
# files are located.
# Defaults to the patchset name appended to the working directory.
[[ -n "$GENTOO_PATCHDIR" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
# @VARIABLE: GENTOO_DEVELOPER
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains the name of the
# gentoo developer who created the patch tarball
# @VARIABLE: GENTOO_PATCHSTAMP
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains the date the patch
# tarball was created at in YYYYMMDD format
# @VARIABLE: GENTOO_PATCH_A
# @DESCRIPTION:
# This variable should contain the entire filename of patch tarball.
# Defaults to the name of the patchset, with a datestamp.
[[ -n "$GENTOO_PATCH_A" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2"
SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
# @VARIABLE: IUSE_MPMS_FORK
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a list of forking
# (i.e. non-threaded) MPMs
# @VARIABLE: IUSE_MPMS_THREAD
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a list of threaded
# MPMs
# @VARIABLE: IUSE_MODULES
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a list of available
# built-in modules
IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}"
IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads"
for module in ${IUSE_MODULES} ; do
IUSE="${IUSE} apache2_modules_${module}"
done
for mpm in ${IUSE_MPMS} ; do
IUSE="${IUSE} apache2_mpms_${mpm}"
done
DEPEND="dev-lang/perl
=dev-libs/apr-1*
=dev-libs/apr-util-1*[ldap?]
dev-libs/libpcre
ldap? ( =net-nds/openldap-2* )
selinux? ( sec-policy/selinux-apache )
ssl? ( >=dev-libs/openssl-0.9.8f )
!=www-servers/apache-1*"
RDEPEND="${DEPEND}"
PDEPEND="~app-admin/apache-tools-${PV}"
S="${WORKDIR}/httpd-${PV}"
# ==============================================================================
# INTERNAL FUNCTIONS
# ==============================================================================
# @ECLASS-VARIABLE: MY_MPM
# @DESCRIPTION:
# This internal variable contains the selected MPM after a call to setup_mpm()
# @FUNCTION: setup_mpm
# @DESCRIPTION:
# This internal function makes sure that only one of APACHE2_MPMS was selected
# or a default based on USE=threads is selected if APACHE2_MPMS is empty
setup_mpm() {
MY_MPM=""
for x in ${IUSE_MPMS} ; do
if use apache2_mpms_${x} ; then
if [[ -z "${MY_MPM}" ]] ; then
MY_MPM=${x}
elog
elog "Selected MPM: ${MY_MPM}"
elog
else
eerror "You have selected more then one mpm USE-flag."
eerror "Only one MPM is supported."
die "more then one mpm was specified"
fi
fi
done
if [[ -z "${MY_MPM}" ]] ; then
if use threads ; then
MY_MPM=worker
elog
elog "Selected default threaded MPM: ${MY_MPM}"
elog
else
MY_MPM=prefork
elog
elog "Selected default MPM: ${MY_MPM}"
elog
fi
fi
if has ${MY_MPM} ${IUSE_MPMS_THREAD} && ! use threads ; then
eerror "You have selected a threaded MPM but USE=threads is disabled"
die "invalid use flag combination"
fi
if has ${MY_MPM} ${IUSE_MPMS_FORK} && use threads ; then
eerror "You have selected a non-threaded MPM but USE=threads is enabled"
die "invalid use flag combination"
fi
}
# @VARIABLE: MODULE_CRITICAL
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a space-separated
# list of modules critical for the default apache. A user may still
# disable these modules for custom minimal installation at their own risk.
# @FUNCTION: check_module_critical
# @DESCRIPTION:
# This internal function warns the user about modules critical for the default
# apache configuration.
check_module_critical() {
local unsupported=0
for m in ${MODULE_CRITICAL} ; do
if ! has ${m} ${MY_MODS} ; then
ewarn "Module '${m}' is required in the default apache configuration."
unsupported=1
fi
done
if [[ ${unsupported} -ne 0 ]] ; then
ewarn
ewarn "You have disabled one or more required modules"
ewarn "for the default apache configuration."
ewarn "Although this is not an error, please be"
ewarn "aware that this setup is UNSUPPORTED."
ewarn
ebeep 10
fi
}
# @VARIABLE: MODULE_DEPENDS
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a space-separated
# list of dependency tokens each with a module and the module it depends on
# separated by a colon
# @FUNCTION: check_module_depends
# @DESCRIPTION:
# This internal function makes sure that all inter-module dependencies are
# satisfied with the current module selection
check_module_depends() {
local err=0
for m in ${MY_MODS} ; do
for dep in ${MODULE_DEPENDS} ; do
if [[ "${m}" == "${dep%:*}" ]] ; then
if ! use apache2_modules_${dep#*:} ; then
eerror "Module '${m}' depends on '${dep#*:}'"
err=1
fi
fi
done
done
if [[ ${err} -ne 0 ]] ; then
die "invalid use flag combination"
fi
}
# @ECLASS-VARIABLE: MY_CONF
# @DESCRIPTION:
# This internal variable contains the econf options for the current module
# selection after a call to setup_modules()
# @ECLASS-VARIABLE: MY_MODS
# @DESCRIPTION:
# This internal variable contains a sorted, space separated list of currently
# selected modules after a call to setup_modules()
# @FUNCTION: setup_modules
# @DESCRIPTION:
# This internal function selects all built-in modules based on USE flags and
# APACHE2_MODULES USE_EXPAND flags
setup_modules() {
local mod_type=
if use static ; then
mod_type="static"
else
mod_type="shared"
fi
MY_CONF="--enable-so=static"
if use ldap ; then
MY_CONF="${MY_CONF} --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}"
MY_MODS="${MY_MODS} ldap authnz_ldap"
else
MY_CONF="${MY_CONF} --disable-authnz_ldap --disable-ldap"
fi
if use ssl ; then
MY_CONF="${MY_CONF} --with-ssl=/usr --enable-ssl=${mod_type}"
MY_MODS="${MY_MODS} ssl"
else
MY_CONF="${MY_CONF} --without-ssl --disable-ssl"
fi
if use threads || has ${MY_MPM} ${IUSE_MPMS_THREAD} ; then
MY_CONF="${MY_CONF} --enable-cgid=${mod_type}"
MY_MODS="${MY_MODS} cgid"
else
MY_CONF="${MY_CONF} --enable-cgi=${mod_type}"
MY_MODS="${MY_MODS} cgi"
fi
if use suexec ; then
elog "You can manipulate several configure options of suexec"
elog "through the following environment variables:"
elog
elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: /usr/local/bin:/usr/bin:/bin)"
elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: /var/log/apache2/suexec_log)"
elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: /var/www)"
elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
elog
MY_CONF="${MY_CONF} --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}"
MY_CONF="${MY_CONF} --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}"
MY_CONF="${MY_CONF} --with-suexec-bin=/usr/sbin/suexec"
MY_CONF="${MY_CONF} --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}"
MY_CONF="${MY_CONF} --with-suexec-caller=${SUEXEC_CALLER:-apache}"
MY_CONF="${MY_CONF} --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}"
MY_CONF="${MY_CONF} --with-suexec-uidmin=${SUEXEC_MINUID:-1000}"
MY_CONF="${MY_CONF} --with-suexec-gidmin=${SUEXEC_MINGID:-100}"
MY_CONF="${MY_CONF} --with-suexec-umask=${SUEXEC_UMASK:-077}"
MY_CONF="${MY_CONF} --enable-suexec=${mod_type}"
MY_MODS="${MY_MODS} suexec"
else
MY_CONF="${MY_CONF} --disable-suexec"
fi
for x in ${IUSE_MODULES} ; do
if use apache2_modules_${x} ; then
MY_CONF="${MY_CONF} --enable-${x}=${mod_type}"
MY_MODS="${MY_MODS} ${x}"
else
MY_CONF="${MY_CONF} --disable-${x}"
fi
done
# sort and uniquify MY_MODS
MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u)
check_module_depends
check_module_critical
}
# @VARIABLE: MODULE_DEFINES
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a space-separated
# list of tokens each mapping a module to a runtime define which can be
# specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular
# module.
# @FUNCTION: generate_load_module
# @DESCRIPTION:
# This internal function generates the LoadModule lines for httpd.conf based on
# the current module selection and MODULE_DEFINES
generate_load_module() {
local endit=0 mod_lines= mod_dir="${D}/usr/$(get_libdir)/apache2/modules"
if use static; then
sed -i -e "/%%LOAD_MODULE%%/d" \
"${GENTOO_PATCHDIR}"/conf/httpd.conf
return
fi
for m in ${MY_MODS} ; do
if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then
for def in ${MODULE_DEFINES} ; do
if [[ "${m}" == "${def%:*}" ]] ; then
mod_lines="${mod_lines}\n<IfDefine ${def#*:}>"
endit=1
fi
done
mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so"
if [[ ${endit} -ne 0 ]] ; then
mod_lines="${mod_lines}\n</IfDefine>"
endit=0
fi
fi
done
sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \
"${GENTOO_PATCHDIR}"/conf/httpd.conf
}
# @FUNCTION: check_upgrade
# @DESCRIPTION:
# This internal function checks if the previous configuration file for built-in
# modules exists in ROOT and prevents upgrade in this case. Users are supposed
# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
# it afterwards.
check_upgrade() {
if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then
eerror "The previous configuration file for built-in modules"
eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your"
eerror "system."
eerror
eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
eerror "for detailed information how to convert this file to the new"
eerror "APACHE2_MODULES USE_EXPAND variable."
eerror
die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
fi
}
# ==============================================================================
# EXPORTED FUNCTIONS
# ==============================================================================
# @FUNCTION: apache-2_pkg_setup
# @DESCRIPTION:
# This function selects built-in modules, the MPM and other configure options,
# creates the apache user and group and informs about CONFIG_SYSVIPC being
# needed (we don't depend on kernel sources and therefore cannot check).
apache-2_pkg_setup() {
check_upgrade
# setup apache user and group
enewgroup apache 81
enewuser apache 81 -1 /var/www apache
setup_mpm
setup_modules
if use debug; then
MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook"
fi
elog "Please note that you need SysV IPC support in your kernel."
elog "Make sure CONFIG_SYSVIPC=y is set."
elog
if use userland_BSD; then
elog "On BSD systems you need to add the following line to /boot/loader.conf:"
elog " accf_http_load=\"YES\""
elog
fi
}
# @FUNCTION: apache-2_src_prepare
# @DESCRIPTION:
# This function applies patches, configures a custom file-system layout and
# rebuilds the configure scripts.
apache-2_src_prepare() {
# 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
# idea for everyone
case ${CHOST} in
*-linux-gnu|*-solaris*|*-freebsd*)
# do nothing, these use GNU binutils
:
;;
*-darwin*)
sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
;;
*)
# patch it out to be like upstream
sed -i -e 's/-Wl,-z,now//g' \
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
;;
esac
# Use correct multilib libdir in gentoo patches
sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
"${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
|| die "libdir sed failed"
epatch "${GENTOO_PATCHDIR}"/patches/*.patch
# setup the filesystem layout config
cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
die "Failed preparing config.layout!"
sed -i -e "s:version:${PF}:g" "${S}"/config.layout
# apache2.8 instead of httpd.8 (bug #194828)
mv docs/man/{httpd,apache2}.8
sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
# patched-in MPMs need the build environment rebuilt
sed -i -e '/sinclude/d' configure.in
AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf
}
# @FUNCTION: apache-2_src_configure
# @DESCRIPTION:
# This function adds compiler flags and runs econf and emake based on MY_MPM and
# MY_CONF
apache-2_src_configure() {
# Instead of filtering --as-needed (bug #128505), append --no-as-needed
# Thanks to Harald van Dijk
append-ldflags $(no-as-needed)
# peruser MPM debugging with -X is nearly impossible
if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
use debug && append-flags -DMPM_PERUSER_DEBUG
fi
# econf overwrites the stuff from config.layout, so we have to put them into
# our myconf line too
econf \
--includedir=/usr/include/apache2 \
--libexecdir=/usr/$(get_libdir)/apache2/modules \
--datadir=/var/www/localhost \
--sysconfdir=/etc/apache2 \
--localstatedir=/var \
--with-mpm=${MY_MPM} \
--with-apr=/usr \
--with-apr-util=/usr \
--with-pcre=/usr \
--with-z=/usr \
--with-port=80 \
--with-program-name=apache2 \
--enable-layout=Gentoo \
${MY_CONF} || die "econf failed!"
sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
}
# @FUNCTION: apache-2_src_install
# @DESCRIPTION:
# This function runs `emake install' and generates, installs and adapts the gentoo
# specific configuration files found in the tarball
apache-2_src_install() {
make DESTDIR="${D}" install || die "make install failed"
# install our configuration files
keepdir /etc/apache2/vhosts.d
keepdir /etc/apache2/modules.d
generate_load_module
insinto /etc/apache2
doins -r "${GENTOO_PATCHDIR}"/conf/*
use apache2_modules_mime_magic && doins docs/conf/magic
insinto /etc/logrotate.d
newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
# generate a sane default APACHE2_OPTS
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
if hasq negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
fi
sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
"${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
# install apache2ctl wrapper for our init script if available
if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
exeinto /usr/sbin
doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
else
dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
fi
# provide legacy symlink for apxs, bug 177697
dosym /usr/sbin/apxs /usr/sbin/apxs2
# install some documentation
dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
dodoc "${GENTOO_PATCHDIR}"/docs/*
# drop in a convenient link to the manual
if use doc ; then
sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf"
else
rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
rm -Rf "${D}/usr/share/doc/${PF}/manual"
fi
# the default icons and error pages get stored in
# /usr/share/apache2/{error,icons}
dodir /usr/share/apache2
mv -f "${D}/var/www/localhost/error" "${D}/usr/share/apache2/error"
mv -f "${D}/var/www/localhost/icons" "${D}/usr/share/apache2/icons"
rm -rf "${D}/var/www/localhost/"
eend $?
# set some sane permissions for suexec
if use suexec ; then
fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
fperms 4710 /usr/sbin/suexec
# provide legacy symlink for suexec, bug 177697
dosym /usr/sbin/suexec /usr/sbin/suexec2
fi
# empty dirs
for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
keepdir ${i}
fowners apache:apache ${i}
fperms 0755 ${i}
done
}
# @FUNCTION: apache-2_pkg_postinst
# @DESCRIPTION:
# This function creates test certificates if SSL is enabled and installs the
# default index.html to /var/www/localhost if it does not exist. We do this here
# because the default webroot is a copy of the files that exist elsewhere and we
# don't want them to be managed/removed by portage when apache is upgraded.
apache-2_pkg_postinst() {
if use ssl && [[ ! -e "${ROOT}/etc/ssl/apache2/server.pem" ]]; then
SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
install_cert /etc/ssl/apache2/server
ewarn
ewarn "The location of SSL certificates has changed. If you are"
ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
ewarn "*any* apache version), you might want to move your old"
ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
ewarn "update your config files."
ewarn
fi
if [[ ! -e "${ROOT}/var/www/localhost" ]] ; then
mkdir -p "${ROOT}/var/www/localhost/htdocs"
echo "<html><body><h1>It works!</h1></body></html>" > "${ROOT}/var/www/localhost/htdocs/index.html"
fi
}
EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

View File

@ -0,0 +1,237 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.23 2008/03/23 12:11:52 hollow Exp $
# @ECLASS: apache-module.eclass
# @MAINTAINER:
# apache-devs@gentoo.org
# @BLURB: Provides a common set of functions for apache modules
# @DESCRIPTION:
# This eclass handles apache modules in a sane way.
#
# To make use of this eclass simply call one of the need/want_apache functions
# described in depend.apache.eclass. Make sure you use the need/want_apache call
# after you have defined DEPEND and RDEPEND. Also note that you can not rely on
# the automatic RDEPEND=DEPEND that portage does if you use this eclass.
#
# See Bug 107127 for more information.
#
# @EXAMPLE:
#
# Here is a simple example of an ebuild for mod_foo:
#
# @CODE
# APACHE2_MOD_CONF="42_mod_foo"
# APACHE2_MOD_DEFINE="FOO"
# need_apache2
# @CODE
#
# A more complicated example for a module with non-standard locations:
#
# @CODE
# APXS2_S="${S}/apache22/src"
# APACHE2_MOD_FILE="${APXS2_S}/${PN}.so"
# APACHE2_MOD_CONF="42_${PN}"
# APACHE2_MOD_DEFINE="FOO"
# DOCFILES="docs/*.html"
# need_apache2_2
# @CODE
#
# A basic module configuration which just loads the module into apache:
#
# @CODE
# <IfDefine FOO>
# LoadModule foo_module modules/mod_foo.so
# </IfDefine>
# @CODE
inherit depend.apache
# ==============================================================================
# PUBLIC VARIABLES
# ==============================================================================
# @VARIABLE: APXS2_S
# @DESCRIPTION:
# Path to temporary build directory. (Defaults to `${S}/src' if it exists,
# `${S}' otherwise)
# @VARIABLE: APXS2_ARGS
# @DESCRIPTION:
# Arguments to pass to the apxs tool. (Defaults to `-c ${PN}.c')
# @VARIABLE: APACHE2_EXECFILES
# @DESCRIPTION:
# List of files that will be installed into ${APACHE_MODULE_DIR} beside
# ${APACHE2_MOD_FILE}. In addition, this function also sets the executable
# permission on those files.
# @VARIABLE: APACHE2_MOD_CONF
# @DESCRIPTION:
# Module configuration file installed by src_install (minus the .conf suffix and
# relative to ${FILESDIR}).
# @VARIABLE: APACHE2_MOD_DEFINE
# @DESCRIPTION:
# Name of define (e.g. FOO) to use in conditional loading of the installed
# module/its config file, multiple defines should be space separated.
# @VARIABLE: APACHE2_MOD_FILE
# @DESCRIPTION:
# Name of the module that src_install installs minus the .so suffix. (Defaults
# to `${APXS2_S}/.libs/${PN}.so')
# @VARIABLE: APACHE2_VHOST_CONF
# @DESCRIPTION:
# Virtual host configuration file installed by src_install (minus the .conf
# suffix and relative to ${FILESDIR}).
# @VARIABLE: DOCFILES
# @DESCRIPTION:
# If the exported src_install() is being used, and ${DOCFILES} is non-zero, some
# sed-fu is applied to split out html documentation (if any) from normal
# documentation, and dodoc'd or dohtml'd.
# ==============================================================================
# INTERNAL FUNCTIONS
# ==============================================================================
# Internal function to construct the default ${APXS2_S} path if required.
apache_cd_dir() {
debug-print-function $FUNCNAME $*
local CD_DIR="${APXS2_S}"
if [[ -z "${CD_DIR}" ]] ; then
if [[ -d "${S}/src" ]] ; then
CD_DIR="${S}/src"
else
CD_DIR="${S}"
fi
fi
debug-print $FUNCNAME "CD_DIR=${CD_DIR}"
echo "${CD_DIR}"
}
# Internal function to construct the default ${APACHE2_MOD_FILE} if required.
apache_mod_file() {
debug-print-function $FUNCNAME $*
local MOD_FILE="${APACHE2_MOD_FILE:-$(apache_cd_dir)/.libs/${PN}.so}"
debug-print $FUNCNAME "MOD_FILE=${MOD_FILE}"
echo "${MOD_FILE}"
}
# Internal function for picking out html files from ${DOCFILES}. It takes an
# optional first argument `html'; if the first argument is equals `html', only
# html files are returned, otherwise normal (non-html) docs are returned.
apache_doc_magic() {
debug-print-function $FUNCNAME $*
local DOCS=
if [[ -n "${DOCFILES}" ]] ; then
if [[ "x$1" == "xhtml" ]] ; then
DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`"
else
DOCS="`echo ${DOCFILES} | sed 's, *[^ ]*\+.html, ,g'`"
fi
fi
debug-print $FUNCNAME "DOCS=${DOCS}"
echo "${DOCS}"
}
# ==============================================================================
# EXPORTED FUNCTIONS
# ==============================================================================
# @FUNCTION: apache-module_src_compile
# @DESCRIPTION:
# The default action is to call ${APXS} with the value of ${APXS2_ARGS}. If a
# module requires a different build setup than this, use ${APXS} in your own
# src_compile routine.
apache-module_src_compile() {
debug-print-function $FUNCNAME $*
local CD_DIR=$(apache_cd_dir)
cd "${CD_DIR}" || die "cd ${CD_DIR} failed"
APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}"
${APXS} ${APXS2_ARGS} || die "${APXS} ${APXS2_ARGS} failed"
}
# @FUNCTION: apache-module_src_install
# @DESCRIPTION:
# This installs the files into apache's directories. The module is installed
# from a directory chosen as above (apache_cd_dir). In addition, this function
# can also set the executable permission on files listed in
# ${APACHE2_EXECFILES}. The configuration file name is listed in
# ${APACHE2_MOD_CONF} without the .conf extensions, so if you configuration is
# 55_mod_foo.conf, APACHE2_MOD_CONF would be 55_mod_foo. ${DOCFILES} contains
# the list of files you want filed as documentation.
apache-module_src_install() {
debug-print-function $FUNCNAME $*
local CD_DIR=$(apache_cd_dir)
cd "${CD_DIR}" || die "cd ${CD_DIR} failed"
local MOD_FILE=$(apache_mod_file)
exeinto "${APACHE_MODULESDIR}"
doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found"
[[ -n "${APACHE2_EXECFILES}" ]] && doexe ${APACHE2_EXECFILES}
if [[ -n "${APACHE2_MOD_CONF}" ]] ; then
insinto "${APACHE_MODULES_CONFDIR}"
set -- ${APACHE2_MOD_CONF}
newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf" \
|| die "internal ebuild error: '${FILESDIR}/${1}.conf' not found"
fi
if [[ -n "${APACHE2_VHOST_CONF}" ]] ; then
insinto "${APACHE_VHOSTS_CONFDIR}"
set -- ${APACHE2_VHOST_CONF}
newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf " \
|| die "internal ebuild error: '${FILESDIR}/${1}.conf' not found"
fi
cd "${S}"
if [[ -n "${DOCFILES}" ]] ; then
local OTHER_DOCS=$(apache_doc_magic)
local HTML_DOCS=$(apache_doc_magic html)
[[ -n "${OTHER_DOCS}" ]] && dodoc ${OTHER_DOCS}
[[ -n "${HTML_DOCS}" ]] && dohtml ${HTML_DOCS}
fi
}
# @FUNCTION: apache-module_pkg_postinst
# @DESCRIPTION:
# This prints out information about the installed module and how to enable it.
apache-module_pkg_postinst() {
debug-print-function $FUNCNAME $*
if [[ -n "${APACHE2_MOD_DEFINE}" ]] ; then
local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }"
einfo
einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and"
einfo "add '${my_opts}' to APACHE2_OPTS."
einfo
fi
if [[ -n "${APACHE2_MOD_CONF}" ]] ; then
set -- ${APACHE2_MOD_CONF}
einfo
einfo "Configuration file installed as"
einfo " ${APACHE_MODULES_CONFDIR}/$(basename $1).conf"
einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2"
einfo
fi
}
EXPORT_FUNCTIONS src_compile src_install pkg_postinst

View File

@ -0,0 +1,67 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/aspell-dict.eclass,v 1.41 2009/01/10 16:16:19 pva Exp $
# @ECLASS: aspell-dict.eclass
# @MAINTAINER:
# app-dicts@gentoo.org
#
# Original author: Seemant Kulleen
#
# @BLURB: An eclass to streamline the construction of ebuilds for new aspell dicts
# @DESCRIPTION:
# The aspell-dict eclass is designed to streamline the construction of
# ebuilds for the new aspell dictionaries (from gnu.org) which support
# aspell-0.50. Support for aspell-0.60 has been added by Sergey Ulanov.
# @ECLASS-VARIABLE: ASPELL_LANG
# @DESCRIPTION:
# Which language is the dictionary for? It's used for the DESCRIPTION of the
# package.
# @ECLASS-VARIABLE: ASPOSTFIX
# @DESCRIPTION:
# What major version of aspell is this dictionary for?
EXPORT_FUNCTIONS src_compile src_install
#MY_P=${PN}-${PV%.*}-${PV#*.*.}
MY_P=${P%.*}-${PV##*.}
MY_P=aspell${ASPOSTFIX}-${MY_P/aspell-/}
SPELLANG=${PN/aspell-/}
S="${WORKDIR}/${MY_P}"
DESCRIPTION="${ASPELL_LANG} language dictionary for aspell"
HOMEPAGE="http://aspell.net"
SRC_URI="mirror://gnu/aspell/dict/${SPELLANG}/${MY_P}.tar.bz2"
IUSE=""
SLOT="0"
if [ x${ASPOSTFIX} = x6 ] ; then
RDEPEND=">=app-text/aspell-0.60"
DEPEND="${RDEPEND}"
else
RDEPEND=">=app-text/aspell-0.50"
DEPEND="${RDEPEND}"
fi
PROVIDE="virtual/aspell-dict"
# @FUNCTION: aspell-dict_src_compile
# @DESCRIPTION:
# The aspell-dict src_compile function which is exported.
aspell-dict_src_compile() {
./configure || die
emake || die
}
# @FUNCTION: aspell-dict_src_install
# @DESCRIPTION:
# The aspell-dict src_install function which is exported.
aspell-dict_src_install() {
make DESTDIR="${D}" install || die
for doc in README info ; do
[ -s "$doc" ] && dodoc $doc
done
}

View File

@ -0,0 +1,66 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.23 2010/01/02 00:07:46 ulm Exp $
# @ECLASS: bash-completion.eclass
# @MAINTAINER:
# shell-tools@gentoo.org.
#
# Original author: Aaron Walker <ka0ttic@gentoo.org>
# @BLURB: An Interface for installing contributed bash-completion scripts
# @DESCRIPTION:
# Simple eclass that provides an interface for installing
# contributed (ie not included in bash-completion proper)
# bash-completion scripts.
# @ECLASS-VARIABLE: BASH_COMPLETION_NAME
# @DESCRIPTION:
# Install the completion script with this name (see also dobashcompletion)
EXPORT_FUNCTIONS pkg_postinst
IUSE="bash-completion"
# Allow eclass to be inherited by eselect without a circular dependency
if [[ ${CATEGORY}/${PN} != app-admin/eselect ]]; then
RDEPEND="bash-completion? ( app-admin/eselect )"
fi
PDEPEND="bash-completion? ( app-shells/bash-completion )"
# @FUNCTION: dobashcompletion
# @USAGE: < file > [ new_file ]
# @DESCRIPTION:
# First arg, <file>, is required and is the location of the bash-completion
# script to install. If the variable BASH_COMPLETION_NAME is set in the
# ebuild, dobashcompletion will install <file> as
# /usr/share/bash-completion/$BASH_COMPLETION_NAME. If it is not set,
# dobashcompletion will check if a second arg [new_file] was passed, installing as
# the specified name. Failing both these checks, dobashcompletion will
# install the file as /usr/share/bash-completion/${PN}.
dobashcompletion() {
[[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
[[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
if use bash-completion ; then
insinto /usr/share/bash-completion
newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1"
fi
}
# @FUNCTION: bash-completion_pkg_postinst
# @DESCRIPTION:
# The bash-completion pkg_postinst function, which is exported
bash-completion_pkg_postinst() {
if use bash-completion ; then
elog "In the case that you haven't yet enabled command-line completion"
elog "for ${PN}, you can run:"
elog
elog " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}"
elog
elog "to install locally, or"
elog
elog " eselect bashcomp enable --global ${BASH_COMPLETION_NAME:-${PN}}"
elog
elog "to install system-wide."
fi
}

View File

@ -0,0 +1,83 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/bsdmk.eclass,v 1.9 2008/08/08 21:16:24 aballier Exp $
# @ECLASS: bsdmk.eclass
# @MAINTAINER:
# Otavio R. Piske "AngusYoung" <angusyoung@gentoo.org>
# Diego Pettenò <flameeyes@gentoo.org>
# Benigno B. Junior <bbj@gentoo.org>
# @BLURB: Some functions for BSDmake
inherit toolchain-funcs portability flag-o-matic
EXPORT_FUNCTIONS src_compile src_install
RDEPEND=""
# this should actually be BDEPEND, but this works.
DEPEND="virtual/pmake"
ESED="/usr/bin/sed"
# @ECLASS-VARIABLE: mymakeopts
# @DESCRIPTION:
# Options for bsd-make
# @FUNCTION: append-opt
# @USAGE: < options >
# @DESCRIPTION:
# append options to enable or disable features
append-opt() {
mymakeopts="${mymakeopts} $@"
}
# @FUNCTION: mkmake
# @USAGE: [ options ]
# @DESCRIPTION:
# calls bsd-make command with the given options, passing ${mymakeopts} to
# enable ports to useflags bridge.
mkmake() {
[[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)"
tc-export CC CXX LD RANLIB
${BMAKE} ${MAKEOPTS} ${EXTRA_EMAKE} ${mymakeopts} NO_WERROR= STRIP= "$@"
}
# @FUNCTION: mkinstall
# @USAGE: [ options ]
# @DESCRIPTION:
# Calls "bsd-make install" with the given options, passing ${mamakeopts} to
# enable ports to useflags bridge
mkinstall() {
[[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)"
# STRIP= will replace the default value of -s, leaving to portage the
# task of stripping executables.
${BMAKE} ${mymakeopts} NO_WERROR= STRIP= MANSUBDIR= DESTDIR="${D}" "$@" install
}
# @FUNCTION: dummy_mk
# @USAGE: < dirnames >
# @DESCRIPTION:
# removes the specified subdirectories and creates a dummy makefile in them
# useful to remove the need for "minimal" patches
dummy_mk() {
for dir in $@; do
echo ".include <bsd.lib.mk>" > ${dir}/Makefile
done
}
# @FUNCTION: bsdmk_src_compile
# @DESCRIPTION:
# The bsdmk src_compile function, which is exported
bsdmk_src_compile() {
mkmake || die "make failed"
}
# @FUNCTION: bsdmk_src_install
# @DESCRIPTION:
# The bsdmk src_install function, which is exported
bsdmk_src_install() {
mkinstall || die "install failed"
}

View File

@ -0,0 +1,309 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.8 2010/03/05 09:35:23 fauli Exp $
#
# @ECLASS: bzr.eclass
# @MAINTAINER:
# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>,
# Ulrich Mueller <ulm@gentoo.org>,
# Christian Faulhammer <fauli@gentoo.org>,
# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>,
# and anyone who wants to help
# @BLURB: This eclass provides support to use the Bazaar VCS
# @DESCRIPTION:
# The bzr.eclass provides support for apps using the Bazaar VCS
# (distributed version control system).
# The eclass was originally derived from the git eclass.
#
# Note: Just set EBZR_REPO_URI to the URI of the branch and the src_unpack()
# of this eclass will put an export of the branch in ${WORKDIR}/${PN}.
inherit eutils
EBZR="bzr.eclass"
case "${EAPI:-0}" in
0|1) EXPORT_FUNCTIONS src_unpack ;;
*) EXPORT_FUNCTIONS src_unpack src_prepare ;;
esac
HOMEPAGE="http://bazaar-vcs.org/"
DESCRIPTION="Based on the ${EBZR} eclass"
DEPEND=">=dev-vcs/bzr-1.5"
# @ECLASS-VARIABLE: EBZR_STORE_DIR
# @DESCRIPTION:
# The directory to store all fetched Bazaar live sources.
: ${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bzr-src}
# @ECLASS-VARIABLE: EBZR_FETCH_CMD
# @DESCRIPTION:
# The Bazaar command to fetch the sources.
EBZR_FETCH_CMD="bzr checkout --lightweight"
# @ECLASS-VARIABLE: EBZR_UPDATE_CMD
# @DESCRIPTION:
# The Bazaar command to update the sources.
EBZR_UPDATE_CMD="bzr update"
# @ECLASS-VARIABLE: EBZR_DIFF_CMD
# @DESCRIPTION:
# The Bazaar command to get the diff output.
EBZR_DIFF_CMD="bzr diff"
# @ECLASS-VARIABLE: EBZR_EXPORT_CMD
# @DESCRIPTION:
# The Bazaar command to export a branch.
EBZR_EXPORT_CMD="bzr export"
# @ECLASS-VARIABLE: EBZR_REVNO_CMD
# @DESCRIPTION:
# The Bazaar command to list a revision number of the branch.
EBZR_REVNO_CMD="bzr revno"
# @ECLASS-VARIABLE: EBZR_OPTIONS
# @DESCRIPTION:
# The options passed to the fetch and update commands.
EBZR_OPTIONS="${EBZR_OPTIONS:-}"
# @ECLASS-VARIABLE: EBZR_REPO_URI
# @DESCRIPTION:
# The repository URI for the source package.
#
# @CODE
# Supported protocols:
# - http://
# - https://
# - sftp://
# - rsync://
# - lp:
# @CODE
#
# Note: lp: seems to be an alias for https://launchpad.net
EBZR_REPO_URI="${EBZR_REPO_URI:-}"
# @ECLASS-VARIABLE: EBZR_BOOTSTRAP
# @DESCRIPTION:
# Bootstrap script or command like autogen.sh or etc.
EBZR_BOOTSTRAP="${EBZR_BOOTSTRAP:-}"
# @ECLASS-VARIABLE: EBZR_PATCHES
# @DESCRIPTION:
# bzr eclass can apply patches in bzr_bootstrap().
# You can use regular expressions in this variable like *.diff or
# *.patch and the like.
# NOTE: These patches will bei applied before EBZR_BOOTSTRAP is processed.
#
# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either
# location, the installation dies.
EBZR_PATCHES="${EBZR_PATCHES:-}"
# @ECLASS-VARIABLE: EBZR_REVISION
# @DESCRIPTION:
# Revision to fetch, defaults to the latest
# (see http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec).
# If you set this to a non-empty value, then it is recommended not to
# use a lightweight checkout (see also EBZR_FETCH_CMD).
EBZR_REVISION="${EBZR_REVISION:-}"
# @ECLASS-VARIABLE: EBZR_CACHE_DIR
# @DESCRIPTION:
# The directory to store the source for the package, relative to
# EBZR_STORE_DIR.
#
# default: ${PN}
EBZR_CACHE_DIR="${EBZR_CACHE_DIR:-${PN}}"
# @ECLASS-VARIABLE: EBZR_OFFLINE
# @DESCRIPTION:
# Set this variable to a non-empty value to disable the automatic updating of
# a bzr source tree. This is intended to be set outside the ebuild by users.
EBZR_OFFLINE="${EBZR_OFFLINE:-${ESCM_OFFLINE}}"
# @FUNCTION: bzr_initial_fetch
# @DESCRIPTION:
# Retrieves the source code from a repository for the first time, via
# ${EBZR_FETCH_CMD}.
bzr_initial_fetch() {
local repository="${1}";
local branch_dir="${2}";
# fetch branch
einfo "bzr fetch start -->"
einfo " repository: ${repository} => ${branch_dir}"
${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repository}" "${branch_dir}" \
|| die "${EBZR}: can't branch from ${repository}."
}
# @FUNCTION: bzr_update
# @DESCRIPTION:
# Updates the source code from a repository, via ${EBZR_UPDATE_CMD}.
bzr_update() {
local repository="${1}";
if [[ -n "${EBZR_OFFLINE}" ]]; then
einfo "skipping bzr update -->"
einfo " repository: ${repository}"
else
# update branch
einfo "bzr update start -->"
einfo " repository: ${repository}"
pushd "${EBZR_BRANCH_DIR}" > /dev/null
${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \
|| die "${EBZR}: can't update from ${repository}."
popd > /dev/null
fi
}
# @FUNCTION: bzr_fetch
# @DESCRIPTION:
# Wrapper function to fetch sources from a Bazaar repository via bzr
# fetch or bzr update, depending on whether there is an existing
# working copy in ${EBZR_BRANCH_DIR}.
bzr_fetch() {
local EBZR_BRANCH_DIR
# EBZR_REPO_URI is empty.
[[ ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty."
# check for the protocol or pull from a local repo.
if [[ -z ${EBZR_REPO_URI%%:*} ]] ; then
case ${EBZR_REPO_URI%%:*} in
# lp: seems to be an alias to https://launchpad.net
http|https|rsync|lp)
;;
sftp)
if ! built_with_use --missing true dev-vcs/bzr sftp; then
eerror "To fetch sources from ${EBZR_REPO_URI} you need SFTP"
eerror "support in dev-vcs/bzr."
die "Please, rebuild dev-vcs/bzr with the sftp USE flag enabled."
fi
;;
*)
die "${EBZR}: fetch from ${EBZR_REPO_URI%:*} is not yet implemented."
;;
esac
fi
if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
debug-print "${FUNCNAME}: initial branch. Creating bzr directory"
local save_sandbox_write=${SANDBOX_WRITE}
addwrite /
mkdir -p "${EBZR_STORE_DIR}" \
|| die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}."
SANDBOX_WRITE=${save_sandbox_write}
fi
pushd "${EBZR_STORE_DIR}" > /dev/null \
|| die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}"
EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}"
addwrite "${EBZR_STORE_DIR}"
addwrite "${EBZR_BRANCH_DIR}"
debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}"
# Run bzr_initial_fetch() only if the branch has not been pulled
# before or if the existing local copy is a full checkout (as did
# an older version of bzr.eclass)
if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then
bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
elif [[ ${EBZR_FETCH_CMD} == *lightweight* \
&& -d ${EBZR_BRANCH_DIR}/.bzr/repository ]]; then
einfo "Re-fetching the branch to save space..."
rm -rf "${EBZR_BRANCH_DIR}"
bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
else
bzr_update "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}"
fi
cd "${EBZR_BRANCH_DIR}"
einfo "exporting ..."
if [[ -z ${EBZR_REVISION} ]]; then
rsync -rlpgo --exclude=".bzr/" . "${WORKDIR}/${P}" \
|| die "${EBZR}: export failed"
else
# revisions of a lightweight checkout are only available when online
[[ -z ${EBZR_OFFLINE} || -d ${EBZR_BRANCH_DIR}/.bzr/repository ]] \
|| die "${EBZR}: No support for revisions when off-line"
${EBZR_EXPORT_CMD} -r "${EBZR_REVISION}" "${WORKDIR}/${P}" \
|| die "${EBZR}: export failed"
fi
popd > /dev/null
}
# @FUNCTION: bzr_bootstrap
# @DESCRIPTION:
# Apply patches in ${EBZR_PATCHES} and run ${EBZR_BOOTSTRAP} if specified.
bzr_bootstrap() {
local patch lpatch
pushd "${S}" > /dev/null
if [[ -n ${EBZR_PATCHES} ]] ; then
einfo "apply patches -->"
for patch in ${EBZR_PATCHES} ; do
if [[ -f ${patch} ]] ; then
epatch ${patch}
else
# This loop takes care of wildcarded patches given via
# EBZR_PATCHES in an ebuild
for lpatch in "${FILESDIR}"/${patch} ; do
if [[ -f ${lpatch} ]] ; then
epatch ${lpatch}
else
die "${EBZR}: ${patch} is not found"
fi
done
fi
done
fi
if [[ -n ${EBZR_BOOTSTRAP} ]] ; then
einfo "begin bootstrap -->"
if [[ -f ${EBZR_BOOTSTRAP} ]] && [[ -x ${EBZR_BOOTSTRAP} ]] ; then
einfo " bootstrap with a file: ${EBZR_BOOTSTRAP}"
"./${EBZR_BOOTSTRAP}" \
|| die "${EBZR}: can't execute EBZR_BOOTSTRAP."
else
einfo " bootstrap with commands: ${EBZR_BOOTSTRAP}"
"${EBZR_BOOTSTRAP}" \
|| die "${EBZR}: can't eval EBZR_BOOTSTRAP."
fi
fi
popd > /dev/null
}
# @FUNCTION: bzr_src_unpack
# @DESCRIPTION:
# Default src_unpack(). Includes bzr_fetch() and bootstrap().
bzr_src_unpack() {
if ! [ -z ${EBZR_BRANCH} ]; then
# This test will go away on 01 Jul 2010
eerror "This ebuild uses EBZR_BRANCH which is not supported anymore"
eerror "by the bzr.eclass. Please report this to the ebuild's maintainer."
die "EBZR_BRANCH still defined"
fi
bzr_fetch || die "${EBZR}: unknown problem in bzr_fetch()."
case "${EAPI:-0}" in
0|1) bzr_src_prepare ;;
esac
}
# @FUNCTION: bzr_src_prepare
# @DESCRIPTION:
# Default src_prepare(). Executes bzr_bootstrap() for patch
# application and Make file generation (if needed).
bzr_src_prepare() {
bzr_bootstrap || die "${EBZR}: unknown problem in bzr_bootstrap()."
}

View File

@ -0,0 +1,153 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.15 2008/09/10 08:15:48 pva Exp $
# @ECLASS: cannadic.eclass
# @MAINTAINER:
# ???
#
# Original author: Mamoru KOMACHI <usata@gentoo.org>
# @BLURB: Function for Canna compatible dictionaries
# @DESCRIPTION:
# The cannadic eclass is used for installation and setup of Canna
# compatible dictionaries within the Portage system.
EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
IUSE=""
DESCRIPTION="Based on the $ECLASS eclass"
HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
SRC_URI="mirror://gentoo/${P}.tar.gz"
LICENSE="public-domain"
SLOT="0"
S="${WORKDIR}"
DICSDIRFILE="${FILESDIR}/*.dics.dir"
CANNADICS="${CANNADICS}" # (optional)
DOCS="README*"
# You don't need to modify these
#local cannadir dicsdir
cannadir="${ROOT}/var/lib/canna/dic/canna"
dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
# @FUNCTION: cannadic_pkg_setup
# @DESCRIPTION:
# Sets up cannadic dir
cannadic_pkg_setup() {
keepdir $cannadir
fowners bin:bin $cannadir
fperms 0775 $cannadir
}
# @FUNCTION: cannadic-install
# @DESCRIPTION:
# Installs dictionaries to cannadir
cannadic-install() {
insinto $cannadir
insopts -m0664 -o bin -g bin
doins "$@"
}
# @FUNCTION: dicsdir-install
# @DESCRIPTION:
# Installs dics.dir from ${DICSDIRFILE}
dicsdir-install() {
insinto ${dicsdir}
doins ${DICSDIRFILE}
}
# @FUNCTION: cannadic_src_install
# @DESCRIPTION:
# Installs all dictionaries under ${WORKDIR}
# plus dics.dir and docs
cannadic_src_install() {
for f in *.c[btl]d *.t ; do
cannadic-install $f
done 2>/dev/null
dicsdir-install || die
dodoc ${DOCS}
}
# @FUNCTION: update-cannadic-dir
# @DESCRIPTION:
# Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
#
# compiles dics.dir files for Canna Server
# Copyright 2001 ISHIKAWA Mutsumi
# Licensed under the GNU General Public License, version 2. See the file
# /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
update-cannadic-dir() {
einfo
einfo "Updating dics.dir for Canna ..."
einfo
# write new dics.dir file in case we are interrupted
cat >${cannadir}/dics.dir.update-new<<-EOF
# dics.dir -- automatically generated file by Portage.
# DO NOT EDIT BY HAND.
EOF
for file in ${dicsdir}/*.dics.dir ; do
echo "# $file" >> ${cannadir}/dics.dir.update-new
cat $file >> ${cannadir}/dics.dir.update-new
einfo "Added $file."
done
mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
einfo
einfo "Done."
einfo
}
# @FUNCTION: cannadic_pkg_postinst
# @DESCRIPTION:
# Updates dics.dir and print out notice after install
cannadic_pkg_postinst() {
update-cannadic-dir
einfo
einfo "Please restart cannaserver to fit the changes."
einfo "You need to modify your config file (~/.canna) to enable dictionaries."
if [ -n "${CANNADICS}" ] ; then
einfo "e.g) add $(for d in ${CANNADICS}; do
echo -n "\"$d\" "
done)to section use-dictionary()."
einfo "For details, see documents under /usr/share/doc/${PF}"
fi
einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
ewarn "If you are upgrading from existing dictionary, you may need to recreate"
ewarn "user dictionary if you have one."
einfo
}
# @FUNCTION: cannadic_pkg_postrm
# @DESCRIPTION:
# Updates dics.dir and print out notice after uninstall
cannadic_pkg_postrm() {
update-cannadic-dir
einfo
einfo "Please restart cannaserver to fit changes."
einfo "and modify your config file (~/.canna) to disable dictionary."
if [ -n "${CANNADICS}" ] ; then
einfo "e.g) delete $(for d in ${CANNADICS}; do
echo -n "\"$d\" "
done)from section use-dictionary()."
fi
einfo
}

View File

@ -0,0 +1,8 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ccc.eclass,v 1.23 2010/01/11 20:26:53 armin76 Exp $
# @DEAD
# To be removed on 2012/01/11
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/check-kernel.eclass,v 1.9 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,207 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v 1.6 2008/04/11 13:52:55 zlin Exp $
# @ECLASS: check-reqs.eclass
# @MAINTAINER:
# Bo Ørsted Andresen <zlin@gentoo.org>
#
# Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
# @BLURB: Provides a uniform way of handling ebuild which have very high build requirements
# @DESCRIPTION:
# This eclass provides a uniform way of handling ebuilds which have very high
# build requirements in terms of memory or disk space. It provides a function
# which should usually be called during pkg_setup().
#
# From a user perspective, the variable CHECKREQS_ACTION can be set to:
# * "warn" (default), which will display a warning and wait for 15s
# * "error", which will make the ebuild error out
# * "ignore", which will not take any action
#
# The chosen action only happens when the system's resources are detected
# correctly and only if they are below the threshold specified by the package.
#
# For ebuild authors: only use this eclass if you reaaalllllly have stupidly
# high build requirements. At an absolute minimum, you shouldn't be using this
# unless the ebuild needs >256MBytes RAM or >1GByte temporary or install space.
# The code should look something like:
#
# @CODE
# pkg_setup() {
# # values in MBytes
#
# # need this much memory (does *not* check swap)
# CHECKREQS_MEMORY="256"
#
# # need this much temporary build space
# CHECKREQS_DISK_BUILD="2048"
#
# # install will need this much space in /usr
# CHECKREQS_DISK_USR="1024"
#
# # install will need this much space in /var
# CHECKREQS_DISK_VAR="1024"
#
# # go!
# check_reqs
# }
# @CODE
#
# Alternatively, the check_reqs_conditional function can be used to carry out
# alternate actions (e.g. using a much slower but far less memory intensive
# build option that gives the same end result).
#
# You should *not* override the user's CHECKREQS_ACTION setting, nor should you
# attempt to provide a value if it is unset. Note that the environment variables
# are used rather than parameters for a few reasons:
# * easier to do if use blah ; then things
# * we might add in additional requirements things later
# If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
# carried out.
#
# These checks should probably mostly work on non-Linux, and they should
# probably degrade gracefully if they don't. Probably.
inherit eutils
# @ECLASS-VARIABLE: CHECKREQS_MEMORY
# @DESCRIPTION:
# How much RAM is needed in MB?
# @ECLASS-VARIABLE: CHECKREQS_DISK_BUILD
# @DESCRIPTION:
# How much diskspace is needed to build the package? In MB
# @ECLASS-VARIABLE: CHECKREQS_DISK_USR
# @DESCRIPTION:
# How much space in /usr is needed to install the package? In MB
# @ECLASS-VARIABLE: CHECKREQS_DISK_VAR
# @DESCRIPTION:
# How much space is needed in /var? In MB
# @FUNCTION: check_reqs
# @DESCRIPTION:
# Checks the requirements given in the specific variables. If not reached,
# either prints a warning or dies.
check_reqs() {
[[ -n "${1}" ]] && die "Usage: check_reqs"
export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE=""
if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then
[[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory
[[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \
"${T}" "\${T}" "${CHECKREQS_DISK_BUILD}"
[[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \
"${ROOT}/usr" "\${ROOT}/usr" "${CHECKREQS_DISK_USR}"
[[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \
"${ROOT}/var" "\${ROOT}/var" "${CHECKREQS_DISK_VAR}"
fi
if [[ -n "${CHECKREQS_NEED_SLEEP}" ]] ; then
echo
ewarn "Bad things may happen! You may abort the build by pressing ctrl+c in"
ewarn "the next 15 seconds."
ewarn " "
einfo "To make this kind of warning a fatal error, add a line to /etc/make.conf"
einfo "setting CHECKREQS_ACTION=\"error\". To skip build requirements checking,"
einfo "set CHECKREQS_ACTION=\"ignore\"."
epause 15
fi
if [[ -n "${CHECKREQS_NEED_DIE}" ]] ; then
eerror "Bailing out as specified by CHECKREQS_ACTION"
die "Build requirements not met"
fi
}
# @FUNCTION: check_reqs_conditional
# @RETURN: True if requirements check passed, else False
# @DESCRIPTION:
# Checks the requirements given in the specific variables
check_reqs_conditional() {
[[ -n "${1}" ]] && die "Usage: check_reqs"
export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE=""
if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then
[[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory
[[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \
"${T}" "\${T}" "${CHECKREQS_DISK_BUILD}"
[[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \
"${ROOT}/usr" "\${ROOT}/usr" "${CHECKREQS_DISK_USR}"
[[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \
"${ROOT}/var" "\${ROOT}/var" "${CHECKREQS_DISK_VAR}"
fi
[[ -z "${CHECKREQS_NEED_SLEEP}" && -z "${CHECKREQS_NEED_DIE}" ]]
}
# internal use only!
check_build_memory() {
[[ -n "${1}" ]] && die "Usage: check_build_memory"
check_build_msg_begin "${CHECKREQS_MEMORY}" "MBytes" "RAM"
if [[ -r /proc/meminfo ]] ; then
actual_memory=$(sed -n -e '/MemTotal:/s/^[^:]*: *\([0-9]\+\) kB/\1/p' \
/proc/meminfo)
else
actual_memory=$(sysctl hw.physmem 2>/dev/null )
[[ "$?" == "0" ]] &&
actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' )
fi
if [[ -n "${actual_memory}" ]] ; then
if [[ ${actual_memory} -lt $((1024 * ${CHECKREQS_MEMORY})) ]] ; then
eend 1
check_build_msg_ick "${CHECKREQS_MEMORY}" "MBytes" "RAM"
else
eend 0
fi
else
eend 1
ewarn "Couldn't determine amount of memory, skipping ..."
fi
}
# internal use only!
check_build_disk() {
[[ -z "${3}" ]] && die "Usage: check_build_disk where name needed"
check_build_msg_begin "${3}" "MBytes" \
"disk space at ${2}"
actual_space=$(df -Pm ${1} 2>/dev/null | sed -n \
'$s/\(\S\+\s\+\)\{3\}\([0-9]\+\).*/\2/p' 2>/dev/null )
if [[ "$?" == "0" && -n "${actual_space}" ]] ; then
if [[ ${actual_space} -lt ${3} ]] ; then
eend 1
check_build_msg_ick "${3}" "MBytes" \
"disk space at ${2}"
else
eend 0
fi
else
eend 1
ewarn "Couldn't figure out disk space, skipping ..."
fi
}
# internal use only!
check_build_msg_begin() {
ebegin "Checking for at least ${1}${2} ${3}"
}
# internal use only!
check_build_msg_skip() {
ewarn "Skipping check for at least ${1}${2} ${3}"
}
# internal use only!
check_build_msg_ick() {
if [[ "${CHECKREQS_ACTION}" == "error" ]] ; then
eerror "Don't have at least ${1}${2} ${3}"
echo
export CHECKREQS_NEED_DIE="yes"
else
ewarn "Don't have at least ${1}${2} ${3}"
echo
export CHECKREQS_NEED_SLEEP="yes"
fi
}

View File

@ -0,0 +1,64 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/clutter.eclass,v 1.1 2010/02/26 21:15:55 nirbheek Exp $
#
# @ECLASS: clutter.eclass
# @MAINTAINER: GNOME Herd <gnome@gentoo.org>
#
# @BLURB: Sets SRC_URI, LICENSE, etc and exports src_install
#
# Authors:
# Nirbheek Chauhan <nirbheek@gentoo.org>
#
inherit versionator
HOMEPAGE="http://www.clutter-project.org/"
RV=($(get_version_components))
SRC_URI="http://www.clutter-project.org/sources/${PN}/${RV[0]}.${RV[1]}/${P}.tar.bz2"
# All official clutter packages use LGPL-2
LICENSE="LGPL-2"
# This will be used by all clutter packages
DEPEND="dev-util/pkgconfig"
# @ECLASS-VARIABLE: DOCS
# @DESCRIPTION:
# This variable holds relative paths of files to be dodoc-ed.
# By default, it contains the standard list of autotools doc files
DOCS="${DOCS:-AUTHORS ChangeLog NEWS README TODO}"
# @ECLASS-VARIABLE: EXAMPLES
# @DESCRIPTION:
# This variable holds relative paths of files to be added as examples when the
# "examples" USE-flag exists, and is switched on. Bash expressions can be used
# since the variable is eval-ed before substitution. Empty by default.
EXAMPLES="${EXAMPLES:-""}"
# @FUNCTION: clutter_src_install
# @USAGE:
# @DESCRIPTION: Runs emake install, dodoc, and installs examples
clutter_src_install() {
emake DESTDIR="${D}" install || die "emake install failed"
dodoc ${DOCS} || die "dodoc failed"
# examples
if hasq examples ${IUSE} && use examples; then
insinto /usr/share/doc/${PF}/examples
# We use eval to be able to use globs and other bash expressions
for example in $(eval echo ${EXAMPLES}); do
# If directory
if [[ ${example: -1} == "/" ]]; then
doins -r ${example} || die "doins ${example} failed!"
else
doins ${example} || die "doins ${example} failed!"
fi
done
fi
}
EXPORT_FUNCTIONS src_install

View File

@ -0,0 +1,80 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common-2.eclass,v 1.3 2009/09/18 15:35:50 hkbst Exp $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# Sundry code common to many Common Lisp related ebuilds.
# Some handy constants
inherit eutils
CLSOURCEROOT=/usr/share/common-lisp/source/
CLSYSTEMROOT=/usr/share/common-lisp/systems/
# Many of our Common Lisp ebuilds are either inspired by, or actually
# use packages and files from the Debian project's archives.
do-debian-credits() {
docinto debian
for i in copyright README.Debian changelog; do
test -f $i && dodoc "${S}"/debian/${i}
done
docinto .
}
# BIG FAT HACK: Since the Portage emerge step kills file timestamp
# information, we need to compensate by ensuring all FASL files are
# more recent than their source files.
# The following `impl-*-timestamp-hack' functions SHOULD NOT be used
# outside of this eclass.
impl-save-timestamp-hack() {
local impl=$1
dodir /usr/share/${impl}
tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
}
impl-restore-timestamp-hack() {
local impl=$1
tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
}
impl-remove-timestamp-hack() {
local impl=$1
rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
}
standard-impl-postinst() {
local impl=$1
unregister-common-lisp-implementation cmucl
case ${impl} in
cmucl|sbcl)
impl-restore-timestamp-hack ${impl}
;;
*)
;;
esac
register-common-lisp-implementation ${impl}
}
standard-impl-postrm() {
local impl=$1 impl_binary=$2
if [ ! -x ${impl_binary} ]; then
case ${impl} in
cmucl|sbcl)
impl-remove-timestamp-hack ${impl}
;;
*)
;;
esac
rm -rf /var/cache/common-lisp-controller/*/${impl}
fi
}
# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***

View File

@ -0,0 +1,82 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common-3.eclass,v 1.2 2009/09/18 15:35:50 hkbst Exp $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# Sundry code common to many Common Lisp related ebuilds. Some
# implementation use the Portage time stamp hack to ensure their
# installed files have the right modification time relative to each
# other.
inherit eutils
CLSOURCEROOT=/usr/share/common-lisp/source/
CLSYSTEMROOT=/usr/share/common-lisp/systems/
# Many of our Common Lisp ebuilds are either inspired by, or actually
# use packages and files from the Debian project's archives.
do-debian-credits() {
docinto debian
for i in copyright README.Debian changelog; do
test -f $i && dodoc "${S}"/debian/${i}
done
docinto .
}
# BIG FAT HACK: Since the Portage emerge step kills file timestamp
# information, we need to compensate by ensuring all FASL files are
# more recent than their source files.
# The following `impl-*-timestamp-hack' functions SHOULD NOT be used
# outside of this eclass.
# Bug http://bugs.gentoo.org/show_bug.cgi?id=16162 should remove the
# need for this hack.
impl-save-timestamp-hack() {
local impl=$1
dodir /usr/share/${impl}
tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
}
impl-restore-timestamp-hack() {
local impl=$1
tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
}
impl-remove-timestamp-hack() {
local impl=$1
rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
}
standard-impl-postinst() {
local impl=$1
case ${impl} in
cmucl|sbcl)
impl-restore-timestamp-hack ${impl}
;;
*)
;;
esac
}
standard-impl-postrm() {
local impl=$1 impl_binary=$2
if [ ! -x ${impl_binary} ]; then
case ${impl} in
cmucl|sbcl)
impl-remove-timestamp-hack ${impl}
;;
*)
;;
esac
rm -rf /var/cache/common-lisp-controller/*/${impl}
fi
}
# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***

View File

@ -0,0 +1,209 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common.eclass,v 1.13 2009/09/18 15:35:50 hkbst Exp $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# Sundry code common to many Common Lisp related ebuilds.
# Some handy constants
inherit eutils
CLFASLROOT=/usr/$(get_libdir)/common-lisp/
CLSOURCEROOT=/usr/share/common-lisp/source/
CLSYSTEMROOT=/usr/share/common-lisp/systems/
# Many of our Common Lisp ebuilds are either inspired by, or actually
# use packages and files from the Debian project's archives.
do-debian-credits() {
docinto debian
for i in copyright README.Debian changelog; do
# be silent, since all files are not always present
dodoc "${S}"/debian/${i} &>/dev/null || true
done
docinto .
}
# Most of the code below is from Debian's Common Lisp Controller
# package
register-common-lisp-implementation() {
PROGNAME=$(basename $0)
# first check if there is at least a compiler-name:
if [ -z "$1" ] ; then
cat <<EOF
usage: $PROGNAME compiler-name
registers a Common Lisp compiler to the
Common-Lisp-Controller system.
EOF
exit 1
fi
IMPL=$1
FILE="/usr/$(get_libdir)/common-lisp/bin/$IMPL.sh"
if [ ! -f "$FILE" ] ; then
cat <<EOF
$PROGNAME: I cannot find the script $FILE for the implementation $IMPL
EOF
exit 2
fi
if [ ! -r "$FILE" ] ; then
cat <<EOF
$PROGNAME: I cannot read the script $FILE for the implementation $IMPL
EOF
exit 2
fi
# install CLC into the lisp
sh "$FILE" install-clc || (echo "Installation of CLC failed" >&2 ; exit 3)
mkdir /usr/$(get_libdir)/common-lisp/$IMPL &>/dev/null || true
chown cl-builder:cl-builder /usr/$(get_libdir)/common-lisp/$IMPL
# now recompile the stuff
for i in /usr/share/common-lisp/systems/*.asd ; do
if [ -f $i -a -r $i ] ; then
i=${i%.asd}
package=${i##*/}
clc-autobuild-check $IMPL $package
if [ $? = 0 ]; then
echo recompiling package $package for implementation $IMPL
/usr/bin/clc-send-command --quiet recompile $package $IMPL
fi
fi
done
for i in /usr/share/common-lisp/systems/*.system ; do
if [ -f $i -a -r $i ] ; then
i=${i%.system}
package=${i##*/}
clc-autobuild-check $IMPL $package
if [ $? = 0 ]; then
echo recompiling package $package for implementation $IMPL
/usr/bin/clc-send-command --quiet recompile $package $IMPL
fi
fi
done
echo "$PROGNAME: Compiler $IMPL installed"
}
unregister-common-lisp-implementation() {
PROGNAME=$(basename $0)
if [ `id -u` != 0 ] ; then
echo $PROGNAME: you need to be root to run this program
exit 1
fi
if [ -z "$1" ] ; then
cat <<EOF
usage: $PROGNAME compiler-name
un-registers a Common Lisp compiler to the
Common-Lisp-Controller system.
EOF
exit 1
fi
IMPL=$1
IMPL_BIN="/usr/$(get_libdir)/common-lisp/bin/$IMPL.sh"
if [ ! -f "$IMPL_BIN" ] ; then
cat <<EOF
$PROGNAME: No implementation of the name $IMPL is registered
Cannot find the file $IMPL_BIN
Maybe you already removed it?
EOF
exit 0
fi
if [ ! -r "$IMPL_BIN" ] ; then
cat <<EOF
$PROGNAME: No implementation of the name $IMPL is registered
Cannot read the file $IMPL_BIN
Maybe you already removed it?
EOF
exit 0
fi
# Uninstall the CLC
sh $IMPL_BIN remove-clc || echo "De-installation of CLC failed" >&2
clc-autobuild-impl $IMPL inherit
# Just remove the damn subtree
(cd / ; rm -rf "/usr/$(get_libdir)/common-lisp/$IMPL/" ; true )
echo "$PROGNAME: Common Lisp implementation $IMPL uninstalled"
}
reregister-all-common-lisp-implementations() {
# Rebuilds all common lisp implementations
# Written by Kevin Rosenberg <kmr@debian.org>
# GPL-2 license
local clc_bin_dir=/usr/$(get_libdir)/common-lisp/bin
local opt=$(shopt nullglob); shopt -s nullglob
cd $clc_bin_dir
for impl_bin in *.sh; do
impl=$(echo $impl_bin | sed 's/\(.*\).sh/\1/')
unregister-common-lisp-implementation $impl
register-common-lisp-implementation $impl
done
cd - >/dev/null
[[ $opt = *off ]] && shopt -u nullglob
}
# BIG FAT HACK: Since the Portage emerge step kills file timestamp
# information, we need to compensate by ensuring all FASL files are
# more recent than their source files.
# The following `impl-*-timestamp-hack' functions SHOULD NOT be used
# outside of this eclass.
impl-save-timestamp-hack() {
local impl=$1
dodir /usr/share/${impl}
tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
}
impl-restore-timestamp-hack() {
local impl=$1
tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
}
impl-remove-timestamp-hack() {
local impl=$1
rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
}
test-in() {
local symbol=$1
shift
for i in $@; do
if [ $i == ${symbol} ]; then
return 0 # true
fi
done
false
}
standard-impl-postinst() {
local impl=$1
rm -rf /usr/$(get_libdir)/common-lisp/${impl}/* &>/dev/null || true
chown cl-builder:cl-builder /usr/$(get_libdir)/common-lisp/${impl}
if test-in ${impl} cmucl sbcl; then
impl-restore-timestamp-hack ${impl}
fi
chown -R root:0 /usr/$(get_libdir)/${impl}
/usr/bin/clc-autobuild-impl ${impl} yes
register-common-lisp-implementation ${impl}
}
standard-impl-postrm() {
local impl=$1 impl_binary=$2
# Since we keep our own time stamps we must manually remove them
# here.
if [ ! -x ${impl_binary} ]; then
if test-in ${impl} cmucl sbcl; then
impl-remove-timestamp-hack ${impl}
fi
rm -rf /usr/$(get_libdir)/common-lisp/${impl}/*
fi
}
# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***

View File

@ -0,0 +1,78 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp.eclass,v 1.13 2005/07/11 15:08:06 swegener Exp $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# This eclass supports the common-lisp-controller installation of many
# Common Lisp libraries
inherit common-lisp-common
CLPACKAGE=
DEPEND="dev-lisp/common-lisp-controller"
EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
common-lisp_pkg_postinst() {
if [ -z "${CLPACKAGE}" ]; then
die "CLPACKAGE was empty or undefined upon call to pkg_prerm"
else
for package in ${CLPACKAGE}; do
einfo "Registering Common Lisp source for ${package}"
register-common-lisp-source ${package}
done
fi
}
common-lisp_pkg_postrm() {
if [ -z "${CLPACKAGE}" ]; then
die "CLPACKAGE was empty or undefined upon call to pkg_prerm"
else
for package in ${CLPACKAGE}; do
if [ ! -d ${CLSOURCEROOT}/${package} ]; then
einfo "Unregistering Common Lisp source for ${package}"
# rm -rf ${CLFASLROOT}/*/${package}
unregister-common-lisp-source ${package}
fi
done
fi
}
#
# In pkg_preinst, we remove the FASL files for the previous version of
# the source.
#
common-lisp_pkg_preinst() {
if [ -z "${CLPACKAGE}" ]; then
die "CLPACKAGE was empty or undefined upon call to pkg_preinst"
else
for package in ${CLPACKAGE}; do
einfo "Removing FASL files for previous version of Common Lisp package ${package}"
rm -rf ${CLFASLROOT}/*/${package} || true
done
fi
}
common-lisp-install() {
insinto ${CLSOURCEROOT}/${CLPACKAGE}
doins $@
}
common-lisp-system-symlink() {
dodir ${CLSYSTEMROOT}/`dirname ${CLPACKAGE}`
if [ $# -eq 0 ]; then
dosym ${CLSOURCEROOT}/${CLPACKAGE}/${CLPACKAGE}.asd \
${CLSYSTEMROOT}/${CLPACKAGE}.asd
else
for package in "$@" ; do
dosym ${CLSOURCEROOT}/$CLPACKAGE/${package}.asd \
${CLSYSTEMROOT}/${package}.asd
done
fi
}
# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***

View File

@ -0,0 +1,480 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.22 2008/02/27 09:53:04 hollow Exp $
# @ECLASS: confutils.eclass
# @MAINTAINER:
# Benedikt Böhm <hollow@gentoo.org>
# @BLURB: utility functions to help with configuring a package
# @DESCRIPTION:
# The confutils eclass contains functions to handle use flag dependencies and
# extended --with-*/--enable-* magic.
#
# Based on the PHP5 eclass by Stuart Herbert <stuart@stuartherbert.com>
inherit eutils
DESCRIPTION="Based on the ${ECLASS} eclass"
# @VARIABLE: EBUILD_SUPPORTS_SHAREDEXT
# @DESCRIPTION:
# Set this variable to 1 if your ebuild supports shared extensions. You need to
# call confutils_init() in pkg_setup() if you use this variable.
if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then
IUSE="sharedext"
fi
# @FUNCTION: confutils_init
# @USAGE: [value]
# @DESCRIPTION:
# Call this function from your pkg_setup() function to initialize this eclass
# if EBUILD_SUPPORTS_SHAREDEXT is enabled. If no value is given `shared' is used
# by default.
confutils_init() {
if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext; then
shared="=${1:-shared}"
else
shared=
fi
}
# @FUNCTION: confutils_require_one
# @USAGE: <flag> [more flags ...]
# @DESCRIPTION:
# Use this function to ensure exactly one of the specified USE flags have been
# enabled
confutils_require_one() {
local required_flags="$@"
local success=0
for flag in ${required_flags}; do
use ${flag} && ((success++))
done
[[ ${success} -eq 1 ]] && return
echo
eerror "You *must* enable *exactly* one of the following USE flags:"
eerror " ${required_flags}"
eerror
eerror "You can do this by enabling *one* of these flag in /etc/portage/package.use:"
set -- ${required_flags}
eerror " =${CATEGORY}/${PN}-${PVR} ${1}"
shift
for flag in $@; do
eerror " OR =${CATEGORY}/${PN}-${PVR} ${flag}"
done
echo
die "Missing or conflicting USE flags"
}
# @FUNCTION: confutils_require_any
# @USAGE: <flag> [more flags ...]
# @DESCRIPTION:
# Use this function to ensure one or more of the specified USE flags have been
# enabled
confutils_require_any() {
local required_flags="$@"
local success=0
for flag in ${required_flags}; do
use ${flag} && success=1
done
[[ ${success} -eq 1 ]] && return
echo
eerror "You *must* enable one or more of the following USE flags:"
eerror " ${required_flags}"
eerror
eerror "You can do this by enabling these flags in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} ${required_flags}"
echo
die "Missing USE flags"
}
# @FUNCTION: confutils_require_built_with_all
# @USAGE: <foreign> <flag> [more flags ...]
# @DESCRIPTION:
# Use this function to ensure all of the specified USE flags have been enabled
# in the specified foreign package
confutils_require_built_with_all() {
local foreign=$1 && shift
local required_flags="$@"
built_with_use ${foreign} ${required_flags} && return
echo
eerror "You *must* enable all of the following USE flags in ${foreign}:"
eerror " ${required_flags}"
eerror
eerror "You can do this by enabling these flags in /etc/portage/package.use:"
eerror " ${foreign} ${required_flags}"
echo
die "Missing USE flags in ${foreign}"
}
# @FUNCTION: confutils_require_built_with_any
# @USAGE: <foreign> <flag> [more flags ...]
# @DESCRIPTION:
# Use this function to ensure one or more of the specified USE flags have been
# enabled in the specified foreign package
confutils_require_built_with_any() {
local foreign=$1 && shift
local required_flags="$@"
local success=0
for flag in ${required_flags}; do
built_with_use ${foreign} ${flag} && success=1
done
[[ ${success} -eq 1 ]] && return
echo
eerror "You *must* enable one or more of the following USE flags in ${foreign}:"
eerror " ${required_flags}"
eerror
eerror "You can do this by enabling these flags in /etc/portage/package.use:"
eerror " ${foreign} ${required_flags}"
echo
die "Missing USE flags in ${foreign}"
}
# @FUNCTION: confutils_use_conflict
# @USAGE: <enabled flag> <conflicting flag> [more conflicting flags ...]
# @DESCRIPTION:
# Use this function to automatically complain to the user if conflicting USE
# flags have been enabled
confutils_use_conflict() {
use $1 || return
local my_flag="$1" && shift
local my_present=
local my_remove=
for flag in "$@"; do
if use ${flag}; then
my_present="${my_present} ${flag}"
my_remove="${my_remove} -${flag}"
fi
done
[[ -z "${my_present}" ]] && return
echo
eerror "USE flag '${my_flag}' conflicts with these USE flag(s):"
eerror " ${my_present}"
eerror
eerror "You must disable these conflicting flags before you can emerge this package."
eerror "You can do this by disabling these flags in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} ${my_remove}"
eerror
eerror "You could disable this flag instead in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
echo
die "Conflicting USE flags"
}
# @FUNCTION: confutils_use_depend_all
# @USAGE: <enabled flag> <needed flag> [more needed flags ...]
# @DESCRIPTION:
# Use this function to automatically complain to the user if a USE flag depends
# on another USE flag that hasn't been enabled
confutils_use_depend_all() {
use $1 || return
local my_flag="$1" && shift
local my_missing=
for flag in "$@"; do
use ${flag} || my_missing="${my_missing} ${flag}"
done
[[ -z "${my_missing}" ]] && return
echo
eerror "USE flag '${my_flag}' needs these additional flag(s) set:"
eerror " ${my_missing}"
eerror
eerror "You can do this by enabling these flags in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} ${my_missing}"
eerror
eerror "You could disable this flag instead in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
echo
die "Need missing USE flags"
}
# @FUNCTION: confutils_use_depend_any
# @USAGE: <enabled flag> <needed flag> [more needed flags ...]
# @DESCRIPTION:
# Use this function to automatically complain to the user if a USE flag depends
# on another USE flag that hasn't been enabled
confutils_use_depend_any() {
use $1 || return
local my_flag="$1" && shift
local my_found=
local my_missing=
for flag in "$@"; do
if use ${flag}; then
my_found="${my_found} ${flag}"
else
my_missing="${my_missing} ${flag}"
fi
done
[[ -n "${my_found}" ]] && return
echo
eerror "USE flag '${my_flag}' needs one or more of these additional flag(s) set:"
eerror " ${my_missing}"
eerror
eerror "You can do this by enabling one of these flags in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} ${my_missing}"
eerror
eerror "You could disable this flag instead in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
echo
die "Need missing USE flag(s)"
}
# @FUNCTION: confutils_use_depend_built_with_all
# @USAGE: <enabled flag> <foreign> <needed flag> [more needed flags ...]
# @DESCRIPTION:
# Use this function to automatically complain to the user if a USE flag depends
# on a USE flag in another package that hasn't been enabled
confutils_use_depend_built_with_all() {
use $1 || return
local my_flag="$1" && shift
local foreign=$1 && shift
local required_flags="$@"
built_with_use ${foreign} ${required_flags} && return
echo
eerror "USE flag '${my_flag}' needs the following USE flags in ${foreign}:"
eerror " ${required_flags}"
eerror
eerror "You can do this by enabling these flags in /etc/portage/package.use:"
eerror " ${foreign} ${required_flags}"
eerror
eerror "You could disable this flag instead in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
echo
die "Missing USE flags in ${foreign}"
}
# @FUNCTION: confutils_use_depend_built_with_any
# @USAGE: <enabled flag> <foreign> <needed flag> [more needed flags ...]
# @DESCRIPTION:
# Use this function to automatically complain to the user if a USE flag depends
# on a USE flag in another package that hasn't been enabled
confutils_use_depend_built_with_any() {
use $1 || return
local my_flag="$1" && shift
local foreign=$1 && shift
local required_flags="$@"
local success=0
for flag in ${required_flags}; do
built_with_use ${foreign} ${flag} && success=1
done
[[ ${success} -eq 1 ]] && return
echo
eerror "USE flag '${my_flag}' needs one or more of the following USE flags in ${foreign}:"
eerror " ${required_flags}"
eerror
eerror "You can do this by enabling these flags in /etc/portage/package.use:"
eerror " ${foreign} ${required_flags}"
eerror
eerror "You could disable this flag instead in /etc/portage/package.use:"
eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
echo
die "Missing USE flags in ${foreign}"
}
# internal function constructs the configure values for optional shared module
# support and extra arguments
_confutils_shared_suffix() {
local my_shared=
if [[ "$1" == "1" ]]; then
if [[ -n "${shared}" ]]; then
my_shared="${shared}"
if [[ -n "$2" ]]; then
my_shared="${my_shared},$2"
fi
elif [[ -n "$2" ]]; then
my_shared="=$2"
fi
else
if [[ -n "$2" ]]; then
my_shared="=$2"
fi
fi
echo "${my_shared}"
}
# @FUNCTION: enable_extension_disable
# @USAGE: <extension> <flag> [msg]
# @DESCRIPTION:
# Use this function to disable an extension that is enabled by default. This is
# provided for those rare configure scripts that don't support a --enable for
# the corresponding --disable.
enable_extension_disable() {
local my_msg=${3:-$1}
if use "$2" ; then
einfo " Enabling ${my_msg}"
else
my_conf="${my_conf} --disable-$1"
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_enable
# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
# @DESCRIPTION:
# This function is like use_enable(), except that it knows about enabling
# modules as shared libraries, and it supports passing additional data with the
# switch.
enable_extension_enable() {
local my_shared=$(_confutils_shared_suffix $3 $4)
local my_msg=${5:-$1}
if use $2; then
my_conf="${my_conf} --enable-${1}${my_shared}"
einfo " Enabling ${my_msg}"
else
my_conf="${my_conf} --disable-$1"
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_enableonly
# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
# @DESCRIPTION:
# This function is like use_enable(), except that it knows about enabling
# modules as shared libraries, and it supports passing additional data with the
# switch. This function is provided for those rare configure scripts that support
# --enable but not the corresponding --disable.
enable_extension_enableonly() {
local my_shared=$(_confutils_shared_suffix $3 $4)
local my_msg=${5:-$1}
if use $2 ; then
my_conf="${my_conf} --enable-${1}${my_shared}"
einfo " Enabling ${my_msg}"
else
# note: we deliberately do *not* use a --disable switch here
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_without
# @USAGE: <extension> <flag> [msg]
# @DESCRIPTION:
# Use this function to disable an extension that is enabled by default. This
# function is provided for those rare configure scripts that support --without
# but not the corresponding --with
enable_extension_without() {
local my_msg=${3:-$1}
if use "$2"; then
einfo " Enabling ${my_msg}"
else
my_conf="${my_conf} --without-$1"
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_with
# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
# @DESCRIPTION:
# This function is like use_with(), except that it knows about enabling modules
# as shared libraries, and it supports passing additional data with the switch.
enable_extension_with() {
local my_shared=$(_confutils_shared_suffix $3 $4)
local my_msg=${5:-$1}
if use $2; then
my_conf="${my_conf} --with-${1}${my_shared}"
einfo " Enabling ${my_msg}"
else
my_conf="${my_conf} --without-$1"
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_withonly
# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
# @DESCRIPTION:
# This function is like use_with(), except that it knows about enabling modules
# as shared libraries, and it supports passing additional data with the switch.
# This function is provided for those rare configure scripts that support --enable
# but not the corresponding --disable.
enable_extension_withonly() {
local my_shared=$(_confutils_shared_suffix $3 $4)
local my_msg=${5:-$1}
if use $2; then
my_conf="${my_conf} --with-${1}${my_shared}"
einfo " Enabling ${my_msg}"
else
# note: we deliberately do *not* use a --without switch here
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_enable_built_with
# @USAGE: <foreign> <flag> <extension> [shared] [extra conf] [msg]
# @DESCRIPTION:
# This function is like enable_extension_enable(), except that it
# enables/disables modules based on a USE flag in a foreign package.
enable_extension_enable_built_with() {
local my_shared=$(_confutils_shared_suffix $4 $5)
local my_msg=${6:-$3}
if built_with_use $1 $2; then
my_conf="${my_conf} --enable-${3}${my_shared}"
einfo " Enabling ${my_msg}"
else
my_conf="${my_conf} --disable-$3"
einfo " Disabling ${my_msg}"
fi
}
# @FUNCTION: enable_extension_with_built_with ()
# @USAGE: <foreign> <flag> <extension> [shared] [extra conf] [msg]
# @DESCRIPTION:
# This function is like enable_extension_with(), except that it
# enables/disables modules based on a USE flag in a foreign package.
enable_extension_with_built_with() {
# legacy workaround
if [[ "$4" != "0" && "$4" != "1" ]]; then
enable_extension_with_built_with "$1" "$2" "$3" 0 "$4" "$5"
return
fi
local my_shared=$(_confutils_shared_suffix $4 $5)
local my_msg=${6:-$3}
if built_with_use $1 $2; then
my_conf="${my_conf} --with-${3}${my_shared}"
einfo " Enabling ${my_msg}"
else
my_conf="${my_conf} --disable-$3"
einfo " Disabling ${my_msg}"
fi
}

View File

@ -0,0 +1,162 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/cron.eclass,v 1.12 2008/06/26 10:51:41 bangert Exp $
# @ECLASS: cron
# @MAINTAINER:
# cron-bugs@gentoo.org
#
# Original Author: Aaron Walker <ka0ttic@gentoo.org>
# @BLURB: Some functions for cron
# @DESCRIPTION:
# Purpose: The main motivation for this eclass was to simplify
# the jungle known as src_install() in cron ebuilds. Using these
# functions also ensures that permissions are *always* reset,
# preventing the accidental installation of files with wrong perms.
#
# NOTE on defaults: the default settings in the below functions were
# chosen based on the most common setting among cron ebuilds.
#
# Please assign any bugs regarding this eclass to cron-bugs@gentoo.org.
inherit eutils flag-o-matic
EXPORT_FUNCTIONS pkg_postinst
SLOT="0"
DEPEND=">=sys-apps/sed-4.0.5"
RDEPEND="!virtual/cron
virtual/mta
>=sys-process/cronbase-0.3.2"
PROVIDE="virtual/cron"
# @FUNCTION: docrondir
# @USAGE: [ dir ] [ perms ]
# @DESCRIPTION:
# Creates crontab directory
#
# Both arguments are optional. Everything after 'dir' is considered
# the permissions (same format as insopts).
#
# ex: docrondir /some/dir -m 0770 -o root -g cron
# docrondir /some/dir (uses default perms)
# docrondir -m0700 (uses default dir)
docrondir() {
# defaults
local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs"
if [[ -n $1 ]] ; then
case "$1" in
*/*)
dir=$1
shift
[[ -n $1 ]] && perms="$@"
;;
*)
perms="$@"
;;
esac
fi
diropts ${perms}
keepdir ${dir}
# reset perms to default
diropts -m0755
}
# @FUNCTION: docron
# @USAGE: [ exe ] [ perms ]
# @DESCRIPTION:
# Install cron executable
#
# Both arguments are optional.
#
# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron")
# docron crond -m 0110
docron() {
local cron="cron" perms="-m 0750 -o root -g wheel"
if [[ -n $1 ]] ; then
case "$1" in
-*)
perms="$@"
;;
*)
cron=$1
shift
[[ -n $1 ]] && perms="$@"
;;
esac
fi
exeopts ${perms}
exeinto /usr/sbin
doexe ${cron} || die "failed to install ${cron}"
# reset perms to default
exeopts -m0755
}
# @FUNCTION: docrontab
# @USAGE: [ exe ] [ perms ]
# @DESCRIPTION:
# Install crontab executable
#
# Uses same semantics as docron.
docrontab() {
local crontab="crontab" perms="-m 4750 -o root -g cron"
if [[ -n $1 ]] ; then
case "$1" in
-*)
perms="$@"
;;
*)
crontab=$1
shift
[[ -n $1 ]] && perms="$@"
;;
esac
fi
exeopts ${perms}
exeinto /usr/bin
doexe ${crontab} || die "failed to install ${crontab}"
# reset perms to default
exeopts -m0755
# users expect /usr/bin/crontab to exist...
if [[ "${crontab##*/}" != "crontab" ]] ; then
dosym ${crontab##*/} /usr/bin/crontab || \
die "failed to create /usr/bin/crontab symlink"
fi
}
# @FUNCTION: cron_pkg_postinst
# @DESCRIPTION:
# Outputs a message about system crontabs
# daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes"
cron_pkg_postinst() {
echo
# daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes"
if [ "${CRON_SYSTEM_CRONTAB:-no}" != "yes" ] ; then
einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:"
einfo " crontab /etc/crontab"
einfo
einfo "!!! That will replace root's current crontab !!!"
einfo
fi
einfo "You may wish to read the Gentoo Linux Cron Guide, which can be"
einfo "found online at:"
einfo " http://www.gentoo.org/doc/en/cron-guide.xml"
echo
}

View File

@ -0,0 +1,566 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.70 2008/04/27 07:00:40 ulm Exp $
# @ECLASS: cvs.eclass
# @MAINTAINER:
# vapier@gentoo.org (and anyone who wants to help)
# @BLURB: This eclass provides generic cvs fetching functions
# @DESCRIPTION:
# This eclass provides the generic cvs fetching functions. To use this from an
# ebuild, set the ECLASS VARIABLES as specified below in your ebuild before
# inheriting. Then either leave the default src_unpack or extend over
# cvs_src_unpack. If you find that you need to call the cvs_* functions
# directly, I'd be interested to hear about it.
inherit eutils
# TODO:
# Implement more auth types (gserver?, kserver?)
# Support additional remote shells with `ext' authentication (does
# anyone actually need to use it with anything other than SSH?)
# Users shouldn't change these settings! The ebuild/eclass inheriting
# this eclass will take care of that. If you want to set the global
# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
# @ECLASS-VARIABLE: ECVS_CVS_COMMAND
# @DESCRIPTION:
# CVS command to run
#
# You can set, for example, "cvs -t" for extensive debug information
# on the cvs connection. The default of "cvs -q -f -z4" means to be
# quiet, to disregard the ~/.cvsrc config file and to use maximum
# compression.
# @ECLASS-VARIABLE: ECVS_CVS_COMPRESS
# @DESCRIPTION:
# Set the compression level.
[[ -z ${ECVS_CVS_COMPRESS} ]] && ECVS_CVS_COMPRESS="-z1"
# @ECLASS-VARIABLE: ECVS_CVS_OPTIONS
# @DESCRIPTION:
# Additional options to the cvs commands.
[[ -z ${ECVS_CVS_OPTIONS} ]] && ECVS_CVS_OPTIONS="-q -f"
# @ECLASS-VARIABLE: ECVS_CVS_COMMAND
# @DESCRIPTION:
# The cvs command.
[[ -z ${ECVS_CVS_COMMAND} ]] && ECVS_CVS_COMMAND="cvs ${ECVS_CVS_OPTIONS} ${ECVS_CVS_COMPRESS}"
# @ECLASS-VARIABLE: ECVS_UP_OPTS
# @DESCRIPTION:
# CVS options given after the cvs update command. Don't remove "-dP" or things
# won't work.
[ -z "$ECVS_UP_OPTS" ] && ECVS_UP_OPTS="-dP"
# @ECLASS-VARIABLE: ECVS_CO_OPTS
# @DESCRIPTION:
# CVS options given after the cvs checkout command.
[ -z "$ECVS_CO_OPTS" ] && ECVS_CO_OPTS=""
# @ECLASS-VARIABLE: ECVS_LOCAL
# @DESCRIPTION:
# If this is set, the CVS module will be fetched non-recursively.
# Refer to the information in the CVS man page regarding the -l
# command option (not the -l global option).
# @ECLASS-VARIABLE: ECVS_LOCALNAME
# @DESCRIPTION:
# Local name of checkout directory
#
# This is useful if the module on the server is called something
# common like 'driver' or is nested deep in a tree, and you don't like
# useless empty directories.
#
# WARNING: Set this only from within ebuilds! If set in your shell or
# some such, things will break because the ebuild won't expect it and
# have e.g. a wrong $S setting.
# @ECLASS-VARIABLE: ECVS_TOP_DIR
# @DESCRIPTION:
# The directory under which CVS modules are checked out.
[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src"
# @ECLASS-VARIABLE: ECVS_SERVER
# @DESCRIPTION:
# CVS path
#
# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde".
# Remove the other parts of the full CVSROOT, which might look like
# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated
# using other settings also.
#
# Set this to "offline" to disable fetching (i.e. to assume the module
# is already checked out in ECVS_TOP_DIR).
[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline"
# @ECLASS-VARIABLE: ECVS_MODULE
# @DESCRIPTION:
# The name of the CVS module to be fetched
#
# This must be set when cvs_src_unpack is called. This can include
# several directory levels, i.e. "foo/bar/baz"
#[ -z "$ECVS_MODULE" ] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue"
# @ECLASS-VARIABLE: ECVS_BRANCH
# @DESCRIPTION:
# The name of the branch/tag to use
#
# The default is "HEAD". The following default _will_ reset your
# branch checkout to head if used.
#[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD"
# @ECLASS-VARIABLE: ECVS_AUTH
# @DESCRIPTION:
# Authentication method to use
#
# Possible values are "pserver" and "ext". If `ext' authentication is
# used, the remote shell to use can be specified in CVS_RSH (SSH is
# used by default). Currently, the only supported remote shell for
# `ext' authentication is SSH.
#
# Armando Di Cianno <fafhrd@gentoo.org> 2004/09/27
# - Added "no" as a server type, which uses no AUTH method, nor
# does it login
# e.g.
# "cvs -danoncvs@savannah.gnu.org:/cvsroot/backbone co System"
# ( from gnustep-apps/textedit )
[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver"
# @ECLASS-VARIABLE: ECVS_USER
# @DESCRIPTION:
# Username to use for authentication on the remote server.
[ -z "$ECVS_USER" ] && ECVS_USER="anonymous"
# @ECLASS-VARIABLE: ECVS_PASS
# @DESCRIPTION:
# Password to use for authentication on the remote server
[ -z "$ECVS_PASS" ] && ECVS_PASS=""
# @ECLASS-VARIABLE: ECVS_SSH_HOST_KEY
# @DESCRIPTION:
# If SSH is used for `ext' authentication, use this variable to
# specify the host key of the remote server. The format of the value
# should be the same format that is used for the SSH known hosts file.
#
# WARNING: If a SSH host key is not specified using this variable, the
# remote host key will not be verified.
# @ECLASS-VARIABLE: ECVS_CLEAN
# @DESCRIPTION:
# Set this to get a clean copy when updating (passes the
# -C option to cvs update)
# @ECLASS-VARIABLE: ECVS_RUNAS
# @DESCRIPTION:
# Specifies an alternate (non-root) user to use to run cvs. Currently
# b0rked and wouldn't work with portage userpriv anyway without
# special magic.
# [ -z "$ECVS_RUNAS" ] && ECVS_RUNAS="`whoami`"
# ECVS_SUBDIR -- deprecated, do not use
[ -n "$ECVS_SUBDIR" ] && die "ERROR: deprecated ECVS_SUBDIR defined. Please fix this ebuild."
# add cvs to deps
# ssh is used for ext auth
# sudo is used to run as a specified user
DEPEND="dev-util/cvs"
[ -n "$ECVS_RUNAS" ] && DEPEND="$DEPEND app-admin/sudo"
if [ "$ECVS_AUTH" == "ext" ]; then
#default to ssh
[ -z "$CVS_RSH" ] && export CVS_RSH="ssh"
if [ "$CVS_RSH" != "ssh" ]; then
die "Support for ext auth with clients other than ssh has not been implemented yet"
fi
DEPEND="${DEPEND} net-misc/openssh"
fi
# called from cvs_src_unpack
cvs_fetch() {
# Make these options local variables so that the global values are
# not affected by modifications in this function.
local ECVS_COMMAND="${ECVS_COMMAND}"
local ECVS_UP_OPTS="${ECVS_UP_OPTS}"
local ECVS_CO_OPTS="${ECVS_CO_OPTS}"
debug-print-function $FUNCNAME $*
# Update variables that are modified by ebuild parameters, which
# should be effective every time cvs_fetch is called, and not just
# every time cvs.eclass is inherited
# Handle parameter for local (non-recursive) fetching
if [ -n "$ECVS_LOCAL" ]; then
ECVS_UP_OPTS="$ECVS_UP_OPTS -l"
ECVS_CO_OPTS="$ECVS_CO_OPTS -l"
fi
# Handle ECVS_BRANCH option
#
# Because CVS auto-switches branches, we just have to pass the
# correct -rBRANCH option when updating.
if [ -n "$ECVS_BRANCH" ]; then
ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH"
ECVS_CO_OPTS="$ECVS_CO_OPTS -r$ECVS_BRANCH"
fi
# Handle ECVS_LOCALNAME, which specifies the local directory name
# to use. Note that the -d command option is not equivalent to
# the global -d option.
if [ "$ECVS_LOCALNAME" != "$ECVS_MODULE" ]; then
ECVS_CO_OPTS="$ECVS_CO_OPTS -d $ECVS_LOCALNAME"
fi
if [ -n "$ECVS_CLEAN" ]; then
ECVS_UP_OPTS="$ECVS_UP_OPTS -C"
fi
# It would be easiest to always be in "run-as mode", logic-wise,
# if sudo didn't ask for a password even when sudo'ing to `whoami`.
if [ -z "$ECVS_RUNAS" ]; then
run=""
else
run="sudo -u $ECVS_RUNAS"
fi
# Create the top dir if needed
if [ ! -d "$ECVS_TOP_DIR" ]; then
# Note that the addwrite statements in this block are only
# there to allow creating ECVS_TOP_DIR; we allow writing
# inside it separately.
# This is because it's simpler than trying to find out the
# parent path of the directory, which would need to be the
# real path and not a symlink for things to work (so we can't
# just remove the last path element in the string)
debug-print "$FUNCNAME: checkout mode. creating cvs directory"
addwrite /foobar
addwrite /
$run mkdir -p "/$ECVS_TOP_DIR"
export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
fi
# In case ECVS_TOP_DIR is a symlink to a dir, get the real path,
# otherwise addwrite() doesn't work.
cd -P "$ECVS_TOP_DIR" > /dev/null
ECVS_TOP_DIR="`/bin/pwd`"
# Disable the sandbox for this dir
addwrite "$ECVS_TOP_DIR"
# Chown the directory and all of its contents
if [ -n "$ECVS_RUNAS" ]; then
$run chown -R "$ECVS_RUNAS" "/$ECVS_TOP_DIR"
fi
# Determine the CVS command mode (checkout or update)
if [ ! -d "$ECVS_TOP_DIR/$ECVS_LOCALNAME/CVS" ]; then
mode=checkout
else
mode=update
fi
# Our server string (i.e. CVSROOT) without the password so it can
# be put in Root
if [ "$ECVS_AUTH" == "no" ]
then
local server="${ECVS_USER}@${ECVS_SERVER}"
else
local connection="${ECVS_AUTH}"
[[ -n ${ECVS_PROXY} ]] && connection="${connection};proxy=${ECVS_PROXY}"
[[ -n ${ECVS_PROXY_PORT} ]] && connection="${connection};proxyport=${ECVS_PROXY_PORT}"
local server=":${connection}:${ECVS_USER}@${ECVS_SERVER}"
fi
# Switch servers automagically if needed
if [ "$mode" == "update" ]; then
cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME
local oldserver="`$run cat CVS/Root`"
if [ "$server" != "$oldserver" ]; then
einfo "Changing the CVS server from $oldserver to $server:"
debug-print "$FUNCNAME: Changing the CVS server from $oldserver to $server:"
einfo "Searching for CVS directories ..."
local cvsdirs="`$run find . -iname CVS -print`"
debug-print "$FUNCNAME: CVS directories found:"
debug-print "$cvsdirs"
einfo "Modifying CVS directories ..."
for x in $cvsdirs; do
debug-print "In $x"
$run echo "$server" > "$x/Root"
done
fi
fi
# Prepare a cvspass file just for this session, we don't want to
# mess with ~/.cvspass
touch "${T}/cvspass"
export CVS_PASSFILE="${T}/cvspass"
if [ -n "$ECVS_RUNAS" ]; then
chown "$ECVS_RUNAS" "${T}/cvspass"
fi
# The server string with the password in it, for login
cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
# Ditto without the password, for checkout/update after login, so
# that the CVS/Root files don't contain the password in plaintext
if [ "$ECVS_AUTH" == "no" ]
then
cvsroot_nopass="${ECVS_USER}@${ECVS_SERVER}"
else
cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}"
fi
# Commands to run
cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login"
cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}"
cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}"
# Execute commands
cd "${ECVS_TOP_DIR}"
if [ "${ECVS_AUTH}" == "pserver" ]; then
einfo "Running $cmdlogin"
eval $cmdlogin || die "cvs login command failed"
if [ "${mode}" == "update" ]; then
einfo "Running $cmdupdate"
eval $cmdupdate || die "cvs update command failed"
elif [ "${mode}" == "checkout" ]; then
einfo "Running $cmdcheckout"
eval $cmdcheckout|| die "cvs checkout command failed"
fi
elif [ "${ECVS_AUTH}" == "ext" ] || [ "${ECVS_AUTH}" == "no" ]; then
# Hack to support SSH password authentication
# Backup environment variable values
local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}"
if [ "${SSH_ASKPASS+set}" == "set" ]; then
local CVS_ECLASS_ORIG_SSH_ASKPASS="${SSH_ASKPASS}"
else
unset CVS_ECLASS_ORIG_SSH_ASKPASS
fi
if [ "${DISPLAY+set}" == "set" ]; then
local CVS_ECLASS_ORIG_DISPLAY="${DISPLAY}"
else
unset CVS_ECLASS_ORIG_DISPLAY
fi
if [ "${CVS_RSH}" == "ssh" ]; then
# Force SSH to use SSH_ASKPASS by creating python wrapper
export CVS_RSH="${T}/cvs_sshwrapper"
cat > "${CVS_RSH}"<<EOF
#!/usr/bin/python
import fcntl
import os
import sys
try:
fd = os.open('/dev/tty', 2)
TIOCNOTTY=0x5422
try:
fcntl.ioctl(fd, TIOCNOTTY)
except:
pass
os.close(fd)
except:
pass
newarglist = sys.argv[:]
EOF
# disable X11 forwarding which causes .xauth access violations
# - 20041205 Armando Di Cianno <fafhrd@gentoo.org>
echo "newarglist.insert(1, '-oClearAllForwardings=yes')" \
>> "${CVS_RSH}"
echo "newarglist.insert(1, '-oForwardX11=no')" \
>> "${CVS_RSH}"
# Handle SSH host key checking
local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts"
echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \
>> "${CVS_RSH}"
if [ -z "${ECVS_SSH_HOST_KEY}" ]; then
ewarn "Warning: The SSH host key of the remote server will not be verified."
einfo "A temporary known hosts list will be used."
local CVS_ECLASS_STRICT_HOST_CHECKING="no"
touch "${CVS_ECLASS_KNOWN_HOSTS}"
else
local CVS_ECLASS_STRICT_HOST_CHECKING="yes"
echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}"
fi
echo -n "newarglist.insert(1, '-oStrictHostKeyChecking=" \
>> "${CVS_RSH}"
echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \
>> "${CVS_RSH}"
echo "os.execv('/usr/bin/ssh', newarglist)" \
>> "${CVS_RSH}"
chmod a+x "${CVS_RSH}"
# Make sure DISPLAY is set (SSH will not use SSH_ASKPASS
# if DISPLAY is not set)
[ -z "${DISPLAY}" ] && DISPLAY="DISPLAY"
export DISPLAY
# Create a dummy executable to echo $ECVS_PASS
export SSH_ASKPASS="${T}/cvs_sshechopass"
if [ "${ECVS_AUTH}" != "no" ]; then
echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \
> "${SSH_ASKPASS}"
else
echo -en "#!/bin/bash\nreturn\n" \
> "${SSH_ASKPASS}"
fi
chmod a+x "${SSH_ASKPASS}"
fi
if [ "${mode}" == "update" ]; then
einfo "Running $cmdupdate"
eval $cmdupdate || die "cvs update command failed"
elif [ "${mode}" == "checkout" ]; then
einfo "Running $cmdcheckout"
eval $cmdcheckout|| die "cvs checkout command failed"
fi
# Restore environment variable values
export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}"
if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then
export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}"
else
unset SSH_ASKPASS
fi
if [ "${CVS_ECLASS_ORIG_DISPLAY+set}" == "set" ]; then
export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}"
else
unset DISPLAY
fi
fi
# Restore ownership. Not sure why this is needed, but someone
# added it in the orig ECVS_RUNAS stuff.
if [ -n "$ECVS_RUNAS" ]; then
chown `whoami` "${T}/cvspass"
fi
}
# @FUNCTION: cvs_src_unpack
# @DESCRIPTION:
# The cvs src_unpack function, which will be exported
cvs_src_unpack() {
debug-print-function $FUNCNAME $*
debug-print "$FUNCNAME: init:
ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND
ECVS_UP_OPTS=$ECVS_UP_OPTS
ECVS_CO_OPTS=$ECVS_CO_OPTS
ECVS_TOP_DIR=$ECVS_TOP_DIR
ECVS_SERVER=$ECVS_SERVER
ECVS_USER=$ECVS_USER
ECVS_PASS=$ECVS_PASS
ECVS_MODULE=$ECVS_MODULE
ECVS_LOCAL=$ECVS_LOCAL
ECVS_RUNAS=$ECVS_RUNAS
ECVS_LOCALNAME=$ECVS_LOCALNAME"
[ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue."
local ECVS_LOCALNAME="${ECVS_LOCALNAME}"
if [ -z "$ECVS_LOCALNAME" ]; then
ECVS_LOCALNAME="$ECVS_MODULE"
fi
local sanitized_pn=$(echo "${PN}" | LC_ALL=C sed -e 's:[^A-Za-z0-9_]:_:g')
local offline_pkg_var="ECVS_OFFLINE_${sanitized_pn}"
if [ "${!offline_pkg_var}" == "1" -o "$ECVS_OFFLINE" == "1" -o "$ECVS_SERVER" == "offline" ]; then
# We're not required to fetch anything; the module already
# exists and shouldn't be updated.
if [ -d "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" ]; then
debug-print "$FUNCNAME: offline mode"
else
debug-print "$FUNCNAME: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error"
die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting."
fi
elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode
einfo "Fetching CVS module $ECVS_MODULE into $ECVS_TOP_DIR ..."
cvs_fetch
else # ECVS_SERVER not set
die "ERROR: CVS server not specified, cannot continue."
fi
einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR ..."
debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR ..."
# This is probably redundant, but best to make sure.
mkdir -p "$WORKDIR/$ECVS_LOCALNAME"
if [ -n "$ECVS_LOCAL" ]; then
cp -f "$ECVS_TOP_DIR/$ECVS_LOCALNAME"/* "$WORKDIR/$ECVS_LOCALNAME"
else
cp -Rf "$ECVS_TOP_DIR/$ECVS_LOCALNAME" "$WORKDIR/$ECVS_LOCALNAME/.."
fi
# If the directory is empty, remove it; empty directories cannot
# exist in cvs. This happens when, for example, kde-source
# requests module/doc/subdir which doesn't exist. Still create
# the empty directory in workdir though.
if [ "`ls -A \"${ECVS_TOP_DIR}/${ECVS_LOCALNAME}\"`" == "CVS" ]; then
debug-print "$FUNCNAME: removing empty CVS directory $ECVS_LOCALNAME"
rm -rf "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
fi
# Implement some of base_src_unpack's functionality; note however
# that base.eclass may not have been inherited!
if [ -n "$PATCHES" ]; then
debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching"
cd "$S"
epatch ${PATCHES}
# Make sure we don't try to apply patches more than once,
# since cvs_src_unpack is usually called several times from
# e.g. kde-source_src_unpack
export PATCHES=""
fi
einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
}
EXPORT_FUNCTIONS src_unpack

View File

@ -0,0 +1,158 @@
# Copyright 2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/darcs.eclass,v 1.7 2008/05/14 18:13:14 kolmodin Exp $
#
# darcs eclass author: Andres Loeh <kosmikus@gentoo.org>
# tla eclass author: <rphillips@gentoo.org>
# Original Author: Jeffrey Yasskin <jyasskin@mail.utexas.edu>
#
# Originally derived from the tla eclass, which is derived from the
# cvs eclass.
#
# This eclass provides the generic darcs fetching functions.
# to use from an ebuild, set the 'ebuild-configurable settings' below in your
# ebuild before inheriting. then either leave the default src_unpack or extend
# over darcs_src_unpack.
# Most of the time, you will define only $EDARCS_REPOSITORY in your
# ebuild.
# TODO: support for tags, ...
# Don't download anything other than the darcs repository
SRC_URI=""
# You shouldn't change these settings yourself! The ebuild/eclass inheriting
# this eclass will take care of that.
# --- begin ebuild-configurable settings
# darcs command to run
[ -z "$EDARCS_DARCS_CMD" ] && EDARCS_DARCS_CMD="darcs"
# darcs commands with command-specific options
[ -z "$EDARCS_GET_CMD" ] && EDARCS_GET_CMD="get --partial"
[ -z "$EDARCS_UPDATE_CMD" ] && EDARCS_UPDATE_CMD="pull"
# options to pass to both the "get" and "update" commands
[ -z "$EDARCS_OPTIONS" ] && EDARCS_OPTIONS="--set-scripts-executable"
# Where the darcs repositories are stored/accessed
[ -z "$EDARCS_TOP_DIR" ] && EDARCS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src"
# The URI to the repository.
[ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY=""
# EDARCS_CLEAN: set this to something to get a clean copy when updating
# (removes the working directory, then uses $EDARCS_GET_CMD to
# re-download it.)
# --- end ebuild-configurable settings ---
# add darcs to deps
DEPEND="dev-util/darcs"
# is called from darcs_src_unpack
darcs_fetch() {
# The local directory to store the repository (useful to ensure a
# unique local name); relative to EDARCS_TOP_DIR
[ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \
&& EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
&& EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
debug-print-function $FUNCNAME $*
if [ -n "$EDARCS_CLEAN" ]; then
rm -rf $EDARCS_TOP_DIR/$EDARCS_LOCALREPO
fi
# create the top dir if needed
if [ ! -d "$EDARCS_TOP_DIR" ]; then
# note that the addwrite statements in this block are only there to allow creating EDARCS_TOP_DIR;
# we've already allowed writing inside it
# this is because it's simpler than trying to find out the parent path of the directory, which
# would need to be the real path and not a symlink for things to work (so we can't just remove
# the last path element in the string)
debug-print "$FUNCNAME: checkout mode. creating darcs directory"
addwrite /foobar
addwrite /
mkdir -p "$EDARCS_TOP_DIR"
export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
fi
# in case EDARCS_DARCS_DIR is a symlink to a dir, get the real
# dir's path, otherwise addwrite() doesn't work.
pushd .
cd -P "$EDARCS_TOP_DIR" > /dev/null
EDARCS_TOP_DIR="`/bin/pwd`"
# disable the sandbox for this dir
addwrite "$EDARCS_TOP_DIR"
# determine checkout or update mode and change to the right directory.
if [ ! -d "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO/_darcs" ]; then
mode=get
cd "$EDARCS_TOP_DIR"
else
mode=update
cd "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"
fi
# commands to run
local cmdget="${EDARCS_DARCS_CMD} ${EDARCS_GET_CMD} ${EDARCS_OPTIONS} --repo-name=${EDARCS_LOCALREPO} ${EDARCS_REPOSITORY}"
local cmdupdate="${EDARCS_DARCS_CMD} ${EDARCS_UPDATE_CMD} --all ${EDARCS_OPTIONS} ${EDARCS_REPOSITORY}"
if [ "${mode}" == "get" ]; then
einfo "Running $cmdget"
eval $cmdget || die "darcs get command failed"
elif [ "${mode}" == "update" ]; then
einfo "Running $cmdupdate"
eval $cmdupdate || die "darcs update command failed"
fi
popd
}
darcs_src_unpack() {
# The local directory to store the repository (useful to ensure a
# unique local name); relative to EDARCS_TOP_DIR
[ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \
&& EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
&& EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
local EDARCS_SHOPT
debug-print-function $FUNCNAME $*
debug-print "$FUNCNAME: init:
EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD
EDARCS_GET_CMD=$EDARCS_GET_CMD
EDARCS_UPDATE_CMD=$EDARCS_UPDATE_CMD
EDARCS_OPTIONS=$EDARCS_OPTIONS
EDARCS_TOP_DIR=$EDARCS_TOP_DIR
EDARCS_REPOSITORY=$EDARCS_REPOSITORY
EDARCS_LOCALREPO=$EDARCS_LOCALREPO
EDARCS_CLEAN=$EDARCS_CLEAN"
einfo "Fetching darcs repository $EDARCS_REPOSITORY into $EDARCS_TOP_DIR..."
darcs_fetch
einfo "Copying $EDARCS_LOCALREPO from $EDARCS_TOP_DIR..."
debug-print "Copying $EDARCS_LOCALREPO from $EDARCS_TOP_DIR..."
# probably redundant, but best to make sure
# Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside.
mkdir -p "${WORKDIR}/${P}"
EDARCS_SHOPT=$(shopt -p dotglob)
shopt -s dotglob # get any dotfiles too.
rsync -rlpgo --exclude="_darcs/" "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}"
eval ${EDARCS_SHOPT} # reset shopt
einfo "Darcs repository contents are now in ${WORKDIR}/${P}"
}
EXPORT_FUNCTIONS src_unpack

View File

@ -0,0 +1,109 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/db-use.eclass,v 1.8 2009/11/24 05:24:20 robbat2 Exp $
# This is a common location for functions that aid the use of sys-libs/db
#
# Bugs: pauldv@gentoo.org
inherit versionator multilib
#Convert a version to a db slot
db_ver_to_slot() {
if [ $# -ne 1 ]; then
eerror "Function db_ver_to_slot needs one argument" >&2
eerror "args given:" >&2
for f in $@
do
eerror " - \"$@\"" >&2
done
return 1
fi
echo -n "${1/.0/}"
}
#Find the version that correspond to the given atom
db_findver() {
if [ $# -ne 1 ]; then
eerror "Function db_findver needs one argument" >&2
eerror "args given:" >&2
for f in $@
do
eerror " - \"$@\"" >&2
done
return 1
fi
PKG="$(best_version $1)"
VER="$(get_version_component_range 1-2 "${PKG/*db-/}")"
if [ -d /usr/include/db$(db_ver_to_slot "$VER") ]; then
#einfo "Found db version ${VER}" >&2
echo -n "$VER"
return 0
else
return 1
fi
}
# Get the include dir for berkeley db.
# This function has two modes. Without any arguments it will give the best
# version available. With arguments that form the versions of db packages
# to test for, it will aim to find the library corresponding to it.
db_includedir() {
if [ $# -eq 0 ]; then
VER="$(db_findver sys-libs/db)" || return 1
VER="$(db_ver_to_slot "$VER")"
echo "include version ${VER}" >&2
if [ -d "/usr/include/db${VER}" ]; then
echo -n "/usr/include/db${VER}"
return 0
else
eerror "sys-libs/db package requested, but headers not found" >&2
return 1
fi
else
#arguments given
for x in $@
do
if VER=$(db_findver "=sys-libs/db-${x}*") &&
[ -d "/usr/include/db$(db_ver_to_slot $VER)" ]; then
echo -n "/usr/include/db$(db_ver_to_slot $VER)"
return 0
fi
done
eerror "No suitable db version found"
return 1
fi
}
# Get the library name for berkeley db. Something like "db-4.2" will be the
# outcome. This function has two modes. Without any arguments it will give
# the best version available. With arguments that form the versions of db
# packages to test for, it will aim to find the library corresponding to it.
db_libname() {
if [ $# -eq 0 ]; then
VER="$(db_findver sys-libs/db)" || return 1
if [ -e "/usr/$(get_libdir)/libdb-${VER}.so" ]; then
echo -n "db-${VER}"
return 0
else
eerror "sys-libs/db package requested, but library not found" >&2
return 1
fi
else
#arguments given
for x in $@
do
if VER=$(db_findver "=sys-libs/db-${x}*"); then
if [ -e "/usr/$(get_libdir)/libdb-${VER}.so" ]; then
echo -n "db-${VER}"
return 0
fi
fi
done
eerror "No suitable db version found" >&2
return 1
fi
}

View File

@ -0,0 +1,130 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/db.eclass,v 1.31 2009/07/29 20:25:25 pauldv Exp $
# This is a common location for functions used in the sys-libs/db ebuilds
#
# Bugs: pauldv@gentoo.org
IUSE="doc test"
EXPORT_FUNCTIONS src_test
DEPEND="test? ( >=dev-lang/tcl-8.4 )"
RDEPEND=""
db_fix_so () {
LIB="${ROOT}/usr/$(get_libdir)"
cd $LIB
# first clean up old symlinks
find ${LIB} -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
find ${LIB} -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
find ${LIB} -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
# now rebuild all the correct ones
for ext in so a; do
for name in libdb libdb_cxx libdb_tcl libdb_java; do
target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -n |tail -n 1`
[ -n "${target}" ] && ln -sf ${target//.\//} ${name}.${ext}
done;
done;
# db[23] gets some extra-special stuff
if [ -f libdb1.so.2 ]; then
ln -sf libdb1.so.2 libdb.so.2
ln -sf libdb1.so.2 libdb1.so
ln -sf libdb1.so.2 libdb-1.so
fi
# what do we do if we ever get 3.3 ?
for i in libdb libdb_cxx libdb_tcl libdb_java; do
if [ -f $i-3.2.so ]; then
ln -sf $i-3.2.so $i-3.so
ln -sf $i-3.2.so $i.so.3
fi
done
# do the same for headers now
# but since there are only two of them, just overwrite them
cd ${ROOT}/usr/include
target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1`
if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
einfo "Creating db.h symlinks to ${target}"
ln -sf "${target}"/db.h .
ln -sf "${target}"/db_185.h .
elif [ ! -e "${target}/db.h" ]; then
if [ -n "${target}" ]; then
ewarn "Could not find ${target}/db.h"
elif [ -h db.h ]; then
einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
rm db.h db_185.h
fi
fi
}
db_src_install_doc() {
# not everybody wants this wad of documentation as it is primarily API docs
if use doc; then
dodir /usr/share/doc/${PF}/html
mv ${D}/usr/docs/* ${D}/usr/share/doc/${PF}/html/
rm -rf ${D}/usr/docs
else
rm -rf ${D}/usr/docs
fi
}
db_src_install_usrbinslot() {
# slot all program names to avoid overwriting
for fname in ${D}/usr/bin/db_*
do
mv ${fname} ${fname//\/db_/\/db${SLOT}_}
done
}
db_src_install_headerslot() {
# install all headers in a slotted location
dodir /usr/include/db${SLOT}
mv ${D}/usr/include/*.h ${D}/usr/include/db${SLOT}/
}
db_src_install_usrlibcleanup() {
LIB="${D}/usr/$(get_libdir)"
# Clean out the symlinks so that they will not be recorded in the
# contents (bug #60732)
if [ "${D}" = "" ]; then
die "Calling clean_links while \$D not defined"
fi
if [ -e ${LIB}/libdb.a ] && [ ! -e ${LIB}/libdb-${SLOT}.a ]; then
einfo "Moving libdb.a to a versioned name"
mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a"
fi
if [ -e ${LIB}/libdb_cxx.a ] && [ ! -e ${LIB}/libdb_cxx-${SLOT}.a ]; then
einfo "Moving libdb_cxx.a to a versioned name"
mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a"
fi
find ${LIB} -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
find ${LIB} -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
einfo "removing unversioned static archives"
find ${LIB} -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
rm -f ${D}/usr/include/db.h ${D}/usr/include/db_185.h ${LIB}/libdb.a ${LIB}/libdb_cxx.a
}
db_src_test() {
if useq tcl; then
einfo "Running sys-libs/db testsuite"
ewarn "This can take 6+ hours on modern machines"
cd ${S}
echo 'source ../test/test.tcl' >testrunner.tcl
echo 'run_std' >>testrunner.tcl
tclsh testrunner.tcl
egrep -qs '^FAIL' ALL.OUT && die "Some tests failed, please see ${S}/ALL.OUT"
else
eerror "You must have USE=tcl to run the sys-libs/db testsuite."
fi
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/db4-fix.eclass,v 1.7 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,300 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.45 2009/05/26 16:41:56 arfrever Exp $
# @ECLASS: depend.apache.eclass
# @MAINTAINER:
# apache-devs@gentoo.org
# @BLURB: Functions to allow ebuilds to depend on apache
# @DESCRIPTION:
# This eclass handles depending on apache in a sane way and provides information
# about where certain binaries and configuration files are located.
#
# To make use of this eclass simply call one of the need/want_apache functions
# described below. Make sure you use the need/want_apache call after you have
# defined DEPEND and RDEPEND. Also note that you can not rely on the automatic
# RDEPEND=DEPEND that portage does if you use this eclass.
#
# See Bug 107127 for more information.
#
# @EXAMPLE:
#
# Here is an example of an ebuild depending on apache:
#
# @CODE
# DEPEND="virtual/Perl-CGI"
# RDEPEND="${DEPEND}"
# need_apache2
# @CODE
#
# Another example which demonstrates non-standard IUSE options for optional
# apache support:
#
# @CODE
# DEPEND="server? ( virtual/Perl-CGI )"
# RDEPEND="${DEPEND}"
# want_apache2 server
#
# pkg_setup() {
# depend.apache_pkg_setup server
# }
# @CODE
inherit multilib
# ==============================================================================
# INTERNAL VARIABLES
# ==============================================================================
# @ECLASS-VARIABLE: APACHE_VERSION
# @DESCRIPTION:
# Stores the version of apache we are going to be ebuilding.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APXS
# @DESCRIPTION:
# Path to the apxs tool.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_BIN
# @DESCRIPTION:
# Path to the apache binary.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_CTL
# @DESCRIPTION:
# Path to the apachectl tool.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_BASEDIR
# @DESCRIPTION:
# Path to the server root directory.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_CONFDIR
# @DESCRIPTION:
# Path to the configuration file directory.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR
# @DESCRIPTION:
# Path where module configuration files are kept.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR
# @DESCRIPTION:
# Path where virtual host configuration files are kept.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_MODULESDIR
# @DESCRIPTION:
# Path where we install modules.
# This variable is set by the want/need_apache functions.
# @ECLASS-VARIABLE: APACHE_DEPEND
# @DESCRIPTION:
# Dependencies for Apache
APACHE_DEPEND="www-servers/apache"
# @ECLASS-VARIABLE: APACHE2_DEPEND
# @DESCRIPTION:
# Dependencies for Apache 2.x
APACHE2_DEPEND="=www-servers/apache-2*"
# @ECLASS-VARIABLE: APACHE2_2_DEPEND
# @DESCRIPTION:
# Dependencies for Apache 2.2.x
APACHE2_2_DEPEND="=www-servers/apache-2.2*"
# ==============================================================================
# INTERNAL FUNCTIONS
# ==============================================================================
_init_apache2() {
debug-print-function $FUNCNAME $*
# WARNING: Do not use these variables with anything that is put
# into the dependency cache (DEPEND/RDEPEND/etc)
APACHE_VERSION="2"
APXS="/usr/sbin/apxs2"
APACHE_BIN="/usr/sbin/apache2"
APACHE_CTL="/usr/sbin/apache2ctl"
APACHE_INCLUDEDIR="/usr/include/apache2"
APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
APACHE_CONFDIR="/etc/apache2"
APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d"
APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d"
APACHE_MODULESDIR="${APACHE_BASEDIR}/modules"
}
_init_no_apache() {
debug-print-function $FUNCNAME $*
APACHE_VERSION="0"
}
# ==============================================================================
# PUBLIC FUNCTIONS
# ==============================================================================
# @FUNCTION: depend.apache_pkg_setup
# @USAGE: [myiuse]
# @DESCRIPTION:
# An ebuild calls this in pkg_setup() to initialize variables for optional
# apache-2.x support. If the myiuse parameter is not given it defaults to
# apache2.
depend.apache_pkg_setup() {
debug-print-function $FUNCNAME $*
if [[ "${EBUILD_PHASE}" != "setup" ]]; then
die "$FUNCNAME() should be called in pkg_setup()"
fi
local myiuse=${1:-apache2}
if has ${myiuse} ${IUSE}; then
if use ${myiuse}; then
_init_apache2
else
_init_no_apache
fi
fi
}
# @FUNCTION: want_apache
# @USAGE: [myiuse]
# @DESCRIPTION:
# An ebuild calls this to get the dependency information for optional apache
# support. If the myiuse parameter is not given it defaults to apache2.
# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
# with the same myiuse parameter.
want_apache() {
debug-print-function $FUNCNAME $*
want_apache2 "$@"
}
# @FUNCTION: want_apache2
# @USAGE: [myiuse]
# @DESCRIPTION:
# An ebuild calls this to get the dependency information for optional apache-2.x
# support. If the myiuse parameter is not given it defaults to apache2.
# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
# with the same myiuse parameter.
want_apache2() {
debug-print-function $FUNCNAME $*
local myiuse=${1:-apache2}
IUSE="${IUSE} ${myiuse}"
DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
}
# @FUNCTION: want_apache2_2
# @USAGE: [myiuse]
# @DESCRIPTION:
# An ebuild calls this to get the dependency information for optional
# apache-2.2.x support. If the myiuse parameter is not given it defaults to
# apache2.
# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
# with the same myiuse parameter.
want_apache2_2() {
debug-print-function $FUNCNAME $*
local myiuse=${1:-apache2}
IUSE="${IUSE} ${myiuse}"
DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
}
# @FUNCTION: need_apache
# @DESCRIPTION:
# An ebuild calls this to get the dependency information for apache.
need_apache() {
debug-print-function $FUNCNAME $*
need_apache2
}
# @FUNCTION: need_apache2
# @DESCRIPTION:
# An ebuild calls this to get the dependency information for apache-2.x.
need_apache2() {
debug-print-function $FUNCNAME $*
DEPEND="${DEPEND} ${APACHE2_DEPEND}"
RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
_init_apache2
}
# @FUNCTION: need_apache2_2
# @DESCRIPTION:
# An ebuild calls this to get the dependency information for apache-2.2.x.
need_apache2_2() {
debug-print-function $FUNCNAME $*
DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
_init_apache2
}
# @FUNCTION: has_apache
# @DESCRIPTION:
# An ebuild calls this to get runtime variables for an indirect apache
# dependency without USE-flag, in which case want_apache does not work.
# DO NOT call this function in global scope.
has_apache() {
debug-print-function $FUNCNAME $*
if has_version '>=www-servers/apache-2'; then
_init_apache2
else
_init_no_apache
fi
}
# @FUNCTION: has_apache_threads
# @USAGE: [myflag]
# @DESCRIPTION:
# An ebuild calls this to make sure thread-safety is enabled if apache has been
# built with a threaded MPM. If the myflag parameter is not given it defaults to
# threads.
has_apache_threads() {
debug-print-function $FUNCNAME $*
if ! built_with_use www-servers/apache threads; then
return
fi
local myflag="${1:-threads}"
if ! use ${myflag}; then
echo
eerror "You need to enable USE flag '${myflag}' to build a thread-safe version"
eerror "of ${CATEGORY}/${PN} for use with www-servers/apache"
die "Need missing USE flag '${myflag}'"
fi
}
# @FUNCTION: has_apache_threads_in
# @USAGE: <myforeign> [myflag]
# @DESCRIPTION:
# An ebuild calls this to make sure thread-safety is enabled in a foreign
# package if apache has been built with a threaded MPM. If the myflag parameter
# is not given it defaults to threads.
has_apache_threads_in() {
debug-print-function $FUNCNAME $*
if ! built_with_use www-servers/apache threads; then
return
fi
local myforeign="$1"
local myflag="${2:-threads}"
if ! built_with_use ${myforeign} ${myflag}; then
echo
eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
eerror "with www-servers/apache"
die "Need missing USE flag '${myflag}' in ${myforeign}"
fi
}
EXPORT_FUNCTIONS pkg_setup

View File

@ -0,0 +1,663 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.25 2008/02/26 16:26:08 armin76 Exp $
# Author: Stuart Herbert <stuart@gentoo.org>
# Author: Luca Longinotti <chtekk@gentoo.org>
# Author: Jakub Moc <jakub@gentoo.org> (documentation)
# @ECLASS: depend.php.eclass
# @MAINTAINER:
# Gentoo PHP team <php-bugs@gentoo.org>
# @BLURB: Functions to allow ebuilds to depend on php[45] and check for specific features.
# @DESCRIPTION:
# This eclass provides functions that allow ebuilds to depend on php[45] and check
# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install
# documentation for PHP packages to php-specific location.
inherit eutils phpconfutils
# PHP4-only depend functions
# @FUNCTION: need_php4_cli
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4
# with cli SAPI.
need_php4_cli() {
DEPEND="${DEPEND} =virtual/php-4*"
RDEPEND="${RDEPEND} =virtual/php-4*"
PHP_VERSION="4"
}
# @FUNCTION: need_php4_httpd
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4
# with either cgi or apache2 SAPI.
need_php4_httpd() {
DEPEND="${DEPEND} =virtual/httpd-php-4*"
RDEPEND="${RDEPEND} =virtual/httpd-php-4*"
PHP_VERSION="4"
}
# @FUNCTION: need_php4
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4
# (with any SAPI).
need_php4() {
DEPEND="${DEPEND} =dev-lang/php-4*"
RDEPEND="${RDEPEND} =dev-lang/php-4*"
PHP_VERSION="4"
PHP_SHARED_CAT="php4"
}
# common settings go in here
uses_php4() {
# cache this
libdir=$(get_libdir)
PHPIZE="/usr/${libdir}/php4/bin/phpize"
PHPCONFIG="/usr/${libdir}/php4/bin/php-config"
PHPCLI="/usr/${libdir}/php4/bin/php"
PHPCGI="/usr/${libdir}/php4/bin/php-cgi"
PHP_PKG="$(best_version =dev-lang/php-4*)"
PHPPREFIX="/usr/${libdir}/php4"
EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
einfo
einfo "Using ${PHP_PKG}"
einfo
}
# PHP5-only depend functions
# @FUNCTION: need_php5_cli
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
# with cli SAPI.
need_php5_cli() {
DEPEND="${DEPEND} =virtual/php-5*"
RDEPEND="${RDEPEND} =virtual/php-5*"
PHP_VERSION="5"
}
# @FUNCTION: need_php5_httpd
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
# with either cgi or apache2 SAPI.
need_php5_httpd() {
DEPEND="${DEPEND} =virtual/httpd-php-5*"
RDEPEND="${RDEPEND} =virtual/httpd-php-5*"
PHP_VERSION="5"
}
# @FUNCTION: need_php5
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
# (with any SAPI).
need_php5() {
DEPEND="${DEPEND} =dev-lang/php-5*"
RDEPEND="${RDEPEND} =dev-lang/php-5*"
PHP_VERSION="5"
PHP_SHARED_CAT="php5"
}
# common settings go in here
uses_php5() {
# cache this
libdir=$(get_libdir)
PHPIZE="/usr/${libdir}/php5/bin/phpize"
PHPCONFIG="/usr/${libdir}/php5/bin/php-config"
PHPCLI="/usr/${libdir}/php5/bin/php"
PHPCGI="/usr/${libdir}/php5/bin/php-cgi"
PHP_PKG="$(best_version =dev-lang/php-5*)"
PHPPREFIX="/usr/${libdir}/php5"
EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
einfo
einfo "Using ${PHP_PKG}"
einfo
}
# general PHP depend functions
# @FUNCTION: need_php_cli
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
# (any version) with cli SAPI.
need_php_cli() {
DEPEND="${DEPEND} virtual/php"
RDEPEND="${RDEPEND} virtual/php"
}
# @FUNCTION: need_php_httpd
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
# (any version) with either cgi or apache2 SAPI.
need_php_httpd() {
DEPEND="${DEPEND} virtual/httpd-php"
RDEPEND="${RDEPEND} virtual/httpd-php"
}
# @FUNCTION: need_php
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
# (any version with any SAPI).
need_php() {
DEPEND="${DEPEND} dev-lang/php"
RDEPEND="${RDEPEND} dev-lang/php"
PHP_SHARED_CAT="php"
}
# @FUNCTION: need_php_by_category
# @DESCRIPTION:
# Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version
# determined by ${CATEGORY} - any PHP version, PHP4 or PHP5 for dev-php, dev-php4 and
# dev-php5, respectively.
need_php_by_category() {
case "${CATEGORY}" in
dev-php) need_php ;;
dev-php4) need_php4 ;;
dev-php5) need_php5 ;;
*) die "Version of PHP required by packages in category ${CATEGORY} unknown"
esac
}
# @FUNCTION: has_php
# @DESCRIPTION:
# Call this function from your pkg_setup, src_compile, src_install etc. if you
# need to know which PHP version is being used and where the PHP binaries/data
# are installed.
has_php() {
# Detect which PHP version we have installed
if has_version '=dev-lang/php-5*' ; then
PHP_VERSION="5"
elif has_version '=dev-lang/php-4*' ; then
PHP_VERSION="4"
else
die "Unable to find an installed dev-lang/php package"
fi
# If we get here, then PHP_VERSION tells us which version of PHP we
# want to use
uses_php${PHP_VERSION}
}
# @FUNCTION: require_php_sapi_from
# @USAGE: <list of SAPIs>
# @DESCRIPTION:
# Call this function from pkg_setup if your package only works with
# specific SAPI(s) and specify a list of PHP SAPI USE flags that are
# required (one or more from cli, cgi, apache2) as arguments.
# Returns if any of the listed SAPIs have been installed, dies if none
# of them is available.
#
# Unfortunately, if you want to be really sure that the required SAPI is
# provided by PHP, you will have to use this function or similar ones (like
# require_php_cli or require_php_cgi) in pkg_setup until we are able to
# depend on USE flags being enabled. The above described need_php[45]_cli
# and need_php[45]_httpd functions cannot guarantee these requirements.
# See Bug 2272 for details.
require_php_sapi_from() {
has_php
local has_sapi="0"
local x
einfo "Checking for compatible SAPI(s)"
for x in $@ ; do
if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
einfo " Discovered compatible SAPI ${x}"
has_sapi="1"
fi
done
if [[ "${has_sapi}" == "1" ]] ; then
return
fi
eerror
eerror "${PHP_PKG} needs to be re-installed with one of the following"
eerror "USE flags enabled:"
eerror
eerror " $@"
eerror
die "No compatible PHP SAPIs found"
}
# @FUNCTION: require_php_with_use
# @USAGE: <list of USE flags>
# @DESCRIPTION:
# Call this function from pkg_setup if your package requires PHP compiled
# with specific USE flags. Returns if all of the listed USE flags are enabled.
# Dies if any of the listed USE flags are disabled.
# @VARIABLE: PHPCHECKNODIE
# @DESCRIPTION:
# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple
# require_php_with_(any)_use checks without making the ebuild die on every failure.
# This is useful in cases when certain PHP features are only required if specific
# USE flag(s) are enabled for that ebuild.
# @CODE
# Example:
#
# local flags="pcre session snmp sockets wddx"
# use mysql && flags="${flags} mysql"
# use postgres && flags="${flags} postgres"
# if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} \
# || ! PHPCHECKNODIE="yes" require_php_with_any_use gd gd-external ; then
# die "Re-install ${PHP_PKG} with ${flags} and either gd or gd-external"
# fi
# @CODE
require_php_with_use() {
has_php
local missing_use=""
local x
einfo "Checking for required PHP feature(s) ..."
for x in $@ ; do
if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
einfo " Discovered missing USE flag: ${x}"
missing_use="${missing_use} ${x}"
fi
done
if [[ -z "${missing_use}" ]] ; then
if [[ -z "${PHPCHECKNODIE}" ]] ; then
return
else
return 0
fi
fi
if [[ -z "${PHPCHECKNODIE}" ]] ; then
eerror
eerror "${PHP_PKG} needs to be re-installed with all of the following"
eerror "USE flags enabled:"
eerror
eerror " $@"
eerror
die "Missing PHP USE flags found"
else
return 1
fi
}
# @FUNCTION: require_php_with_any_use
# @USAGE: <list of USE flags>
# @DESCRIPTION:
# Call this function from pkg_setup if your package requires PHP compiled with
# any of specified USE flags. Returns if any of the listed USE flags are enabled.
# Dies if all of the listed USE flags are disabled.
require_php_with_any_use() {
has_php
local missing_use=""
local x
einfo "Checking for required PHP feature(s) ..."
for x in $@ ; do
if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
einfo " USE flag ${x} is enabled, ok ..."
return
else
missing_use="${missing_use} ${x}"
fi
done
if [[ -z "${missing_use}" ]] ; then
if [[ -z "${PHPCHECKNODIE}" ]] ; then
return
else
return 0
fi
fi
if [[ -z "${PHPCHECKNODIE}" ]] ; then
eerror
eerror "${PHP_PKG} needs to be re-installed with any of the following"
eerror "USE flags enabled:"
eerror
eerror " $@"
eerror
die "Missing PHP USE flags found"
else
return 1
fi
}
# ========================================================================
# has_*() functions
#
# These functions return 0 if the condition is satisfied, 1 otherwise
# ========================================================================
# @FUNCTION: has_zts
# @DESCRIPTION:
# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled.
# @RETURN: 0 if true, 1 otherwise
has_zts() {
has_php
if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then
return 0
fi
return 1
}
# @FUNCTION: has_debug
# @DESCRIPTION:
# Check if our PHP was built with debug support enabled.
# @RETURN: 0 if true, 1 otherwise
has_debug() {
has_php
if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
return 0
fi
return 1
}
# @FUNCTION: has_concurrentmodphp
# @DESCRIPTION:
# Check if our PHP was built with the concurrentmodphp support enabled.
# @RETURN: 0 if true, 1 otherwise
has_concurrentmodphp() {
has_php
if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then
return 0
fi
return 1
}
# ========================================================================
# require_*() functions
#
# These functions die() if PHP was built without the required features
# ========================================================================
# @FUNCTION: require_pdo
# @DESCRIPTION:
# Require a PHP built with PDO support (PHP5 only).
# This function is now redundant and DEPRECATED since
# pdo-external use flag and pecl-pdo-* ebuilds were removed.
# You should use require_php_with_use pdo instead now.
# @RETURN: die if feature is missing
require_pdo() {
has_php
# Do we have PHP5 installed?
if [[ "${PHP_VERSION}" == "4" ]] ; then
eerror
eerror "This package requires PDO."
eerror "PDO is only available for PHP 5."
eerror "You must install >=dev-lang/php-5.1 with USE=\"pdo\"."
eerror "pdo USE flags turned on."
eerror
die "PHP 5 not installed"
fi
# Was PHP5 compiled with internal PDO support?
if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then
return
else
eerror
eerror "No PDO extension for PHP found."
eerror "Please note that PDO only exists for PHP 5."
eerror "Please install a PDO extension for PHP 5."
eerror "You must install >=dev-lang/php-5.1 with USE=\"pdo\"."
eerror
die "No PDO extension for PHP 5 found"
fi
}
# @FUNCTION: require_php_cli
# @DESCRIPTION:
# Determines which installed PHP version has the CLI SAPI enabled.
# Useful for PEAR stuff, or anything which needs to run PHP script
# depending on the CLI SAPI.
# @RETURN: die if feature is missing
require_php_cli() {
# If PHP_PKG is set, then we have remembered our PHP settings
# from last time
if [[ -n ${PHP_PKG} ]] ; then
return
fi
local PHP_PACKAGE_FOUND=""
# Detect which PHP version we have installed
if has_version '=dev-lang/php-4*' ; then
PHP_PACKAGE_FOUND="1"
pkg="$(best_version '=dev-lang/php-4*')"
if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
PHP_VERSION="4"
fi
fi
if has_version '=dev-lang/php-5*' ; then
PHP_PACKAGE_FOUND="1"
pkg="$(best_version '=dev-lang/php-5*')"
if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
PHP_VERSION="5"
fi
fi
if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
die "Unable to find an installed dev-lang/php package"
fi
if [[ -z ${PHP_VERSION} ]] ; then
die "No PHP CLI installed. Re-emerge dev-lang/php with USE=cli."
fi
# If we get here, then PHP_VERSION tells us which version of PHP we
# want to use
uses_php${PHP_VERSION}
}
# @FUNCTION: require_php_cgi
# @DESCRIPTION:
# Determines which installed PHP version has the CGI SAPI enabled.
# Useful for anything which needs to run PHP scripts depending on the CGI SAPI.
# @RETURN: die if feature is missing
require_php_cgi() {
# If PHP_PKG is set, then we have remembered our PHP settings
# from last time
if [[ -n ${PHP_PKG} ]] ; then
return
fi
local PHP_PACKAGE_FOUND=""
# Detect which PHP version we have installed
if has_version '=dev-lang/php-4*' ; then
PHP_PACKAGE_FOUND="1"
pkg="$(best_version '=dev-lang/php-4*')"
if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
PHP_VERSION="4"
fi
fi
if has_version '=dev-lang/php-5*' ; then
PHP_PACKAGE_FOUND="1"
pkg="$(best_version '=dev-lang/php-5*')"
if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
PHP_VERSION="5"
fi
fi
if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
die "Unable to find an installed dev-lang/php package"
fi
if [[ -z ${PHP_VERSION} ]] ; then
die "No PHP CGI installed. Re-emerge dev-lang/php with USE=cgi."
fi
# If we get here, then PHP_VERSION tells us which version of PHP we
# want to use
uses_php${PHP_VERSION}
}
# @FUNCTION: require_sqlite
# @DESCRIPTION:
# Require a PHP built with SQLite support
# @RETURN: die if feature is missing
require_sqlite() {
has_php
# Has our PHP been built with SQLite support?
if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then
return
fi
# Do we have pecl-sqlite installed for PHP4?
if [[ "${PHP_VERSION}" == "4" ]] ; then
if has_version 'dev-php4/pecl-sqlite' ; then
return
fi
fi
# If we get here, then we don't have any SQLite support for PHP installed
eerror
eerror "No SQLite extension for PHP found."
eerror "Please install an SQLite extension for PHP,"
eerror "this is done best by simply adding the"
eerror "'sqlite' USE flag when emerging dev-lang/php."
eerror
die "No SQLite extension for PHP found"
}
# @FUNCTION: require_gd
# @DESCRIPTION:
# Require a PHP built with GD support
# @RETURN: die if feature is missing
require_gd() {
has_php
# Do we have the internal GD support installed?
if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then
return
fi
# Ok, maybe GD was built using the external library support?
if built_with_use =${PHP_PKG} gd-external || phpconfutils_built_with_use =${PHP_PKG} gd-external ; then
return
fi
# If we get here, then we have no GD support
eerror
eerror "No GD support for PHP found."
eerror "Please install the GD support for PHP,"
eerror "you must install dev-lang/php with either"
eerror "the 'gd' or the 'gd-external' USE flags"
eerror "turned on."
eerror
die "No GD support found for PHP"
}
# ========================================================================
# Misc functions
#
# These functions provide miscellaneous checks and functionality.
# ========================================================================
# @FUNCTION: php_binary_extension
# @DESCRIPTION:
# Executes some checks needed when installing a binary PHP extension.
php_binary_extension() {
has_php
local PUSE_ENABLED=""
# Binary extensions do not support the change of PHP
# API version, so they can't be installed when USE flags
# are enabled which change the PHP API version, they also
# don't provide correctly versioned symbols for our use
if has_debug ; then
eerror
eerror "You cannot install binary PHP extensions"
eerror "when the 'debug' USE flag is enabled!"
eerror "Please reemerge dev-lang/php with the"
eerror "'debug' USE flag turned off."
eerror
PUSE_ENABLED="1"
fi
if has_concurrentmodphp ; then
eerror
eerror "You cannot install binary PHP extensions when"
eerror "the 'concurrentmodphp' USE flag is enabled!"
eerror "Please reemerge dev-lang/php with the"
eerror "'concurrentmodphp' USE flag turned off."
eerror
PUSE_ENABLED="1"
fi
if [[ -n ${PUSE_ENABLED} ]] ; then
die "'debug' and/or 'concurrentmodphp' USE flags turned on!"
fi
}
# @FUNCTION: dodoc-php
# @USAGE: <list of docs>
# @DESCRIPTION:
# Alternative to dodoc function for use in our PHP eclasses and ebuilds.
# Stored here because depend.php gets always sourced everywhere in the PHP
# ebuilds and eclasses. It simply is dodoc with a changed path to the docs.
# NOTE: No support for docinto is provided!
dodoc-php() {
if [[ $# -lt 1 ]] ; then
echo "$0: at least one argument needed" 1>&2
exit 1
fi
phpdocdir="/usr/share/doc/${CATEGORY}/${PF}/"
for x in $@ ; do
if [[ -s "${x}" ]] ; then
insinto "${phpdocdir}"
doins "${x}"
gzip -f -9 "${D}/${phpdocdir}/${x##*/}"
elif [[ ! -e "${x}" ]] ; then
echo "dodoc-php: ${x} does not exist" 1>&2
fi
done
}
# @FUNCTION: dohtml-php
# @USAGE: <list of html docs>
# @DESCRIPTION:
# Alternative to dohtml function for use in our PHP eclasses and ebuilds.
# Stored here because depend.php gets always sourced everywhere in the PHP
# ebuilds and eclasses. It simply is dohtml with a changed path to the docs.
# NOTE: No support for [-a|-A|-p|-x] options is provided!
dohtml-php() {
if [[ $# -lt 1 ]] ; then
echo "$0: at least one argument needed" 1>&2
exit 1
fi
phphtmldir="/usr/share/doc/${CATEGORY}/${PF}/html"
for x in $@ ; do
if [[ -s "${x}" ]] ; then
insinto "${phphtmldir}"
doins "${x}"
elif [[ ! -e "${x}" ]] ; then
echo "dohtml-php: ${x} does not exist" 1>&2
fi
done
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ebook.eclass,v 1.27 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,242 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/eclipse-ext.eclass,v 1.13 2006/04/17 03:47:44 nichoj Exp $
# Original Author: Karl Trygve Kalleberg <karltk@gentoo.org>
# Maintainers:
# Development Tools Team <dev-tools@gentoo.org>
# Java Team <java@gentoo.org>
inherit eutils multilib
# Must be listed in oldest->newest order!
known_eclipse_slots="2 3 3.1"
# These should not be reinitialized if previously set
# (check allows require-slot in pkg_setup)
[ -z "${eclipse_ext_type}" ] && \
eclipse_ext_type="source"
[ -z "${eclipse_ext_slot}" ] && \
eclipse_ext_slot="0"
[ -z "${eclipse_ext_basedir}" ] && \
eclipse_ext_basedir="/usr/$(get_libdir)/eclipse-extensions-${eclipse_ext_slot}/eclipse"
[ -z "${eclipse_ext_platformdir}" ] && \
eclipse_ext_platformdir="/usr/$(get_libdir)/eclipse-${eclipse_ext_slot}"
# ---------------------------------------------------------------------------
# @private _find-optimum-slot
#
# Look for a given SLOT. If not found return the least highest SLOT
# available.
#
# @param $1 - SLOT of Eclipse SDK that is most desired
# @return 0 - all is well, non-zero otherwise
# ---------------------------------------------------------------------------
function _find-optimum-slot {
local found=false
for x in ${known_eclipse_slots} ; do
if [ "$1" == "$x" ] ; then
found=true
fi
if [ "${found}" == "true" ] && [ -d /usr/$(get_libdir)/eclipse-${x} ] ; then
echo $x
return 0
fi
done
echo ""
return 1
}
# ---------------------------------------------------------------------------
# @public require-slot
#
# Ensure that an Eclipse SDK is actually available for the given slot;
# sets internal state to install for selected slot.
#
# @param $1 - SLOT of Eclipse SDK that required for this ebuild
# alternatively
# @return 0 - all is well, non-zero otherwise
# ---------------------------------------------------------------------------
function eclipse-ext_require-slot {
local slot=$(_find-optimum-slot $1)
if [ -z "${slot}" ] ; then
eerror "Cannot find any Eclipse SDK supporting slot $1"
return 1
fi
if [ "${slot}" != "$1" ] ; then
ewarn "Slot $1 could not be satisfied, installing for ${slot} instead"
fi
eclipse_ext_slot=${slot}
eclipse_ext_basedir="/usr/$(get_libdir)/eclipse-extensions-${eclipse_ext_slot}/eclipse"
eclipse_ext_platformdir="/usr/$(get_libdir)/eclipse-${eclipse_ext_slot}"
return 0
}
# ---------------------------------------------------------------------------
# @public create-plugin-layout
#
# Create directory infrastructure for binary-only plugins so that the installed
# Eclipse SDK will see them. Sets internal state for installing as source or
# binary.
#
# @param $1 - type of ebuild, "source" or "binary"
# @return - nothing
# ---------------------------------------------------------------------------
function eclipse-ext_create-ext-layout {
local type=$1
if [ "${type}" == "binary" ] ; then
eclipse_ext_basedir="/opt/eclipse-extensions-${eclipse_ext_slot}/eclipse"
dodir ${eclipse_ext_basedir}/{features,plugins}
touch ${D}/${eclipse_ext_basedir}/.eclipseextension
else
eclipse_ext_basedir="/usr/$(get_libdir)/eclipse-extensions-${eclipse_ext_slot}/eclipse"
dodir ${eclipse_ext_basedir}/{features,plugins}
touch ${D}/${eclipse_ext_basedir}/.eclipseextension
fi
}
# ---------------------------------------------------------------------------
# @public install-features
#
# Installs one or multiple features into the plugin directory for the required
# Eclipse SDK.
#
# Note: You must call require-slot prior to calling install-features. If your
# ebuild is for a binary-only plugin, you must also call create-plugin-layout
# prior to calling install-features.
#
# @param $* - feature directories
# @return 0 - if all is well
# 1 - if require-slot was not called
# ---------------------------------------------------------------------------
function eclipse-ext_install-features {
if [ ${eclipse_ext_slot} == 0 ] ; then
eerror "You must call require-slot prior to calling ${FUNCNAME}!"
return 1
fi
for x in $* ; do
if [ -d "$x" ] && [ -f $x/feature.xml ] ; then
cp -a $x ${D}/${eclipse_ext_basedir}/features
else
eerror "$x not a feature directory!"
fi
done
}
# ---------------------------------------------------------------------------
# @public install-plugins
#
# Installs one or multiple plugins into the plugin directory for the required
# Eclipse SDK.
#
# Note: You must call require-slot prior to calling install-features. If your
# ebuild is for a binary-only plugin, you must also call create-plugin-layout
# prior to calling install-features.
#
# @param $* - plugin directories
# @return - nothing
# ---------------------------------------------------------------------------
function eclipse-ext_install-plugins {
if [ ${eclipse_ext_slot} == 0 ] ; then
eerror "You must call require-slot prior to calling ${FUNCNAME}!"
return 1
fi
for x in $* ; do
if [ -d "$x" ] && ( [ -f "$x/plugin.xml" ] || [ -f "$x/fragment.xml" ] ) ; then
cp -a $x ${D}/${eclipse_ext_basedir}/plugins
else
eerror "$x not a plugin directory!"
fi
done
}
# TODO really should have a page hosted on gentoo's infra
function eclipse-ext_pkg_postinst() {
einfo "For tips, tricks and general info on running Eclipse on Gentoo, go to:"
einfo "http://gentoo-wiki.com/Eclipse"
}
# ---------------------------------------------------------------------------
# @public get-classpath
#
# Tries to parse out a classpath string from a build.properties file. Is very
# stupid: Assumes it's a one-liner on the form classpath = comma:separated:
#
# @param $1 - name of the file (typically build.properties)
# @param $2 - name of the one-liner env var (default 'classpath')
# @return - echo of space-separated classpath entries.
# ---------------------------------------------------------------------------
eclipse-ext_get-classpath() {
local file=$1
local envvar="classpath"
if [ "$1" == "build.properties" ] ; then
if [ ! -z "$2" ] ; then
envvar="$2"
fi
fi
echo "$(cat ${FILESDIR}/build.properties-${PV} | sed "s/.*=//" | tr ';' ' ')"
}
_path-dissecter() {
echo $1 | sed -r "s/.*\/([^/]+)_([0-9.]+)\/(.*)/\\${2}/"
}
_get-plugin-name() {
_path-dissecter $1 1
}
_get-plugin-version() {
_path-dissecter $1 2
}
_get-plugin-content() {
_path-dissecter $1 3
}
# ---------------------------------------------------------------------------
# @public resolve-jars
#
# Takes a space-separated list of plugin_version/subdirs/file.jar entries and
# tries to resolve the version for the plugin against the chosen eclipse version
# (set by require-slot).
#
# Note: You must call require-slot prior to calling resolve-jars.
#
# @param $1 - string with space-separated plugin/jarfile
# @return - echo of :-separated resolved files
# ---------------------------------------------------------------------------
eclipse-ext_resolve-jars() {
local resolved=""
for x in $1 ; do
local jarfile=$(_get-plugin-content $x)
local name="$(_get-plugin-name $x)"
local x=$(echo ${eclipse_ext_platformdir}/plugins/${name}_*/${jarfile})
if [ -f ${x} ] ; then
resolved="${resolved}:$x"
else
:
#echo "Warning: did not find ${name}"
fi
done
echo ${resolved}
}
EXPORT_FUNCTIONS pkg_postinst

View File

@ -0,0 +1,367 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.65 2009/12/29 20:15:12 ulm Exp $
#
# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org>
# Copyright 2007-2008 Christian Faulhammer <fauli@gentoo.org>
# Copyright 2007-2009 Ulrich Müller <ulm@gentoo.org>
#
# @ECLASS: elisp-common.eclass
# @MAINTAINER:
# Feel free to contact the Emacs team through <emacs@gentoo.org> if you
# have problems, suggestions or questions.
# @BLURB: Emacs-related installation utilities
# @DESCRIPTION:
#
# Usually you want to use this eclass for (optional) GNU Emacs support
# of your package. This is NOT for XEmacs!
#
# Many of the steps here are sometimes done by the build system of your
# package (especially compilation), so this is mainly for standalone
# elisp files you gathered from somewhere else.
#
# When relying on the emacs USE flag, you need to add
#
# emacs? ( virtual/emacs )
#
# to your DEPEND/RDEPEND line and use the functions provided here to
# bring the files to the correct locations.
#
# .SS
# src_compile() usage:
#
# An elisp file is compiled by the elisp-compile() function defined
# here and simply takes the source files as arguments. The case of
# interdependent elisp files is also supported, since the current
# directory is added to the load-path which makes sure that all files
# are loadable.
#
# elisp-compile *.el || die
#
# Function elisp-make-autoload-file() can be used to generate a file
# with autoload definitions for the lisp functions. It takes the output
# file name (default: "${PN}-autoloads.el") and a list of directories
# (default: working directory) as its arguments. Use of this function
# requires that the elisp source files contain magic ";;;###autoload"
# comments. See the Emacs Lisp Reference Manual (node "Autoload") for
# a detailed explanation.
#
# .SS
# src_install() usage:
#
# The resulting compiled files (.elc) should be put in a subdirectory of
# /usr/share/emacs/site-lisp/ which is named after the first argument
# of elisp-install(). The following parameters are the files to be put
# in that directory. Usually the subdirectory should be ${PN}, you can
# choose something else, but remember to tell elisp-site-file-install()
# (see below) the change, as it defaults to ${PN}.
#
# elisp-install ${PN} *.el *.elc || die
#
# To let the Emacs support be activated by Emacs on startup, you need
# to provide a site file (shipped in ${FILESDIR}) which contains the
# startup code (have a look in the documentation of your software).
# Normally this would look like this:
#
# (add-to-list 'load-path "@SITELISP@")
# (add-to-list 'auto-mode-alist '("\\.csv\\'" . csv-mode))
# (autoload 'csv-mode "csv-mode" "Major mode for csv files." t)
#
# If your Emacs support files are installed in a subdirectory of
# /usr/share/emacs/site-lisp/ (which is strongly recommended), you need
# to extend Emacs' load-path as shown in the first non-comment line.
# The elisp-site-file-install() function of this eclass will replace
# "@SITELISP@" and "@SITEETC@" by the actual paths.
#
# The next line tells Emacs to load the mode opening a file ending
# with ".csv" and load functions depending on the context and needed
# features. Be careful though. Commands as "load-library" or "require"
# bloat the editor as they are loaded on every startup. When having
# many Emacs support files, users may be annoyed by the start-up time.
# Also avoid keybindings as they might interfere with the user's
# settings. Give a hint in pkg_postinst(), which should be enough.
#
# The naming scheme for this site-init file matches the shell pattern
# "[1-8][0-9]*-gentoo*.el", where the two digits at the beginning define
# the loading order (numbers below 10 or above 89 are reserved for
# internal use). So if your initialisation depends on another Emacs
# package, your site file's number must be higher!
#
# Best practice is to define a SITEFILE variable in the global scope of
# your ebuild (e.g., right after S or RDEPEND):
#
# SITEFILE="50${PN}-gentoo.el"
#
# Which is then installed by
#
# elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
#
# in src_install(). Any characters after the "-gentoo" part and before
# the extension will be stripped from the destination file's name.
# For example, a file "50${PN}-gentoo-${PV}.el" will be installed as
# "50${PN}-gentoo.el". If your subdirectory is not named ${PN}, give
# the differing name as second argument.
#
# .SS
# pkg_postinst() / pkg_postrm() usage:
#
# After that you need to recreate the start-up file of Emacs after
# emerging and unmerging by using
#
# pkg_postinst() {
# elisp-site-regen
# }
#
# pkg_postrm() {
# elisp-site-regen
# }
#
# When having optional Emacs support, you should prepend "use emacs &&"
# to above calls of elisp-site-regen().
# Don't use "has_version virtual/emacs"! When unmerging the state of
# the emacs USE flag is taken from the package database and not from the
# environment, so it is no problem when you unset USE=emacs between
# merge and unmerge of a package.
#
# .SS
# Miscellaneous functions:
#
# elisp-emacs-version() outputs the version of the currently active Emacs.
# @ECLASS-VARIABLE: SITELISP
# @DESCRIPTION:
# Directory where packages install Emacs Lisp files.
SITELISP=/usr/share/emacs/site-lisp
# @ECLASS-VARIABLE: SITEETC
# @DESCRIPTION:
# Directory where packages install miscellaneous (not Lisp) files.
SITEETC=/usr/share/emacs/etc
# @ECLASS-VARIABLE: EMACS
# @DESCRIPTION:
# Path of Emacs executable.
EMACS=${EPREFIX}/usr/bin/emacs
# @ECLASS-VARIABLE: EMACSFLAGS
# @DESCRIPTION:
# Flags for executing Emacs in batch mode.
# These work for Emacs versions 18-23, so don't change them.
EMACSFLAGS="-batch -q --no-site-file"
# @ECLASS-VARIABLE: BYTECOMPFLAGS
# @DESCRIPTION:
# Emacs flags used for byte-compilation in elisp-compile().
BYTECOMPFLAGS="-L ."
# @FUNCTION: elisp-compile
# @USAGE: <list of elisp files>
# @DESCRIPTION:
# Byte-compile Emacs Lisp files.
#
# This function uses GNU Emacs to byte-compile all ".el" specified by
# its arguments. The resulting byte-code (".elc") files are placed in
# the same directory as their corresponding source file.
#
# The current directory is added to the load-path. This will ensure
# that interdependent Emacs Lisp files are visible between themselves,
# in case they require or load one another.
elisp-compile() {
ebegin "Compiling GNU Emacs Elisp files"
${EMACS} ${EMACSFLAGS} ${BYTECOMPFLAGS} -f batch-byte-compile "$@"
eend $? "elisp-compile: batch-byte-compile failed"
}
elisp-comp() {
die "Function elisp-comp is not supported any more, see bug 235442"
}
# @FUNCTION: elisp-emacs-version
# @DESCRIPTION:
# Output version of currently active Emacs.
elisp-emacs-version() {
# The following will work for at least versions 18-23.
echo "(princ emacs-version)" >"${T}"/emacs-version.el
${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el
rm -f "${T}"/emacs-version.el
}
# @FUNCTION: elisp-make-autoload-file
# @USAGE: [output file] [list of directories]
# @DESCRIPTION:
# Generate a file with autoload definitions for the lisp functions.
elisp-make-autoload-file() {
local f="${1:-${PN}-autoloads.el}" null="" page=$'\f'
shift
ebegin "Generating autoload file for GNU Emacs"
cat >"${f}" <<-EOF
;;; ${f##*/} --- autoloads for ${P}
;;; Commentary:
;; Automatically generated by elisp-common.eclass
;; DO NOT EDIT THIS FILE
;;; Code:
${page}
;; Local ${null}Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; ${f##*/} ends here
EOF
${EMACS} ${EMACSFLAGS} \
--eval "(setq make-backup-files nil)" \
--eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \
-f batch-update-autoloads "${@-.}"
eend $? "elisp-make-autoload-file: batch-update-autoloads failed"
}
# @FUNCTION: elisp-install
# @USAGE: <subdirectory> <list of files>
# @DESCRIPTION:
# Install files in SITELISP directory.
elisp-install() {
local subdir="$1"
shift
ebegin "Installing Elisp files for GNU Emacs support"
( # subshell to avoid pollution of calling environment
insinto "${SITELISP}/${subdir}"
doins "$@"
)
eend $? "elisp-install: doins failed"
}
# @FUNCTION: elisp-site-file-install
# @USAGE: <site-init file> [subdirectory]
# @DESCRIPTION:
# Install Emacs site-init file in SITELISP directory. Automatically
# inserts a standard comment header with the name of the package (unless
# it is already present). Tokens @SITELISP@ and @SITEETC@ are replaced
# by the path to the package's subdirectory in SITELISP and SITEETC,
# respectively.
elisp-site-file-install() {
local sf="${1##*/}" my_pn="${2:-${PN}}" ret
local header=";;; ${PN} site-lisp configuration"
[[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \
|| ewarn "elisp-site-file-install: bad name of site-init file"
sf="${T}/${sf/%-gentoo*.el/-gentoo.el}"
ebegin "Installing site initialisation file for GNU Emacs"
[[ $1 = ${sf} ]] || cp "$1" "${sf}"
sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \
-e "s:@SITELISP@:${EPREFIX}${SITELISP}/${my_pn}:g" \
-e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g;\$q" "${sf}"
( # subshell to avoid pollution of calling environment
insinto "${SITELISP}/site-gentoo.d"
doins "${sf}"
)
ret=$?
rm -f "${sf}"
eend ${ret} "elisp-site-file-install: doins failed"
}
# @FUNCTION: elisp-site-regen
# @DESCRIPTION:
# Regenerate the site-gentoo.el file, based on packages' site
# initialisation files in the /usr/share/emacs/site-lisp/site-gentoo.d/
# directory.
#
# Note: Before December 2007, site initialisation files were installed
# in /usr/share/emacs/site-lisp/. For backwards compatibility, this
# location is still supported when generating site-gentoo.el.
elisp-site-regen() {
local sitelisp=${ROOT}${EPREFIX}${SITELISP}
local sf i line null="" page=$'\f'
local -a sflist
if [ ! -d "${sitelisp}" ]; then
eerror "elisp-site-regen: Directory ${sitelisp} does not exist"
return 1
fi
if [ ! -d "${T}" ]; then
eerror "elisp-site-regen: Temporary directory ${T} does not exist"
return 1
fi
einfon "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE}) ..."
# Until January 2009, elisp-common.eclass sometimes created an
# auxiliary file for backwards compatibility. Remove any such file.
rm -f "${sitelisp}"/00site-gentoo.el
# set nullglob option, there may be a directory without matching files
local old_shopts=$(shopt -p nullglob)
shopt -s nullglob
for sf in "${sitelisp}"/[0-9][0-9]*-gentoo.el \
"${sitelisp}"/site-gentoo.d/[0-9][0-9]*.el
do
[ -r "${sf}" ] || continue
# sort files by their basename. straight insertion sort.
for ((i=${#sflist[@]}; i>0; i--)); do
[[ ${sf##*/} < ${sflist[i-1]##*/} ]] || break
sflist[i]=${sflist[i-1]}
done
sflist[i]=${sf}
done
eval "${old_shopts}"
cat <<-EOF >"${T}"/site-gentoo.el
;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
;;; Commentary:
;; Automatically generated by elisp-common.eclass
;; DO NOT EDIT THIS FILE
;;; Code:
EOF
# Use sed instead of cat here, since files may miss a trailing newline.
sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el
cat <<-EOF >>"${T}"/site-gentoo.el
(provide 'site-gentoo)
${page}
;; Local ${null}Variables:
;; no-byte-compile: t
;; buffer-read-only: t
;; End:
;;; site-gentoo.el ends here
EOF
if cmp -s "${sitelisp}"/site-gentoo.el "${T}"/site-gentoo.el; then
# This prevents outputting unnecessary text when there
# was actually no change.
# A case is a remerge where we have doubled output.
echo " no changes."
else
mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el
echo
case ${#sflist[@]} in
0) ewarn "... Huh? No site initialisation files found." ;;
1) einfo "... ${#sflist[@]} site initialisation file included." ;;
*) einfo "... ${#sflist[@]} site initialisation files included." ;;
esac
fi
# cleanup
rm -f "${T}"/site-gentoo.el
return 0
}

View File

@ -0,0 +1,140 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/elisp.eclass,v 1.44 2010/01/30 22:54:00 ulm Exp $
#
# Copyright 2002-2003 Matthew Kennedy <mkennedy@gentoo.org>
# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
# Copyright 2007-2009 Christian Faulhammer <fauli@gentoo.org>
# Copyright 2007-2010 Ulrich Müller <ulm@gentoo.org>
#
# @ECLASS: elisp.eclass
# @MAINTAINER:
# Feel free to contact the Emacs team through <emacs@gentoo.org> if you
# have problems, suggestions or questions.
# @BLURB: Eclass for Emacs Lisp packages
# @DESCRIPTION:
#
# This eclass is designed to install elisp files of Emacs related
# packages into the site-lisp directory. The majority of elisp packages
# will only need to define the standard ebuild variables (like SRC_URI)
# and optionally SITEFILE for successful installation.
#
# Emacs support for other than pure elisp packages is handled by
# elisp-common.eclass where you won't have a dependency on Emacs itself.
# All elisp-* functions are documented there.
#
# If the package's source is a single (in whatever way) compressed elisp
# file with the file name ${P}.el, then this eclass will move ${P}.el to
# ${PN}.el in src_unpack().
# @ECLASS-VARIABLE: NEED_EMACS
# @DESCRIPTION:
# If you need anything different from Emacs 21, use the NEED_EMACS
# variable before inheriting elisp.eclass. Set it to the major version
# your package uses and the dependency will be adjusted.
# @ECLASS-VARIABLE: ELISP_PATCHES
# @DESCRIPTION:
# Any patches to apply after unpacking the sources. Patches are searched
# both in ${PWD} and ${FILESDIR}.
# @ECLASS-VARIABLE: SITEFILE
# @DESCRIPTION:
# Name of package's site-init file. The filename must match the shell
# pattern "[1-8][0-9]*-gentoo.el"; numbers below 10 and above 89 are
# reserved for internal use. "50${PN}-gentoo.el" is a reasonable choice
# in most cases.
# @ECLASS-VARIABLE: ELISP_TEXINFO
# @DESCRIPTION:
# Space separated list of Texinfo sources. Respective GNU Info files
# will be generated in src_compile() and installed in src_install().
# @ECLASS-VARIABLE: DOCS
# @DESCRIPTION:
# DOCS="blah.txt ChangeLog" is automatically used to install the given
# files by dodoc in src_install().
inherit elisp-common eutils
case "${EAPI:-0}" in
0|1) EXPORT_FUNCTIONS src_{unpack,compile,install} \
pkg_{setup,postinst,postrm} ;;
*) EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
pkg_{setup,postinst,postrm} ;;
esac
DEPEND=">=virtual/emacs-${NEED_EMACS:-21}"
RDEPEND="${DEPEND}"
IUSE=""
elisp_pkg_setup() {
local need_emacs=${NEED_EMACS:-21}
local have_emacs=$(elisp-emacs-version)
if [ "${have_emacs%%.*}" -lt "${need_emacs%%.*}" ]; then
eerror "This package needs at least Emacs ${need_emacs%%.*}."
eerror "Use \"eselect emacs\" to select the active version."
die "Emacs version ${have_emacs} is too low."
fi
einfo "Emacs version: ${have_emacs}"
}
elisp_src_unpack() {
[ -n "${A}" ] && unpack ${A}
if [ -f ${P}.el ]; then
# the "simple elisp" case with a single *.el file in WORKDIR
mv ${P}.el ${PN}.el || die
[ -d "${S}" ] || S=${WORKDIR}
fi
case "${EAPI:-0}" in
0|1) [ -d "${S}" ] && cd "${S}"
elisp_src_prepare ;;
esac
}
elisp_src_prepare() {
local patch
for patch in ${ELISP_PATCHES}; do
if [ -f "${patch}" ]; then
epatch "${patch}"
elif [ -f "${WORKDIR}/${patch}" ]; then
epatch "${WORKDIR}/${patch}"
elif [ -f "${FILESDIR}/${patch}" ]; then
epatch "${FILESDIR}/${patch}"
else
die "Cannot find ${patch}"
fi
done
}
elisp_src_configure() { :; }
elisp_src_compile() {
elisp-compile *.el || die
if [ -n "${ELISP_TEXINFO}" ]; then
makeinfo ${ELISP_TEXINFO} || die
fi
}
elisp_src_install() {
elisp-install ${PN} *.el *.elc || die
if [ -n "${SITEFILE}" ]; then
elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
fi
if [ -n "${ELISP_TEXINFO}" ]; then
set -- ${ELISP_TEXINFO}
doinfo ${@/%.*/.info*} || die
fi
if [ -n "${DOCS}" ]; then
dodoc ${DOCS} || die
fi
}
elisp_pkg_postinst() {
elisp-site-regen
}
elisp_pkg_postrm() {
elisp-site-regen
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/embassy-2.10.eclass,v 1.8 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/embassy-2.9.eclass,v 1.10 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,93 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/embassy.eclass,v 1.17 2008/11/03 22:17:50 ribosome Exp $
# Author Olivier Fisette <ribosome@gentoo.org>
# This eclass is used to install EMBASSY programs (EMBOSS add-ons).
# The inheriting ebuild should provide a "DESCRIPTION", "KEYWORDS" and, if
# necessary, add "(R|P)DEPEND"encies. Additionnaly, the inheriting ebuild's
# name must begin by "embassy-". Also, before inheriting, the ebuild should
# specify what version of EMBOSS is required by setting EBOV.
inherit eutils multilib
# The EMBASSY package name, retrieved from the inheriting ebuild's name
EN=${PN:8}
# The full name and version of the EMBASSY package (excluding the Gentoo
# revision number)
EF="$(echo ${EN} | tr "[:lower:]" "[:upper:]")-${PV}"
DESCRIPTION="Based on the $ECLASS eclass"
HOMEPAGE="http://emboss.sourceforge.net/"
LICENSE="LGPL-2 GPL-2"
SRC_URI="ftp://emboss.open-bio.org/pub/EMBOSS/EMBOSS-${EBOV}.tar.gz
ftp://emboss.open-bio.org/pub/EMBOSS/${EF}.tar.gz"
SLOT="0"
IUSE="X png"
DEPEND="=sci-biology/emboss-${EBOV}*
!<sci-biology/emboss-${EBOV}
X? ( x11-libs/libX11 )
png? ( sys-libs/zlib
media-libs/libpng
>=media-libs/gd-1.8
)"
S=${WORKDIR}/EMBOSS-${EBOV}/embassy/${EF}
embassy_src_unpack() {
unpack ${A}
mkdir EMBOSS-${EBOV}/embassy
mv ${EF} EMBOSS-${EBOV}/embassy/
cp /usr/$(get_libdir)/libplplot.la EMBOSS-${EBOV}/plplot/
cp /usr/$(get_libdir)/libeplplot.la EMBOSS-${EBOV}/plplot/
cp /usr/$(get_libdir)/libajax.la EMBOSS-${EBOV}/ajax/
cp /usr/$(get_libdir)/libajaxg.la EMBOSS-${EBOV}/ajax/
cp /usr/$(get_libdir)/libnucleus.la EMBOSS-${EBOV}/nucleus/
if [ -e "${FILESDIR}"/${PF}.patch ]; then
cd "${S}"
epatch "${FILESDIR}"/${PF}.patch
fi
}
embassy_src_compile() {
local PREFIX="${ROOT}/usr"
local EXTRA_CONF
! use X && EXTRA_CONF="${EXTRA_CONF} --without-x"
! use png && EXTRA_CONF="${EXTRA_CONF} --without-pngdriver"
./configure \
"--bindir=${PREFIX}/bin" \
"--sbindir=${PREFIX}/sbin" \
"--libexecdir=${PREFIX}/libexec" \
"--sysconfdir=${ROOT}/etc" \
"--sharedstatedir=${ROOT}/var" \
"--localstatedir=${ROOT}/var" \
"--libdir=${PREFIX}/$(get_libdir)" \
"--includedir=${PREFIX}/include" \
"--datarootdir=${PREFIX}/share" \
"--datadir=${PREFIX}/share" \
"--infodir=${PREFIX}/share/info" \
"--localedir=${PREFIX}/share/locale" \
"--mandir=${PREFIX}/share/man" \
${EXTRA_CONF} || die
emake || die "Before reporting this error as a bug, please make sure you compiled
EMBOSS and the EMBASSY packages with the same \"USE\" flags. Failure to
do so may prevent the compilation of some EMBASSY packages, or cause
runtime problems with some EMBASSY programs. For example, if you
compile EMBOSS with \"png\" support and then try to build DOMAINATRIX
without \"png\" support, compilation will fail when linking the binaries."
}
embassy_src_install() {
emake DESTDIR="${D}" install || die "Install failed"
dodoc AUTHORS ChangeLog NEWS README
dodir /usr/share
mv "${D}"/usr/local/share/* "${D}"/usr/share/
rmdir "${D}"/usr/local/share
rmdir "${D}"/usr/local
}
EXPORT_FUNCTIONS src_unpack src_compile src_install

View File

@ -0,0 +1,7 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/emul-libs.eclass,v 1.9 2010/01/14 21:46:51 abcd Exp $
# @DEAD
# Scheduled for removal on 2012/01/14.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,49 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/emul-linux-x86.eclass,v 1.5 2010/02/22 20:52:52 pacho Exp $
#
# Original Author: Mike Doty <kingtaco@gentoo.org>
# Adapted from emul-libs.eclass
# Purpose: Providing a template for the app-emulation/emul-linux-* packages
#
EXPORT_FUNCTIONS src_unpack src_install
SRC_URI="mirror://gentoo/${PN}-${PV}.tar.bz2"
DESCRIPTION="Provides precompiled 32bit libraries"
#HOMEPAGE="http://amd64.gentoo.org/emul/content.xml"
HOMEPAGE="http://dev.gentoo.org/~pacho/emul.html"
RESTRICT="strip"
S=${WORKDIR}
SLOT="0"
IUSE=""
DEPEND=">=sys-apps/findutils-4.2.26"
RDEPEND=""
emul-linux-x86_src_unpack() {
unpack ${A}
cd "${S}"
ALLOWED=${ALLOWED:-^${S}/etc/env.d}
find "${S}" ! -type d ! -name '*.so*' | egrep -v "${ALLOWED}" | xargs -d $'\n' rm -f || die 'failed to remove everything but *.so*'
}
emul-linux-x86_src_install() {
for dir in etc/env.d etc/revdep-rebuild ; do
if [[ -d "${S}"/${dir} ]] ; then
for f in "${S}"/${dir}/* ; do
mv -f "$f"{,-emul}
done
fi
done
# remove void directories
find "${S}" -depth -type d -print0 | xargs -0 rmdir 2&>/dev/null
cp -pPR "${S}"/* "${D}"/ || die "copying files failed!"
}

View File

@ -0,0 +1,178 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/enlightenment.eclass,v 1.81 2010/02/28 10:52:06 tommy Exp $
#
# Author: vapier@gentoo.org
inherit eutils libtool
# E_STATE's:
# release [default]
# KEYWORDS arch
# SRC_URI $P.tar.gz
# S $WORKDIR/$P
#
# snap $PV has .200##### datestamp or .### counter
# KEYWORDS ~arch
# SRC_URI $P.tar.bz2
# S $WORKDIR/$P
#
# live $PV has a 9999 marker
# KEYWORDS ""
# SRC_URI cvs/svn/etc... up
# S $WORKDIR/$E_S_APPEND
#
# Overrides:
# KEYWORDS EKEY_STATE
# SRC_URI EURI_STATE
# S EURI_STATE
#E_LIVE_DEFAULT_CVS="cvs.sourceforge.net:/cvsroot/enlightenment"
E_LIVE_SERVER_DEFAULT_CVS="anoncvs.enlightenment.org:/var/cvs/e"
E_LIVE_SERVER_DEFAULT_SVN="http://svn.enlightenment.org/svn/e/trunk"
E_STATE="release"
if [[ ${PV/9999} != ${PV} ]] ; then
E_LIVE_SERVER=${E_LIVE_SERVER:-${E_LIVE_SERVER_DEFAULT_SVN}}
E_STATE="live"
WANT_AUTOTOOLS="yes"
# force people to opt-in to legacy cvs
if [[ -n ${ECVS_MODULE} ]] ; then
ECVS_SERVER=${ECVS_SERVER:-${E_LIVE_SERVER_DEFAULT_CVS}}
E_LIVE_SOURCE="cvs"
E_S_APPEND=${ECVS_MODULE}
inherit cvs
else
ESVN_URI_APPEND=${ESVN_URI_APPEND:-${PN}}
ESVN_PROJECT="enlightenment/${ESVN_SUB_PROJECT}"
ESVN_REPO_URI=${ESVN_SERVER:-${E_LIVE_SERVER_DEFAULT_SVN}}/${ESVN_SUB_PROJECT}/${ESVN_URI_APPEND}
E_S_APPEND=${ESVN_URI_APPEND}
E_LIVE_SOURCE="svn"
inherit subversion
fi
elif [[ -n ${E_SNAP_DATE} ]] ; then
E_STATE="snap"
else
E_STATE="release"
fi
if [[ ${WANT_AUTOTOOLS} == "yes" ]] ; then
WANT_AUTOCONF=${E_WANT_AUTOCONF:-latest}
WANT_AUTOMAKE=${E_WANT_AUTOMAKE:-latest}
inherit autotools
fi
ENLIGHTENMENT_EXPF="pkg_setup src_unpack src_compile src_install pkg_postinst"
case "${EAPI:-0}" in
2|3|4) ENLIGHTENMENT_EXPF+=" src_prepare src_configure" ;;
*) ;;
esac
EXPORT_FUNCTIONS ${ENLIGHTENMENT_EXPF}
DESCRIPTION="A DR17 production"
HOMEPAGE="http://www.enlightenment.org/"
case ${EURI_STATE:-${E_STATE}} in
release) SRC_URI="mirror://sourceforge/enlightenment/${P}.tar.gz";;
snap) SRC_URI="http://download.enlightenment.org/snapshots/${E_SNAP_DATE}/${P}.tar.bz2";;
live) SRC_URI="";;
esac
LICENSE="BSD"
SLOT="0"
case ${EKEY_STATE:-${E_STATE}} in
release) KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sh sparc x86 ~x86-fbsd";;
snap) KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd";;
live) KEYWORDS="";;
esac
IUSE="nls doc"
DEPEND="doc? ( app-doc/doxygen )"
RDEPEND="nls? ( sys-devel/gettext )"
# gettext (via `autopoint`) needs to run cvs #245073
[[ ${E_STATE} == "live" ]] && DEPEND="${DEPEND} dev-util/cvs"
case ${EURI_STATE:-${E_STATE}} in
release) S=${WORKDIR}/${P};;
snap) S=${WORKDIR}/${P};;
live) S=${WORKDIR}/${E_S_APPEND};;
esac
enlightenment_warning_msg() {
if [[ -n ${E_LIVE_SERVER} ]] ; then
einfo "Using user server for live sources: ${E_LIVE_SERVER}"
fi
if [[ ${E_STATE} == "snap" ]] ; then
ewarn "Please do not contact the E team about bugs in Gentoo."
ewarn "Only contact enlightenment@gentoo.org via e-mail or bugzilla."
ewarn "Remember, this stuff is DEV only code so dont cry when"
ewarn "I break you :)."
elif [[ ${E_STATE} == "live" ]] ; then
eerror "This is a LIVE SOURCES ebuild."
eerror "That means there are NO promises it will work."
eerror "If it fails to build, FIX THE CODE YOURSELF"
eerror "before reporting any issues."
fi
}
enlightenment_die() {
enlightenment_warning_msg
die "$@"$'\n'"!!! SEND BUG REPORTS TO enlightenment@gentoo.org NOT THE E TEAM"
}
enlightenment_pkg_setup() {
: enlightenment_warning_msg
}
enlightenment_src_unpack() {
if [[ ${E_STATE} == "live" ]] ; then
case ${E_LIVE_SOURCE} in
cvs) cvs_src_unpack;;
svn) subversion_src_unpack;;
*) die "eek!";;
esac
else
unpack ${A}
fi
hasq src_prepare ${ENLIGHTENMENT_EXPF} || enlightenment_src_prepare
}
enlightenment_src_prepare() {
[[ -s gendoc ]] && chmod a+rx gendoc
if [[ ${WANT_AUTOTOOLS} == "yes" ]] ; then
[[ -d po ]] && eautopoint -f
# autotools require README, when README.in is around, but README
# is created later in configure step
[[ -f README.in ]] && touch README
eautoreconf
fi
epunt_cxx
elibtoolize
}
enlightenment_src_configure() {
# gstreamer sucks, work around it doing stupid stuff
export GST_REGISTRY="${S}/registry.xml"
econf ${MY_ECONF}
}
enlightenment_src_compile() {
hasq src_configure ${ENLIGHTENMENT_EXPF} || enlightenment_src_configure
emake || enlightenment_die "emake failed"
use doc && [[ -x ./gendoc ]] && { ./gendoc || enlightenment_die "gendoc failed" ; }
}
enlightenment_src_install() {
emake install DESTDIR="${D}" || enlightenment_die
find "${D}" '(' -name CVS -o -name .svn -o -name .git ')' -type d -exec rm -rf '{}' \; 2>/dev/null
for d in AUTHORS ChangeLog NEWS README TODO ${EDOCS}; do
[[ -f ${d} ]] && dodoc ${d}
done
use doc && [[ -d doc ]] && dohtml -r doc/*
}
enlightenment_pkg_postinst() {
: enlightenment_warning_msg
}

View File

@ -0,0 +1,35 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/fdo-mime.eclass,v 1.8 2008/12/23 01:28:49 solar Exp $
# @ECLASS: fdo-mime.eclass
# @MAINTAINER: freedesktop-bugs@gentoo.org
#
#
# Original author: foser <foser@gentoo.org>
# @BLURB: Utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations
# @FUNCTION: fdo-mime_desktop_database_update
# @DESCRIPTION:
# Updates the desktop database.
# Generates a list of mimetypes linked to applications that can handle them
fdo-mime_desktop_database_update() {
if [ -x "/usr/bin/update-desktop-database" ]
then
einfo "Updating desktop mime database ..."
"/usr/bin/update-desktop-database" -q "${ROOT}/usr/share/applications"
fi
}
# @FUNCTION: fdo-mime_mime_database_update
# @DESCRIPTION:
# Update the mime database.
# Creates a general list of mime types from several sources
fdo-mime_mime_database_update() {
if [ -x "/usr/bin/update-mime-database" ]
then
einfo "Updating shared mime info database ..."
"/usr/bin/update-mime-database" "${ROOT}/usr/share/mime"
fi
}

View File

@ -0,0 +1,56 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/findlib.eclass,v 1.9 2009/02/08 21:30:12 maekke Exp $
# @ECLASS: findlib.eclass
# @MAINTAINER:
# ml@gentoo.org
#
# Original author : Matthieu Sozeau <mattam@gentoo.org> (retired)
#
# Changes: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/findlib.eclass?view=log
# @BLURB: ocamlfind (a.k.a. findlib) eclass
# @DESCRIPTION:
# ocamlfind (a.k.a. findlib) eclass
# From this findlib version there is proper stublibs support.
DEPEND=">=dev-ml/findlib-1.0.4-r1"
[[ ${FINDLIB_USE} ]] && DEPEND="${FINDLIB_USE}? ( ${DEPEND} )"
check_ocamlfind() {
if [ ! -x /usr/bin/ocamlfind ]
then
eerror "In findlib.eclass: could not find the ocamlfind executable"
eerror "Please report this bug on gentoo's bugzilla, assigning to ml@gentoo.org"
die "ocamlfind executabled not found"
fi
}
# @FUNCTION: findlib_src_preinst
# @DESCRIPTION:
# Prepare the image for a findlib installation.
# We use the stublibs style, so no ld.conf needs to be
# updated when a package installs C shared libraries.
findlib_src_preinst() {
check_ocamlfind
# destdir is the ocaml sitelib
local destdir=`ocamlfind printconf destdir`
dodir ${destdir} || die "dodir failed"
export OCAMLFIND_DESTDIR=${D}${destdir}
# stublibs style
dodir ${destdir}/stublibs || die "dodir failed"
export OCAMLFIND_LDCONF=ignore
}
# @FUNCTION: findlib_src_install
# @DESCRIPTION:
# Install with a properly setup findlib
findlib_src_install() {
findlib_src_preinst
make DESTDIR="${D}" "$@" install || die "make failed"
}

View File

@ -0,0 +1,44 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/fixheadtails.eclass,v 1.11 2008/02/19 05:27:25 vapier Exp $
#
# Original author John Mylchreest <johnm@gentoo.org>
# @ECLASS: fixheadtails.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @BLURB: functions to replace obsolete head/tail with POSIX compliant ones
DEPEND=">=sys-apps/sed-4"
__do_sed_fix() {
einfo " - fixed $1"
sed -i \
-e 's/head \+-\([0-9]\)/head -n \1/g' \
-e 's/tail \+\([-+][0-9]\+\)c/tail -c \1/g' \
-e 's/tail \+\([-+][0-9]\)/tail -n \1/g' ${1} || \
die "sed ${1} failed"
}
# @FUNCTION: ht_fix_file
# @USAGE: <files>
# @DESCRIPTION:
# Fix all the specified files.
ht_fix_file() {
local i
einfo "Replacing obsolete head/tail with POSIX compliant ones"
for i in "$@" ; do
__do_sed_fix "$i"
done
}
# @FUNCTION: ht_fix_all
# @DESCRIPTION:
# Find and fix all files in the current directory as needed.
ht_fix_all() {
local MATCHES
MATCHES=$(grep -l -s -i -R -e "head -[ 0-9]" -e "tail [+-][ 0-9]" * | sort -u)
[[ -n ${MATCHES} ]] \
&& ht_fix_file ${MATCHES} \
|| einfo "No need for ht_fix_all anymore !"
}

View File

@ -0,0 +1,746 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.146 2010/02/17 18:20:49 ssuominen Exp $
# @ECLASS: flag-o-matic.eclass
# @MAINTAINER:
# toolchain@gentoo.org
# @BLURB: common functions to manipulate and query toolchain flags
# @DESCRIPTION:
# This eclass contains a suite of functions to help developers sanely
# and safely manage toolchain flags in their builds.
inherit eutils toolchain-funcs multilib
################ DEPRECATED functions ################
# The following are still present to avoid breaking existing
# code more than necessary; however they are deprecated. Please
# use gcc-specs-* from toolchain-funcs.eclass instead, if you
# need to know which hardened techs are active in the compiler.
# See bug #100974
#
# has_hardened
# has_pie
# has_pic
# has_ssp_all
# has_ssp
# {C,CXX,F,FC}FLAGS that we allow in strip-flags
# Note: shell globs and character lists are allowed
setup-allowed-flags() {
if [[ -z ${ALLOWED_FLAGS} ]] ; then
export ALLOWED_FLAGS="-pipe"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-strict-overflow"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g[0-9] -ggdb -ggdb[0-9] -gstabs -gstabs+"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-ident"
export ALLOWED_FLAGS="${ALLOWED_FLAGS} -W* -w"
fi
# allow a bunch of flags that negate features / control ABI
ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all \
-fno-strict-aliasing -fno-bounds-checking -fstrict-overflow -fno-omit-frame-pointer"
ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \
-mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 \
-mno-sse4.2 -mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow \
-mno-popcnt -mno-abm \
-mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt \
-msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \
-mieee -mieee-with-inexact -mschedule \
-mtls-direct-seg-refs -mno-tls-direct-seg-refs \
-mflat -mno-flat -mno-faster-structs -mfaster-structs \
-m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \
-mlive-g0 -mcmodel -mstack-bias -mno-stack-bias \
-msecure-plt -m*-toc -D* -U*"
# {C,CXX,F,FC}FLAGS that we are think is ok, but needs testing
# NOTE: currently -Os have issues with gcc3 and K6* arch's
export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks"
return 0
}
# inverted filters for hardened compiler. This is trying to unpick
# the hardened compiler defaults.
_filter-hardened() {
local f
for f in "$@" ; do
case "${f}" in
# Ideally we should only concern ourselves with PIE flags,
# not -fPIC or -fpic, but too many places filter -fPIC without
# thinking about -fPIE.
-fPIC|-fpic|-fPIE|-fpie|-Wl,pie|-pie)
gcc-specs-pie || continue
is-flagq -nopie || append-flags -nopie;;
-fstack-protector)
gcc-specs-ssp || continue
is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector);;
-fstack-protector-all)
gcc-specs-ssp-to-all || continue
is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all);;
-fno-strict-overflow)
gcc-specs-nostrict || continue
is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow);;
esac
done
}
# Remove occurrences of strings from variable given in $1
# Strings removed are matched as globs, so for example
# '-O*' would remove -O1, -O2 etc.
_filter-var() {
local f x VAR VAL
declare -a new
VAR=$1
shift
eval VAL=\${${VAR}}
for f in ${VAL}; do
for x in "$@"; do
# Note this should work with globs like -O*
[[ ${f} == ${x} ]] && continue 2
done
eval new\[\${\#new\[@]}]=\${f}
done
eval export ${VAR}=\${new\[*]}
}
# @FUNCTION: filter-flags
# @USAGE: <flags>
# @DESCRIPTION:
# Remove particular <flags> from {C,CPP,CXX,F,FC}FLAGS. Accepts shell globs.
filter-flags() {
_filter-hardened "$@"
_filter-var CFLAGS "$@"
_filter-var CPPFLAGS "$@"
_filter-var CXXFLAGS "$@"
_filter-var FFLAGS "$@"
_filter-var FCFLAGS "$@"
return 0
}
# @FUNCTION: filter-lfs-flags
# @DESCRIPTION:
# Remove flags that enable Large File Support.
filter-lfs-flags() {
[[ -n $@ ]] && die "filter-lfs-flags takes no arguments"
filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
}
# @FUNCTION: append-cppflags
# @USAGE: <flags>
# @DESCRIPTION:
# Add extra <flags> to the current CPPFLAGS.
append-cppflags() {
[[ -z $* ]] && return 0
export CPPFLAGS="${CPPFLAGS} $*"
return 0
}
# @FUNCTION: append-cflags
# @USAGE: <flags>
# @DESCRIPTION:
# Add extra <flags> to the current CFLAGS.
append-cflags() {
[[ -z $* ]] && return 0
export CFLAGS="${CFLAGS} $*"
return 0
}
# @FUNCTION: append-cxxflags
# @USAGE: <flags>
# @DESCRIPTION:
# Add extra <flags> to the current CXXFLAGS.
append-cxxflags() {
[[ -z $* ]] && return 0
export CXXFLAGS="${CXXFLAGS} $*"
return 0
}
# @FUNCTION: append-fflags
# @USAGE: <flags>
# @DESCRIPTION:
# Add extra <flags> to the current {F,FC}FLAGS.
append-fflags() {
[[ -z $* ]] && return 0
export FFLAGS="${FFLAGS} $*"
export FCFLAGS="${FCFLAGS} $*"
return 0
}
# @FUNCTION: append-lfs-flags
# @DESCRIPTION:
# Add flags that enable Large File Support.
append-lfs-flags() {
[[ -n $@ ]] && die "append-lfs-flags takes no arguments"
append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
}
# @FUNCTION: append-flags
# @USAGE: <flags>
# @DESCRIPTION:
# Add extra <flags> to your current {C,CXX,F,FC}FLAGS.
append-flags() {
[[ -z $* ]] && return 0
append-cflags "$@"
append-cxxflags "$@"
append-fflags "$@"
return 0
}
# @FUNCTION: replace-flags
# @USAGE: <old> <new>
# @DESCRIPTION:
# Replace the <old> flag with <new>. Accepts shell globs for <old>.
replace-flags() {
[[ $# != 2 ]] \
&& echo && eerror "Usage: replace-flags <old flag> <new flag>" \
&& die "replace-flags takes 2 arguments, not $#"
local f fset
declare -a new_CFLAGS new_CXXFLAGS new_FFLAGS new_FCFLAGS
for fset in CFLAGS CXXFLAGS FFLAGS FCFLAGS; do
# Looping over the flags instead of using a global
# substitution ensures that we're working with flag atoms.
# Otherwise globs like -O* have the potential to wipe out the
# list of flags.
for f in ${!fset}; do
# Note this should work with globs like -O*
[[ ${f} == ${1} ]] && f=${2}
eval new_${fset}\[\${\#new_${fset}\[@]}]=\${f}
done
eval export ${fset}=\${new_${fset}\[*]}
done
return 0
}
# @FUNCTION: replace-cpu-flags
# @USAGE: <old> <new>
# @DESCRIPTION:
# Replace cpu flags (like -march/-mcpu/-mtune) that select the <old> cpu
# with flags that select the <new> cpu. Accepts shell globs for <old>.
replace-cpu-flags() {
local newcpu="$#" ; newcpu="${!newcpu}"
while [ $# -gt 1 ] ; do
# quote to make sure that no globbing is done (particularly on
# ${oldcpu}) prior to calling replace-flags
replace-flags "-march=${1}" "-march=${newcpu}"
replace-flags "-mcpu=${1}" "-mcpu=${newcpu}"
replace-flags "-mtune=${1}" "-mtune=${newcpu}"
shift
done
return 0
}
_is_flagq() {
local x
for x in ${!1} ; do
[[ ${x} == $2 ]] && return 0
done
return 1
}
# @FUNCTION: is-flagq
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is in {C,CXX,F,FC}FLAGS, else returns shell false. Accepts shell globs.
is-flagq() {
[[ -n $2 ]] && die "Usage: is-flag <flag>"
_is_flagq CFLAGS $1 || _is_flagq CXXFLAGS $1 || _is_flagq FFLAGS $1 || _is_flagq FCFLAGS $1
}
# @FUNCTION: is-flag
# @USAGE: <flag>
# @DESCRIPTION:
# Echo's "true" if flag is set in {C,CXX,F,FC}FLAGS. Accepts shell globs.
is-flag() {
is-flagq "$@" && echo true
}
# @FUNCTION: is-ldflagq
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is in LDFLAGS, else returns shell false. Accepts shell globs.
is-ldflagq() {
[[ -n $2 ]] && die "Usage: is-ldflag <flag>"
_is_flagq LDFLAGS $1
}
# @FUNCTION: is-ldflag
# @USAGE: <flag>
# @DESCRIPTION:
# Echo's "true" if flag is set in LDFLAGS. Accepts shell globs.
is-ldflag() {
is-ldflagq "$@" && echo true
}
# @FUNCTION: filter-mfpmath
# @USAGE: <math types>
# @DESCRIPTION:
# Remove specified math types from the fpmath flag. For example, if the user
# has -mfpmath=sse,386, running `filter-mfpmath sse` will leave the user with
# -mfpmath=386.
filter-mfpmath() {
local orig_mfpmath new_math prune_math
# save the original -mfpmath flag
orig_mfpmath=$(get-flag -mfpmath)
# get the value of the current -mfpmath flag
new_math=$(get-flag mfpmath)
new_math=" ${new_math//,/ } "
# figure out which math values are to be removed
prune_math=""
for prune_math in "$@" ; do
new_math=${new_math/ ${prune_math} / }
done
new_math=$(echo ${new_math})
new_math=${new_math// /,}
if [[ -z ${new_math} ]] ; then
# if we're removing all user specified math values are
# slated for removal, then we just filter the flag
filter-flags ${orig_mfpmath}
else
# if we only want to filter some of the user specified
# math values, then we replace the current flag
replace-flags ${orig_mfpmath} -mfpmath=${new_math}
fi
return 0
}
# @FUNCTION: strip-flags
# @DESCRIPTION:
# Strip C[XX]FLAGS of everything except known good/safe flags.
strip-flags() {
local x y flag NEW_CFLAGS NEW_CXXFLAGS NEW_FFLAGS NEW_FCFLAGS
setup-allowed-flags
local NEW_CFLAGS=""
local NEW_CXXFLAGS=""
local NEW_FFLAGS=""
local NEW_FCFLAGS=""
# Allow unstable C[XX]FLAGS if we are using unstable profile ...
if has "~$(tc-arch)" ${ACCEPT_KEYWORDS} ; then
ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}"
fi
set -f # disable pathname expansion
for x in ${CFLAGS}; do
for y in ${ALLOWED_FLAGS}; do
flag=${x%%=*}
if [ "${flag%%${y}}" = "" ] ; then
NEW_CFLAGS="${NEW_CFLAGS} ${x}"
break
fi
done
done
for x in ${CXXFLAGS}; do
for y in ${ALLOWED_FLAGS}; do
flag=${x%%=*}
if [ "${flag%%${y}}" = "" ] ; then
NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}"
break
fi
done
done
for x in ${FFLAGS}; do
for y in ${ALLOWED_FLAGS}; do
flag=${x%%=*}
if [ "${flag%%${y}}" = "" ] ; then
NEW_FFLAGS="${NEW_FFLAGS} ${x}"
break
fi
done
done
for x in ${FCFLAGS}; do
for y in ${ALLOWED_FLAGS}; do
flag=${x%%=*}
if [ "${flag%%${y}}" = "" ] ; then
NEW_FCFLAGS="${NEW_FCFLAGS} ${x}"
break
fi
done
done
# In case we filtered out all optimization flags fallback to -O2
if [ "${CFLAGS/-O}" != "${CFLAGS}" -a "${NEW_CFLAGS/-O}" = "${NEW_CFLAGS}" ]; then
NEW_CFLAGS="${NEW_CFLAGS} -O2"
fi
if [ "${CXXFLAGS/-O}" != "${CXXFLAGS}" -a "${NEW_CXXFLAGS/-O}" = "${NEW_CXXFLAGS}" ]; then
NEW_CXXFLAGS="${NEW_CXXFLAGS} -O2"
fi
if [ "${FFLAGS/-O}" != "${FFLAGS}" -a "${NEW_FFLAGS/-O}" = "${NEW_FFLAGS}" ]; then
NEW_FFLAGS="${NEW_FFLAGS} -O2"
fi
if [ "${FCFLAGS/-O}" != "${FCFLAGS}" -a "${NEW_FCFLAGS/-O}" = "${NEW_FCFLAGS}" ]; then
NEW_FCFLAGS="${NEW_FCFLAGS} -O2"
fi
set +f # re-enable pathname expansion
export CFLAGS="${NEW_CFLAGS}"
export CXXFLAGS="${NEW_CXXFLAGS}"
export FFLAGS="${NEW_FFLAGS}"
export FCFLAGS="${NEW_FCFLAGS}"
return 0
}
test-flag-PROG() {
local comp=$1
local flags="$2"
[[ -z ${comp} || -z ${flags} ]] && \
return 1
local PROG=$(tc-get${comp})
${PROG} ${flags} -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1
}
# @FUNCTION: test-flag-CC
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the C compiler, else returns shell false.
test-flag-CC() { test-flag-PROG "CC" "$1"; }
# @FUNCTION: test-flag-CXX
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the C++ compiler, else returns shell false.
test-flag-CXX() { test-flag-PROG "CXX" "$1"; }
# @FUNCTION: test-flag-F77
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false.
test-flag-F77() { test-flag-PROG "F77" "$1"; }
# @FUNCTION: test-flag-FC
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
test-flag-FC() { test-flag-PROG "FC" "$1"; }
test-flags-PROG() {
local comp=$1
local flags
local x
shift
[[ -z ${comp} ]] && return 1
x=""
for x in "$@" ; do
test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}"
done
echo "${flags}"
# Just bail if we dont have any flags
[[ -n ${flags} ]]
}
# @FUNCTION: test-flags-CC
# @USAGE: <flags>
# @DESCRIPTION:
# Returns shell true if <flags> are supported by the C compiler, else returns shell false.
test-flags-CC() { test-flags-PROG "CC" "$@"; }
# @FUNCTION: test-flags-CXX
# @USAGE: <flags>
# @DESCRIPTION:
# Returns shell true if <flags> are supported by the C++ compiler, else returns shell false.
test-flags-CXX() { test-flags-PROG "CXX" "$@"; }
# @FUNCTION: test-flags-F77
# @USAGE: <flags>
# @DESCRIPTION:
# Returns shell true if <flags> are supported by the Fortran 77 compiler, else returns shell false.
test-flags-F77() { test-flags-PROG "F77" "$@"; }
# @FUNCTION: test-flags-FC
# @USAGE: <flags>
# @DESCRIPTION:
# Returns shell true if <flags> are supported by the Fortran 90 compiler, else returns shell false.
test-flags-FC() { test-flags-PROG "FC" "$@"; }
# @FUNCTION: test-flags
# @USAGE: <flags>
# @DESCRIPTION:
# Short-hand that should hopefully work for both C and C++ compiler, but
# its really only present due to the append-flags() abomination.
test-flags() { test-flags-CC "$@"; }
# @FUNCTION: test_flag
# @DESCRIPTION:
# DEPRICIATED, use test-flags()
test_flag() {
ewarn "test_flag: deprecated, please use test-flags()!" >&2
test-flags-CC "$@"
}
# @FUNCTION: test_version_info
# @USAGE: <version>
# @DESCRIPTION:
# Returns shell true if the current C compiler version matches <version>, else returns shell false.
# Accepts shell globs.
test_version_info() {
if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
return 0
else
return 1
fi
}
# @FUNCTION: strip-unsupported-flags
# @DESCRIPTION:
# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain.
strip-unsupported-flags() {
export CFLAGS=$(test-flags-CC ${CFLAGS})
export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
export FFLAGS=$(test-flags-F77 ${FFLAGS})
export FCFLAGS=$(test-flags-FC ${FCFLAGS})
}
# @FUNCTION: get-flag
# @USAGE: <flag>
# @DESCRIPTION:
# Find and echo the value for a particular flag. Accepts shell globs.
get-flag() {
local f findflag="$1"
# this code looks a little flaky but seems to work for
# everything we want ...
# for example, if CFLAGS="-march=i686":
# `get-flag -march` == "-march=i686"
# `get-flag march` == "i686"
for f in ${CFLAGS} ${CXXFLAGS} ${FFLAGS} ${FCFLAGS} ; do
if [ "${f/${findflag}}" != "${f}" ] ; then
printf "%s\n" "${f/-${findflag}=}"
return 0
fi
done
return 1
}
# @FUNCTION: has_hardened
# @DESCRIPTION:
# DEPRECATED - use gcc-specs-relro or gcc-specs-now from toolchain-funcs
has_hardened() {
ewarn "has_hardened: deprecated, please use gcc-specs-{relro,now}()!" >&2
test_version_info Hardened && return 0
# The specs file wont exist unless gcc has GCC_SPECS support
[[ -f ${GCC_SPECS} && ${GCC_SPECS} != ${GCC_SPECS/hardened/} ]]
}
# @FUNCTION: has_pic
# @DESCRIPTION:
# DEPRECATED - use gcc-specs-pie from toolchain-funcs
# indicate whether PIC is set
has_pic() {
ewarn "has_pic: deprecated, please use gcc-specs-pie()!" >&2
[[ ${CFLAGS/-fPIC} != ${CFLAGS} || \
${CFLAGS/-fpic} != ${CFLAGS} ]] || \
gcc-specs-pie
}
# @FUNCTION: has_pie
# @DESCRIPTION:
# DEPRECATED - use gcc-specs-pie from toolchain-funcs
# indicate whether PIE is set
has_pie() {
ewarn "has_pie: deprecated, please use gcc-specs-pie()!" >&2
[[ ${CFLAGS/-fPIE} != ${CFLAGS} || \
${CFLAGS/-fpie} != ${CFLAGS} ]] || \
gcc-specs-pie
}
# @FUNCTION: has_ssp_all
# @DESCRIPTION:
# DEPRECATED - use gcc-specs-ssp from toolchain-funcs
# indicate whether code for SSP is being generated for all functions
has_ssp_all() {
ewarn "has_ssp_all: deprecated, please use gcc-specs-ssp()!" >&2
# note; this matches only -fstack-protector-all
[[ ${CFLAGS/-fstack-protector-all} != ${CFLAGS} || \
-n $(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP_ALL__) ]] || \
gcc-specs-ssp-to-all
}
# @FUNCTION: has_ssp
# @DESCRIPTION:
# DEPRECATED - use gcc-specs-ssp from toolchain-funcs
# indicate whether code for SSP is being generated
has_ssp() {
ewarn "has_ssp: deprecated, please use gcc-specs-ssp()!" >&2
# note; this matches both -fstack-protector and -fstack-protector-all
[[ ${CFLAGS/-fstack-protector} != ${CFLAGS} || \
-n $(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP__) ]] || \
gcc-specs-ssp
}
# @FUNCTION: has_m64
# @DESCRIPTION:
# This doesn't test if the flag is accepted, it tests if the flag actually
# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works
# return code is 0, else the return code is 1.
has_m64() {
# this doesnt test if the flag is accepted, it tests if the flag
# actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
# please dont replace this function with test_flag in some future
# clean-up!
local temp="$(emktemp)"
echo "int main() { return(0); }" > "${temp}".c
MY_CC=$(tc-getCC)
${MY_CC/ .*/} -m64 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1
local ret=$?
rm -f "${temp}".c
[[ ${ret} != 1 ]] && return 0
return 1
}
# @FUNCTION: has_m32
# @DESCRIPTION:
# This doesn't test if the flag is accepted, it tests if the flag actually
# WORKS. Non-mulilib gcc will take both -m32 and -64. If the flag works return
# code is 0, else return code is 1.
has_m32() {
# this doesnt test if the flag is accepted, it tests if the flag
# actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
# please dont replace this function with test_flag in some future
# clean-up!
[ "$(tc-arch)" = "amd64" ] && has_multilib_profile && return 0
local temp=$(emktemp)
echo "int main() { return(0); }" > "${temp}".c
MY_CC=$(tc-getCC)
${MY_CC/ .*/} -m32 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1
local ret=$?
rm -f "${temp}".c
[[ ${ret} != 1 ]] && return 0
return 1
}
# @FUNCTION: replace-sparc64-flags
# @DESCRIPTION:
# Sets mcpu to v8 and uses the original value as mtune if none specified.
replace-sparc64-flags() {
local SPARC64_CPUS="ultrasparc3 ultrasparc v9"
if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
for x in ${SPARC64_CPUS}; do
CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}"
done
else
for x in ${SPARC64_CPUS}; do
CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
done
fi
if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
for x in ${SPARC64_CPUS}; do
CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}"
done
else
for x in ${SPARC64_CPUS}; do
CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
done
fi
export CFLAGS CXXFLAGS
}
# @FUNCTION: append-ldflags
# @USAGE: <flags>
# @DESCRIPTION:
# Add extra <flags> to the current LDFLAGS.
append-ldflags() {
[[ -z $* ]] && return 0
local flag
for flag in "$@"; do
[[ ${flag} == -l* ]] && \
ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS"
done
export LDFLAGS="${LDFLAGS} $*"
return 0
}
# @FUNCTION: filter-ldflags
# @USAGE: <flags>
# @DESCRIPTION:
# Remove particular <flags> from LDFLAGS. Accepts shell globs.
filter-ldflags() {
_filter-var LDFLAGS "$@"
return 0
}
# @FUNCTION: raw-ldflags
# @USAGE: <flags>
# @DESCRIPTION:
# Turn C style ldflags (-Wl,-foo) into straight ldflags - the results
# are suitable for passing directly to 'ld'; note LDFLAGS is usually passed
# to gcc where it needs the '-Wl,'.
raw-ldflags() {
local x input="$@"
[[ -z ${input} ]] && input=${LDFLAGS}
set --
for x in ${input} ; do
x=${x#-Wl,}
set -- "$@" ${x//,/ }
done
echo "$@"
}
# @FUNCTION: no-as-needed
# @RETURN: Flag to disable asneeded behavior for use with append-ldflags.
no-as-needed() {
case $($(tc-getLD) -v 2>&1 </dev/null) in
*GNU*) # GNU ld
echo "-Wl,--no-as-needed" ;;
esac
}
# Some tests for when we screw with things and want to make
# sure we didn't break anything
#TESTS() {
# CFLAGS="-a -b -c=1"
# CXXFLAGS="-x -y -z=2"
# LDFLAGS="-l -m -n=3"
#
# die() { exit 1; }
# (is-flag 1 2 3) && die
# (is-ldflag 1 2 3) && die
#
# is-flagq -l && die
# is-ldflagq -a && die
# is-flagq -a || die
# is-flagq -x || die
# is-ldflagq -n=* || die
# is-ldflagq -n && die
#
# strip-unsupported-flags
# [[ ${CFLAGS} == "-c=1" ]] || die
# [[ ${CXXFLAGS} == "-y -z=2" ]] || die
#
# echo "All tests pass"
#}
#TESTS

View File

@ -0,0 +1,46 @@
# Copyright 2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/font-ebdftopcf.eclass,v 1.5 2007/09/16 02:56:19 dirtyepic Exp $
# Author: Robin H. Johnson <robbat2@gentoo.org>
# font-ebdftopcf.eclass
# Eclass to make PCF font generator from BDF uniform and optimal
# The manpage for this eclass is in media-gfx/ebdftopcf.
# inherit this eclass after font.eclass
# if USE="-X", this eclass is basically a no-op, since bdftopcf requires Xorg.
IUSE="X"
# Variable declarations
DEPEND="X? ( media-gfx/ebdftopcf )"
RDEPEND=""
use X && FONT_SUFFIX="pcf.gz"
use X || FONT_SUFFIX="bdf"
#
# Public functions
#
ebdftopcf() {
local bdffiles
bdffiles="$@"
[ -z "$bdffiles" ] && die "No BDF files specified."
emake -f /usr/share/ebdftopcf/Makefile.ebdftopcf \
BDFFILES="${bdffiles}" \
BDFTOPCF_PARAMS="${BDFTOPCF_PARAMS}" \
|| die "Failed to build PCF files"
}
#
# Public inheritable functions
#
font-ebdftopcf_src_compile() {
if use X; then
[ -z "${BDFFILES}" ] && BDFFILES="$(find . -name '*.bdf')"
ebdftopcf ${BDFFILES}
fi
}
EXPORT_FUNCTIONS src_compile

View File

@ -0,0 +1,184 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.48 2010/02/09 17:15:08 scarabeus Exp $
# @ECLASS: font.eclass
# @MAINTAINER:
# fonts@gentoo.org
# Author: Tomáš Chvátal <scarabeus@gentoo.org>
# Author: foser <foser@gentoo.org>
# @BLURB: Eclass to make font installation uniform
inherit eutils
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: FONT_SUFFIX
# @DESCRIPTION:
# Space delimited list of font suffixes to install
FONT_SUFFIX=${FONT_SUFFIX:=}
# @ECLASS-VARIABLE: FONT_S
# @DESCRIPTION:
# Dir containing the fonts
FONT_S=${FONT_S:=${S}}
# @ECLASS-VARIABLE: FONT_PN
# @DESCRIPTION:
# Last part of $FONTDIR
FONT_PN=${FONT_PN:=${PN}}
# @ECLASS-VARIABLE: FONTDIR
# @DESCRIPTION:
# This is where the fonts are installed
FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
# @ECLASS-VARIABLE: FONT_CONF
# @DESCRIPTION:
# Array, which element(s) is(are) path(s) of fontconfig-2.4 file(s) to install
FONT_CONF=( "" )
# @ECLASS-VARIABLE: DOCS
# @DESCRIPTION:
# Docs to install
DOCS=${DOCS:-}
IUSE="X"
DEPEND="X? (
x11-apps/mkfontdir
media-fonts/encodings
)
>=media-libs/fontconfig-2.4.0"
# @FUNCTION: font_xfont_config
# @DESCRIPTION:
# Creates the Xfont files.
font_xfont_config() {
# create Xfont files
if has X ${IUSE//+} && use X ; then
ebegin "Creating fonts.scale & fonts.dir"
rm -f "${ED}${FONTDIR}"/fonts.{dir,scale}
mkfontscale "${ED}${FONTDIR}"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
"${ED}${FONTDIR}"
eend $?
if [ -e "${FONT_S}/fonts.alias" ] ; then
doins "${FONT_S}/fonts.alias"
fi
fi
}
# @FUNCTION: font_fontconfig
# @DESCRIPTION:
# Installs the fontconfig config files of 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_src_install
# @DESCRIPTION:
# The font src_install function.
font_src_install() {
local suffix commondoc
pushd "${FONT_S}" > /dev/null
insinto "${FONTDIR}"
for suffix in ${FONT_SUFFIX}; do
doins *.${suffix}
done
rm -f fonts.{dir,scale} encodings.dir
font_xfont_config
font_fontconfig
popd > /dev/null
[[ -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_setup
# @DESCRIPTION:
# The font pkg_setup function.
# Collision portection 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_pkg_postinst
# @DESCRIPTION:
# The font pkg_postinst function.
# Update global font cache and fix permissions.
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 [[ ${ROOT} == / ]]; then
ebegin "Updating global fontcache"
fc-cache -fs
eend $?
fi
}
# @FUNCTION: font_pkg_postrm
# @DESCRIPTION:
# The font pkg_postrm function.
# Updates global font cache
font_pkg_postrm() {
# unreadable font files = fontconfig segfaults
find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
| xargs -0 chmod -v 0644 2>/dev/null
if [[ ${ROOT} == / ]]; then
ebegin "Updating global fontcache"
fc-cache -fs
eend $?
fi
}

View File

@ -0,0 +1,216 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/fortran.eclass,v 1.21 2009/03/07 10:02:33 maekke Exp $
#
# Author: Danny van Dyk <kugelfang@gentoo.org>
#
inherit eutils autotools
DESCRIPTION="Based on the ${ECLASS} eclass"
IUSE="debug"
#DEPEND="virtual/fortran" # Let's aim for this...
# Which Fortran Compiler has been selected ?
export FORTRANC
# These are the options to ./configure / econf that enable the usage
# of a specific Fortran Compiler. If your package uses a different
# option that the one listed here, overwrite it in your ebuild.
g77_CONF="--with-f77"
f2c_CONF="--with-f2c"
# This function prints the necessary options for the currently selected
# Fortran Compiler.
fortran_conf() {
echo $(eval echo \${$(echo -n ${FORTRANC})_CONF})
}
# need_fortran(<profiles>):
# profiles = <profile> ... <profile>
#
# profile:
# * gfortran - GCC Fortran 95
# * g77 - GCC Fortran 77
# * f2c - Fortran 2 C Translator
# * ifc - Intel Fortran Compiler
# * f95 - Sun Studio Fortran Compiler
#
# Checks if at least one of <profiles> is installed.
# Checks also if F77 (the fortran compiler to use) is available
# on the System.
need_fortran() {
if [ -z "$*" ]; then
eerror "Call need_fortran with at least one argument !"
fi
local AVAILABLE
local PROFILE
for PROFILE in $@; do
case ${PROFILE} in
gfortran)
if [ -x "$(type -P gfortran 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} gfortran"
fi
;;
g77)
if [ -x "$(type -P g77 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} g77"
fi
;;
f2c)
if [ -x "$(type -P f2c 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} f2c"
fi
;;
ifc)
case ${ARCH} in
x86|ia64|amd64)
if [ -x "$(type -P ifort 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} ifort"
elif [ -x "$(type -P ifc 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} ifc"
fi
;;
*)
;;
esac
;;
f95)
case ${ARCH} in
x86|amd64)
if [ -x "$(type -P f95 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} f95"
fi
;;
*)
;;
esac
;;
esac
done
AVAILABLE="${AVAILABLE/^[[:space:]]}"
use debug && echo ${AVAILABLE}
if [ -z "${AVAILABLE}" ]; then
eerror "None of the needed Fortran Compilers ($@) is installed."
eerror "To install one of these, choose one of the following steps:"
i=1
for PROFILE in $@; do
case ${PROFILE} in
gfortran)
eerror "[${i}] USE=\"fortran\" emerge =sys-devel/gcc-4*"
;;
g77)
eerror "[${i}] USE=\"fortran\" emerge =sys-devel/gcc-3*"
;;
f2c)
eerror "[${i}] emerge dev-lang/f2c"
;;
ifc)
case ${ARCH} in
x86|ia64)
eerror "[${i}] emerge dev-lang/ifc"
;;
*)
;;
esac
;;
f95)
case ${ARCH} in
x86|amd64)
eerror "[${i}] emerge dev-lang/sunstudio"
;;
*)
;;
esac
;;
esac
i=$((i + 1))
done
die "Install a Fortran Compiler !"
else
einfo "You need one of these Fortran Compilers: $@"
einfo "Installed are: ${AVAILABLE}"
if [ -n "${F77}" -o -n "${FC}" -o -n "${F2C}" ]; then
if [ -n "${F77}" ]; then
FC="${F77}" # F77 overwrites FC
fi
if [ -n "${FC}" -a -n "${F2C}" ]; then
ewarn "Using ${FC} and f2c is impossible. Disabling F2C !"
F2C="" # Disabling f2c
MY_FORTRAN="$(basename ${FC})" # set MY_FORTRAN to filename of
# the Fortran Compiler
else
if [ -n "${F2C}" ]; then
MY_FORTRAN="$(basename ${F2C})"
elif [ -n "${FC}" ]; then
MY_FORTRAN="$(basename ${FC})"
else
MY_FORTRAN="$(basename ${F77})"
fi
fi
fi
# default to gfortran if available, g77 if not
use debug && echo "MY_FORTRAN: \"${MY_FORTRAN}\""
if hasq gfortran ${AVAILABLE}; then
MY_FORTRAN=${MY_FORTRAN:=gfortran}
elif hasq g77 ${AVAILABLE}; then
MY_FORTRAN=${MY_FORTRAN:=g77}
else
# Default to the first valid Fortran compiler
for i in ${AVAILABLE}; do
MY_FORTRAN=$i
break
done
fi
use debug && echo "MY_FORTRAN: \"${MY_FORTRAN}\""
if ! hasq ${MY_FORTRAN} ${AVAILABLE}; then
eerror "Current Fortran Compiler is set to ${MY_FORTRAN}, which is not usable with this package !"
die "Wrong Fortran Compiler !"
fi
case ${MY_FORTRAN} in
gfortran|g77|ifc|ifort|f2c|f95)
FORTRANC="${MY_FORTRAN}"
esac
fi
use debug && echo "FORTRANC: \"${FORTRANC}\""
}
# patch_fortran():
# Apply necessary patches for ${FORTRANC}
patch_fortran() {
if [[ -z "${FORTRANC}" || ! -d "${FILESDIR}" ]]; then
return
fi
local PATCHES=$(find ${FILESDIR} -name "${P}-${FORTRANC}-*")
einfo "Applying patches for selected FORTRAN compiler: ${FORTRANC}"
local PATCH
if [ -n "${PATCHES}" ]; then
for PATCH in ${PATCHES}; do
epatch ${PATCH}
done
eautoreconf
fi
}
# fortran_pkg_setup():
# Set FORTRAN to indicate the list of Fortran Compiler that
# can be used for the ebuild.
# If not set in ebuild, FORTRAN will default to f77
fortran_pkg_setup() {
need_fortran ${FORTRAN:="gfortran g77"}
}
# fortran_src_unpack():
# Run patch_fortran if no new src_unpack() is defined.
fortran_src_unpack() {
unpack ${A}
cd "${S}"
patch_fortran
}
EXPORT_FUNCTIONS pkg_setup src_unpack

View File

@ -0,0 +1,236 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/fox.eclass,v 1.8 2008/10/12 12:31:36 mabi Exp $
# fox eclass
#
# This eclass allows building SLOT-able FOX Toolkit installations
# (x11-libs/fox: headers, libs, and docs), which are by design
# parallel-installable, while installing only one version of the utils
# (dev-util/reswrap) and apps (app-editors/adie, sci-calculators/calculator,
# x11-misc/pathfinder, and x11-misc/shutterbug).
#
# Version numbering follows the kernel-style odd-even minor version
# designation. Even-number minor versions are API stable, which patch
# releases aimed mostly at the library; apps generally won't need to be
# bumped for a patch release.
#
# Odd-number versions are development branches with their own SLOT and
# are API unstable; changes are made to the apps, and likely need to be
# bumped together with the library.
#
# Here are sample [R]DEPENDs for the fox apps
# fox versions that do not use this eclass are blocked in INCOMPAT_DEP below
# 1.0: '=x11-libs/fox-1.0*'
# 1.2: '=x11-libs/fox-1.2*'
# 1.4: '=x11-libs/fox-1.4*'
# 1.5: '~x11-libs/fox-${PV}'
# 1.6: '=x11-libs/fox-${FOXVER}*'
#
# Some concepts borrowed from gst-plugins and gtk-sharp-component eclasses
inherit eutils libtool versionator
FOX_PV="${FOX_PV:-${PV}}"
PVP=(${FOX_PV//[-\._]/ })
FOXVER="${PVP[0]}.${PVP[1]}"
if [ "${FOXVER}" != "1.0" ] ; then
FOXVER_SUFFIX="-${FOXVER}"
fi
DESCRIPTION="C++ based Toolkit for developing Graphical User Interfaces easily and effectively"
HOMEPAGE="http://www.fox-toolkit.org/"
SRC_URI="http://www.fox-toolkit.org/ftp/fox-${FOX_PV}.tar.gz"
IUSE="debug doc profile"
# from fox-1.0
FOX_APPS="adie calculator pathfinder"
# from fox-1.2+
if [ "${FOXVER}" != "1.0" ] ; then
FOX_APPS="${FOX_APPS} shutterbug"
FOX_CHART="chart"
fi
if [ "${PN}" != fox ] ; then
FOX_COMPONENT="${FOX_COMPONENT:-${PN}}"
fi
if [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then
DOXYGEN_DEP="doc? ( app-doc/doxygen )"
fi
if [ "${PN}" != reswrap ] ; then
RESWRAP_DEP="dev-util/reswrap"
fi
# These versions are not compatible with new fox layout
# and will cause collissions - we need to block them
INCOMPAT_DEP="!<x11-libs/fox-1.0.53
!=x11-libs/fox-1.2.4
!~x11-libs/fox-1.2.6
!=x11-libs/fox-1.4.11"
DEPEND="${INCOMPAT_DEP}
${DOXYGEN_DEP}
${RESWRAP_DEP}
=sys-devel/automake-1.4*
>=sys-apps/sed-4"
S="${WORKDIR}/fox-${FOX_PV}"
fox_src_unpack() {
unpack ${A}
cd ${S}
ebegin "Fixing configure"
# Respect system CXXFLAGS
sed -i -e 's:CXXFLAGS=""::' configure.in || die "sed configure.in error"
touch aclocal.m4
sed -i -e 's:CXXFLAGS=""::' configure || die "sed configure error"
eend
ebegin "Fixing Makefiles"
# don't build apps from top-level (i.e. x11-libs/fox)
# utils == reswrap
for d in ${FOX_APPS} utils windows ; do
sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error"
done
# use the installed reswrap for everything else
for d in ${FOX_APPS} ${FOX_CHART} tests ; do
sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \
${d}/Makefile.am || die "sed ${d}/Makefile.am error"
done
# use the installed headers and library for apps
for d in ${FOX_APPS} ; do
if version_is_at_least "1.6.34" ${PV} ; then
sed -i \
-e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox${FOXVER_SUFFIX}:" \
-e 's:$(top_builddir)/src/libFOX:-lFOX:' \
-e 's:\.la::' \
${d}/Makefile.am || die "sed ${d}/Makefile.am error"
else
sed -i \
-e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox${FOXVER_SUFFIX}:" \
-e 's:../src/libFOX:-lFOX:' \
-e 's:\.la::' \
${d}/Makefile.am || die "sed ${d}/Makefile.am error"
fi
done
# Upstream often has trouble with version number transitions
if [ "${FOXVER}" == "1.5" ] ; then
sed -i -e 's:1.4:1.5:g' chart/Makefile.am
fi
eend
ebegin "Running automake"
automake-1.4 -a -c || die "automake error"
eend
elibtoolize
}
fox_src_compile() {
local myconf
use debug && myconf="${myconf} --enable-debug" \
|| myconf="${myconf} --enable-release"
econf \
${FOXCONF} \
${myconf} \
$(use_with profile profiling) \
|| die "configure error"
cd ${S}/${FOX_COMPONENT}
emake || die "compile error"
# build class reference docs (FOXVER >= 1.2)
if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then
cd ${S}/doc
make docs || die "doxygen error"
fi
}
fox_src_install () {
cd ${S}/${FOX_COMPONENT}
make install \
DESTDIR=${D} \
htmldir=/usr/share/doc/${PF}/html \
artdir=/usr/share/doc/${PF}/html/art \
screenshotsdir=/usr/share/doc/${PF}/html/screenshots \
|| die "install error"
# create desktop menu items for apps
case ${FOX_COMPONENT} in
adie)
newicon big_gif.gif adie.gif
make_desktop_entry adie "Adie Text Editor" adie.gif
;;
calculator)
newicon bigcalc.gif foxcalc.gif
make_desktop_entry calculator "FOX Calculator" foxcalc.gif
;;
pathfinder)
newicon iconpath.gif pathfinder.gif
make_desktop_entry PathFinder "PathFinder" pathfinder.gif "FileManager"
;;
shutterbug)
doicon shutterbug.gif
make_desktop_entry shutterbug "ShutterBug" shutterbug.gif "Graphics"
;;
esac
for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do
[ -f $doc ] && dodoc $doc
done
# remove documentation if USE=-doc
if ( ! use doc ) && [ -d ${D}/usr/share/doc/${PF}/html ] ; then
rm -fr ${D}/usr/share/doc/${PF}/html
fi
# install class reference docs (FOXVER >= 1.2) if USE=doc
if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then
dohtml -r ${S}/doc/ref
fi
# slot fox-config where present (FOXVER >= 1.2)
if [ -f ${D}/usr/bin/fox-config ] ; then
mv ${D}/usr/bin/fox-config ${D}/usr/bin/fox-${FOXVER}-config
fi
}
fox_pkg_postinst() {
if [ -z "${FOX_COMPONENT}" ] ; then
echo
einfo "Multiple versions of the FOX Toolkit library may now be installed"
einfo "in parallel SLOTs on the same system."
einfo
einfo "The reswrap utility and the applications included in the FOX Toolkit"
einfo "(adie, calculator, pathfinder, shutterbug) are now available as"
einfo "separate ebuilds."
echo
if [ "${FOXVER}" != "1.0" ] ; then
einfo "The fox-config script has been installed as fox-${FOXVER}-config."
einfo "The fox-wrapper package is used to direct calls to fox-config"
einfo "to the correct versioned script, based on the WANT_FOX variable."
einfo "For example:"
einfo
einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>"
einfo
epause
fi
fi
}
EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst

View File

@ -0,0 +1,125 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/freebsd.eclass,v 1.14 2009/05/22 15:23:35 aballier Exp $
#
# Diego Pettenò <flameeyes@gentoo.org>
inherit versionator eutils flag-o-matic bsdmk
LICENSE="BSD"
HOMEPAGE="http://www.freebsd.org/"
# Define global package names
LIB="freebsd-lib-${PV}"
BIN="freebsd-bin-${PV}"
CONTRIB="freebsd-contrib-${PV}"
SHARE="freebsd-share-${PV}"
UBIN="freebsd-ubin-${PV}"
USBIN="freebsd-usbin-${PV}"
CRYPTO="freebsd-crypto-${PV}"
LIBEXEC="freebsd-libexec-${PV}"
SBIN="freebsd-sbin-${PV}"
GNU="freebsd-gnu-${PV}"
ETC="freebsd-etc-${PV}"
SYS="freebsd-sys-${PV}"
INCLUDE="freebsd-include-${PV}"
RESCUE="freebsd-rescue-${PV}"
# Release version (5.3, 5.4, 6.0, etc)
RV="$(get_version_component_range 1-2)"
if [[ ${PN} != "freebsd-share" ]] && [[ ${PN} != freebsd-sources ]]; then
IUSE="profile"
fi
#unalias -a
alias install-info='/usr/bin/bsdinstall-info'
EXPORT_FUNCTIONS src_compile src_install src_unpack
# doperiodic <kind> <file> ...
doperiodic() {
local kind=$1
shift
( # dont want to pollute calling env
insinto /etc/periodic/${kind}
insopts -m 0755
doins "$@"
)
}
freebsd_get_bmake() {
local bmake
bmake=$(get_bmake)
[[ ${CBUILD} == *-freebsd* ]] || bmake="${bmake} -m /usr/share/mk/freebsd"
echo "${bmake}"
}
freebsd_do_patches() {
if [[ ${#PATCHES[@]} -gt 1 ]] ; then
for x in "${PATCHES[@]}"; do
epatch "${x}"
done
else
for x in ${PATCHES} ; do
epatch "${x}"
done
fi
}
freebsd_rename_libraries() {
ebegin "Renaming libraries"
# We don't use libtermcap, we use libncurses
find "${S}" -name Makefile -print0 | xargs -0 \
sed -i -e 's:-ltermcap:-lncurses:g; s:{LIBTERMCAP}:{LIBNCURSES}:g'
# flex provides libfl, not libl
find "${S}" -name Makefile -print0 | xargs -0 \
sed -i -e 's:-ll:-lfl:g; s:{LIBL}:{LIBFL}:g'
eend $?
}
freebsd_src_unpack() {
unpack ${A}
cd "${S}"
dummy_mk ${REMOVE_SUBDIRS}
freebsd_do_patches
freebsd_rename_libraries
}
freebsd_src_compile() {
use profile && filter-flags "-fomit-frame-pointer"
use profile || \
case "${RV}" in
5.*) mymakeopts="${mymakeopts} NOPROFILE= " ;;
6.*|7.*) mymakeopts="${mymakeopts} NO_PROFILE= " ;;
esac
mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS="
# Many things breaks when using ricer flags here
[[ -z "${NOFLAGSTRIP}" ]] && strip-flags
# Make sure to use FreeBSD definitions while crosscompiling
[[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)"
bsdmk_src_compile
}
freebsd_src_install() {
use profile || \
case "${RV}" in
5.*) mymakeopts="${mymakeopts} NOPROFILE= " ;;
6.*|7.*) mymakeopts="${mymakeopts} NO_PROFILE= " ;;
esac
mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS="
[[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)"
bsdmk_src_install
}

View File

@ -0,0 +1,51 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/freedict.eclass,v 1.18 2008/03/29 02:08:46 philantrop Exp $
# @ECLASS: freedict.eclass
# @MAINTAINER:
# app-dicts@gentoo.org
#
# Original author: Seemant Kulleen
#
# @BLURB: Ease the installation of freedict translation dictionaries
# @DESCRIPTION:
# This eclass exists to ease the installation of freedict translation
# dictionaries. The only variables which need to be defined in the actual
# ebuilds are FORLANG and TOLANG for the source and target languages,
# respectively.
# @ECLASS-VARIABLE: FORLANG
# @DESCRIPTION:
# Please see above for a description.
# @ECLASS-VARIABLE: TOLANG
# @DESCRIPTION:
# Please see above for a description.
inherit eutils
IUSE=""
MY_P=${PN/freedict-/}
S="${WORKDIR}"
DESCRIPTION="Freedict for language translation from ${FORLANG} to ${TOLANG}"
HOMEPAGE="http://www.freedict.de"
SRC_URI="http://freedict.sourceforge.net/download/linux/${MY_P}.tar.gz"
SLOT="0"
LICENSE="GPL-2"
DEPEND="app-text/dictd"
# @FUNCTION: freedict_src_install
# @DESCRIPTION:
# The freedict src_install function, which is exported
freedict_src_install() {
insinto /usr/$(get_libdir)/dict
doins ${MY_P}.dict.dz
doins ${MY_P}.index
}
EXPORT_FUNCTIONS src_install

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/games-etmod.eclass,v 1.15 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,75 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/games-ggz.eclass,v 1.5 2009/02/01 17:44:23 mr_bones_ Exp $
inherit base
# For GGZ Gaming Zone packages
case ${EAPI:-0} in
0|1) EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm ;;
2) EXPORT_FUNCTIONS src_configure src_compile src_install pkg_postinst pkg_postrm ;;
esac
HOMEPAGE="http://www.ggzgamingzone.org/"
SRC_URI="mirror://ggz/${PV}/${P}.tar.gz"
GGZ_MODDIR="/usr/share/ggz/modules"
games-ggz_src_configure() {
econf \
--disable-dependency-tracking \
--enable-noregistry="${GGZ_MODDIR}" \
$(has debug ${IUSE} && ! use debug && echo --disable-debug) \
"$@" || die
}
games-ggz_src_compile() {
case ${EAPI:-0} in
0|1) games-ggz_src_configure "$@" ;;
esac
emake || die "emake failed"
}
games-ggz_src_install() {
emake DESTDIR="${D}" install || die "emake install failed"
local f
for f in AUTHORS ChangeLog NEWS QuickStart.GGZ README* TODO ; do
[[ -f ${f} ]] && dodoc ${f}
done
}
# Update ggz.modules with the .dsc files from ${GGZ_MODDIR}.
games-ggz_update_modules() {
[[ ${EBUILD_PHASE} == "postinst" ]] || [[ ${EBUILD_PHASE} == "postrm" ]] \
|| die "${FUNCNAME} can only be used in pkg_postinst or pkg_postrm"
# ggz-config needs libggz, so it could be broken
ggz-config -h &> /dev/null || return 1
local confdir=${ROOT}/etc
local moddir=${ROOT}/${GGZ_MODDIR}
local dsc rval=0
mkdir -p "${confdir}"
echo -n > "${confdir}"/ggz.modules
if [[ -d ${moddir} ]] ; then
ebegin "Installing GGZ modules"
cd "${moddir}"
find . -type f -name '*.dsc' | while read dsc ; do
DESTDIR=${ROOT} ggz-config -Dim "${dsc}" || ((rval++))
done
eend ${rval}
fi
return ${rval}
}
# Register new modules
games-ggz_pkg_postinst() {
games-ggz_update_modules
}
# Unregister old modules
games-ggz_pkg_postrm() {
games-ggz_update_modules
}

View File

@ -0,0 +1,319 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v 1.42 2009/10/12 00:53:51 nyhm Exp $
# 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[@]}" ;;
2)
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
;;
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/runscript
$(head -n 2 ${PORTDIR}/header.txt)
# 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

@ -0,0 +1,144 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/games-q3mod.eclass,v 1.36 2007/03/07 15:23:39 wolf31o2 Exp $
inherit games
EXPORT_FUNCTIONS src_install pkg_postinst
DESCRIPTION="Quake III - ${MOD_DESC}"
SLOT="0"
KEYWORDS="-* amd64 ~ppc x86"
IUSE="dedicated"
DEPEND="app-arch/unzip"
RDEPEND="|| ( games-fps/quake3 games-fps/quake3-bin )
amd64? ( app-emulation/emul-linux-x86-baselibs )
dedicated? ( app-misc/screen )"
S=${WORKDIR}
games-q3mod_src_install() {
[[ -z ${MOD_NAME} ]] && die "what is the name of this q3mod ?"
local bdir=${GAMES_PREFIX_OPT}/quake3
local mdir=${bdir}/${MOD_NAME}
MOD_BINS=${MOD_BINS:-${MOD_NAME}}
if [[ -d ${MOD_NAME} ]] ; then
dodir "${bdir}"
mv ${MOD_NAME} "${D}/${bdir}/"
fi
if [[ -d baseq3 ]] ; then
dodir "${bdir}"
mv baseq3 "${D}/${bdir}/"
fi
if [[ ! -z $(ls "${S}"/* 2> /dev/null) ]] ; then
dodir "${mdir}"
mv "${S}"/* "${D}/${mdir}/"
fi
if use dedicated; then
games-q3mod_make_q3ded_exec
newgamesbin "${T}"/q3${MOD_NAME}-ded.bin q3${MOD_BINS}-ded
fi
games-q3mod_make_quake3_exec
newgamesbin "${T}"/quake3-${MOD_NAME}.bin quake3-${MOD_BINS}
if use dedicated; then
games-q3mod_make_init.d
newinitd "${T}"/q3${MOD_NAME}-ded.init.d q3${MOD_BINS}-ded
games-q3mod_make_conf.d
newconfd "${T}"/q3${MOD_NAME}-ded.conf.d q3${MOD_BINS}-ded
fi
dodir "${GAMES_SYSCONFDIR}"/quake3
dodir "${bdir}"/q3a-homedir
dosym "${bdir}"/q3a-homedir "${GAMES_PREFIX}"/.q3a
keepdir "${bdir}"/q3a-homedir
prepgamesdirs
chmod g+rw "${D}/${mdir}" "${D}/${bdir}"/q3a-homedir
chmod -R g+rw "${D}/${GAMES_SYSCONFDIR}"/quake3
}
games-q3mod_pkg_postinst() {
local samplecfg=${FILESDIR}/server.cfg
local realcfg=${GAMES_PREFIX_OPT}/quake3/${MOD_NAME}/server.cfg
if [[ -e ${samplecfg} ]] && [[ ! -e ${realcfg} ]] ; then
cp "${samplecfg}" "${realcfg}"
fi
einfo "To play this mod: quake3-${MOD_BINS}"
use dedicated && \
einfo "To launch a dedicated server: q3${MOD_BINS}-ded" && \
einfo "To launch server at startup: /etc/init.d/q3${MOD_NAME}-ded"
games_pkg_postinst
}
games-q3mod_make_q3ded_exec() {
cat << EOF > "${T}"/q3${MOD_NAME}-ded.bin
#!/bin/sh
exec "${GAMES_BINDIR}"/q3ded-bin +set fs_game ${MOD_NAME} +set dedicated 1 +exec server.cfg \${@}
EOF
}
games-q3mod_make_quake3_exec() {
cat << EOF > "${T}"/quake3-${MOD_NAME}.bin
#!/bin/sh
exec "${GAMES_BINDIR}"/quake3-bin +set fs_game ${MOD_NAME} \${@}
EOF
}
games-q3mod_make_init.d() {
cat << EOF > "${T}"/q3${MOD_NAME}-ded.init.d
#!/sbin/runscript
$(<"${PORTDIR}"/header.txt)
depend() {
need net
}
start() {
ebegin "Starting ${MOD_NAME} dedicated"
screen -A -m -d -S q3${MOD_BINS}-ded su - ${GAMES_USER_DED} -c "${GAMES_BINDIR}/q3${MOD_BINS}-ded \${${MOD_NAME}_OPTS}"
eend \$?
}
stop() {
ebegin "Stopping ${MOD_NAME} dedicated"
local pid=\`screen -list | grep q3${MOD_BINS}-ded | awk -F . '{print \$1}' | sed -e s/.//\`
if [[ -z "\${pid}" ]] ; then
eend 1 "Lost screen session"
else
pid=\`pstree -p \${pid} | sed -e 's:^.*q3ded::'\`
pid=\${pid:1:\${#pid}-2}
if [[ -z "\${pid}" ]] ; then
eend 1 "Lost q3ded session"
else
kill \${pid}
eend \$? "Could not kill q3ded"
fi
fi
}
status() {
screen -list | grep q3${MOD_BINS}-ded
}
EOF
}
games-q3mod_make_conf.d() {
if [[ -e ${FILESDIR}/${MOD_NAME}.conf.d ]] ; then
cp "${FILESDIR}"/${MOD_NAME}.conf.d "${T}"/q3${MOD_NAME}-ded.conf.d
return 0
fi
cat << EOF > "${T}"/q3${MOD_NAME}-ded.conf.d
$(<"${PORTDIR}"/header.txt)
# Any extra options you want to pass to the dedicated server
${MOD_NAME}_OPTS="+set vm_game 0 +set sv_pure 1 +set bot_enable 0 +set com_hunkmegs 64 +set net_port 27960"
EOF
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/games-ut2k4mod.eclass,v 1.12 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,219 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/games.eclass,v 1.141 2010/01/03 19:13:44 scarabeus Exp $
# devlist: {vapier,wolf31o2,mr_bones_}@gentoo.org -> games@gentoo.org
#
# This is the games eclass for standardizing the install of games ...
# you better have a *good* reason why you're *not* using games.eclass
# in a games-* ebuild
inherit base multilib toolchain-funcs eutils
case ${EAPI:-0} in
0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst pkg_postinst ;;
2) EXPORT_FUNCTIONS pkg_setup src_configure src_compile pkg_preinst pkg_postinst ;;
esac
DESCRIPTION="Based on the ${ECLASS} eclass"
export GAMES_PREFIX=${GAMES_PREFIX:-/usr/games}
export GAMES_PREFIX_OPT=${GAMES_PREFIX_OPT:-/opt}
export GAMES_DATADIR=${GAMES_DATADIR:-/usr/share/games}
export GAMES_DATADIR_BASE=${GAMES_DATADIR_BASE:-/usr/share} # some packages auto append 'games'
export GAMES_SYSCONFDIR=${GAMES_SYSCONFDIR:-/etc/games}
export GAMES_STATEDIR=${GAMES_STATEDIR:-/var/games}
export GAMES_LOGDIR=${GAMES_LOGDIR:-/var/log/games}
export GAMES_BINDIR=${GAMES_BINDIR:-${GAMES_PREFIX}/bin}
export GAMES_ENVD="90games"
# if you want to use a different user/group than games.games,
# just add these two variables to your environment (aka /etc/profile)
export GAMES_USER=${GAMES_USER:-root}
export GAMES_USER_DED=${GAMES_USER_DED:-games}
export GAMES_GROUP=${GAMES_GROUP:-games}
games_get_libdir() {
echo ${GAMES_PREFIX}/$(get_libdir)
}
egamesconf() {
econf \
--prefix="${GAMES_PREFIX}" \
--libdir="$(games_get_libdir)" \
--datadir="${GAMES_DATADIR}" \
--sysconfdir="${GAMES_SYSCONFDIR}" \
--localstatedir="${GAMES_STATEDIR}" \
"$@"
}
gameswrapper() {
# dont want to pollute calling env
(
into "${GAMES_PREFIX}"
cmd=$1
shift
${cmd} "$@"
)
}
dogamesbin() { gameswrapper ${FUNCNAME/games} "$@"; }
dogamessbin() { gameswrapper ${FUNCNAME/games} "$@"; }
dogameslib() { gameswrapper ${FUNCNAME/games} "$@"; }
dogameslib.a() { gameswrapper ${FUNCNAME/games} "$@"; }
dogameslib.so() { gameswrapper ${FUNCNAME/games} "$@"; }
newgamesbin() { gameswrapper ${FUNCNAME/games} "$@"; }
newgamessbin() { gameswrapper ${FUNCNAME/games} "$@"; }
games_make_wrapper() { gameswrapper ${FUNCNAME/games_} "$@"; }
gamesowners() { chown ${GAMES_USER}:${GAMES_GROUP} "$@"; }
gamesperms() { chmod u+rw,g+r-w,o-rwx "$@"; }
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
if [[ ${dir} == "${GAMES_PREFIX_OPT}" ]] ; then
fowners root:root "${dir}"
fperms 755 "${dir}"
for d in $(get_libdir) bin ; do
fowners root:root "${dir}/${d}"
fperms 755 "${dir}/${d}"
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 '{}' \;
}
gamesenv() {
local d libdirs
for d in $(get_all_libdirs) ; do
libdirs="${libdirs}:${GAMES_PREFIX}/${d}"
done
# Wish we could use doevnd here, but we dont want the env
# file to be tracked in the CONTENTS of every game
cat <<-EOF > "${ROOT}"/etc/env.d/${GAMES_ENVD}
LDPATH="${libdirs:1}"
PATH="${GAMES_BINDIR}"
EOF
}
games_pkg_setup() {
tc-export CC CXX
[[ ${GAMES_CHECK_LICENSE} == "yes" ]] && check_license ${LICENSE}
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
[[ $(getent passwd "${GAMES_USER_DED}" | cut -f7 -d:) == "/bin/false" ]] \
&& usermod -s /bin/bash "${GAMES_USER_DED}"
}
games_src_configure() {
[[ -x ./configure ]] && egamesconf
}
games_src_compile() {
case ${EAPI:-0} in
0|1) games_src_configure ;;
esac
base_src_make
}
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)
}
# pkg_postinst function ... create env.d entry and warn about games group
games_pkg_postinst() {
gamesenv
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 " http://games.gentoo.org/"
echo
fi
}
# Unpack .uz2 files for UT2003/UT2004
# $1: directory or file to unpack
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/}" &>/dev/null \
|| die "uncompressing file ${ut_unpack}"
fi
if [[ -d ${ut_unpack} ]] ; then
while read f ; do
uz2unpack "${ut_unpack}/${f}" "${ut_unpack}/${f%.uz2}" &>/dev/null \
|| 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
}
# Unpacks .umod/.ut2mod/.ut4mod files for UT/UT2003/UT2004
# Usage: games_umod_unpack $1
# oh, and 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"
}

View File

@ -0,0 +1,205 @@
# Copyright 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.18 2009/05/13 02:11:24 nixphoeni Exp $
#
# Authors: Joe Sapp <nixphoeni@gentoo.org>
# Mike Gardiner <obz@gentoo.org>
#
# Usage:
# As a writer for an ebuild for gDesklets, you should set a few things:
#
# DESKLET_NAME: The name of the desklet.
# DOCS: Anything (like a README) that should be dodoc'd.
# S: *Optional* The package's base directory.
# Usually ${WORKDIR}/${DESKLET_NAME} if it was packaged
# correctly (hence, this is the default).
# RDEPEND: *Optional* Set if the desklet requires a minimum version
# of gDesklets greater than 0.34 or other packages.
inherit eutils multilib python
MY_PN="${DESKLET_NAME}"
MY_P="${MY_PN}-${PV}"
S="${WORKDIR}/${DESKLET_NAME}"
SRC_URI="http://gdesklets.de/files/desklets/${MY_PN}/${MY_P}.tar.gz"
# Ebuild writer shouldn't need to touch these (except maybe $RDEPEND)
SLOT="0"
IUSE=""
RDEPEND=">=gnome-extra/gdesklets-core-0.34.3-r1"
GDESKLETS_INST_DIR="${ROOT}usr/$(get_libdir)/gdesklets"
gdesklets_src_install() {
debug-print-function $FUNCNAME $*
# Disable compilation of included python modules (Controls)
python_disable_pyc
# Do not remove - see bugs 126890 and 128289
addwrite "${ROOT}/root/.gnome2"
has_version ">=gnome-extra/gdesklets-core-0.33.1" || \
GDESKLETS_INST_DIR="/usr/share/gdesklets"
# This should be done by the gdesklets-core ebuild
# It makes the Displays or Controls directory in the
# global installation directory if it doesn't exist
[[ -d "${GDESKLETS_INST_DIR}/Displays" ]] || \
dodir "${GDESKLETS_INST_DIR}/Displays"
# The displays only need to be readable
insopts -m0744
# Check to see if DISPLAY is set for the
# gdesklets-control-getid script to run without
# error
[ -z "${DISPLAY}" ] && DISPLAY=""
export DISPLAY
debug-print-section sensor_install
# First, install the Sensor (if there is one)
if [[ -n "${SENSOR_NAME}" ]]; then
for SENS in ${SENSOR_NAME[@]}; do
einfo "Installing Sensor ${SENS}"
/usr/bin/python "Install_${SENS}_Sensor.bin" \
--nomsg "${D}${GDESKLETS_INST_DIR}/Sensors" || \
die "Couldn't Install Sensor"
chown -R root:0 "${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME}"
done # for in ${SENSOR_NAME}
fi # if -n "${SENSOR_NAME}"
debug-print-section display_install
# This finds the Displays
DISPLAY_FILES=(`find . -iname "*.display"`)
DESKLET_INSDIR=""
# There is most likely only one display per package
if [[ -n "${DISPLAY_FILES[@]}" ]]; then
# Base installation directory for displays from this desklet
DESKLET_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
# This creates the subdirectory of ${DESKLET_NAME}
# in the global Displays directory
[[ -d "${DESKLET_INSDIR}" ]] || \
dodir "${DESKLET_INSDIR}"
# For each of the Display files, there may be
# scripts included inline which don't necessarily
# follow any naming scheme.
# So for each of them, determine what those scripts are
# and install them.
for DSP in ${DISPLAY_FILES[@]}; do
cd `dirname ${DSP}`
einfo "Installing Display `basename ${DSP} .display`"
debug-print "Installing ${DSP} into ${DESKLET_INSDIR}"
DSP=`basename ${DSP}`
insinto "${DESKLET_INSDIR}"
doins "${DSP}"
SCRIPTS=$(grep "script .*uri" ${DSP} | \
sed -e "s:.*<script\b.*\buri=[\"']: :g" -e "s:[\"'].*/>.*: :g")
# For each one of the scripts, change to its
# base directory and change the install location
# so it gets installed at the proper place
# relative to the display.
for SCR in ${SCRIPTS[@]}; do
insinto "${DESKLET_INSDIR}/`dirname ${SCR}`"
doins "${SCR}"
debug-print "Installed ${SCR} into ${DESKLET_INSDIR}/`dirname ${SCR}`"
done # for in ${SCRIPTS}
# Install the graphics for this display.
# If there are multiple displays in this
# directory, this will be done more than
# once. It's the only solution I can
# come up with for now...
GFX=(`find . \
-iname "*.png" -o -iname "*.svg" \
-o -iname "*.jpg" -o -iname "*.gif" \
-o -iname "*.xcf"`)
for G in ${GFX[@]}; do
insinto "${DESKLET_INSDIR}/`dirname ${G}`"
doins "${G}"
debug-print "Installed ${G} into ${DESKLET_INSDIR}/`dirname ${G}`"
done # for in ${GFX}
cd "${S}"
done # for in ${DISPLAY_FILES}
fi
debug-print-section control_install
CONTROL_INSDIR=""
# Make sure that it only finds Controls and not Sensors
# If it uses a Sensor, it shouldn't use a Control (since
# Sensors are deprecated).
if [[ -z "${SENSOR_NAME}" ]]; then
# Base installation directory for Controls
CONTROL_INSDIR="${GDESKLETS_INST_DIR}/Controls"
CONTROL_INITS=$(find . -iname "__init__.py")
# There are possibly multiple Controls packaged with the display.
# For each __init__.py found, there must be a Control associated with it.
for CTRL in ${CONTROL_INITS[@]}; do
cd `dirname ${CTRL}`
CTRL_NAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` )
einfo "Installing Control ${CTRL_NAME}"
# This creates the subdirectory of ${CTRL_NAME}
# in the global Controls directory
[[ -d "${CONTROL_INSDIR}/${CTRL_NAME}" ]] || \
dodir "${CONTROL_INSDIR}/${CTRL_NAME}"
insinto "${CONTROL_INSDIR}/${CTRL_NAME}"
doins -r *.py
cd "${S}"
done # for in ${CONTROL_INITS}
fi # if no Sensors
# Install any remaining graphics and other files
# that are sitting in ${S}.
GFX=$(find . -maxdepth 1 \
-iname "*.png" -o -iname "*.svg" \
-o -iname "*.jpg" -o -iname "*.gif" \
-o -iname "*.xcf")
if [[ -n "${GFX}" ]]; then
# Install to the Displays directory of the Desklet
insinto "${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
doins "${GFX}"
debug-print "Installed ${GFX} into ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
fi # if -n "${GFX}"
# Install some docs if so requested
[[ -n "${DOCS}" ]] && dodoc ${DOCS} && \
debug-print "Installed ${DOCS}"
}
EXPORT_FUNCTIONS src_install

View File

@ -0,0 +1,130 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gems.eclass,v 1.32 2009/11/29 19:10:01 flameeyes Exp $
# @ECLASS: gems.eclass
# @MAINTAINER:
# ruby@gentoo.org
#
# Original Author: Rob Cakebread <pythonhead@gentoo.org>
#
# @BLURB: Eclass helping with the installation of RubyGems
# @DESCRIPTION:
# See http://dev.gentoo.org/~pythonhead/ruby/gems.html for notes on using gems with Portage.
# @ECLASS-VARIABLE: USE_RUBY
# @DESCRIPTION:
# Ruby versions the gem is compatible to. The eclass will install the gem for
# versions that are compatible and installed on the system. Format: rubyDD where
# DD is the two-digit version suffix (e.g.: USE_RUBY="ruby19" for Ruby 1.9.1)
inherit eutils ruby
SRC_URI="mirror://rubygems/${P}.gem"
IUSE="doc"
DEPEND="
|| ( >=dev-ruby/rubygems-1.3.1 =dev-lang/ruby-1.9* )
!<dev-ruby/rdoc-2
"
RDEPEND="${DEPEND}"
# @FUNCTION: gems_location
# @USAGE: [Ruby binary]
# @DESCRIPTION:
# Exports GEMSDIR to the path Gems are installed to for the respective Ruby
# version
gems_location() {
local ruby_version
if [[ -z "$1" ]]; then
ruby_version="gem"
else
ruby_version=${1/ruby/gem}
fi
export GEMSDIR=$(/usr/bin/${ruby_version} env gemdir)
}
# @FUNCTION: gems_src_unpack
# @DESCRIPTION:
# does nothing
gems_src_unpack() {
true
}
# @FUNCTION: gems_src_compile
# @DESCRIPTION:
# does nothing
gems_src_compile() {
true
}
# @FUNCTION: gems_src_install
# @DESCRIPTION:
# Installs the gem
gems_src_install() {
local myconf
if use doc; then
myconf="--rdoc --ri"
else
myconf="--no-rdoc --no-ri"
fi
if [[ -n "${GEMS_FORCE_INSTALL}" ]]; then
myconf="${myconf} --force"
fi
# I'm not sure how many ebuilds have correctly set USE_RUBY - let's assume
# ruby18 if they haven't, since even pure Ruby gems that have been written
# against 1.8 can explode under 1.9.
if [[ -z "${USE_RUBY}" ]]; then
einfo "QA notice"
einfo "The ebuild doesn't set USE_RUBY explicitly. Defaulting to ruby18."
einfo "Please check compatibility and set USE_RUBY respectively."
USE_RUBY="ruby18"
elif [[ "${USE_RUBY}" == "any" ]]; then
eerror "USE_RUBY=\"any\" is no longer supported. Please use explicit versions instead."
die "USE_RUBY=\"any\" is no longer supported."
fi
local num_ruby_slots=$(echo "${USE_RUBY}" | wc -w)
for ruby_version in ${USE_RUBY} ; do
# Check that we have the version installed
[[ -e "/usr/bin/${ruby_version/ruby/gem}" ]] || continue
einfo "Installing for ${ruby_version}..."
gems_location ${ruby_version}
dodir ${GEMSDIR} || die
if [[ -z "${MY_P}" ]]; then
[[ -z "${GEM_SRC}" ]] && GEM_SRC="${DISTDIR}/${P}"
spec_path="${D}/${GEMSDIR}/specifications/${P}.gemspec"
else
[[ -z "${GEM_SRC}" ]] && GEM_SRC="${DISTDIR}/${MY_P}"
spec_path="${D}/${GEMSDIR}/specifications/${MY_P}.gemspec"
fi
# >=1.3.0 needs a path fix
local gte13=$(/usr/bin/${ruby_version} -rubygems -e 'puts Gem::RubyGemsVersion >= "1.3.0"')
/usr/bin/${ruby_version} /usr/bin/gem install ${GEM_SRC} \
--version ${PV} ${myconf} --local --install-dir "${D}/${GEMSDIR}" \
--sandbox-fix --no-user-install || die "gem (>=1.3.0) install failed"
if [[ -d "${D}/${GEMSDIR}/bin" ]] ; then
exeinto /usr/bin
for exe in "${D}"/${GEMSDIR}/bin/* ; do
if [ "$num_ruby_slots" -ge 2 ] ; then
# Ensures that the exe file gets run using the currently
# selected version of ruby.
sed -i -e 's@^#!/usr/bin/ruby.*$@#!/usr/bin/ruby@' "${exe}"
fi
doexe "${exe}" || die
done
fi
done
}
EXPORT_FUNCTIONS src_unpack src_compile src_install

View File

@ -0,0 +1,341 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.27 2009/03/23 20:06:19 kolmodin Exp $
#
# Author: Andres Loeh <kosmikus@gentoo.org>
# Maintained by: Haskell herd <haskell@gentoo.org>
#
# This eclass helps with the Glasgow Haskell Compiler's package
# configuration utility.
inherit versionator
# promote /opt/ghc/bin to a better position in the search path
PATH="/usr/bin:/opt/ghc/bin:${PATH}"
# for later configuration using environment variables/
# returns the name of the ghc executable
ghc-getghc() {
type -P ghc
}
# returns the name of the ghc-pkg executable
ghc-getghcpkg() {
type -P ghc-pkg
}
# returns the name of the ghc-pkg binary (ghc-pkg
# itself usually is a shell script, and we have to
# bypass the script under certain circumstances);
# for Cabal, we add an empty global package config file,
# because for some reason the global package file
# must be specified
ghc-getghcpkgbin() {
if version_is_at_least "6.10" "$(ghc-version)"; then
# the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
# the wrapper script with the static flags
echo '[]' > "${T}/empty.conf"
echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf"
elif ghc-cabal; then
echo '[]' > "${T}/empty.conf"
echo "$(ghc-libdir)/ghc-pkg.bin" "--global-conf=${T}/empty.conf"
else
echo "$(ghc-libdir)/ghc-pkg.bin"
fi
}
# returns the version of ghc
_GHC_VERSION_CACHE=""
ghc-version() {
if [[ -z "${_GHC_VERSION_CACHE}" ]]; then
_GHC_VERSION_CACHE="$($(ghc-getghc) --numeric-version)"
fi
echo "${_GHC_VERSION_CACHE}"
}
# this function can be used to determine if ghc itself
# uses the Cabal package format; it has nothing to do
# with the Cabal libraries ... ghc uses the Cabal package
# format since version 6.4
ghc-cabal() {
version_is_at_least "6.4" "$(ghc-version)"
}
# return the best version of the Cabal library that is available
ghc-bestcabalversion() {
local cabalversion
if ghc-cabal; then
# We ask portage, not ghc, so that we only pick up
# portage-installed cabal versions.
cabalversion="$(ghc-extractportageversion dev-haskell/cabal)"
echo "Cabal-${cabalversion}"
else
# older ghc's don't support package versioning
echo Cabal
fi
}
# check if a standalone Cabal version is available for the
# currently used ghc; takes minimal version of Cabal as
# an optional argument
ghc-sanecabal() {
local f
local version
if [[ -z "$1" ]]; then version="1.0.1"; else version="$1"; fi
for f in $(ghc-confdir)/cabal-*; do
[[ -f "${f}" ]] && version_is_at_least "${version}" "${f#*cabal-}" && return
done
return 1
}
# checks if ghc and ghc-bin are installed in the same version
# (if they're both installed); if this is not the case, we
# unfortunately cannot trust portage's dependency resolution
ghc-saneghc() {
local ghcversion
local ghcbinversion
if [[ "${PN}" == "ghc" || "${PN}" == "ghc-bin" ]]; then
return
fi
if has_version dev-lang/ghc && has_version dev-lang/ghc-bin; then
ghcversion="$(ghc-extractportageversion dev-lang/ghc)"
ghcbinversion="$(ghc-extractportageversion dev-lang/ghc-bin)"
if [[ "${ghcversion}" != "${ghcbinversion}" ]]; then
return 1
fi
fi
return
}
# extract the version of a portage-installed package
ghc-extractportageversion() {
local pkg
local version
pkg="$(best_version $1)"
version="${pkg#$1-}"
version="${version%-r*}"
version="${version%_pre*}"
echo "${version}"
}
# returns the library directory
_GHC_LIBDIR_CACHE=""
ghc-libdir() {
if [[ -z "${_GHC_LIBDIR_CACHE}" ]]; then
_GHC_LIBDIR_CACHE="$($(ghc-getghc) --print-libdir)"
fi
echo "${_GHC_LIBDIR_CACHE}"
}
# returns the (Gentoo) library configuration directory
ghc-confdir() {
echo "$(ghc-libdir)/gentoo"
}
# returns the name of the local (package-specific)
# package configuration file
ghc-localpkgconf() {
echo "${PF}.conf"
}
# make a ghci foo.o file from a libfoo.a file
ghc-makeghcilib() {
local outfile
outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')"
ld --relocatable --discard-all --output="${outfile}" --whole-archive "$1"
}
# tests if a ghc package exists
ghc-package-exists() {
local describe_flag
if version_is_at_least "6.4" "$(ghc-version)"; then
describe_flag="describe"
else
describe_flag="--show-package"
fi
$(ghc-getghcpkg) "${describe_flag}" "$1" > /dev/null 2>&1
}
# creates a local (package-specific) package
# configuration file; the arguments should be
# uninstalled package description files, each
# containing a single package description; if
# no arguments are given, the resulting file is
# empty
ghc-setup-pkg() {
local localpkgconf
localpkgconf="${S}/$(ghc-localpkgconf)"
echo '[]' > "${localpkgconf}"
local update_flag
if version_is_at_least "6.4" "$(ghc-version)"; then
update_flag="update -"
else
update_flag="--update-package"
fi
for pkg in $*; do
$(ghc-getghcpkgbin) -f "${localpkgconf}" ${update_flag} --force \
< "${pkg}" || die "failed to register ${pkg}"
done
}
# fixes the library and import directories path
# of the package configuration file
ghc-fixlibpath() {
sed -i "s|$1|$(ghc-libdir)|g" "${S}/$(ghc-localpkgconf)"
if [[ -n "$2" ]]; then
sed -i "s|$2|$(ghc-libdir)/imports|g" "${S}/$(ghc-localpkgconf)"
fi
}
# moves the local (package-specific) package configuration
# file to its final destination
ghc-install-pkg() {
mkdir -p "${D}/$(ghc-confdir)"
cat "${S}/$(ghc-localpkgconf)" | sed "s|${D}||g" \
> "${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
}
# registers all packages in the local (package-specific)
# package configuration file
ghc-register-pkg() {
local localpkgconf
localpkgconf="$(ghc-confdir)/$1"
local update_flag
local describe_flag
if version_is_at_least "6.4" "$(ghc-version)"; then
update_flag="update -"
describe_flag="describe"
else
update_flag="--update-package"
describe_flag="--show-package"
fi
if [[ -f "${localpkgconf}" ]]; then
for pkg in $(ghc-listpkg "${localpkgconf}"); do
ebegin "Registering ${pkg} "
$(ghc-getghcpkgbin) -f "${localpkgconf}" "${describe_flag}" "${pkg}" \
| $(ghc-getghcpkg) ${update_flag} --force > /dev/null
eend $?
done
fi
}
# re-adds all available .conf files to the global
# package conf file, to be used on a ghc reinstallation
ghc-reregister() {
einfo "Re-adding packages (may cause several harmless warnings) ..."
PATH="/usr/bin:${PATH}" CONFDIR="$(ghc-confdir)"
if [ -d "${CONFDIR}" ]; then
pushd "${CONFDIR}" > /dev/null
for conf in *.conf; do
PATH="/usr/bin:${PATH}" ghc-register-pkg "${conf}"
done
popd > /dev/null
fi
}
# unregisters a package configuration file
# protected are all packages that are still contained in
# another package configuration file
ghc-unregister-pkg() {
local localpkgconf
local i
local pkg
local protected
local unregister_flag
localpkgconf="$(ghc-confdir)/$1"
if version_is_at_least "6.4" "$(ghc-version)"; then
unregister_flag="unregister"
else
unregister_flag="--remove-package"
fi
for i in $(ghc-confdir)/*.conf; do
[[ "${i}" != "${localpkgconf}" ]] && protected="${protected} $(ghc-listpkg ${i})"
done
# protected now contains the packages that cannot be unregistered yet
if [[ -f "${localpkgconf}" ]]; then
for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
if $(ghc-elem "${pkg}" "${protected}"); then
einfo "Package ${pkg} is protected."
elif ! ghc-package-exists "${pkg}"; then
:
# einfo "Package ${pkg} is not installed for ghc-$(ghc-version)."
else
ebegin "Unregistering ${pkg} "
$(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null
eend $?
fi
done
fi
}
# help-function: reverse a list
ghc-reverse() {
local result
local i
for i in $1; do
result="${i} ${result}"
done
echo "${result}"
}
# help-function: element-check
ghc-elem() {
local i
for i in $2; do
[[ "$1" == "${i}" ]] && return 0
done
return 1
}
# show the packages in a package configuration file
ghc-listpkg() {
local ghcpkgcall
local i
for i in $*; do
if ghc-cabal; then
echo $($(ghc-getghcpkg) list -f "${i}") \
| sed \
-e "s|^.*${i}:\([^:]*\).*$|\1|" \
-e "s|/.*$||" \
-e "s|,| |g" -e "s|[(){}]||g"
else
echo $($(ghc-getghcpkgbin) -l -f "${i}") \
| cut -f2 -d':' \
| sed 's:,: :g'
fi
done
}
# exported function: check if we have a consistent ghc installation
ghc-package_pkg_setup() {
if ! ghc-saneghc; then
eerror "You have inconsistent versions of dev-lang/ghc and dev-lang/ghc-bin"
eerror "installed. Portage currently cannot work correctly with this setup."
eerror "There are several possibilities to work around this problem:"
eerror "(1) Up/downgrade ghc-bin to the same version as ghc."
eerror "(2) Unmerge ghc-bin."
eerror "(3) Unmerge ghc."
eerror "You probably want option 1 or 2."
die "Inconsistent versions of ghc and ghc-bin."
fi
}
# exported function: registers the package-specific package
# configuration file
ghc-package_pkg_postinst() {
ghc-register-pkg "$(ghc-localpkgconf)"
}
# exported function: unregisters the package-specific package
# configuration file; a package contained therein is unregistered
# only if it the same package is not also contained in another
# package configuration file ...
ghc-package_pkg_prerm() {
ghc-unregister-pkg "$(ghc-localpkgconf)"
}
EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm

View File

@ -0,0 +1,470 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/git.eclass,v 1.58 2011/12/14 23:40:18 vapier Exp $
# @DEPRECATED
# This eclass has been superseded by git-2 eclass.
# Please modify your ebuilds to use that one instead.
# @ECLASS: git.eclass
# @MAINTAINER:
# Donnie Berkholz <dberkholz@gentoo.org>
# @BLURB: Fetching and unpacking of git repositories
# @DESCRIPTION:
# The git eclass provides functions to fetch, patch and bootstrap
# software sources from git repositories and is based on the subversion eclass.
# It is necessary to define at least the EGIT_REPO_URI variable.
# @THANKS TO:
# Fernando J. Pereda <ferdy@gentoo.org>
inherit eutils
EGIT="git.eclass"
# We DEPEND on a not too ancient git version
DEPEND=">=dev-vcs/git-1.6"
EXPORTED_FUNCTIONS="src_unpack"
case "${EAPI:-0}" in
4|3|2) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare" ;;
1|0) ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
# define some nice defaults but only if nothing is set already
: ${HOMEPAGE:=http://git-scm.com/}
# @ECLASS-VARIABLE: EGIT_QUIET
# @DESCRIPTION:
# Set to non-empty value to supress some eclass messages.
: ${EGIT_QUIET:=${ESCM_QUIET}}
# @ECLASS-VARIABLE: EGIT_STORE_DIR
# @DESCRIPTION:
# Storage directory for git sources.
# Can be redefined.
: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"}
# @ECLASS-VARIABLE: EGIT_UNPACK_DIR
# @DESCRIPTION:
# Directory to unpack git sources in.
# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
# @DESCRIPTION:
# Set this to non-empty value to enable submodule support (slower).
: ${EGIT_HAS_SUBMODULES:=}
# @ECLASS-VARIABLE: EGIT_FETCH_CMD
# @DESCRIPTION:
# Command for cloning the repository.
: ${EGIT_FETCH_CMD:="git clone"}
# @ECLASS-VARIABLE: EGIT_UPDATE_CMD
# @DESCRIPTION:
# Git fetch command.
if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
EGIT_UPDATE_CMD="git pull -f -u"
else
EGIT_UPDATE_CMD="git fetch -f -u"
fi
# @ECLASS-VARIABLE: EGIT_DIFFSTAT_CMD
# @DESCRIPTION:
# Git command for diffstat.
EGIT_DIFFSTAT_CMD="git --no-pager diff --stat"
# @ECLASS-VARIABLE: EGIT_OPTIONS
# @DESCRIPTION:
# This variable value is passed to clone and fetch.
: ${EGIT_OPTIONS:=}
# @ECLASS-VARIABLE: EGIT_MASTER
# @DESCRIPTION:
# Variable for specifying master branch.
# Usefull when upstream don't have master branch.
: ${EGIT_MASTER:=master}
# @ECLASS-VARIABLE: EGIT_REPO_URI
# @DESCRIPTION:
# URI for the repository
# e.g. http://foo, git://bar
# Supported protocols:
# http://
# https://
# git://
# git+ssh://
# rsync://
# ssh://
eval X="\$${PN//[-+]/_}_LIVE_REPO"
if [[ ${X} = "" ]]; then
: ${EGIT_REPO_URI:=}
else
EGIT_REPO_URI="${X}"
fi
# @ECLASS-VARIABLE: EGIT_PROJECT
# @DESCRIPTION:
# Project name, it must be unique across EGIT_STORE_DIR.
# Git eclass will check out the git repository into ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/}
# Default is ${PN}.
: ${EGIT_PROJECT:=${PN}}
# @ECLASS-VARIABLE: EGIT_BOOTSTRAP
# @DESCRIPTION:
# bootstrap script or command like autogen.sh or etc...
: ${EGIT_BOOTSTRAP:=}
# @ECLASS-VARIABLE: EGIT_OFFLINE
# @DESCRIPTION:
# Set this variable to a non-empty value to disable the automatic updating of
# an GIT source tree. This is intended to be set outside the git source
# tree by users.
: ${EGIT_OFFLINE:=${ESCM_OFFLINE}}
# @ECLASS-VARIABLE: EGIT_PATCHES
# @DESCRIPTION:
# Similar to PATCHES array from base.eclass
# Only difference is that this patches are applied before bootstrap.
# Please take note that this variable should be bash array.
# @ECLASS-VARIABLE: EGIT_BRANCH
# @DESCRIPTION:
# git eclass can fetch any branch in git_fetch().
eval X="\$${PN//[-+]/_}_LIVE_BRANCH"
if [[ "${X}" = "" ]]; then
: ${EGIT_BRANCH:=master}
else
EGIT_BRANCH="${X}"
fi
# @ECLASS-VARIABLE: EGIT_COMMIT
# @DESCRIPTION:
# git eclass can checkout any commit.
eval X="\$${PN//[-+]/_}_LIVE_COMMIT"
if [[ "${X}" = "" ]]; then
: ${EGIT_COMMIT:=${EGIT_BRANCH}}
else
EGIT_COMMIT="${X}"
fi
# @ECLASS-VARIABLE: EGIT_REPACK
# @DESCRIPTION:
# Set to non-empty value to repack objects to save disk space. However this can
# take a long time with VERY big repositories.
: ${EGIT_REPACK:=}
# @ECLASS-VARIABLE: EGIT_PRUNE
# @DESCRIPTION:
# Set to non-empty value to prune loose objects on each fetch. This is useful
# if upstream rewinds and rebases branches often.
: ${EGIT_PRUNE:=}
# @FUNCTION: git_submodules
# @DESCRIPTION:
# Internal function wrapping the submodule initialisation and update
git_submodules() {
if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
debug-print "git submodule init"
git submodule init
debug-print "git submodule sync"
git submodule sync
debug-print "git submodule update"
git submodule update
fi
}
# @FUNCTION: git_branch
# @DESCRIPTION:
# Internal function that changes branch for the repo based on EGIT_TREE and
# EGIT_BRANCH variables.
git_branch() {
local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then
branchname=tree-${EGIT_COMMIT}
src=${EGIT_COMMIT}
fi
debug-print "git checkout -b ${branchname} ${src}"
git checkout -b ${branchname} ${src} &> /dev/null
unset branchname src
}
# @FUNCTION: git_fetch
# @DESCRIPTION:
# Gets repository from EGIT_REPO_URI and store it in specified EGIT_STORE_DIR
git_fetch() {
debug-print-function ${FUNCNAME} "$@"
eqawarn "git.eclass is deprecated."
eqawarn "Please update your ebuilds to use git-2 instead. For details, see"
eqawarn "http://archives.gentoo.org/gentoo-dev/msg_b7ba363cae580845819ae3501fb157e9.xml"
local GIT_DIR EGIT_CLONE_DIR oldsha1 cursha1 extra_clone_opts upstream_branch
[[ -z ${EGIT_HAS_SUBMODULES} ]] && export GIT_DIR
# choose if user wants elog or just einfo.
if [[ -n ${EGIT_QUIET} ]]; then
elogcmd="einfo"
else
elogcmd="elog"
fi
# If we have same branch and the tree we can do --depth 1 clone
# which outputs into really smaller data transfers.
# Sadly we can do shallow copy for now because quite a few packages need .git
# folder.
#[[ ${EGIT_COMMIT} = ${EGIT_BRANCH} ]] && \
# EGIT_FETCH_CMD="${EGIT_FETCH_CMD} --depth 1"
if [[ -n ${EGIT_TREE} ]] ; then
EGIT_COMMIT=${EGIT_TREE}
ewarn "QA: Usage of deprecated EGIT_TREE variable detected."
ewarn "QA: Use EGIT_COMMIT variable instead."
fi
# EGIT_REPO_URI is empty.
[[ -z ${EGIT_REPO_URI} ]] && die "${EGIT}: EGIT_REPO_URI is empty."
# check for the protocol or pull from a local repo.
if [[ -z ${EGIT_REPO_URI%%:*} ]] ; then
case ${EGIT_REPO_URI%%:*} in
git*|http|https|rsync|ssh) ;;
*) die "${EGIT}: protocol for fetch from "${EGIT_REPO_URI%:*}" is not yet implemented in eclass." ;;
esac
fi
# initial clone, we have to create master git storage directory and play
# nicely with sandbox
if [[ ! -d ${EGIT_STORE_DIR} ]] ; then
debug-print "${FUNCNAME}: initial clone. creating git directory"
addwrite /
mkdir -m 775 -p "${EGIT_STORE_DIR}" \
|| die "${EGIT}: can't mkdir ${EGIT_STORE_DIR}."
export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}"
fi
cd -P "${EGIT_STORE_DIR}" || die "${EGIT}: can't chdir to ${EGIT_STORE_DIR}"
EGIT_STORE_DIR=${PWD}
# allow writing into EGIT_STORE_DIR
addwrite "${EGIT_STORE_DIR}"
[[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
EGIT_CLONE_DIR="${EGIT_PROJECT}"
debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\""
GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}"
# we also have to remove all shallow copied repositories
# and fetch them again
if [[ -e "${GIT_DIR}/shallow" ]]; then
rm -rf "${GIT_DIR}"
einfo "The ${EGIT_CLONE_DIR} was shallow copy. Refetching."
fi
# repack from bare copy to normal one
if [[ -n ${EGIT_HAS_SUBMODULES} ]] && [[ -d ${GIT_DIR} && ! -d ${GIT_DIR}/.git ]]; then
rm -rf "${GIT_DIR}"
einfo "The ${EGIT_CLONE_DIR} was bare copy. Refetching."
fi
if [[ -z ${EGIT_HAS_SUBMODULES} ]] && [[ -d ${GIT_DIR} && -d ${GIT_DIR}/.git ]]; then
rm -rf "${GIT_DIR}"
einfo "The ${EGIT_CLONE_DIR} was not a bare copy. Refetching."
fi
if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
upstream_branch=origin/${EGIT_BRANCH}
else
upstream_branch=${EGIT_BRANCH}
extra_clone_opts=--bare
fi
if [[ ! -d ${GIT_DIR} ]] ; then
# first clone
${elogcmd} "GIT NEW clone -->"
${elogcmd} " repository: ${EGIT_REPO_URI}"
debug-print "${EGIT_FETCH_CMD} ${extra_clone_opts} ${EGIT_OPTIONS} \"${EGIT_REPO_URI}\" ${GIT_DIR}"
${EGIT_FETCH_CMD} ${extra_clone_opts} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${GIT_DIR} \
|| die "${EGIT}: can't fetch from ${EGIT_REPO_URI}."
pushd "${GIT_DIR}" &> /dev/null
cursha1=$(git rev-parse ${upstream_branch})
${elogcmd} " at the commit: ${cursha1}"
git_submodules
popd &> /dev/null
elif [[ -n ${EGIT_OFFLINE} ]] ; then
pushd "${GIT_DIR}" &> /dev/null
cursha1=$(git rev-parse ${upstream_branch})
${elogcmd} "GIT offline update -->"
${elogcmd} " repository: ${EGIT_REPO_URI}"
${elogcmd} " at the commit: ${cursha1}"
popd &> /dev/null
else
pushd "${GIT_DIR}" &> /dev/null
# Git urls might change, so unconditionally set it here
git config remote.origin.url "${EGIT_REPO_URI}"
# fetch updates
${elogcmd} "GIT update -->"
${elogcmd} " repository: ${EGIT_REPO_URI}"
oldsha1=$(git rev-parse ${upstream_branch})
if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
# fix branching
git checkout ${EGIT_MASTER}
for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do
git branch -D ${x}
done
${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \
|| die "${EGIT}: can't update from ${EGIT_REPO_URI}."
else
debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \
|| die "${EGIT}: can't update from ${EGIT_REPO_URI}."
fi
git_submodules
cursha1=$(git rev-parse ${upstream_branch})
# write out message based on the revisions
if [[ "${oldsha1}" != "${cursha1}" ]]; then
${elogcmd} " updating from commit: ${oldsha1}"
${elogcmd} " to commit: ${cursha1}"
else
${elogcmd} " at the commit: ${cursha1}"
# @ECLASS-VARIABLE: LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED
# @DESCRIPTION:
# If this variable is set to TRUE in make.conf or somewhere in
# enviroment the package will fail if there is no update, thus in
# combination with --keep-going it would lead in not-updating
# pakcages that are up-to-date.
# TODO: this can lead to issues if more projects/packages use same repo
[[ ${LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED} = true ]] && \
debug-print "${FUNCNAME}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping." && \
die "${EGIT}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping."
fi
${EGIT_DIFFSTAT_CMD} ${oldsha1}..${upstream_branch}
popd &> /dev/null
fi
pushd "${GIT_DIR}" &> /dev/null
if [[ -n ${EGIT_REPACK} ]] || [[ -n ${EGIT_PRUNE} ]]; then
ebegin "Garbage collecting the repository"
local args
[[ -n ${EGIT_PRUNE} ]] && args='--prune'
git gc ${args}
eend $?
fi
popd &> /dev/null
# export the git version
export EGIT_VERSION="${cursha1}"
# log the repo state
[[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]] && ${elogcmd} " commit: ${EGIT_COMMIT}"
${elogcmd} " branch: ${EGIT_BRANCH}"
${elogcmd} " storage directory: \"${GIT_DIR}\""
if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
pushd "${GIT_DIR}" &> /dev/null
debug-print "rsync -rlpgo . \"${EGIT_UNPACK_DIR:-${S}}\""
time rsync -rlpgo . "${EGIT_UNPACK_DIR:-${S}}"
popd &> /dev/null
else
unset GIT_DIR
debug-print "git clone -l -s -n \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\" \"${EGIT_UNPACK_DIR:-${S}}\""
git clone -l -s -n "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" "${EGIT_UNPACK_DIR:-${S}}"
fi
pushd "${EGIT_UNPACK_DIR:-${S}}" &> /dev/null
git_branch
# submodules always reqire net (thanks to branches changing)
[[ -z ${EGIT_OFFLINE} ]] && git_submodules
popd &> /dev/null
echo ">>> Unpacked to ${EGIT_UNPACK_DIR:-${S}}"
}
# @FUNCTION: git_bootstrap
# @DESCRIPTION:
# Runs bootstrap command if EGIT_BOOTSTRAP variable contains some value
# Remember that what ever gets to the EGIT_BOOTSTRAP variable gets evaled by bash.
git_bootstrap() {
debug-print-function ${FUNCNAME} "$@"
if [[ -n ${EGIT_BOOTSTRAP} ]] ; then
pushd "${S}" > /dev/null
einfo "Starting bootstrap"
if [[ -f ${EGIT_BOOTSTRAP} ]]; then
# we have file in the repo which we should execute
debug-print "$FUNCNAME: bootstraping with file \"${EGIT_BOOTSTRAP}\""
if [[ -x ${EGIT_BOOTSTRAP} ]]; then
eval "./${EGIT_BOOTSTRAP}" \
|| die "${EGIT}: bootstrap script failed"
else
eerror "\"${EGIT_BOOTSTRAP}\" is not executable."
eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command."
die "${EGIT}: \"${EGIT_BOOTSTRAP}\" is not executable."
fi
else
# we execute some system command
debug-print "$FUNCNAME: bootstraping with commands \"${EGIT_BOOTSTRAP}\""
eval "${EGIT_BOOTSTRAP}" \
|| die "${EGIT}: bootstrap commands failed."
fi
einfo "Bootstrap finished"
popd > /dev/null
fi
}
# @FUNCTION: git_apply_patches
# @DESCRIPTION:
# Apply patches from EGIT_PATCHES bash array.
# Preferred is using the variable as bash array but for now it allows to write
# it also as normal space separated string list. (This part of code should be
# removed when all ebuilds get converted on bash array).
git_apply_patches() {
debug-print-function ${FUNCNAME} "$@"
pushd "${EGIT_UNPACK_DIR:-${S}}" > /dev/null
if [[ ${#EGIT_PATCHES[@]} -gt 1 ]] ; then
for i in "${EGIT_PATCHES[@]}"; do
debug-print "$FUNCNAME: git_autopatch: patching from ${i}"
epatch "${i}"
done
elif [[ -n ${EGIT_PATCHES} ]]; then
# no need for loop if space separated string is passed.
debug-print "$FUNCNAME: git_autopatch: patching from ${EGIT_PATCHES}"
epatch "${EGIT_PATCHES}"
fi
popd > /dev/null
}
# @FUNCTION: git_src_unpack
# @DESCRIPTION:
# src_upack function, calls src_prepare one if EAPI!=2.
git_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
git_fetch || die "${EGIT}: unknown problem in git_fetch()."
has src_prepare ${EXPORTED_FUNCTIONS} || git_src_prepare
}
# @FUNCTION: git_src_prepare
# @DESCRIPTION:
# src_prepare function for git stuff. Patches, bootstrap...
git_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
git_apply_patches
git_bootstrap
}

View File

@ -0,0 +1,83 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gkrellm-plugin.eclass,v 1.3 2007/04/23 19:35:05 swegener Exp $
#
# Original Author: Jim Ramsay <lack@gentoo.org>
#
# Purpose:
# Provides common methods used by (almost) all gkrellm plugins:
# - Sets up default dependencies
# - Adds pkg_setup check to ensure gkrellm was built with USE="X" (bug
# 167227)
# - Provides utility routines in lieu of hard-coding the plugin directories.
# - Provides the most common src_install method to avoid code duplication.
#
# Utility Routines:
# gkrellm-plugin_dir - Returns the gkrellm-2 plugin directory
# gkrellm-plugin_server_dir - Returns the gkrellm-2 server plugin directory
#
# Environment:
# For src_install:
# PLUGIN_SO - The name of the plugin's .so file which will be installed in
# the plugin dir. Defaults to "${PN}.so".
# PLUGIN_DOCS - An optional list of docs to be installed. Defaults to
# unset.
# PLUGIN_SERVER_SO - The name of the plugin's server plugin .so portion.
# Defaults to unset.
# Important: This will also cause the pkg_setup check to be skipped, so
# you need to check 'build_with_use app-admin/gkrellm X' in your
# src_compile and only compile the GUI portion if that returns true. (see
# x11-plugins/gkrelltop as an example)
#
# Changelog:
# 12 March 2007: Jim Ramsay <lack@gentoo.org>
# - Added server plugin support
# 09 March 2007: Jim Ramsay <lack@gentoo.org>
# - Initial commit
#
inherit multilib eutils
RDEPEND="=app-admin/gkrellm-2*"
DEPEND="${RDEPEND}
dev-util/pkgconfig"
gkrellm-plugin_dir() {
echo /usr/$(get_libdir)/gkrellm2/plugins
}
gkrellm-plugin_server_dir() {
echo /usr/$(get_libdir)/gkrellm2/plugins-gkrellmd
}
gkrellm-plugin_pkg_setup() {
if [[ -z "${PLUGIN_SERVER_SO}" ]] &&
! built_with_use app-admin/gkrellm X; then
eerror "This plugin requires the X frontend of gkrellm."
eerror "Please re-emerge app-admin/gkrellm with USE=\"X\""
die "Please re-emerge app-admin/gkrellm with USE=\"X\""
fi
}
gkrellm-plugin_src_install() {
if built_with_use app-admin/gkrellm X; then
insinto $(gkrellm-plugin_dir)
doins ${PLUGIN_SO:-${PN}.so} || die "Plugin shared library was not installed"
fi
if [[ -n "${PLUGIN_SERVER_SO}" ]]; then
insinto $(gkrellm-plugin_server_dir)
doins ${PLUGIN_SERVER_SO} || die "Server plugin shared library was not installed"
fi
DDOCS="README* Change* AUTHORS FAQ TODO INSTALL"
for doc in ${DDOCS}; do
[ -s "$doc" ] && dodoc $doc
done
[ -n "${PLUGIN_DOCS}" ] && dodoc ${PLUGIN_DOCS}
}
EXPORT_FUNCTIONS pkg_setup src_install

View File

@ -0,0 +1,457 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v 1.39 2010/01/13 15:06:11 scarabeus Exp $
#
# Author: George Shapovalov <george@gentoo.org>
# Belongs to: ada herd <ada@gentoo.org>
#
# This eclass provides the framework for ada lib installation with the split and
# SLOTted gnat compilers (gnat-xxx, gnatbuild.eclass). Each lib gets built once
# for every installed gnat compiler. Activation of a particular bunary module is
# performed by eselect-gnat, when the active compiler gets switched
#
# The ebuilds should define the lib_compile and lib_install functions that are
# called from the (exported) gnat_src_compile function of eclass. These
# functions should operate similarly to the starndard src_compile and
# src_install. The only difference, that they should use $SL variable instead of
# $S (this is where the working copy of source is held) and $DL instead of $D as
# its installation point.
inherit flag-o-matic eutils
# The environment is set locally in src_compile and src_install functions
# by the common code sourced here and in gnat-eselect module.
# This is the standard location for this code (belongs to eselect-gnat,
# since eselect should work even in the absense of portage tree and we can
# guarantee to some extent presence of gnat-eselect when anything gnat-related
# gets processed. See #192505)
#
# Note!
# It may not be safe to source this at top level. Only source inside local
# functions!
GnatCommon="/usr/share/gnat/lib/gnat-common.bash"
# !!NOTE!!
# src_install should not be exported!
# Instead gnat_src_install should be explicitly called from within src_install.
EXPORT_FUNCTIONS pkg_setup pkg_postinst src_compile
DESCRIPTION="Common procedures for building Ada libs using split gnat compilers"
# make sure we have an appropriately recent eselect-gnat installed, as we are
# using some common code here.
DEPEND=">=app-admin/eselect-gnat-1.3"
# ----------------------------------
# Globals
# Lib install locations
#
# Gnat profile dependent files go under ${LibTop}/${Gnat_Profile}/${PN}
# and common files go under SpecsDir, DataDir..
# In order not to pollute PATH and LDPATH attempt should be mabe to install
# binaries and what makes sence for individual packages under
# ${AdalibLibTop}/${Gnat_Profile}/bin
PREFIX=/usr
AdalibSpecsDir=${PREFIX}/include/ada
AdalibDataDir=${PREFIX}/share/ada
AdalibLibTop=${PREFIX}/$(get_libdir)/ada
# build-time locations
# SL is a "localized" S, - location where sources are copied for
#bi profile-specific build
SL=${WORKDIR}/LocalSource
# DL* are "localized destinations" where ARCH/SLOT dependent stuff should be
# installed in lib_install. There are three:
#
DL=${WORKDIR}/LocalDest
# a generic location for the lib (.a, .so) files
#
DLbin=${WORKDIR}/LocalBinDest
# binaries that should be in the PATH, will be moved to common Ada bin dir
#
DLgpr=${WORKDIR}/LocalGPRDest
# gpr's should go here.
# file containing environment formed by gnat-eselect (build-time)
BuildEnv=${WORKDIR}/BuildEnv
# environment for installed lib. Profile-specific stuff should use %DL% as a top
# of their location. This (%DL%) will be substituted with a proper location upon
# install
LibEnv=${WORKDIR}/LibEnv
# env file prepared by gnat.eselect only lists new settings for env vars
# we need to change that to prepend, rather than replace action..
# Takes one argument - the file to expand. This file should contain only
# var=value like lines.. (commenst are Ok)
expand_BuildEnv() {
local line
for line in $(cat $1); do
EnvVar=$(echo ${line}|cut -d"=" -f1)
if [[ "${EnvVar}" == "PATH" ]] ; then
echo "export ${line}:\${${EnvVar}}" >> $1.tmp
else
echo "export ${line}" >> $1.tmp
fi
done
mv $1.tmp $1
}
# ------------------------------------
# Dependency processing related stuff
# A simple wrapper to get the relevant part of the DEPEND
# params:
# $1 - should contain dependency specification analogous to DEPEND,
# if omitted, DEPEND is processed
get_ada_dep() {
[[ -z "$1" ]] && DEP="${DEPEND}" || DEP="$1"
local TempStr
for fn in $DEP; do # here $DEP should *not* be in ""
[[ $fn =~ "virtual/ada" ]] && TempStr=${fn/*virtual\//}
# above match should be to full virtual/ada, as simply "ada" is a common
# part of ${PN}, even for some packages under dev-ada
done
# debug-print-function $FUNCNAME "TempStr=${TempStr:0:8}"
[[ -n ${TempStr} ]] && echo ${TempStr:0:8}
}
# This function is used to check whether the requested gnat profile matches the
# requested Ada standard
# !!ATTN!!
# This must match dependencies as specified in vitrual/ada !!!
#
# params:
# $1 - the requested gnat profile in usual form (e.g. x86_64-pc-linux-gnu-gnat-gcc-4.1)
# $2 - Ada standard specification, as would be specified in DEPEND.
# Valid values: ada-1995, ada-2005, ada
#
# This used to treat ada-1995 and ada alike, but some packages (still
# requested by users) no longer compile with new compilers (not the
# standard issue, but rather compiler becoming stricter most of the time).
# Plus there are some "intermediary versions", not fully 2005 compliant
# but already causing problems. Therefore, now we do exact matching.
belongs_to_standard() {
# debug-print-function $FUNCNAME $*
. ${GnatCommon} || die "failed to source gnat-common lib"
local GnatSlot=$(get_gnat_SLOT $1)
local ReducedSlot=${GnatSlot//\./}
#
if [[ $2 == 'ada' ]] ; then
# debug-print-function "ada or ada-1995 match"
return 0 # no restrictions imposed
elif [[ "$2" == 'ada-1995' ]] ; then
if [[ $(get_gnat_Pkg $1) == "gcc" ]]; then
# debug-print-function "got gcc profile, GnatSlot=${ReducedSlot}"
[[ ${ReducedSlot} -le "42" ]] && return 0 || return 1
elif [[ $(get_gnat_Pkg $1) == "gpl" ]]; then
# debug-print-function "got gpl profile, GnatSlot=${ReducedSlot}"
[[ ${ReducedSlot} -lt "41" ]] && return 0 || return 1
else
return 1 # unknown compiler encountered
fi
elif [[ "$2" == 'ada-2005' ]] ; then
if [[ $(get_gnat_Pkg $1) == "gcc" ]]; then
# debug-print-function "got gcc profile, GnatSlot=${ReducedSlot}"
[[ ${ReducedSlot} -ge "43" ]] && return 0 || return 1
elif [[ $(get_gnat_Pkg $1) == "gpl" ]]; then
# debug-print-function "got gpl profile, GnatSlot=${ReducedSlot}"
[[ ${ReducedSlot} -ge "41" ]] && return 0 || return 1
else
return 1 # unknown compiler encountered
fi
else
return 1 # unknown standard requested, check spelling!
fi
}
# ------------------------------------
# Helpers
#
# The purpose of this one is to remove all parts of the env entry specific to a
# given lib. Usefull when some lib wants to act differently upon detecting
# itself installed..
#
# params:
# $1 - name of env var to process
# $2 (opt) - name of the lib to filter out (defaults to ${PN})
filter_env_var() {
local entries=(${!1//:/ })
local libName=${2:-${PN}}
local env_str
for entry in ${entries[@]} ; do
# this simply checks if $libname is a substring of the $entry, should
# work fine with all the present libs
if [[ ${entry/${libName}/} == ${entry} ]] ; then
env_str="${env_str}:${entry}"
fi
done
echo ${env_str}
}
# A simpler helper, for the libs that need to extract active gnat location
# Returns a first entry for a specified env var. Relies on the (presently true)
# convention that first gnat's entries are listed and then of the other
# installed libs.
#
# params:
# $1 - name of env var to process
get_gnat_value() {
local entries=(${!1//:/ })
echo ${entries[0]}
}
# Returns a name of active gnat profile. Performs some validity checks. No input
# parameters, analyzes the system setup directly.
get_active_profile() {
# get common code and settings
. ${GnatCommon} || die "failed to source gnat-common lib"
local profiles=( $(get_env_list) )
if [[ ${profiles[@]} == "${MARKER}*" ]]; then
return
# returning empty string
fi
if (( 1 == ${#profiles[@]} )); then
local active=${profiles[0]#${MARKER}}
else
die "${ENVDIR} contains multiple gnat profiles, please cleanup!"
fi
if [[ -f ${SPECSDIR}/${active} ]]; then
echo ${active}
else
die "The profile active in ${ENVDIR} does not correspond to any installed gnat!"
fi
}
# ------------------------------------
# Functions
# Checks the gnat backend SLOT and filters flags correspondingly
# To be called from scr_compile for each profile, before actual compilation
# Parameters:
# $1 - gnat profile, e.g. x86_64-pc-linux-gnu-gnat-gcc-3.4
gnat_filter_flags() {
debug-print-function $FUNCNAME $*
# We only need to filter so severely if backends < 3.4 is detected, which
# means basically gnat-3.15
GnatProfile=$1
if [ -z ${GnatProfile} ]; then
# should not get here!
die "please specify a valid gnat profile for flag stripping!"
fi
local GnatSLOT="${GnatProfile//*-/}"
if [[ ${GnatSLOT} < 3.4 ]] ; then
filter-mfpmath sse 387
filter-flags -mmmx -msse -mfpmath -frename-registers \
-fprefetch-loop-arrays -falign-functions=4 -falign-jumps=4 \
-falign-loops=4 -msse2 -frerun-loop-opt -maltivec -mabi=altivec \
-fsigned-char -fno-strict-aliasing -pipe
export ADACFLAGS=${ADACFLAGS:-${CFLAGS}}
export ADACFLAGS=${ADACFLAGS//-Os/-O2}
export ADACFLAGS=${ADACFLAGS//pentium-mmx/i586}
export ADACFLAGS=${ADACFLAGS//pentium[234]/i686}
export ADACFLAGS=${ADACFLAGS//k6-[23]/k6}
export ADACFLAGS=${ADACFLAGS//athlon-tbird/i686}
export ADACFLAGS=${ADACFLAGS//athlon-4/i686}
export ADACFLAGS=${ADACFLAGS//athlon-[xm]p/i686}
# gcc-2.8.1 has no amd64 support, so the following two are safe
export ADACFLAGS=${ADACFLAGS//athlon64/i686}
export ADACFLAGS=${ADACFLAGS//athlon/i686}
else
export ADACFLAGS=${ADACFLAGS:-${CFLAGS}}
fi
export ADAMAKEFLAGS=${ADAMAKEFLAGS:-"-cargs ${ADACFLAGS} -margs"}
export ADABINDFLAGS=${ADABINDFLAGS:-""}
}
gnat_pkg_setup() {
debug-print-function $FUNCNAME $*
# check whether all the primary compilers are installed
. ${GnatCommon} || die "failed to source gnat-common lib"
for fn in $(cat ${PRIMELIST}); do
if [[ ! -f ${SPECSDIR}/${fn} ]]; then
elog "The ${fn} Ada compiler profile is specified as primary, but is not installed."
elog "Please rectify the situation before emerging Ada library!"
elog "Please either install again all the missing compilers listed"
elog "as primary, or edit /etc/ada/primary_compilers and update the"
elog "list of primary compilers there."
einfo ""
ewarn "If you do the latter, please don't forget to rebuild all"
ewarn "affected libs!"
die "Primary compiler is missing"
fi
done
export ADAC=${ADAC:-gnatgcc}
export ADAMAKE=${ADAMAKE:-gnatmake}
export ADABIND=${ADABIND:-gnatbind}
}
gnat_pkg_postinst() {
einfo "Updating gnat configuration to pick up ${PN} library..."
eselect gnat update
elog "The environment has been set up to make gnat automatically find files"
elog "for the installed library. In order to immediately activate these"
elog "settings please run:"
elog
#elog "env-update"
elog "source /etc/profile"
einfo
einfo "Otherwise the settings will become active next time you login"
}
# standard lib_compile plug. Adapted from base.eclass
lib_compile() {
debug-print-function $FUNCNAME $*
[ -z "$1" ] && lib_compile all
cd ${SL}
while [ "$1" ]; do
case $1 in
configure)
debug-print-section configure
econf || die "died running econf, $FUNCNAME:configure"
;;
make)
debug-print-section make
emake || die "died running emake, $FUNCNAME:make"
;;
all)
debug-print-section all
lib_compile configure make
;;
esac
shift
done
}
# Cycles through installed gnat profiles and calls lib_compile and then
# lib_install in turn.
# Use this function to build/install profile-specific binaries. The code
# building/installing common stuff (docs, etc) can go before/after, as needed,
# so that it is called only once..
#
# lib_compile and lib_install are passed the active gnat profile name - may be used or
# discarded as needed..
gnat_src_compile() {
debug-print-function $FUNCNAME $*
# We source the eselect-gnat module and use its functions directly, instead of
# duplicating code or trying to violate sandbox in some way..
. ${GnatCommon} || die "failed to source gnat-common lib"
compilers=( $(find_primary_compilers ) )
if [[ -n ${compilers[@]} ]] ; then
local i
local AdaDep=$(get_ada_dep)
for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
if $(belongs_to_standard ${compilers[${i}]} ${AdaDep}); then
einfo "compiling for gnat profile ${compilers[${i}]}"
# copy sources
mkdir "${DL}" "${DLbin}" "${DLgpr}"
cp -dpR "${S}" "${SL}"
# setup environment
# As eselect-gnat also manages the libs, this will ensure the right
# lib profiles are activated too (in case we depend on some Ada lib)
generate_envFile ${compilers[${i}]} ${BuildEnv} && \
expand_BuildEnv "${BuildEnv}" && \
. "${BuildEnv}" || die "failed to switch to ${compilers[${i}]}"
# many libs (notably xmlada and gtkada) do not like to see
# themselves installed. Need to strip them from ADA_*_PATH
# NOTE: this should not be done in pkg_setup, as we setup
# environment right above
export ADA_INCLUDE_PATH=$(filter_env_var ADA_INCLUDE_PATH)
export ADA_OBJECTS_PATH=$(filter_env_var ADA_OBJECTS_PATH)
# call compilation callback
cd "${SL}"
gnat_filter_flags ${compilers[${i}]}
lib_compile ${compilers[${i}]} || die "failed compiling for ${compilers[${i}]}"
# call install callback
cd "${SL}"
lib_install ${compilers[${i}]} || die "failed installing profile-specific part for ${compilers[${i}]}"
# move installed and cleanup
mv "${DL}" "${DL}-${compilers[${i}]}"
mv "${DLbin}" "${DLbin}-${compilers[${i}]}"
mv "${DLgpr}" "${DLgpr}-${compilers[${i}]}"
rm -rf "${SL}"
else
einfo "skipping gnat profile ${compilers[${i}]}"
fi
done
else
ewarn "Please note!"
elog "Treatment of installed Ada compilers has recently changed!"
elog "Libs are now being built only for \"primary\" compilers."
elog "Please list gnat profiles (as reported by \"eselect gnat list\")"
elog "that you want to regularly use (i.e., not just for testing)"
elog "in ${PRIMELIST}, one per line."
die "please make sure you have at least one gnat compiler installed and set as primary!"
fi
}
# This function simply moves gnat-profile-specific stuff into proper locations.
# Use src_install in ebuild to install the rest of the package
gnat_src_install() {
debug-print-function $FUNCNAME $*
# prep lib specs directory
. ${GnatCommon} || die "failed to source gnat-common lib"
dodir ${SPECSDIR}/${PN}
compilers=( $(find_primary_compilers) )
if [[ -n ${compilers[@]} ]] ; then
local i
local AdaDep=$(get_ada_dep)
for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
if $(belongs_to_standard ${compilers[${i}]} ${AdaDep}); then
debug-print-section "installing for gnat profile ${compilers[${i}]}"
local DLlocation=${AdalibLibTop}/${compilers[${i}]}
dodir ${DLlocation}
cp -dpR "${DL}-${compilers[${i}]}" "${D}/${DLlocation}/${PN}"
cp -dpR "${DLbin}-${compilers[${i}]}" "${D}/${DLlocation}"/bin
cp -dpR "${DLgpr}-${compilers[${i}]}" "${D}/${DLlocation}"/gpr
# create profile-specific specs file
cp ${LibEnv} "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}"
sed -i -e "s:%DL%:${DLlocation}/${PN}:g" "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}"
sed -i -e "s:%DLbin%:${DLlocation}/bin:g" "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}"
sed -i -e "s:%DLgpr%:${DLlocation}/gpr:g" "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}"
else
einfo "skipping gnat profile ${compilers[${i}]}"
fi
done
else
die "please make sure you have at least one gnat compiler installed!"
fi
}

View File

@ -0,0 +1,693 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnatbuild.eclass,v 1.50 2010/01/22 13:27:36 george Exp $
#
# Author: George Shapovalov <george@gentoo.org>
# Belongs to: ada herd <ada@gentoo.org>
#
# Notes:
# HOMEPAGE and LICENSE are set in appropriate ebuild, as
# gnat is developed by FSF and AdaCore "in parallel"
#
# The following vars can be set in ebuild before inheriting this eclass. They
# will be respected:
# SLOT
# BOOT_SLOT - where old bootstrap is used as it works fine
inherit eutils versionator toolchain-funcs flag-o-matic multilib autotools \
libtool fixheadtails gnuconfig pax-utils
EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_postrm src_unpack src_compile src_install
DESCRIPTION="Based on the ${ECLASS} eclass"
IUSE="nls"
# multilib is supported via profiles now, multilib usevar is deprecated
DEPEND=">=app-admin/eselect-gnat-1.3"
RDEPEND="app-admin/eselect-gnat"
# Note!
# It may not be safe to source this at top level. Only source inside local
# functions!
GnatCommon="/usr/share/gnat/lib/gnat-common.bash"
#---->> globals and SLOT <<----
# just a check, this location seems to vary too much, easier to track it in
# ebuild
#[ -z "${GNATSOURCE}" ] && die "please set GNATSOURCE in ebuild! (before inherit)"
# versioning
# because of gnatpro/gnatgpl we need to track both gcc and gnat versions
# these simply default to $PV
GNATMAJOR=$(get_version_component_range 1)
GNATMINOR=$(get_version_component_range 2)
GNATBRANCH=$(get_version_component_range 1-2)
GNATRELEASE=$(get_version_component_range 1-3)
# this one is for the gnat-gpl which is versioned by gcc backend and ACT version
# number added on top
ACT_Ver=$(get_version_component_range 4)
# GCCVER and SLOT logic
#
# I better define vars for package names, as there was discussion on proper
# naming and it may change
PN_GnatGCC="gnat-gcc"
PN_GnatGpl="gnat-gpl"
# ATTN! GCCVER stands for the provided backend gcc, not the one on the system
# so tc-* functions are of no use here. The present versioning scheme makes
# GCCVER basically a part of PV, but *this may change*!!
#
# GCCVER can be set in the ebuild.
[[ -z ${GCCVER} ]] && GCCVER="${GNATRELEASE}"
# finally extract GCC version strings
GCCMAJOR=$(get_version_component_range 1 "${GCCVER}")
GCCMINOR=$(get_version_component_range 2 "${GCCVER}")
GCCBRANCH=$(get_version_component_range 1-2 "${GCCVER}")
GCCRELEASE=$(get_version_component_range 1-3 "${GCCVER}")
# SLOT logic, make it represent gcc backend, as this is what matters most
# There are some special cases, so we allow it to be defined in the ebuild
# ATTN!! If you set SLOT in the ebuild, don't forget to make sure that
# BOOT_SLOT is also set properly!
[[ -z ${SLOT} ]] && SLOT="${GCCBRANCH}"
# possible future crosscompilation support
export CTARGET=${CTARGET:-${CHOST}}
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
# Bootstrap CTARGET and SLOT logic. For now BOOT_TARGET=CHOST is "guaranteed" by
# profiles, so mostly watch out for the right SLOT used in the bootstrap.
# As above, with SLOT, it may need to be defined in the ebuild
BOOT_TARGET=${CTARGET}
[[ -z ${BOOT_SLOT} ]] && BOOT_SLOT=${SLOT}
# set our install locations
PREFIX=${GNATBUILD_PREFIX:-/usr} # not sure we need this hook, but may be..
LIBPATH=${PREFIX}/$(get_libdir)/${PN}/${CTARGET}/${SLOT}
LIBEXECPATH=${PREFIX}/libexec/${PN}/${CTARGET}/${SLOT}
INCLUDEPATH=${LIBPATH}/include
BINPATH=${PREFIX}/${CTARGET}/${PN}-bin/${SLOT}
DATAPATH=${PREFIX}/share/${PN}-data/${CTARGET}/${SLOT}
# ATTN! the one below should match the path defined in eselect-gnat module
CONFIG_PATH="/usr/share/gnat/eselect"
gnat_profile="${CTARGET}-${PN}-${SLOT}"
gnat_config_file="${CONFIG_PATH}/${gnat_profile}"
# ebuild globals
if [[ ${PN} == "${PN_GnatPro}" ]] && [[ ${GNATMAJOR} == "3" ]]; then
DEPEND="x86? ( >=app-shells/tcsh-6.0 )"
fi
S="${WORKDIR}/gcc-${GCCVER}"
# bootstrap globals, common to src_unpack and src_compile
GNATBOOT="${WORKDIR}/usr"
GNATBUILD="${WORKDIR}/build"
# necessary for detecting lib locations and creating env.d entry
#XGCC="${GNATBUILD}/gcc/xgcc -B${GNATBUILD}/gcc"
#----<< globals and SLOT >>----
# set SRC_URI's in ebuilds for now
#----<< support checks >>----
# skipping this section - do not care about hardened/multilib for now
#---->> specs + env.d logic <<----
# TODO!!!
# set MANPATH, etc..
#----<< specs + env.d logic >>----
#---->> some helper functions <<----
is_multilib() {
[[ ${GCCMAJOR} < 3 ]] && return 1
case ${CTARGET} in
mips64*|powerpc64*|s390x*|sparc64*|x86_64*)
has_multilib_profile || use multilib ;;
*) false ;;
esac
}
# adapted from toolchain,
# left only basic multilib functionality and cut off mips stuff
create_specs_file() {
einfo "Creating a vanilla gcc specs file"
"${WORKDIR}"/build/gcc/xgcc -dumpspecs > "${WORKDIR}"/build/vanilla.specs
}
# eselect stuff taken straight from toolchain.eclass and greatly simplified
add_profile_eselect_conf() {
local gnat_config_file=$1
local abi=$2
local var
echo >> "${D}/${gnat_config_file}"
if ! is_multilib ; then
echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
else
echo "[${abi}]" >> "${D}/${gnat_config_file}"
var="CTARGET_${abi}"
if [[ -n ${!var} ]] ; then
echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
else
var="CHOST_${abi}"
if [[ -n ${!var} ]] ; then
echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
else
echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
fi
fi
fi
var="CFLAGS_${abi}"
if [[ -n ${!var} ]] ; then
echo " cflags=${!var}" >> "${D}/${gnat_config_file}"
fi
}
create_eselect_conf() {
local abi
dodir ${CONFIG_PATH}
echo "[global]" > "${D}/${gnat_config_file}"
echo " version=${CTARGET}-${SLOT}" >> "${D}/${gnat_config_file}"
echo " binpath=${BINPATH}" >> "${D}/${gnat_config_file}"
echo " libexecpath=${LIBEXECPATH}" >> "${D}/${gnat_config_file}"
echo " ldpath=${LIBPATH}" >> "${D}/${gnat_config_file}"
echo " manpath=${DATAPATH}/man" >> "${D}/${gnat_config_file}"
echo " infopath=${DATAPATH}/info" >> "${D}/${gnat_config_file}"
echo " bin_prefix=${CTARGET}" >> "${D}/${gnat_config_file}"
for abi in $(get_all_abis) ; do
add_profile_eselect_conf "${D}/${gnat_config_file}" "${abi}"
done
}
should_we_eselect_gnat() {
# we only want to switch compilers if installing to / or /tmp/stage1root
[[ ${ROOT} == "/" ]] || return 1
# if the current config is invalid, we definitely want a new one
# Note: due to bash quirkiness, the following must not be 1 line
local curr_config
curr_config=$(eselect --no-color gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0
[[ -z ${curr_config} ]] && return 0
# The logic is basically "try to keep the same profile if possible"
if [[ ${curr_config} == ${CTARGET}-${PN}-${SLOT} ]] ; then
return 0
else
elog "The current gcc config appears valid, so it will not be"
elog "automatically switched for you. If you would like to"
elog "switch to the newly installed gcc version, do the"
elog "following:"
echo
elog "eselect gnat set <profile>"
echo
ebeep
return 1
fi
}
# active compiler selection, called from pkg_postinst
do_gnat_config() {
eselect gnat set ${CTARGET}-${PN}-${SLOT} &> /dev/null
elog "The following gnat profile has been activated:"
elog "${CTARGET}-${PN}-${SLOT}"
elog ""
elog "The compiler has been installed as gnatgcc, and the coverage testing"
elog "tool as gnatgcov."
elog ""
elog "Ada handling in Gentoo allows you to have multiple gnat variants"
elog "installed in parallel and automatically manage Ada libs."
elog "Please take a look at the Ada project page for some documentation:"
elog "http://www.gentoo.org/proj/en/prog_lang/ada/index.xml"
}
# Taken straight from the toolchain.eclass. Only removed the "obsolete hunk"
#
# The purpose of this DISGUSTING gcc multilib hack is to allow 64bit libs
# to live in lib instead of lib64 where they belong, with 32bit libraries
# in lib32. This hack has been around since the beginning of the amd64 port,
# and we're only now starting to fix everything that's broken. Eventually
# this should go away.
#
# Travis Tilley <lv@gentoo.org> (03 Sep 2004)
#
disgusting_gcc_multilib_HACK() {
local config
local libdirs
if has_multilib_profile ; then
case $(tc-arch) in
amd64)
config="i386/t-linux64"
libdirs="../$(get_abi_LIBDIR amd64) ../$(get_abi_LIBDIR x86)" \
;;
ppc64)
config="rs6000/t-linux64"
libdirs="../$(get_abi_LIBDIR ppc64) ../$(get_abi_LIBDIR ppc)" \
;;
esac
else
die "Your profile is no longer supported by portage."
fi
einfo "updating multilib directories to be: ${libdirs}"
sed -i -e "s:^MULTILIB_OSDIRNAMES.*:MULTILIB_OSDIRNAMES = ${libdirs}:" "${S}"/gcc/config/${config}
}
#---->> pkg_* <<----
gnatbuild_pkg_setup() {
debug-print-function ${FUNCNAME} $@
# Setup variables which would normally be in the profile
if is_crosscompile ; then
multilib_env ${CTARGET}
fi
# we dont want to use the installed compiler's specs to build gnat!
unset GCC_SPECS
}
gnatbuild_pkg_postinst() {
if should_we_eselect_gnat; then
do_gnat_config
else
eselect gnat update
fi
# if primary compiler list is empty, add this profile to the list, so
# that users are not left without active compilers (making sure that
# libs are getting built for at least one)
elog
. ${GnatCommon} || die "failed to source common code"
if [[ ! -f ${PRIMELIST} ]] || [[ ! -s ${PRIMELIST} ]]; then
echo "${gnat_profile}" > ${PRIMELIST}
elog "The list of primary compilers was empty and got assigned ${gnat_profile}."
fi
elog "Please edit ${PRIMELIST} and list there gnat profiles intended"
elog "for common use."
}
gnatbuild_pkg_postrm() {
# "eselect gnat update" now removes the env.d file if the corresponding
# gnat profile was unmerged
eselect gnat update
elog "If you just unmerged the last gnat in this SLOT, your active gnat"
elog "profile got unset. Please check what eselect gnat show tells you"
elog "and set the desired profile"
}
#---->> pkg_* <<----
#---->> src_* <<----
# common unpack stuff
gnatbuild_src_unpack() {
debug-print-function ${FUNCNAME} $@
[ -z "$1" ] && gnatbuild_src_unpack all
while [ "$1" ]; do
case $1 in
base_unpack)
unpack ${A}
pax-mark E $(find ${GNATBOOT} -name gnat1)
cd "${S}"
# patching gcc sources, following the toolchain
if [[ -d "${FILESDIR}"/${SLOT} ]] ; then
EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
epatch "${FILESDIR}"/${SLOT}/*.patch
fi
# Replacing obsolete head/tail with POSIX compliant ones
ht_fix_file */configure
if ! is_crosscompile && is_multilib && \
[[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && -z ${SKIP_MULTILIB_HACK} ]] ; then
disgusting_gcc_multilib_HACK || die "multilib hack failed"
fi
# Fixup libtool to correctly generate .la files with portage
cd "${S}"
elibtoolize --portage --shallow --no-uclibc
gnuconfig_update
# update configure files
einfo "Fixing misc issues in configure files"
for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
ebegin " Updating ${f}"
patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
|| eerror "Please file a bug about this"
eend $?
done
# this is only needed for gnat-gpl-4.1 and breaks for gnat-gcc, so
# this block was moved to corresponding ebuild
# pushd "${S}"/gnattools &> /dev/null
# eautoconf
# popd &> /dev/null
;;
common_prep)
# Prepare the gcc source directory
cd "${S}/gcc"
touch cstamp-h.in
touch ada/[es]info.h
touch ada/nmake.ad[bs]
# set the compiler name to gnatgcc
for i in `find ada/ -name '*.ad[sb]'`; do \
sed -i -e "s/\"gcc\"/\"gnatgcc\"/g" ${i}; \
done
# add -fPIC flag to shared libs for 3.4* backend
if [ "3.4" == "${GCCBRANCH}" ] ; then
cd ada
epatch "${FILESDIR}"/gnat-Make-lang.in.patch
fi
# gcc sources as of 4.3 seem to have a common omission of $(DESTDIR),
# that leads to make install trying to rm -f file on live system.
# As we do not need this rm, we simply remove the whole line
sed -i -e "/\$(RM) \$(bindir)/d" "${S}"/gcc/ada/Make-lang.in
mkdir -p "${GNATBUILD}"
;;
all)
gnatbuild_src_unpack base_unpack common_prep
;;
esac
shift
done
}
# it would be nice to split configure and make steps
# but both need to operate inside specially tuned evironment
# so just do sections for now (as in eclass section of handbook)
# sections are: configure, make-tools, bootstrap,
# gnatlib_and_tools, gnatlib-shared
gnatbuild_src_compile() {
debug-print-function ${FUNCNAME} $@
if [[ -z "$1" ]]; then
gnatbuild_src_compile all
return $?
fi
if [[ "all" == "$1" ]]
then # specialcasing "all" to avoid scanning sources unnecessarily
gnatbuild_src_compile configure make-tools \
bootstrap gnatlib_and_tools gnatlib-shared
else
# Set some paths to our bootstrap compiler.
export PATH="${GNATBOOT}/bin:${PATH}"
# !ATTN! the bootstrap compilers have a very simplystic structure,
# so many paths are not identical to the installed ones.
# Plus it was simplified even more in new releases.
if [[ ${BOOT_SLOT} > 4.1 ]] ; then
GNATLIB="${GNATBOOT}/lib"
else
GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
fi
export CC="${GNATBOOT}/bin/gnatgcc"
export INCLUDE_DIR="${GNATLIB}/include"
export LIB_DIR="${GNATLIB}"
export LDFLAGS="-L${GNATLIB}"
# additional vars from gnuada and elsewhere
#export LD_RUN_PATH="${LIBPATH}"
export LIBRARY_PATH="${GNATLIB}"
#export LD_LIBRARY_PATH="${GNATLIB}"
# export COMPILER_PATH="${GNATBOOT}/bin/"
export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
# einfo "CC=${CC},
# ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH},
# LDFLAGS=${LDFLAGS},
# PATH=${PATH}"
while [ "$1" ]; do
case $1 in
configure)
debug-print-section configure
# Configure gcc
local confgcc
# some cross-compile logic from toolchain
confgcc="${confgcc} --host=${CHOST}"
if is_crosscompile || tc-is-cross-compiler ; then
confgcc="${confgcc} --target=${CTARGET}"
fi
[[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}"
# Native Language Support
if use nls ; then
confgcc="${confgcc} --enable-nls --without-included-gettext"
else
confgcc="${confgcc} --disable-nls"
fi
# reasonably sane globals (from toolchain)
confgcc="${confgcc} \
--with-system-zlib \
--disable-checking \
--disable-werror \
--disable-libunwind-exceptions"
# ACT's gnat-gpl does not like libada for whatever reason..
if [[ ${PN} == ${PN_GnatGpl} ]]; then
einfo "ACT's gnat-gpl does not like libada, disabling"
confgcc="${confgcc} --disable-libada"
else
confgcc="${confgcc} --enable-libada"
fi
# multilib support
if is_multilib ; then
confgcc="${confgcc} --enable-multilib"
else
confgcc="${confgcc} --disable-multilib"
fi
# einfo "confgcc=${confgcc}"
cd "${GNATBUILD}"
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" "${S}"/configure \
--prefix=${PREFIX} \
--bindir=${BINPATH} \
--includedir=${INCLUDEPATH} \
--libdir="${LIBPATH}" \
--libexecdir="${LIBEXECPATH}" \
--datadir=${DATAPATH} \
--mandir=${DATAPATH}/man \
--infodir=${DATAPATH}/info \
--program-prefix=gnat \
--enable-languages="c,ada" \
--with-gcc \
--enable-threads=posix \
--enable-shared \
--with-system-zlib \
${confgcc} || die "configure failed"
;;
make-tools)
debug-print-section make-tools
# Compile helper tools
cd "${GNATBOOT}"
cp "${S}"/gcc/ada/xtreeprs.adb .
cp "${S}"/gcc/ada/xsinfo.adb .
cp "${S}"/gcc/ada/xeinfo.adb .
cp "${S}"/gcc/ada/xnmake.adb .
gnatmake xtreeprs && \
gnatmake xsinfo && \
gnatmake xeinfo && \
gnatmake xnmake || die "building helper tools"
;;
bootstrap)
debug-print-section bootstrap
# and, finally, the build itself
cd "${GNATBUILD}"
emake bootstrap || die "bootstrap failed"
;;
gnatlib_and_tools)
debug-print-section gnatlib_and_tools
einfo "building gnatlib_and_tools"
cd "${GNATBUILD}"
emake -j1 -C gcc gnatlib_and_tools || \
die "gnatlib_and_tools failed"
;;
gnatlib-shared)
debug-print-section gnatlib-shared
einfo "building shared lib"
cd "${GNATBUILD}"
rm -f gcc/ada/rts/*.{o,ali} || die
#otherwise make tries to reuse already compiled (without -fPIC) objs..
emake -j1 -C gcc gnatlib-shared LIBRARY_VERSION="${GCCBRANCH}" || \
die "gnatlib-shared failed"
;;
esac
shift
done # while
fi # "all" == "$1"
}
# -- end gnatbuild_src_compile
gnatbuild_src_install() {
debug-print-function ${FUNCNAME} $@
if [[ -z "$1" ]] ; then
gnatbuild_src_install all
return $?
fi
while [ "$1" ]; do
case $1 in
install) # runs provided make install
debug-print-section install
# Looks like we need an access to the bootstrap compiler here too
# as gnat apparently wants to compile something during the installation
# The spotted obuser was xgnatugn, used to process gnat_ugn_urw.texi,
# during preparison of the docs.
export PATH="${GNATBOOT}/bin:${PATH}"
GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
export CC="${GNATBOOT}/bin/gnatgcc"
export INCLUDE_DIR="${GNATLIB}/include"
export LIB_DIR="${GNATLIB}"
export LDFLAGS="-L${GNATLIB}"
export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
# Do not allow symlinks in /usr/lib/gcc/${CHOST}/${MY_PV}/include as
# this can break the build.
for x in "${GNATBUILD}"/gcc/include/* ; do
if [ -L ${x} ] ; then
rm -f ${x}
fi
done
# Remove generated headers, as they can cause things to break
# (ncurses, openssl, etc). (from toolchain.eclass)
for x in $(find "${WORKDIR}"/build/gcc/include/ -name '*.h') ; do
grep -q 'It has been auto-edited by fixincludes from' "${x}" \
&& rm -f "${x}"
done
cd "${GNATBUILD}"
make DESTDIR="${D}" install || die
#make a convenience info link
dosym ${DATAPATH}/info/gnat_ugn_unw.info ${DATAPATH}/info/gnat.info
;;
move_libs)
debug-print-section move_libs
# first we need to remove some stuff to make moving easier
rm -rf "${D}${LIBPATH}"/{32,include,libiberty.a}
# gcc insists on installing libs in its own place
mv "${D}${LIBPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBPATH}"
mv "${D}${LIBEXECPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBEXECPATH}"
# libgcc_s and, with gcc>=4.0, other libs get installed in multilib specific locations by gcc
# we pull everything together to simplify working environment
if has_multilib_profile ; then
case $(tc-arch) in
amd64)
mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR amd64)/* "${D}${LIBPATH}"
mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR x86)/* "${D}${LIBPATH}"/32
;;
ppc64)
# not supported yet, will have to be adjusted when we
# actually build gnat for that arch
;;
esac
fi
# force gnatgcc to use its own specs - versions prior to 3.4.6 read specs
# from system gcc location. Do the simple wrapper trick for now
# !ATTN! change this if eselect-gnat starts to follow eselect-compiler
if [[ ${GCCVER} < 3.4.6 ]] ; then
# gcc 4.1 uses builtin specs. What about 4.0?
cd "${D}${BINPATH}"
mv gnatgcc gnatgcc_2wrap
cat > gnatgcc << EOF
#! /bin/bash
# wrapper to cause gnatgcc read appropriate specs and search for the right .h
# files (in case no matching gcc is installed)
BINDIR=\$(dirname \$0)
# The paths in the next line have to be absolute, as gnatgcc may be called from
# any location
\${BINDIR}/gnatgcc_2wrap -specs="${LIBPATH}/specs" -I"${LIBPATH}/include" \$@
EOF
chmod a+x gnatgcc
fi
# earlier gnat's generate some Makefile's at generic location, need to
# move to avoid collisions
[ -f "${D}${PREFIX}"/share/gnat/Makefile.generic ] &&
mv "${D}${PREFIX}"/share/gnat/Makefile.* "${D}${DATAPATH}"
# use gid of 0 because some stupid ports don't have
# the group 'root' set to gid 0 (toolchain.eclass)
chown -R root:0 "${D}${LIBPATH}"
;;
cleanup)
debug-print-section cleanup
rm -rf "${D}${LIBPATH}"/{gcc,install-tools,../lib{32,64}}
rm -rf "${D}${LIBEXECPATH}"/{gcc,install-tools}
# this one is installed by gcc and is a duplicate even here anyway
rm -f "${D}${BINPATH}/${CTARGET}-gcc-${GCCRELEASE}"
# remove duplicate docs
rm -f "${D}${DATAPATH}"/info/{dir,gcc,cpp}*
rm -rf "${D}${DATAPATH}"/man/man7/
;;
prep_env)
# instead of putting junk under /etc/env.d/gnat we recreate env files as
# needed with eselect
create_eselect_conf
;;
all)
gnatbuild_src_install install move_libs cleanup prep_env
;;
esac
shift
done # while
}
# -- end gnatbuild_src_install

View File

@ -0,0 +1,114 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnome-python-common.eclass,v 1.9 2010/02/09 10:06:36 grobian Exp $
# Original Author: Arun Raghavan <ford_prefect@gentoo.org> (based on the
# gnome-python-desktop eclass by Jim Ramsay <lack@gentoo.org>)
#
# Purpose: Provides common functionality required for building the gnome-python*
# bindings
#
# Important environment variables:
#
# G_PY_PN: Which gnome-python* package bindings we're working with. Defaults to
# gnome-python if unset.
#
# G_PY_BINDINGS: The actual '--enable-<binding>' name, which by default is ${PN}
# excluding the -python at the end. May be overridden if necessary.
#
# EXAMPLES: The set of example files to be installed if the 'examples' USE flag
# is set.
#
# The naming convention for all bindings is as follows:
# dev-python/<original-${PN}-for-which-this-is-the-binding>-python
#
# So, for example, with the bonobo bindings, the original package is libbonobo
# and the packages is named dev-python/libbonobo-python
inherit versionator python autotools gnome2
G_PY_PN=${G_PY_PN:-gnome-python}
G_PY_BINDINGS=${G_PY_BINDINGS:-${PN%-python}}
PVP="$(get_version_component_range 1-2)"
SRC_URI="mirror://gnome/sources/${G_PY_PN}/${PVP}/${G_PY_PN}-${PV}.tar.bz2"
HOMEPAGE="http://pygtk.org/"
RESTRICT="${RESTRICT} test"
GCONF_DEBUG="no"
DOCS="AUTHORS ChangeLog NEWS README"
if [[ ${G_PY_PN} != "gnome-python" ]]; then
DOCS="${DOCS} MAINTAINERS"
fi
S="${WORKDIR}/${G_PY_PN}-${PV}"
# add blockers, we can probably remove them later on
if [[ ${G_PY_PN} == "gnome-python-extras" ]]; then
RDEPEND="!<=dev-python/gnome-python-extras-2.19.1-r2"
fi
RDEPEND="${RDEPEND} ~dev-python/${G_PY_PN}-base-${PV}"
DEPEND="${RDEPEND}
dev-util/pkgconfig"
# Enable the required bindings as specified by the G_PY_BINDINGS variable
gnome-python-common_pkg_setup() {
G2CONF="${G2CONF} --disable-allbindings"
for binding in ${G_PY_BINDINGS}; do
G2CONF="${G2CONF} --enable-${binding}"
done
}
gnome-python-common_src_unpack() {
gnome2_src_unpack
# disable pyc compiling
if [[ -f py-compile ]]; then
rm py-compile
ln -s $(type -P true) py-compile
fi
}
# Do a regular gnome2 src_install and then install examples if required.
# Set the variable EXAMPLES to provide the set of examples to be installed.
# (to install a directory recursively, specify it with a trailing '/' - for
# example, foo/bar/)
gnome-python-common_src_install() {
# The .pc file is installed by respective gnome-python*-base package
sed -i '/^pkgconfig_DATA/d' Makefile || die "sed failed"
sed -i '/^pkgconfigdir/d' Makefile || die "sed failed"
gnome2_src_install
if hasq examples ${IUSE} && use examples; then
insinto /usr/share/doc/${PF}/examples
for example in ${EXAMPLES}; do
if [[ ${example: -1} = "/" ]]; then
doins -r ${example}
else
doins ${example}
fi
done
fi
# Python does not need these, bug #299243
find "${D%/}${EPREFIX}$(python_get_sitedir)" -name "*.la" -delete \
|| die "failed to remove la files"
}
gnome-python-common_pkg_postinst() {
python_version
python_need_rebuild
python_mod_optimize /usr/$(get_libdir)/python${PYVER}/site-packages/gtk-2.0
}
gnome-python-common_pkg_postrm() {
python_mod_cleanup
}
EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm

View File

@ -0,0 +1,223 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.13 2008/10/22 21:04:53 eva Exp $
#
# gnome2-utils.eclass
#
# Set of auxiliary functions used to perform actions commonly needed by packages
# using the GNOME framework.
#
# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
#
# Path to gconftool-2
: ${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"}
# Directory where scrollkeeper-update should do its work
: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"}
# Path to scrollkeeper-update
: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"}
DEPEND=">=sys-apps/sed-4"
# Find the GConf schemas that are about to be installed and save their location
# in the GNOME2_ECLASS_SCHEMAS environment variable
gnome2_gconf_savelist() {
pushd "${D}" &> /dev/null
export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
popd &> /dev/null
}
# Applies any schema files installed by the current ebuild to Gconf's database
# using gconftool-2
gnome2_gconf_install() {
local F
if [[ ! -x "${GCONFTOOL_BIN}" ]]; then
return
fi
if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
einfo "No GNOME 2 GConf schemas found"
return
fi
# We are ready to install the GCONF Scheme now
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
einfo "Installing GNOME 2 GConf schemas"
for F in ${GNOME2_ECLASS_SCHEMAS}; do
if [[ -e "${ROOT}${F}" ]]; then
# echo "DEBUG::gconf install ${F}"
"${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null
fi
done
# have gconf reload the new schemas
pids=$(pgrep -x gconfd-2)
if [[ $? == 0 ]] ; then
ebegin "Reloading GConf schemas"
kill -HUP ${pids}
eend $?
fi
}
# Removes schema files previously installed by the current ebuild from Gconf's
# database.
gnome2_gconf_uninstall() {
local F
if [[ ! -x "${GCONFTOOL_BIN}" ]]; then
return
fi
if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
einfo "No GNOME 2 GConf schemas found"
return
fi
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
einfo "Uninstalling GNOME 2 GConf schemas"
for F in ${GNOME2_ECLASS_SCHEMAS}; do
if [[ -e "${ROOT}${F}" ]]; then
# echo "DEBUG::gconf uninstall ${F}"
"${GCONFTOOL_BIN}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null
fi
done
# have gconf reload the new schemas
pids=$(pgrep -x gconfd-2)
if [[ $? == 0 ]] ; then
ebegin "Reloading GConf schemas"
kill -HUP ${pids}
eend $?
fi
}
# Find the icons that are about to be installed and save their location
# in the GNOME2_ECLASS_ICONS environment variable
# That function should be called from pkg_preinst
gnome2_icon_savelist() {
pushd "${D}" &> /dev/null
export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
popd &> /dev/null
}
# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
# have installed anything under that location.
gnome2_icon_cache_update() {
local updater="$(type -p gtk-update-icon-cache 2> /dev/null)"
if [[ ! -x "${updater}" ]] ; then
debug-print "${updater} is not executable"
return
fi
if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
return
fi
ebegin "Updating icons cache"
local retval=0
local fails=( )
for dir in ${GNOME2_ECLASS_ICONS}
do
if [[ -f "${ROOT}${dir}/index.theme" ]] ; then
local rv=0
"${updater}" -qf "${ROOT}${dir}"
rv=$?
if [[ ! $rv -eq 0 ]] ; then
debug-print "Updating cache failed on ${ROOT}${dir}"
# Add to the list of failures
fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}"
retval=2
fi
fi
done
eend ${retval}
for f in "${fails[@]}" ; do
eerror "Failed to update cache with icon $f"
done
}
# Workaround applied to Makefile rules in order to remove redundant
# calls to scrollkeeper-update and sandbox violations.
gnome2_omf_fix() {
local omf_makefiles filename
omf_makefiles="$@"
if [[ -f ${S}/omf.make ]] ; then
omf_makefiles="${omf_makefiles} ${S}/omf.make"
fi
# testing fixing of all makefiles found
# The sort is important to ensure .am is listed before the respective .in for
# maintainer mode regeneration not kicking in due to .am being newer than .in
for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
omf_makefiles="${omf_makefiles} ${filename}"
done
ebegin "Fixing OMF Makefiles"
local retval=0
local fails=( )
for omf in ${omf_makefiles} ; do
local rv=0
sed -i -e 's:scrollkeeper-update:true:' "${omf}"
retval=$?
if [[ ! $rv -eq 0 ]] ; then
debug-print "updating of ${omf} failed"
# Add to the list of failures
fails[$(( ${#fails[@]} + 1 ))]=$omf
retval=2
fi
done
eend $retval
for f in "${fails[@]}" ; do
eerror "Failed to update OMF Makefile $f"
done
}
# Updates the global scrollkeeper database.
gnome2_scrollkeeper_update() {
if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then
einfo "Updating scrollkeeper database ..."
"${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}"
fi
}

View File

@ -0,0 +1,150 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.86 2009/02/17 16:05:33 dang Exp $
#
# gnome2.eclass
#
# Exports portage base functions used by ebuilds written for packages using the
# GNOME framework. For additional functions, see gnome2-utils.eclass.
#
# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
#
inherit fdo-mime libtool gnome.org gnome2-utils
case "${EAPI:-0}" in
0|1)
EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
;;
*)
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm
;;
esac
# Extra configure opts passed to econf
G2CONF=${G2CONF:-""}
# Extra options passed to elibtoolize
ELTCONF=${ELTCONF:-""}
# Should we use EINSTALL instead of DESTDIR
USE_EINSTALL=${USE_EINSTALL:-""}
# Run scrollkeeper for this package?
SCROLLKEEPER_UPDATE=${SCROLLKEEPER_UPDATE:-"1"}
if [[ ${GCONF_DEBUG} != "no" ]]; then
IUSE="debug"
fi
gnome2_src_unpack() {
unpack ${A}
cd "${S}"
has ${EAPI:-0} 0 1 && gnome2_src_prepare
}
gnome2_src_prepare() {
# Prevent scrollkeeper access violations
gnome2_omf_fix
# Run libtoolize
elibtoolize ${ELTCONF}
}
gnome2_src_configure() {
# Update the GNOME configuration options
if [[ ${GCONF_DEBUG} != 'no' ]] ; then
if use debug ; then
G2CONF="${G2CONF} --enable-debug=yes"
fi
fi
# Prevent a QA warning
if has doc ${IUSE} ; then
G2CONF="${G2CONF} $(use_enable doc gtk-doc)"
fi
# Avoid sandbox violations caused by misbehaving packages (bug #128289)
addwrite "/root/.gnome2"
# GST_REGISTRY is to work around gst-inspect trying to read/write /root
GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed"
}
gnome2_src_compile() {
has ${EAPI:-0} 0 1 && gnome2_src_configure "$@"
emake || die "compile failure"
}
gnome2_src_install() {
# if this is not present, scrollkeeper-update may segfault and
# create bogus directories in /var/lib/
local sk_tmp_dir="/var/lib/scrollkeeper"
dodir "${sk_tmp_dir}"
# we must delay gconf schema installation due to sandbox
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1"
if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then
debug-print "Installing with 'make install'"
emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed"
else
debug-print "Installing with 'einstall'"
einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed"
fi
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
# Manual document installation
[[ -n "${DOCS}" ]] && dodoc ${DOCS}
# Do not keep /var/lib/scrollkeeper because:
# 1. The scrollkeeper database is regenerated at pkg_postinst()
# 2. ${D}/var/lib/scrollkeeper contains only indexes for the current pkg
# thus it makes no sense if pkg_postinst ISN'T run for some reason.
if [[ -z "$(find "${D}" -name '*.omf')" ]]; then
export SCROLLKEEPER_UPDATE="0"
fi
rm -rf "${D}${sk_tmp_dir}"
# Make sure this one doesn't get in the portage db
rm -fr "${D}/usr/share/applications/mimeinfo.cache"
}
gnome2_pkg_preinst() {
gnome2_gconf_savelist
gnome2_icon_savelist
}
gnome2_pkg_postinst() {
gnome2_gconf_install
fdo-mime_desktop_database_update
fdo-mime_mime_database_update
gnome2_icon_cache_update
if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then
gnome2_scrollkeeper_update
fi
}
#gnome2_pkg_prerm() {
# gnome2_gconf_uninstall
#}
gnome2_pkg_postrm() {
fdo-mime_desktop_database_update
fdo-mime_mime_database_update
gnome2_icon_cache_update
if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then
gnome2_scrollkeeper_update
fi
}
# pkg_prerm

View File

@ -0,0 +1,103 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnuconfig.eclass,v 1.33 2006/06/21 19:35:28 vapier Exp $
#
# THIS ECLASS IS DEAD: It has been integrated into portage
#
# Author: Will Woods <wwoods@gentoo.org>
#
# This eclass is used to automatically update files that typically come with
# automake to the newest version available on the system. The most common use
# of this is to update config.guess and config.sub when configure dies from
# misguessing your canonical system name (CHOST). It can also be used to update
# other files that come with automake, e.g. depcomp, mkinstalldirs, etc.
#
# usage: gnuconfig_update [file1 file2 ...]
# if called without arguments, config.guess and config.sub will be updated.
# All files in the source tree ($S) with the given name(s) will be replaced
# with the newest available versions chosen from the list of locations in
# gnuconfig_findnewest(), below.
#
# gnuconfig_update should generally be called from src_unpack()
DEPEND="sys-devel/gnuconfig"
DESCRIPTION="Based on the ${ECLASS} eclass"
# Wrapper function for gnuconfig_do_update. If no arguments are given, update
# config.sub and config.guess (old default behavior), otherwise update the
# named files.
gnuconfig_update() {
# hmm some packages (like binutils gcc glibc) still use this ...
# echo
# ewarn "QA Notice: Please stop using me, portage updates files for you."
# echo
local startdir # declared here ... used in gnuconfig_do_update
if [[ $1 == /* ]] ; then
startdir=$1
shift
else
startdir=${S}
fi
if [[ $# -gt 0 ]] ; then
gnuconfig_do_update "$@"
else
gnuconfig_do_update config.sub config.guess
fi
return $?
}
# Copy the newest available version of specified files over any old ones in the
# source dir. This function shouldn't be called directly - use gnuconfig_update
#
# Note that since bash using dynamic scoping, startdir is available here from
# the gnuconfig_update function
gnuconfig_do_update() {
local configsubs_dir target targetlist file
[[ $# -eq 0 ]] && die "do not call gnuconfig_do_update; use gnuconfig_update"
configsubs_dir=$(gnuconfig_findnewest)
einfo "Using GNU config files from ${configsubs_dir}"
for file in "$@" ; do
if [[ ! -r ${configsubs_dir}/${file} ]] ; then
eerror "Can't read ${configsubs_dir}/${file}, skipping.."
continue
fi
targetlist=$(find "${startdir}" -name "${file}")
if [[ -n ${targetlist} ]] ; then
for target in ${targetlist} ; do
[[ -L ${target} ]] && rm -f "${target}"
einfo " Updating ${target/$startdir\//}"
cp -f "${configsubs_dir}/${file}" "${target}"
eend $?
done
else
ewarn " No ${file} found in ${startdir}, skipping ..."
fi
done
return 0
}
# this searches the standard locations for the newest config.{sub|guess}, and
# returns the directory where they can be found.
gnuconfig_findnewest() {
local locations="
/usr/share/gnuconfig/config.sub
/usr/share/automake-1.9/config.sub
/usr/share/automake-1.8/config.sub
/usr/share/automake-1.7/config.sub
/usr/share/automake-1.6/config.sub
/usr/share/automake-1.5/config.sub
/usr/share/automake-1.4/config.sub
/usr/share/libtool/config.sub
"
grep -s '^timestamp' ${locations} | sort -n -t\' -k2 | tail -n 1 | sed 's,/config.sub:.*$,,'
}

View File

@ -0,0 +1,23 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-2.eclass,v 1.4 2009/11/25 10:11:40 voyageur Exp $
inherit gnustep-base
# Eclass for GNUstep Apps, Frameworks, and Bundles build
#
# maintainer: GNUstep Herd <gnustep@gentoo.org>
DEPEND=">=gnustep-base/gnustep-make-2.0
virtual/gnustep-back"
RDEPEND="${DEPEND}
debug? ( >=sys-devel/gdb-6.0 )"
# The following gnustep-based EXPORT_FUNCTIONS are available:
# * gnustep-base_pkg_setup
# * gnustep-base_src_unpack (EAPI 0|1 only)
# * gnustep-base_src_prepare (EAPI>=2 only)
# * gnustep-base_src_configure (EAPI>=2 only)
# * gnustep-base_src_compile
# * gnustep-base_src_install
# * gnustep-base_pkg_postinst

View File

@ -0,0 +1,231 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.14 2009/12/05 16:10:30 grobian Exp $
inherit eutils flag-o-matic
# Inner gnustep eclass, should only be inherited directly by gnustep-base
# packages
#
# maintainer: GNUstep Herd <gnustep@gentoo.org>
# IUSE variables across all GNUstep packages
# "debug": enable code for debugging
# "doc": build and install documentation, if available
IUSE="debug doc"
# packages needed to build any base gnustep package
GNUSTEP_CORE_DEPEND="doc? ( virtual/texi2dvi dev-tex/latex2html app-text/texi2html )"
# Where to install GNUstep
GNUSTEP_PREFIX="${EPREFIX}/usr/GNUstep"
# GNUstep environment array
typeset -a GS_ENV
# Ebuild function overrides
gnustep-base_pkg_setup() {
if test_version_info 3.3 ; then
strip-unsupported-flags
elif test_version_info 3.4 ; then
# strict-aliasing is known to break obj-c stuff in gcc-3.4*
filter-flags -fstrict-aliasing
fi
# known to break ObjC (bug 86089)
filter-flags -fomit-frame-pointer
}
gnustep-base_src_unpack() {
unpack ${A}
cd "${S}"
gnustep-base_src_prepare
}
gnustep-base_src_prepare() {
if [[ -f ./GNUmakefile ]] ; then
# Kill stupid includes that are simply overdone or useless on normal
# Gentoo, but (may) cause major headaches on Prefixed Gentoo. If this
# only removes a part of a path it's good that it bails out, as we want
# to know when they use some direct include.
ebegin "Cleaning paths from GNUmakefile"
sed -i \
-e 's|-I/usr/X11R6/include||g' \
-e 's|-I/usr/include||g' \
-e 's|-L/usr/X11R6/lib||g' \
-e 's|-L/usr/lib||g' \
GNUmakefile
eend $?
fi
}
gnustep-base_src_configure() {
egnustep_env
if [[ -x ./configure ]] ; then
econf || die "configure failed"
fi
}
gnustep-base_src_compile() {
egnustep_env
case ${EAPI:-0} in
0|1) gnustep-base_src_configure ;;
esac
egnustep_make
}
gnustep-base_src_install() {
egnustep_env
egnustep_install
if use doc ; then
egnustep_env
egnustep_doc
fi
egnustep_install_config
}
gnustep-base_pkg_postinst() {
[[ $(type -t gnustep_config_script) != "function" ]] && return 0
elog "To use this package, as *user* you should run:"
elog " ${GNUSTEP_SYSTEM_TOOLS}/Gentoo/config-${PN}.sh"
}
# Clean/reset an ebuild to the installed GNUstep environment
egnustep_env() {
# Get additional variables
GNUSTEP_SH_EXPORT_ALL_VARIABLES="true"
if [[ -f ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh ]] ; then
# Reset GNUstep variables
source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep-reset.sh
source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep.sh
# Needed to run installed GNUstep apps in sandbox
addpredict "/root/GNUstep"
# Set rpath in ldflags when available
case ${CHOST} in
*-linux-gnu|*-solaris*)
is-ldflagq -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \
|| append-ldflags \
-Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}"
;;
esac
# Set up env vars for make operations
GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \
ADDITIONAL_NATIVE_LIB_DIRS="${GNUSTEP_SYSTEM_LIBRARIES}" \
DESTDIR="${D}" \
HOME="${T}" \
GNUSTEP_USER_DIR="${T}" \
GNUSTEP_USER_DEFAULTS_DIR="${T}"/Defaults \
GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
TAR_OPTIONS="${TAR_OPTIONS} --no-same-owner" \
messages=yes )
# Parallel-make support was added in gnustep-make 2.2.0
has_version "<gnustep-base/gnustep-make-2.2.0" \
&& GS_ENV=( "${GS_ENV[@]}" "-j1" )
use debug \
&& GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
|| GS_ENV=( "${GS_ENV[@]}" "debug=no" )
return 0
fi
die "gnustep-make not installed!"
}
# Make utilizing GNUstep Makefiles
egnustep_make() {
if [[ -f ./Makefile || -f ./makefile || -f ./GNUmakefile ]] ; then
emake ${*} "${GS_ENV[@]}" all || die "package make failed"
return 0
fi
die "no Makefile found"
}
# Make-install utilizing GNUstep Makefiles
egnustep_install() {
# avoid problems due to our "weird" prefix, make sure it exists
mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS}
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
emake ${*} "${GS_ENV[@]}" install || die "package install failed"
return 0
fi
die "no Makefile found"
}
# Make and install docs using GNUstep Makefiles
egnustep_doc() {
if [[ -d ./Documentation ]] ; then
# Check documentation presence
cd "${S}"/Documentation
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
emake "${GS_ENV[@]}" all || die "doc make failed"
emake "${GS_ENV[@]}" install || die "doc install failed"
fi
cd ..
fi
}
egnustep_install_config() {
[[ $(type -t gnustep_config_script) != "function" ]] && return 0
local cfile=config-${PN}.sh
cat << 'EOF' > "${T}"/${cfile}
#!/usr/bin/env bash
gnustep_append_default() {
if [[ -z $1 || -z $2 || -z $3 ]]; then
echo "warning: invalid script invocation"
return
fi
dom=$1
key=$2
val=$3
cur=$(defaults read ${dom} ${key}) 2> /dev/null
if [[ -z $cur ]] ; then
echo " * setting ${dom} ${key}"
defaults write ${dom} ${key} "( ${val} )"
elif [[ ${cur} != *${val}* ]] ; then
echo " * adding ${val} to ${dom} ${key}"
echo "${cur%)\'}, \"${val}\" )'" | defaults write
else
echo " * ${val} already present in ${dom} ${key}"
fi
}
gnustep_set_default() {
if [[ -z $1 || -z $2 || -z $3 ]]; then
echo "warning: invalid script invocation"
return
fi
dom=$1
key=$2
val=$3
echo " * setting ${dom} ${key}"
defaults write ${dom} ${key} ${val}
}
EOF
echo "echo \"Applying ${P} default configuration ...\"" >> "${T}"/${cfile}
gnustep_config_script | \
while read line ; do
echo "${line}" >> "${T}"/${cfile}
done
echo 'echo "done"' >> "${T}"/${cfile}
exeinto ${GNUSTEP_SYSTEM_TOOLS#${EPREFIX}}/Gentoo
doexe "${T}"/${cfile}
}
case ${EAPI:-0} in
0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst ;;
2) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install pkg_postinst ;;
esac

View File

@ -0,0 +1,132 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/go-mono.eclass,v 1.8 2010/01/03 19:10:49 scarabeus Exp $
# @ECLASS: go-mono.eclass
# @MAINTAINER:
# dotnet@gentoo.org
# @BLURB: Common functionality for go-mono.org apps
# @DESCRIPTION:
# Common functionality needed by all go-mono.org apps.
inherit base versionator mono
PRE_URI="http://mono.ximian.com/monobuild/preview/sources"
SVN_PN="${PN/mono-debugger/debugger}"
ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src/mono"
GO_MONO_SUB_BRANCH=${GO_MONO_SUB_BRANCH}
if [[ "${PV%_rc*}" != "${PV}" ]]
then
GO_MONO_P="${P%_rc*}"
SRC_URI="${PRE_URI}/${PN}/${GO_MONO_P}.tar.bz2 -> ${P}.tar.bz2"
S="${WORKDIR}/${GO_MONO_P}"
elif [[ "${PV%_pre*}" != "${PV}" ]]
then
GO_MONO_P="${P%_pre*}"
SRC_URI="${PRE_URI}/${PN}/${GO_MONO_P}.tar.bz2 -> ${P}.tar.bz2"
S="${WORKDIR}/${GO_MONO_P}"
elif [[ "${PV}" == "9999" ]]
then
GO_MONO_P=${P}
ESVN_REPO_URI="svn://anonsvn.mono-project.com/source/trunk/${SVN_PN}"
SRC_URI=""
inherit autotools subversion
elif [[ "${PV%.9999}" != "${PV}" ]]
then
GO_MONO_P=${P}
ESVN_REPO_URI="svn://anonsvn.mono-project.com/source/branches/mono-$(get_version_component_range 1)-$(get_version_component_range 2)${GO_MONO_SUB_BRANCH}/${SVN_PN}"
SRC_URI=""
inherit autotools subversion
else
GO_MONO_P=${P}
SRC_URI="http://ftp.novell.com/pub/mono/sources/${PN}/${P}.tar.bz2"
fi
NO_MONO_DEPEND=( "dev-lang/mono" "dev-dotnet/libgdiplus" )
if [[ "$(get_version_component_range 3)" != "9999" ]]
then
GO_MONO_REL_PV="$(get_version_component_range 1-2)"
else
GO_MONO_REL_PV="${PV}"
fi
if ! has "${CATEGORY}/${PN}" "${NO_MONO_DEPEND[@]}"
then
RDEPEND="=dev-lang/mono-${GO_MONO_REL_PV}*"
DEPEND="${RDEPEND}"
fi
DEPEND="${DEPEND}
>=dev-util/pkgconfig-0.23
userland_GNU? ( >=sys-apps/findutils-4.4.0 )"
# @FUNCTION: go-mono_src_unpack
# @DESCRIPTION: Runs default()
go-mono_src_unpack() {
if [[ "${PV%.9999}" != "${PV}" || "${PV}" == "9999" ]]
then
default
subversion_src_unpack
else
default
fi
}
# @FUNCTION: go-mono_src_prepare
# @DESCRIPTION: Runs autopatch from base.eclass, if PATCHES is set.
go-mono_src_prepare() {
if [[ "${PV%.9999}" != "${PV}" || "${PV}" == "9999" ]]
then
base_src_prepare
[[ "$EAUTOBOOTSTRAP" != "no" ]] && eautoreconf
else
base_src_prepare
fi
}
# @FUNCTION: go-mono_src_configure
# @DESCRIPTION: Runs econf, disabling static libraries and dependency-tracking.
go-mono_src_configure() {
econf --disable-dependency-tracking \
--disable-static \
"$@"
}
# @FUNCTION: go-mono_src_configure
# @DESCRIPTION: Runs default()
go-mono_src_compile() {
emake "$@" || die "emake failed"
}
# @ECLASS-VARIABLE: DOCS
# @DESCRIPTION: Insert path of docs you want installed. If more than one,
# consider using an array.
# @FUNCTION: go-mono_src_install
# @DESCRIPTION: Rune emake, installs common doc files, if DOCS is
# set, installs those. Gets rid of .la files.
go-mono_src_install () {
emake -j1 DESTDIR="${D}" "$@" install || die "install failed"
mono_multilib_comply
local commondoc=( AUTHORS ChangeLog README TODO )
for docfile in "${commondoc[@]}"
do
[[ -e "${docfile}" ]] && dodoc "${docfile}"
done
if [[ "${DOCS[@]}" ]]
then
dodoc "${DOCS[@]}" || die "dodoc DOCS failed"
fi
find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
}
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install

View File

@ -0,0 +1,116 @@
# Copyright 2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gpe.eclass,v 1.2 2009/06/05 22:53:46 miknix Exp $
#
# @ECLASS: gpe.eclass
# @MAINTAINER: <gpe@gentoo.org>
#
# Original Authors:
# Rene Wagner <rw@handhelds.org>
# Ned Ludd <solar@gentoo.org>
# Angelo Arrifano <miknix@gentoo.org>
#
# @BLURB: Provides common functionality for the G Palmtop Environment.
# @DESCRIPTION: Provides common functionality for the G Palmtop Environment.
#
# Thanks to:
# loki_val for EAPI->EAPI2 patch
# Betelgeuse for multiple suggestions.
#
# Based on:
# gnome2.eclass and gpe.bbclass (the latter from OpenEmbedded)
inherit libtool toolchain-funcs
case "${EAPI:-0}" in
0|1)
EXPORT_FUNCTIONS src_unpack src_compile src_install
;;
*)
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
;;
esac
# @ECLASS-VARIABLE: ELTCONF
# @DESCRIPTION:
# Extra options passed to elibtoolize on gnome2 eclass.
ELTCONF=""
# @ECLASS-VARIABLE: GPE_DOCS
# @DESCRIPTION:
# Documentation files to be installed with dodoc.
GPE_DOCS=""
[[ -z "${GPE_MIRROR}" ]] && GPE_MIRROR="http://gpe.linuxtogo.org/download/source"
[[ -z "${GPE_TARBALL_SUFFIX}" ]] && GPE_TARBALL_SUFFIX="gz"
SRC_URI="${GPE_MIRROR}/${P}.tar.${GPE_TARBALL_SUFFIX}"
HOMEPAGE="http://gpe.linuxtogo.org"
IUSE="nls"
GPECONF="${GPECONF} --enable-debug=no --disable-debug"
RDEPEND=""
DEPEND="
>=dev-util/intltool-0.29
>=dev-util/pkgconfig-0.12.0"
# @FUNCTION: gpe_src_unpack
# @DESCRIPTION: Unpacks and applies some required patches for GPE.
gpe_src_unpack() {
unpack ${A}
cd "${S}"
has "${EAPI:-0}" 0 1 && gpe_src_prepare "$@"
}
# Do not call, use gpe_src_unpack() instead.
gpe_src_prepare() {
# let portage handle stripping.
# sort is needed, see #272161 .
for file in $(find . -name 'Makefile*' | sort) ; do
sed -i -e s/'install -s'/'install'/g \
-e s/'install -Ds'/'install -D'/g \
-e 's/$(INSTALL) -s/$(INSTALL) /g' \
-e 's;strip ;#strip ;g' \
${file} \
||die "Sedding ${file} failed."
done
[[ -f configure ]] && elibtoolize
}
# @FUNCTION: gpe_src_configure
# @DESCRIPTION: Configures a GPE package in a cross-compile aware environment.
gpe_src_configure() {
tc-export CC
[[ -f configure ]] && econf "$@" ${GPECONF}
}
# @FUNCTION: gpe_src_compile
# @DESCRIPTION: (Cross-)Compiles a GPE package.
gpe_src_compile() {
tc-export CC
has "${EAPI:-0}" 0 1 && gpe_src_configure "$@"
emake PREFIX=/usr || die "emake failed"
}
# @FUNCTION: gpe_src_install
# @DESCRIPTION: Installs a GPE package in the correct way.
gpe_src_install() {
local use_nls=yes
use nls || use_nls=no
if [ -f configure ]; then
einstall "$@" || die "einstall failed"
else
emake STRIP=true DESTDIR=${D} PREFIX=/usr \
ENABLE_NLS=${use_nls} "$@" install || die "emake install failed"
fi
use nls || rm -rf ${D}/usr/share/locale
# manual document installation
if [[ "${GPE_DOCS}" ]]; then
dodoc ${GPE_DOCS} || die "dodoc failed"
fi
}

View File

@ -0,0 +1,121 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-bad.eclass,v 1.24 2009/11/09 02:43:05 leio Exp $
#
# Original Author: Saleem Abdulrasool <compnerd@gentoo.org>
# Based on the work of foser <foser@gentoo.org> and zaheerm <zaheerm@gentoo.org>
# Purpose: This elcass is designed to help package external gst-plugins per
# plugin rather than in a single package.
#
# This list is current to gst-plugins-bad-0.10.4 except for:
# gst_v4l2 - moved to gst-plugins-bad-0.10.5 (not in >=gst-plugins-bad-0.10.4)
# But it must stay in this list until all <gst-plugins-bad-0.10.4
# are removed
# drac at gentoo.org:
# This list is current to gst-plugins-bad-0.10.5 except for:
# Not present in 0.10.5 - wavpack
# This list is current for gst-plugins-bad-0.10.14 and is only getting entries
# added to it, and never removed for longer backwards compatibility.
my_gst_plugins_bad="alsa amrwb apexsink assrender bz2 cdaudio celt dc1394 dirac
directfb divx dts dvb dvdnav faac faad fbdev gme gsm gst_v4l2 ivorbis jack jp2k
kate ladspa libmms lv2 metadata mimic modplug mpeg2enc mplex musepack
musicbrainz mythtv nas neon ofa opengl oss4 quicktime schro sdl sdltest sndfile
soundtouch soup spc swfdec theoradec timidity twolame vcd vdpau wavpack wildmidi
x x264 xvid"
#qtdemux spped tta
inherit eutils gst-plugins10
MY_PN="gst-plugins-bad"
MY_P=${MY_PN}-${PV}
SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-bad/${MY_P}.tar.bz2"
if [ ${PV} == "0.10.14" ]; then
SRC_URI="${SRC_URI} http://dev.gentoo.org/~leio/distfiles/gst-plugins-bad-0.10.14-kate-configure-fix.patch.bz2"
fi
# added to remove circular deps
# 6/2/2006 - zaheerm
if [ "${PN}" != "${MY_PN}" ]; then
RDEPEND="=media-libs/gstreamer-0.10*
=media-libs/gst-plugins-base-0.10*
>=dev-libs/glib-2.6
>=dev-libs/liboil-0.3"
DEPEND="${RDEPEND}
sys-apps/sed
dev-util/pkgconfig
sys-devel/gettext"
RESTRICT=test
fi
S=${WORKDIR}/${MY_P}
gst-plugins-bad_src_unpack() {
# local makefiles
unpack ${A}
# Link with the syswide installed gst-libs if needed
gst-plugins10_find_plugin_dir
sed -e "s:\$(top_builddir)/gst-libs/gst/interfaces/libgstphotography:${ROOT}/usr/$(get_libdir)/libgstphotography:" \
-e "s:\$(top_builddir)/gst-libs/gst/signalprocessor/libgstsignalprocessor:${ROOT}/usr/$(get_libdir)/libgstsignalprocessor:" \
-e "s:\$(top_builddir)/gst-libs/gst/video/libgstbasevideo:${ROOT}/usr/$(get_libdir)/libgstbasevideo:" \
-i Makefile.in
# 0.10.14 configure errors when --disable-kate is passed:
# configure: error: conditional "USE_TIGER" was never defined.
# Fix it - this has to stay until any 0.10.14 split or main is in tree:
if [ ${PV} == "0.10.14" ]; then
cd ${S}
epatch "${WORKDIR}/gst-plugins-bad-0.10.14-kate-configure-fix.patch"
fi
# Remove generation of any other Makefiles except the plugin's Makefile
# if [[ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]] ; then
# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile"
# elif [[ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]] ; then
# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile"
# fi
# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \
# -i ${S}/configure
}
gst-plugins-bad_src_configure() {
local plugin gst_conf
einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
for plugin in ${GST_PLUGINS_BUILD} ; do
my_gst_plugins_bad="${my_gst_plugins_bad/${plugin}/}"
done
for plugin in ${my_gst_plugins_bad} ; do
gst_conf="${gst_conf} --disable-${plugin}"
done
for plugin in ${GST_PLUGINS_BUILD} ; do
gst_conf="${gst_conf} --enable-${plugin}"
done
cd ${S}
econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "configure failed"
}
gst-plugins-bad_src_compile() {
gst-plugins-bad_src_configure ${@}
gst-plugins10_find_plugin_dir
emake || die "compile failure"
}
gst-plugins-bad_src_install() {
gst-plugins10_find_plugin_dir
einstall || die "install failed"
[[ -e README ]] && dodoc README
}
EXPORT_FUNCTIONS src_unpack src_compile src_install

View File

@ -0,0 +1,134 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-base.eclass,v 1.15 2009/11/16 00:38:24 leio Exp $
# Author : foser <foser@gentoo.org>
# gst-plugins eclass
#
# eclass to make external gst-plugins emergable on a per-plugin basis
# to solve the problem with gst-plugins generating far too much unneeded deps
#
# 3rd party applications using gstreamer now should depend on a set of plugins as
# defined in the source, in case of spider usage obtain recommended plugins to use from
# Gentoo developers responsible for gstreamer <gnome@gentoo.org>, the application developer
# or the gstreamer team.
inherit eutils gst-plugins10
###
# variable declarations
###
MY_PN=gst-plugins-base
MY_P=${MY_PN}-${PV}
# All relevant configure options for gst-plugins
# need a better way to extract these
# gst-plugins-base 0.9
my_gst_plugins_base="x xvideo xshm gst_v4l alsa cdparanoia gnome_vfs
gio libvisual ogg oggtest theora vorbis vorbistest examples freetypetest pango"
#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2"
SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-base/${MY_P}.tar.bz2"
S=${WORKDIR}/${MY_P}
# added to remove circular deps
# 6/2/2006 - zaheerm
if [ "${PN}" != "${MY_PN}" ]; then
RDEPEND=">=media-libs/gst-plugins-base-${PV}"
DEPEND="${RDEPEND}
~media-libs/gst-plugins-base-${PV}
>=sys-apps/sed-4
dev-util/pkgconfig"
RESTRICT=test
fi
###
# public functions
###
gst-plugins-base_src_configure() {
# disable any external plugin besides the plugin we want
local plugin gst_conf
einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
for plugin in ${GST_PLUGINS_BUILD}; do
my_gst_plugins_base=${my_gst_plugins_base/${plugin}/}
done
for plugin in ${my_gst_plugins_base}; do
gst_conf="${gst_conf} --disable-${plugin} "
done
for plugin in ${GST_PLUGINS_BUILD}; do
gst_conf="${gst_conf} --enable-${plugin} "
done
cd ${S}
econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure"
}
###
# public inheritable functions
###
gst-plugins-base_src_unpack() {
# local makefiles
unpack ${A}
# Link with the syswide installed gst-libs if needed
gst-plugins10_find_plugin_dir
sed -e "s:\$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces:${ROOT}/usr/$(get_libdir)/libgstinterfaces:" \
-e "s:\${top_builddir}/gst-libs/gst/interfaces/libgstinterfaces:${ROOT}/usr/$(get_libdir)/libgstinterfaces:" \
-e "s:\$(top_builddir)/gst-libs/gst/audio/libgstaudio:${ROOT}/usr/$(get_libdir)/libgstaudio:" \
-e "s:\${top_builddir}/gst-libs/gst/audio/libgstaudio:${ROOT}/usr/$(get_libdir)/libgstaudio:" \
-e "s:\$(top_builddir)/gst-libs/gst/cdda/libgstcdda:${ROOT}/usr/$(get_libdir)/libgstcdda:" \
-e "s:\${top_builddir}/gst-libs/gst/cdda/libgstcdda:${ROOT}/usr/$(get_libdir)/libgstcdda:" \
-e "s:\$(top_builddir)/gst-libs/gst/riff/libgstriff:${ROOT}/usr/$(get_libdir)/libgstriff:" \
-e "s:\${top_builddir}/gst-libs/gst/riff/libgstriff:${ROOT}/usr/$(get_libdir)/libgstriff:" \
-e "s:\$(top_builddir)/gst-libs/gst/tag/libgsttag:${ROOT}/usr/$(get_libdir)/libgsttag:" \
-e "s:\${top_builddir}/gst-libs/gst/tag/libgsttag:${ROOT}/usr/$(get_libdir)/libgsttag:" \
-e "s:\$(top_builddir)/gst-libs/gst/video/libgstvideo:${ROOT}/usr/$(get_libdir)/libgstvideo:" \
-e "s:\${top_builddir}/gst-libs/gst/video/libgstvideo:${ROOT}/usr/$(get_libdir)/libgstvideo:" \
-e "s:\$(top_builddir)/gst-libs/gst/netbuffer/libgstnetbuffer:${ROOT}/usr/$(get_libdir)/libgstnetbuffer:" \
-e "s:\${top_builddir}/gst-libs/gst/netbuffer/libgstnetbuffer:${ROOT}/usr/$(get_libdir)/libgstnetbuffer:" \
-e "s:\$(top_builddir)/gst-libs/gst/rtp/libgstrtp:${ROOT}/usr/$(get_libdir)/libgstrtp:" \
-e "s:\${top_builddir}/gst-libs/gst/rtp/libgstrtp:${ROOT}/usr/$(get_libdir)/libgstrtp:" \
-i Makefile.in
# cd ${S}
# Remove generation of any other Makefiles except the plugin's Makefile
# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then
# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile"
# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then
# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile"
# fi
# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \
# -i ${S}/configure
}
gst-plugins-base_src_compile() {
gst-plugins-base_src_configure ${@}
gst-plugins10_find_plugin_dir
emake || die "compile failure"
}
gst-plugins-base_src_install() {
gst-plugins10_find_plugin_dir
einstall || die
[[ -e README ]] && dodoc README
}
EXPORT_FUNCTIONS src_unpack src_compile src_install

View File

@ -0,0 +1,117 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-good.eclass,v 1.18 2009/05/16 22:08:09 tester Exp $
# Author : foser <foser@gentoo.org>, zaheerm <zaheerm@gentoo.org>
# gst-plugins-good eclass
#
# eclass to make external gst-plugins emergable on a per-plugin basis
# to solve the problem with gst-plugins generating far too much unneeded deps
#
# 3rd party applications using gstreamer now should depend on a set of plugins as
# defined in the source, obtain recommended plugins to use from
# Gentoo developers responsible for gstreamer <gnome@gentoo.org>, the application developer
# or the gstreamer team.
inherit eutils gst-plugins10
###
# variable declarations
###
MY_PN=gst-plugins-good
MY_P=${MY_PN}-${PV}
# All relevant configure options for gst-plugins
# need a better way to extract these
# gst-plugins-base 0.9
# This list is current to gst-plugins-good-0.10.6
my_gst_plugins_good="gconf gconftool oss aalib aalibtest cairo cdio esd esdtest
flac jpeg ladspa libcaca libdv libpng dv1394 shout2 shout2test speex annodex hal
x taglib gdk_pixbuf gst_v4l2 sunaudio xshm xvideo zlib wavpack soup pulse bz2"
#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2"
SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-good/${MY_P}.tar.bz2"
S=${WORKDIR}/${MY_P}
# added to remove circular deps
# 6/2/2006 - zaheerm
if [ "${PN}" != "${MY_PN}" ]; then
RDEPEND="=media-libs/gst-plugins-base-0.10*"
DEPEND="${RDEPEND}
>=sys-apps/sed-4
dev-util/pkgconfig"
RESTRICT=test
fi
###
# public functions
###
gst-plugins-good_src_configure() {
# disable any external plugin besides the plugin we want
local plugin gst_conf
einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
for plugin in ${GST_PLUGINS_BUILD}; do
my_gst_plugins_good=${my_gst_plugins_good/${plugin}/}
done
for plugin in ${my_gst_plugins_good}; do
gst_conf="${gst_conf} --disable-${plugin} "
done
for plugin in ${GST_PLUGINS_BUILD}; do
gst_conf="${gst_conf} --enable-${plugin} "
done
cd ${S}
econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure"
}
###
# public inheritable functions
###
gst-plugins-good_src_unpack() {
# local makefiles
unpack ${A}
# Link with the syswide installed gst-libs if needed
# gst-plugins10_find_plugin_dir
# cd ${S}
# Remove generation of any other Makefiles except the plugin's Makefile
# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then
# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile"
# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then
# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile"
# fi
# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \
# -i ${S}/configure
}
gst-plugins-good_src_compile() {
gst-plugins-good_src_configure ${@}
gst-plugins10_find_plugin_dir
emake || die "compile failure"
}
gst-plugins-good_src_install() {
gst-plugins10_find_plugin_dir
einstall || die
[[ -e README ]] && dodoc README
}
EXPORT_FUNCTIONS src_unpack src_compile src_install

View File

@ -0,0 +1,116 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-ugly.eclass,v 1.17 2009/11/16 06:04:12 leio Exp $
# Author : foser <foser@gentoo.org>
# gst-plugins-ugly eclass
#
# eclass to make external gst-plugins emergable on a per-plugin basis
# to solve the problem with gst-plugins generating far too much unneeded deps
#
# 3rd party applications using gstreamer now should depend on a set of plugins as
# defined in the source, in case of spider usage obtain recommended plugins to use from
# Gentoo developers responsible for gstreamer <gnome@gentoo.org>, the application developer
# or the gstreamer team.
inherit eutils gst-plugins10
###
# variable declarations
###
MY_PN=gst-plugins-ugly
MY_P=${MY_PN}-${PV}
# All relevant configure options for gst-plugins-ugly
# need a better way to extract these.
# Not necessary since -ugly-0.10.13: id3tag dvdnav
my_gst_plugins_ugly="a52dec amrnb amrwb cdio dvdread dvdnav lame id3tag mad
mpeg2dec sidplay twolame x264"
#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2"
SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-ugly/${MY_P}.tar.bz2"
S=${WORKDIR}/${MY_P}
# added to remove circular deps
# 6/2/2006 - zaheerm
if [ "${PN}" != "${MY_PN}" ]; then
RDEPEND="=media-libs/gst-plugins-base-0.10*"
DEPEND="${RDEPEND}
>=sys-apps/sed-4
dev-util/pkgconfig"
RESTRICT=test
fi
###
# public functions
###
gst-plugins-ugly_src_configure() {
# disable any external plugin besides the plugin we want
local plugin gst_conf
einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
for plugin in ${GST_PLUGINS_BUILD}; do
my_gst_plugins_ugly=${my_gst_plugins_ugly/${plugin}/}
done
for plugin in ${my_gst_plugins_ugly}; do
gst_conf="${gst_conf} --disable-${plugin} "
done
for plugin in ${GST_PLUGINS_BUILD}; do
gst_conf="${gst_conf} --enable-${plugin} "
done
cd ${S}
econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure"
}
###
# public inheritable functions
###
gst-plugins-ugly_src_unpack() {
# local makefiles
unpack ${A}
# Link with the syswide installed gst-libs if needed
# gst-plugins10_find_plugin_dir
# cd ${S}
# Remove generation of any other Makefiles except the plugin's Makefile
# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then
# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile"
# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then
# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile"
# fi
# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \
# -i ${S}/configure
}
gst-plugins-ugly_src_compile() {
gst-plugins-ugly_src_configure ${@}
gst-plugins10_find_plugin_dir
emake || die "compile failure"
}
gst-plugins-ugly_src_install() {
gst-plugins10_find_plugin_dir
einstall || die
[[ -e README ]] && dodoc README
}
EXPORT_FUNCTIONS src_unpack src_compile src_install

View File

@ -0,0 +1,17 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins.eclass,v 1.35 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"
PVP=(${PV//[-\._]/ })
PV_MAJ_MIN=${PVP[0]}.${PVP[1]}
SLOT=${PV_MAJ_MIN}
gst-plugins_pkg_postrm() {
gst-register-${SLOT}
}
EXPORT_FUNCTIONS pkg_postrm

View File

@ -0,0 +1,81 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins10.eclass,v 1.2 2006/01/01 01:14:59 swegener Exp $
# Author : foser <foser@gentoo.org>
# gst-plugins eclass
#
# eclass to make external gst-plugins emergable on a per-plugin basis
# to solve the problem with gst-plugins generating far too much unneeded deps
#
# 3rd party applications using gstreamer now should depend on a set of plugins as
# defined in the source, in case of spider usage obtain recommended plugins to use from
# Gentoo developers responsible for gstreamer <gnome@gentoo.org>, the application developer
# or the gstreamer team.
inherit eutils
###
# variable declarations
###
# Create a major/minor combo for our SLOT and executables suffix
PVP=(${PV//[-\._]/ })
#PV_MAJ_MIN=${PVP[0]}.${PVP[1]}
PV_MAJ_MIN=0.10
# Extract the plugin to build from the ebuild name
# May be set by an ebuild and contain more than one indentifier, space seperated
# (only src_configure can handle mutiple plugins at this time)
GST_PLUGINS_BUILD=${PN/gst-plugins-/}
# Actual build dir, is the same as the configure switch name most of the time
GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/}
# general common gst-plugins ebuild entries
DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer"
HOMEPAGE="http://gstreamer.freedesktop.org/"
LICENSE="GPL-2"
#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2"
SLOT=${PV_MAJ_MIN}
###
# internal functions
###
gst-plugins10_find_plugin_dir() {
if [ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]; then
if [ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]; then
ewarn "No such plugin directory"
die
fi
einfo "Building system plugin ..."
cd ${S}/sys/${GST_PLUGINS_BUILD_DIR}
else
einfo "Building external plugin ..."
cd ${S}/ext/${GST_PLUGINS_BUILD_DIR}
fi
}
###
# public functions
###
gst-plugins10_remove_unversioned_binaries() {
# remove the unversioned binaries gstreamer provide
# this is to prevent these binaries to be owned by several SLOTs
cd ${D}/usr/bin
for gst_bins in `ls *-${PV_MAJ_MIN}`
do
rm ${gst_bins/-${PV_MAJ_MIN}/}
einfo "Removed ${gst_bins/-${PV_MAJ_MIN}/}"
done
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-component.eclass,v 1.31 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,534 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v 1.26 2010/01/03 19:10:49 scarabeus Exp $
# @ECLASS: gtk-sharp-module.eclass
# @MAINTAINER:
# dotnet@gentoo.org
# @BLURB: Manages the modules of the gtk-, gnome-, and gnome-desktop-sharp tarballs
# @DESCRIPTION:
# This eclass provides phase functions and helper functions for the modules
# of the gtk-sharp, gnome-sharp and gnome-desktop-sharp tarballs.
# PLEASE TAKE NOTE: ONLY FOR EAPI-2 EBUILDS
WANT_AUTOMAKE=none
WANT_AUTOCONF=none
inherit eutils mono multilib libtool autotools base versionator
# @ECLASS-VARIABLE: GTK_SHARP_MODULE
# @DESCRIPTION:
# The name of the Gtk# module.
# Default value: ${PN/-sharp/}
GTK_SHARP_MODULE=${GTK_SHARP_MODULE:=${PN/-sharp/}}
# @ECLASS-VARIABLE: GTK_SHARP_MODULE_DIR
# @DESCRIPTION:
# The subdirectory of S in which GTK_SHARP_MODULE is installed.
# Default value: ${PN/-sharp/}
GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}}
# @ECLASS-VARIABLE: GTK_SHARP_REQUIRED_VERSION
# @DESCRIPTION:
# The version of the gtk-sharp tarball this package requires.
# Optional.
GTK_SHARP_REQUIRED_VERSION="${GTK_SHARP_REQUIRED_VERSION}"
# @ECLASS-VARIABLE: gapi_users_list
# @DESCRIPTION:
# List of modules that use one of gapi2-codegen, gapi2-fixup or gapi2-parser
# No ebuild-serviceable parts inside.
gapi_users_list="art gnome gnomevfs ${gnome_desktop_sharp_module_list} atk gtk gdk glade pango"
# @ECLASS-VARIABLE: PV_MAJOR
# @DESCRIPTION:
# The first two components of the PV variable.
PV_MAJOR=$(get_version_component_range 1-2)
# @FUNCTION: add_bdepend
# @USAGE: <package atom>
# @DESCRIPTION:
# Adds to the DEPEND variable
add_bdepend() {
[[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
DEPEND="${DEPEND} $@"
}
# @FUNCTION: add_rdepend
# @USAGE: <package atom>
# @DESCRIPTION:
# Adds to the RDEPEND variable
add_rdepend() {
[[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
RDEPEND="${RDEPEND} $@"
}
# @FUNCTION: add_depend
# @USAGE: <package atom>
# @DESCRIPTION:
# Adds to the DEPEND and RDEPEND variables
add_depend() {
[[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
DEPEND="${DEPEND} $@"
RDEPEND="${RDEPEND} $@"
}
# @ECLASS-VARIABLE: TARBALL
# @DESCRIPTION:
# The GtkSharp modules are currently divided into three seperate tarball
# distributions. The TARBALL variable holds the name of the tarball
# to which GTK_SHARP_MODULE belongs.
case ${GTK_SHARP_MODULE} in
glib|glade|gtk|gdk|atk|pango|gtk-dotnet|gtk-gapi|gtk-docs)
TARBALL="gtk-sharp"
case ${PVR} in
2.12.*)
SRC_URI="mirror://gentoo/${TARBALL}-2.12.7.patch.bz2"
#Upstream: https://bugzilla.novell.com/show_bug.cgi?id=$bugno
#Upstream bug #470390 for the gtk-sharp-2.12.7.patch
PATCHES=(
"${WORKDIR}/${TARBALL}-2.12.7.patch"
)
EAUTORECONF="YES"
add_bdepend "=sys-devel/automake-1.10*"
add_bdepend ">=sys-devel/autoconf-2.61"
;;
esac
;;
art|gnome|gnomevfs|gconf)
TARBALL="gnome-sharp"
add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
has "${GTK_SHARP_MODULE}" "${gapi_users_list}" && \
add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*"
case ${PVR} in
2.24.1*)
SRC_URI="mirror://gentoo/${TARBALL}-2.24.1.patch.bz2"
# Upstream bug: https://bugzilla.novell.com/show_bug.cgi?id=483251
PATCHES=(
"${WORKDIR}/${TARBALL}-2.24.1.patch"
)
EAUTORECONF="YES"
add_bdepend "=sys-devel/automake-1.10*"
add_bdepend ">=sys-devel/autoconf-2.61"
;;
esac
;;
gnome-desktop|gnome-print|gnome-panel|gtkhtml|gtksourceview|nautilusburn|rsvg|vte|wnck)
TARBALL="gnome-desktop-sharp"
add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
add_depend "=dev-dotnet/gnome-sharp-2.24*"
add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*"
;;
*)
eerror "Huh? Sonny boy, looks like your GTK_SHARP_MODULE is not on the approved list. BAILING!"
die "How did we get here!!?"
;;
esac
case ${PF} in
#gtk-sharp tarball
gtk-sharp-docs*)
add_depend ">=virtual/monodoc-2.0"
;;
gtk-sharp-gapi*)
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
add_depend "dev-perl/XML-LibXML"
;;
gtk-sharp-*)
add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
add_depend "~dev-dotnet/glib-sharp-${PV}"
add_depend "~dev-dotnet/atk-sharp-${PV}"
add_depend "~dev-dotnet/gdk-sharp-${PV}"
add_depend "~dev-dotnet/pango-sharp-${PV}"
;;
gdk-sharp-*)
add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
add_depend "~dev-dotnet/glib-sharp-${PV}"
add_depend "x11-libs/gtk+:2"
add_depend "~dev-dotnet/pango-sharp-${PV}"
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
atk-sharp-*)
add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
add_depend "~dev-dotnet/glib-sharp-${PV}"
add_depend "dev-libs/atk"
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
glib-sharp-*)
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
add_depend "dev-libs/glib:2"
;;
pango-sharp-*)
add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
add_depend "~dev-dotnet/glib-sharp-${PV}"
add_depend "x11-libs/pango"
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
gtk-dotnet-*)
add_depend "~dev-dotnet/glib-sharp-${PV}"
add_depend "~dev-dotnet/gdk-sharp-${PV}"
add_depend "~dev-dotnet/pango-sharp-${PV}"
add_depend "~dev-dotnet/gtk-sharp-${PV}"
add_depend "dev-lang/mono[-minimal]"
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
glade-sharp-*)
add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
add_depend "~dev-dotnet/glib-sharp-${PV}"
add_depend "~dev-dotnet/atk-sharp-${PV}"
add_depend "~dev-dotnet/gdk-sharp-${PV}"
add_depend "~dev-dotnet/gtk-sharp-${PV}"
add_depend "~dev-dotnet/pango-sharp-${PV}"
add_depend ">=gnome-base/libglade-2.3.6"
;;
#gnome-sharp tarball
art-sharp-*)
add_depend ">=media-libs/libart_lgpl-2.3.20"
;;
gnome-sharp-*)
add_depend ">=gnome-base/libgnomeui-${PV_MAJOR}"
add_depend "~dev-dotnet/gnomevfs-sharp-${PV}"
add_depend "~dev-dotnet/art-sharp-${PV}"
add_depend ">=gnome-base/libgnomecanvas-${GNOMECANVAS_REQUIRED_VERSION}"
add_depend ">=x11-libs/gtk+-2.14.0"
;;
gconf-sharp-*)
add_depend ">=gnome-base/gconf-${PV_MAJOR}"
add_depend "=dev-dotnet/glade-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
add_depend "~dev-dotnet/gnome-sharp-${PV}"
add_depend "~dev-dotnet/art-sharp-${PV}"
;;
gnomevfs-sharp-*)
add_depend ">=gnome-base/gnome-vfs-${PV_MAJOR}"
;;
#gnome-desktop-sharp tarball
gnome-desktop-sharp-*)
# NOTE: libgnome-desktop-2.so has been known to make binary-
# incompatible changes, requiring .so bumps. gnome-desktop-sharp
# is locked to a specific .so.n version, so strict dependencies
# may be required in the future (as it has in the past).
add_depend ">=gnome-base/gnome-desktop-${PV_MAJOR}"
;;
gnome-panel-sharp-*)
add_depend ">=gnome-base/gnome-panel-${PV_MAJOR}"
;;
gnome-print-sharp-*)
add_depend ">=gnome-base/libgnomeprint-${API_VERSION}"
;;
gtkhtml-sharp-*)
#NOTE: gtkhtml dependency must follow gtkhtml-sharp version.
#i.e. gtkhtml-sharp-2.24.0 >=gtkhtml-3.24
# gtkhtml-sharp-2.16.0 >=gtkhtml-3.16
# See bug 249540 for unpleasant side effects.
add_depend ">=gnome-extra/gtkhtml-$(($(get_version_component_range 1) + 1 )).$(get_version_component_range 2)"
;;
gtksourceview-sharp-*)
add_depend ">=x11-libs/gtksourceview-${GTKSOURCEVIEW_REQUIRED_VERSION}:2.0"
;;
nautilusburn-sharp-*)
add_depend ">=gnome-extra/nautilus-cd-burner-2.24.0"
;;
rsvg-sharp-*)
add_depend ">=gnome-base/librsvg-${RSVG_REQUIRED_VERSION}"
;;
vte-sharp-*)
add_depend ">=x11-libs/vte-${VTE_REQUIRED_VERSION}"
;;
wnck-sharp-*)
add_depend ">=x11-libs/libwnck-${PV_MAJOR}"
;;
esac
# @ECLASS-VARIABLE: DESCRIPTION
# @DESCRIPTION:
# Default value: GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball
DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball"
# @ECLASS-VARIABLE: HOMEPAGE
# @DESCRIPTION:
# Default value: http://www.mono-project.com/GtkSharp
HOMEPAGE="http://www.mono-project.com/GtkSharp"
# @ECLASS-VARIABLE: DESCRIPTION
# @DESCRIPTION:
# Default value: LGPL-2.1
LICENSE="LGPL-2.1"
add_depend ">=dev-lang/mono-2.0.1"
add_bdepend ">=sys-apps/sed-4"
add_bdepend ">=dev-util/pkgconfig-0.23"
add_bdepend ">=app-shells/bash-3.1"
IUSE="debug"
# @ECLASS-VARIABLE: S
# @DESCRIPTION:
# Default value: ${WORKDIR}/${TARBALL}-${PV}
S="${WORKDIR}/${TARBALL}-${PV}"
# @ECLASS-VARIABLE: SRC_URI
# @DESCRIPTION:
# Default value: mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2
SRC_URI="${SRC_URI}
mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2"
# @FUNCTION: get_sharp_apis
# @USAGE: <type> <pkgconfig-package>
# @RETURN: .NET API files
# @DESCRIPTION:
# Given a valid pkg-config package, will return a list of API xml files.
# <type> can be either --prefixed or --bare. If prefixed, each API file
# will be prefixed with -I:
get_sharp_apis() {
[[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments"
get_sharp_assemblies "$@"
}
# @FUNCTION: get_sharp_assemblies
# @USAGE: <type> <pkgconfig-package>
# @RETURN: .NET .dll assemblies
# @DESCRIPTION:
# Given a valid pkg-config package, will return a list of .dll assemblies.
# <type> can be either --prefixed or --bare. If prefixed, each .dll file
# will be prefixed with -r:
get_sharp_assemblies() {
[[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments"
local string config=libs prefix="-r:"
local -a rvalue
[[ "${FUNCNAME[1]}" = "get_sharp_apis" ]] && config=cflags && prefix="-I:"
for string in $(pkg-config --${config} ${2} 2> /dev/null)
do
rvalue+=( ${string#-?:} )
done
case $1 in
--bare)
:
;;
--prefixed)
for (( i=0 ; i< ${#rvalue[@]} ; i++ ))
do
rvalue[$i]=${prefix}${rvalue[$i]}
done
;;
*)
die "${FUNCNAME}: Unknown parameter"
;;
esac
echo "${rvalue[@]}"
}
# @FUNCTION: phase_hook
# @USAGE: <prefix>
# Looks for functions named <prefix>_caller_suffix and executes them.
# _caller_suffix is the calling function with the prefix
# gtk-sharp-module removed.
phase_hook() {
[[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs one argument"
if [[ "$(type -t ${1}${FUNCNAME[1]#gtk-sharp-module})" = "function" ]]
then
ebegin "Phase-hook: Running ${1}${FUNCNAME[1]#gtk-sharp-module}"
${1}${FUNCNAME[1]#gtk-sharp-module}
eend 0
fi
}
# @FUNCTION: ac_path_prog_override
# @USAGE: <PROG> [path]
# @DESCRIPTION:
# Override AC_PATH_PROG() autoconf macros. Path will be set to " " if
# not specified.
ac_path_prog_override() {
if [[ ${#@} -lt 1 || ${#@} -gt 2 ]]
then
eerror "${FUNCNAME[0]} requires at least one parameter and takes at most two:"
eerror "AC_PATH_PROG(PARAM1, param2)"
die "${FUNCNAME[0]} requires at least one parameter and takes at most two:"
fi
export ac_cv_path_${1}="${2:- }"
}
# @FUNCTION: pkg_check_modules_override
# @USAGE: <GROUP> [package1] [package2]
# @DESCRIPTION:
# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf
# macros, with the string " " by default. If packages are specified, they will
# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted.
# LIBS and CFLAGS can also be specified per-package with the following syntax:
# @CODE
# package=LIBS%CFLAGS
# @CODE
# = and % have no effect unless both are specified.
# Here is an example:
# @CODE
# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0
# @CODE
# The above example will do:
# export GASH_CFLAGS+=" -jule"
# export GASH_LIBS+=" "
# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)"
# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)"
#
# NOTE: If a package is not found, the string " " will be inserted in place of
# <GROUP>_CFLAGS and <GROUP>_LIBS
pkg_check_modules_override() {
local package
local group="${1}"
local packages="${*:2}"
export ${group}_CFLAGS=" "
export ${group}_LIBS=" "
if [[ ${#@} -lt 1 ]]
then
eerror "${FUNCNAME[0]} requires at least one parameter: GROUP"
eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)"
die "${FUNCNAME[0]} requires at least one parameter: GROUP"
fi
for package in $packages
do
if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]]
then
package_cflag_libs=${package##*=}
export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}"
export ${group}_LIBS+=" ${package_cflag_libs##*\%}"
else
if pkg-config --exists $package
then
export ${group}_CFLAGS+=" $(pkg-config --cflags $package)"
export ${group}_LIBS+=" $(pkg-config --libs $package)"
else
export ${group}_CFLAGS+=" "
export ${group}_LIBS+=" "
fi
fi
done
}
# @FUNCTION: gtk-sharp-tarball-post_src_prepare
# @DESCRIPTION:
# Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references to
# local assemblies to the installed ones. Is only called by src_prepare when
# $GTK_SHARP_MODULE is a member of $gtk_sharp_module_list.
gtk-sharp-tarball-post_src_prepare() {
cd "${S}/${GTK_SHARP_MODULE_DIR}"
sed -i \
-e "s; \$(srcdir)/../glib/glib-api.xml; $(get_sharp_apis --bare glib-sharp-2.0);" \
-e "s; ../pango/pango-api.xml; $(get_sharp_apis --bare pango-sharp-2.0);" \
-e "s; ../atk/atk-api.xml; $(get_sharp_apis --bare atk-sharp-2.0);" \
-e "s; ../gdk/gdk-api.xml; $(get_sharp_apis --bare gdk-sharp-2.0);" \
-e "s; ../gtk/gtk-api.xml; $(get_sharp_apis --bare gtk-sharp-2.0);" \
-e "s; \.\./glib/glib-sharp.dll; $(get_sharp_assemblies --bare glib-sharp-2.0);g" \
-e "s; \.\./pango/pango-sharp.dll; $(get_sharp_assemblies --bare pango-sharp-2.0);g" \
-e "s; \.\./atk/atk-sharp.dll; $(get_sharp_assemblies --bare atk-sharp-2.0);g" \
-e "s; \.\./gdk/gdk-sharp.dll; $(get_sharp_assemblies --bare gdk-sharp-2.0);g" \
-e "s; \.\./gtk/gtk-sharp.dll; $(get_sharp_assemblies --bare gtk-sharp-2.0);g" \
-e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;/usr/bin/gapi2-fixup;" \
-e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;/usr/bin/gapi2-codegen;" \
-e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \
-e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \
$(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles"
}
# @FUNCTION: gnome-sharp-tarball-post_src_prepare
# @DESCRIPTION:
# Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references to
# local assemblies to the installed ones. Is only called by src_prepare when
# $GTK_SHARP_MODULE is a member of $gnome_sharp_module_list.
gnome-sharp-tarball-post_src_prepare() {
cd "${S}/${GTK_SHARP_MODULE_DIR}"
sed -i \
-e "s; ../gnomevfs/gnome-vfs-api.xml; $(get_sharp_apis --bare gnome-vfs-sharp-2.0);" \
-e "s; ../art/art-api.xml; $(get_sharp_apis --bare art-sharp-2.0);" \
-e "s; \.\./art/art-sharp.dll; $(get_sharp_assemblies --bare art-sharp-2.0);g" \
-e "s; \.\./gnomevfs/gnome-vfs-sharp.dll; $(get_sharp_assemblies --bare gnome-vfs-sharp-2.0);g" \
-e "s;/r:\$(top_builddir)/art/art-sharp.dll;$(get_sharp_assemblies --prefixed art-sharp-2.0);" \
-e "s;/r:\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_assemblies --prefixed gnome-sharp-2.0);" \
$(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles"
}
# @FUNCTION: gtk-sharp-module_src_prepare
# @DESCRIPTION:
# Runs autopatch from base.eclass, eautoreconf if EAUTORECONF is set to any
# value.
# Contains a phase_hook, runs very last.
# phase_hook prefix trigger: ${TARBALL}-tarball-post
# Is exported.
gtk-sharp-module_src_prepare() {
base_src_prepare
# @ECLASS-VARIABLE: EAUTORECONF
# @DESCRIPTION:
# If set, EAUTORECONF will be run during src_prepare.
[[ ${EAUTORECONF} ]] && eautoreconf
phase_hook ${TARBALL}-tarball-post
elibtoolize
}
# @FUNCTION: gtk-sharp-tarball_src_configure
# @DESCRIPTION:
# Sets some environment variables that will allow us to make the dependencies
# for each ebuild be only its own dependencies, without patching configure.
# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE
# is a member of $gtk_sharp_module_list.
gtk-sharp-tarball_src_configure() {
pkg_check_modules_override GLIB gobject-2.0
pkg_check_modules_override GIO gio-2.0
pkg_check_modules_override PANGO pango
pkg_check_modules_override ATK atk
pkg_check_modules_override GTK gtk+-2.0
pkg_check_modules_override GLADE libglade-2.0
}
# @FUNCTION: gnome-sharp-tarball_src_configure
# @DESCRIPTION:
# Sets some environment variables that will allow us to make the dependencies
# for each ebuild be only its own dependencies. Without patching configure.
# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE
# is a member of $gnome_sharp_module_list.
gnome-sharp-tarball_src_configure() {
pkg_check_modules_override GLADESHARP glade-sharp-2.0
pkg_check_modules_override GAPI gapi-2.0
ac_path_prog_override GAPI_PARSER /usr/bin/gapi2-parser
ac_path_prog_override GAPI_CODEGEN /usr/bin/gapi2-codegen
ac_path_prog_override GAPI_FIXUP /usr/bin/gapi2-fixup
}
# @FUNCTION: gtk-sharp-module_src_configure
# @USAGE: [econf-arguments]
# @DESCRIPTION:
# Calls econf with some default values.
# Contains a phase_hook, run before econf.
# phase_hook prefix trigger: ${TARBALL}-tarball
# Is exported.
gtk-sharp-module_src_configure() {
phase_hook ${TARBALL}-tarball
econf --disable-static \
--disable-dependency-tracking \
--disable-maintainer-mode \
$(use debug &&echo "--enable-debug" ) \
${@} || die "econf failed"
}
# @FUNCTION: gtk-sharp-module_src_compile
# @DESCRIPTION:
# Calls emake in the subdir of the module.
# Sets CSC=/usr/bin/gmcs. Deletes top_srcdir Makefiles to prevent recursing in
# case we missed some dll references.
# Is exported.
gtk-sharp-module_src_compile() {
rm -f "${S}"/Makefile* &> /dev/null
cd "${S}/${GTK_SHARP_MODULE_DIR}"
emake CSC=/usr/bin/gmcs || die "emake failed"
}
# @FUNCTION: gtk-sharp-module_src_install
# @DESCRIPTION:
# Installs the module. Fixes up lib paths so they're multilib-safe.
# Gets rid of .la files.
# Is exported.
gtk-sharp-module_src_install() {
cd "${S}/${GTK_SHARP_MODULE_DIR}"
emake DESTDIR="${D}" install || die "emake install failed"
mono_multilib_comply
find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
[[ $(find "${D}" -type f|wc -l) -lt 3 ]] && die "Too few files. This smells like a failed install."
}
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install

View File

@ -0,0 +1,361 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.18 2010/01/26 20:50:40 kolmodin Exp $
#
# Original authors: Andres Loeh <kosmikus@gentoo.org>
# Duncan Coutts <dcoutts@gentoo.org>
# Maintained by: Haskell herd <haskell@gentoo.org>
#
# This eclass is for packages that make use of the
# Haskell Common Architecture for Building Applications
# and Libraries (cabal).
#
# Basic instructions:
#
# Before inheriting the eclass, set CABAL_FEATURES to
# reflect the tools and features that the package makes
# use of.
#
# Currently supported features:
# haddock -- for documentation generation
# alex -- lexer/scanner generator
# happy -- parser generator
# c2hs -- C interface generator
# cpphs -- C preprocessor clone written in Haskell
# profile -- if package supports to build profiling-enabled libraries
# bootstrap -- only used for the cabal package itself
# bin -- the package installs binaries
# lib -- the package installs libraries
# nocabaldep -- don't add dependency on cabal.
# only used for packages that _must_ not pull the dependency
# on cabal, but still use this eclass (e.g. haskell-updater).
#
# Dependencies on other cabal packages have to be specified
# correctly.
#
# Cabal libraries should usually be SLOTted with "${PV}".
#
# Many Cabal packages require S to be manually set.
#
# Conforming Cabal packages don't require any function definitions
# in the ebuild.
#
# Special flags to Cabal Configure can now be set by using
# CABAL_CONFIGURE_FLAGS
inherit ghc-package multilib
for feature in ${CABAL_FEATURES}; do
case ${feature} in
haddock) CABAL_USE_HADDOCK=yes;;
alex) CABAL_USE_ALEX=yes;;
happy) CABAL_USE_HAPPY=yes;;
c2hs) CABAL_USE_C2HS=yes;;
cpphs) CABAL_USE_CPPHS=yes;;
profile) CABAL_USE_PROFILE=yes;;
bootstrap) CABAL_BOOTSTRAP=yes;;
bin) CABAL_HAS_BINARIES=yes;;
lib) CABAL_HAS_LIBRARIES=yes;;
nocabaldep) CABAL_FROM_GHC=yes;;
*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
esac
done
if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
IUSE="${IUSE} doc"
DEPEND="${DEPEND} doc? ( dev-haskell/haddock )"
fi
if [[ -n "${CABAL_USE_ALEX}" ]]; then
DEPEND="${DEPEND} dev-haskell/alex"
cabalconf="${cabalconf} --with-alex=/usr/bin/alex"
fi
if [[ -n "${CABAL_USE_HAPPY}" ]]; then
DEPEND="${DEPEND} dev-haskell/happy"
cabalconf="${cabalconf} --with-happy=/usr/bin/happy"
fi
if [[ -n "${CABAL_USE_C2HS}" ]]; then
DEPEND="${DEPEND} dev-haskell/c2hs"
cabalconf="${cabalconf} --with-c2hs=/usr/bin/c2hs"
fi
if [[ -n "${CABAL_USE_CPPHS}" ]]; then
DEPEND="${DEPEND} dev-haskell/cpphs"
cabalconf="${cabalconf} --with-cpphs=/usr/bin/cpphs"
fi
if [[ -n "${CABAL_USE_PROFILE}" ]]; then
IUSE="${IUSE} profile"
fi
# We always use a standalone version of Cabal, rather than the one that comes
# with GHC. But of course we can't depend on cabal when building cabal itself.
if [[ -z ${CABAL_MIN_VERSION} ]]; then
CABAL_MIN_VERSION=1.1.4
fi
if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then
DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
fi
# Libraries require GHC to be installed.
if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
RDEPEND="${RDEPEND} dev-lang/ghc"
fi
# returns the version of cabal currently in use
_CABAL_VERSION_CACHE=""
cabal-version() {
if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then
if [[ "${CABAL_BOOTSTRAP}" ]]; then
# We're bootstrapping cabal, so the cabal version is the version
# of this package itself.
_CABAL_VERSION_CACHE="${PV}"
elif [[ "${CABAL_FROM_GHC}" ]]; then
# We can't assume there's a version of Cabal installed by ebuild as
# this might be a first time install of GHC (for packages that
# use the shipped Cabal like haskell-updater).
# The user is likely to only have one version of Cabal, provided
# by GHC. Note that dev-haskell/cabal can be a dummy package, only
# using the version provided by GHC. If the user has another version
# of Cabal too (more recent than the one GHC provides through
# dev-haskell/cabal, or possibly older if he used an old
# Cabal package) the most recent is used (expected to be the last
# one in the ghc-pkg output).
_CABAL_VERSION_CACHE="$(ghc-pkg field Cabal version | tail -n 1)"
# Strip out the "version: " prefix
_CABAL_VERSION_CACHE="${_CABAL_VERSION_CACHE#"version: "}"
else
# We ask portage, not ghc, so that we only pick up
# portage-installed cabal versions.
_CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
fi
fi
echo "${_CABAL_VERSION_CACHE}"
}
cabal-bootstrap() {
local setupmodule
local cabalpackage
if [[ -f "${S}/Setup.lhs" ]]; then
setupmodule="${S}/Setup.lhs"
else
if [[ -f "${S}/Setup.hs" ]]; then
setupmodule="${S}/Setup.hs"
else
die "No Setup.lhs or Setup.hs found"
fi
fi
# We build the setup program using the latest version of
# cabal that we have installed
if version_is_at_least "6.4" "$(ghc-version)"; then
cabalpackage=Cabal-$(cabal-version)
else
# older ghc's don't support package versioning
cabalpackage=Cabal
fi
einfo "Using cabal-$(cabal-version)."
$(ghc-getghc) -package "${cabalpackage}" --make "${setupmodule}" -o setup \
|| die "compiling ${setupmodule} failed"
}
cabal-mksetup() {
local setupdir
if [[ -n $1 ]]; then
setupdir=$1
else
setupdir=${S}
fi
rm -f "${setupdir}"/Setup.{lhs,hs}
echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
> $setupdir/Setup.hs
}
cabal-haddock() {
./setup haddock || die "setup haddock failed"
}
cabal-configure() {
if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock"
fi
if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
cabalconf="${cabalconf} --enable-library-profiling"
fi
# Building GHCi libs on ppc64 causes "TOC overflow".
if use ppc64; then
cabalconf="${cabalconf} --disable-library-for-ghci"
fi
if version_is_at_least "1.4" "$(cabal-version)"; then
# disable executable stripping for the executables, as portage will
# strip by itself, and pre-stripping gives a QA warning.
# cabal versions previous to 1.4 does not strip executables, and does
# not accept the flag.
# this fixes numerous bugs, amongst them;
# bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
cabalconf="${cabalconf} --disable-executable-stripping"
fi
if version_is_at_least "1.2.0" "$(cabal-version)"; then
cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}"
# As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
# it's better if the configure chatter is in the build logs:
cabalconf="${cabalconf} --verbose"
fi
# Note: with Cabal-1.1.6.x we do not have enough control
# to put the docs into the right place. They're currently going
# into /usr/share/${P}/ghc-x.y/doc/
# rather than /usr/share/doc/${PF}/
# Because we can only set the datadir, not the docdir.
./setup configure \
--ghc --prefix=/usr \
--with-compiler="$(ghc-getghc)" \
--with-hc-pkg="$(ghc-getghcpkg)" \
--prefix=/usr \
--libdir=/usr/$(get_libdir) \
--libsubdir=${P}/ghc-$(ghc-version) \
--datadir=/usr/share/ \
--datasubdir=${P}/ghc-$(ghc-version) \
${cabalconf} \
${CABAL_CONFIGURE_FLAGS} \
"$@" || die "setup configure failed"
}
cabal-build() {
unset LANG LC_ALL LC_MESSAGES
./setup build \
|| die "setup build failed"
}
cabal-copy() {
./setup copy \
--destdir="${D}" \
|| die "setup copy failed"
# cabal is a bit eager about creating dirs,
# so remove them if they are empty
rmdir "${D}/usr/bin" 2> /dev/null
# GHC 6.4 has a bug in get/setPermission and Cabal 1.1.1 has
# no workaround.
# set the +x permission on executables
if [[ -d "${D}/usr/bin" ]] ; then
chmod +x "${D}/usr/bin/"*
fi
# TODO: do we still need this?
}
cabal-pkg() {
# This does not actually register since we're using true instead
# of ghc-pkg. So it just leaves the .installed-pkg-config and we can
# register that ourselves (if it exists).
local result
local err
if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
if version_is_at_least "1.2.0" "$(cabal-version)"; then
# Newer cabal can generate a package conf for us:
./setup register --gen-pkg-config="${T}/${P}.conf"
ghc-setup-pkg "${T}/${P}.conf"
ghc-install-pkg
else
# With older cabal we have to hack it by replacing its ghc-pkg
# with true and then just picking up the .installed-pkg-config
# file and registering that ourselves (if it exists).
sed -i "s|$(ghc-getghcpkg)|$(type -P true)|" .setup-config
./setup register || die "setup register failed"
if [[ -f .installed-pkg-config ]]; then
ghc-setup-pkg .installed-pkg-config
ghc-install-pkg
else
die "setup register has not generated a package configuration file"
fi
fi
fi
}
# Some cabal libs are bundled along with some versions of ghc
# eg filepath-1.0 comes with ghc-6.6.1
# by putting CABAL_CORE_LIB_GHC_PV="6.6.1" in an ebuild we are declaring that
# when building with this version of ghc, the ebuild is a dummy that is it will
# install no files since the package is already included with ghc.
# However portage still records the dependency and we can upgrade the package
# to a later one that's not included with ghc.
# You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1".
cabal-is-dummy-lib() {
for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do
[[ "$(ghc-version)" == "$version" ]] && return 0
done
return 1
}
# exported function: check if cabal is correctly installed for
# the currently active ghc (we cannot guarantee this with portage)
haskell-cabal_pkg_setup() {
ghc-package_pkg_setup
if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
eerror "The package dev-haskell/cabal is not correctly installed for"
eerror "the currently active version of ghc ($(ghc-version)). Please"
eerror "run ghc-updater or haskell-updater or re-build dev-haskell/cabal."
die "cabal is not correctly installed"
fi
if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
fi
if [[ -n "${CABAL_UNKNOWN}" ]]; then
ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
fi
if cabal-is-dummy-lib; then
einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
fi
}
# exported function: cabal-style bootstrap configure and compile
cabal_src_compile() {
if ! cabal-is-dummy-lib; then
cabal-bootstrap
cabal-configure
cabal-build
if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
cabal-haddock
fi
fi
}
haskell-cabal_src_compile() {
cabal_src_compile
}
# exported function: cabal-style copy and register
cabal_src_install() {
if cabal-is-dummy-lib; then
# create a dummy local package conf file for the sake of ghc-updater
dodir "$(ghc-confdir)"
echo '[]' > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
else
cabal-copy
cabal-pkg
if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
if ! version_is_at_least "1.1.6" "$(cabal-version)"; then
dohtml -r dist/doc/html/*
fi
fi
fi
}
haskell-cabal_src_install() {
cabal_src_install
}
EXPORT_FUNCTIONS pkg_setup src_compile src_install

View File

@ -0,0 +1,176 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/horde.eclass,v 1.37 2008/08/08 13:21:56 wrobel Exp $
#
# Help manage the horde project http://www.horde.org/
#
# Author: Mike Frysinger <vapier@gentoo.org>
# CVS additions by Chris Aniszczyk <zx@mea-culpa.net>
# SNAP additions by Jonathan Polansky <jpolansky@lsit.ucsb.edu>
#
# This eclass provides generic functions to make the writing of horde
# ebuilds fairly trivial since there are many horde applications and
# they all share the same basic install process.
# EHORDE_SNAP
# This variable tracks whether the user is using a snapshot version
#
# EHORDE_SNAP_BRANCH
# You set this via the ebuild to whatever branch you wish to grab a
# snapshot of. Typically this is 'HEAD' or 'RELENG'.
#
# EHORDE_CVS
# This variable tracks whether the user is using a cvs version
inherit webapp eutils
[[ ${PN} != ${PN/-cvs} ]] && inherit cvs
IUSE="vhosts"
EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst
[[ -z ${HORDE_PN} ]] && HORDE_PN="${PN/horde-}"
[[ -z ${HORDE_MAJ} ]] && HORDE_MAJ=""
EHORDE_CVS="false"
EHORDE_SNAP="false"
if [[ ${PN} != ${PN/-cvs} ]] ; then
EHORDE_CVS="true"
HORDE_PN=${HORDE_PN/-cvs}
ECVS_SERVER="anoncvs.horde.org:/repository"
ECVS_MODULE="${HORDE_PN}"
ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src/${PN}"
ECVS_USER="cvsread"
ECVS_PASS="horde"
SRC_URI=""
S=${WORKDIR}/${HORDE_PN}
elif [[ ${PN} != ${PN/-snap} ]] ; then
EHORDE_SNAP="true"
EHORDE_SNAP_BRANCH=${EHORDE_SNAP_BRANCH:-HEAD}
SNAP_PV=${PV:0:4}-${PV:4:2}-${PV:6:2}
HORDE_PN=${HORDE_PN/-snap}
SRC_URI="http://ftp.horde.org/pub/snaps/${SNAP_PV}/${HORDE_PN}-${EHORDE_SNAP_BRANCH}-${SNAP_PV}.tar.gz"
S=${WORKDIR}/${HORDE_PN}
else
SRC_URI="http://ftp.horde.org/pub/${HORDE_PN}/${HORDE_PN}${HORDE_MAJ}-${PV/_/-}.tar.gz"
S=${WORKDIR}/${HORDE_PN}${HORDE_MAJ}-${PV/_/-}
fi
HOMEPAGE="http://www.horde.org/${HORDE_PN}"
LICENSE="LGPL-2"
# INSTALL_DIR is used by webapp.eclass when USE=-vhosts
INSTALL_DIR="/horde"
[[ ${HORDE_PN} != "horde" && ${HORDE_PN} != "horde-groupware" && ${HORDE_PN} != "horde-webmail" ]] && INSTALL_DIR="${INSTALL_DIR}/${HORDE_PN}"
HORDE_APPLICATIONS="${HORDE_APPLICATIONS} ."
horde_pkg_setup() {
webapp_pkg_setup
if [[ ! -z ${HORDE_PHP_FEATURES} ]] ; then
local param
if [[ ${HORDE_PHP_FEATURES:0:2} = "-o" ]] ; then
param="-o"
HORDE_PHP_FEATURES=${HORDE_PHP_FEATURES:2}
fi
if ! built_with_use ${param} dev-lang/php ${HORDE_PHP_FEATURES} ; then
echo
if [[ ${param} == "-o" ]] ; then
eerror "You MUST re-emerge php with at least one of"
else
eerror "You MUST re-emerge php with all of"
fi
eerror "the following options in your USE:"
eerror " ${HORDE_PHP_FEATURES}"
die "current php install cannot support ${HORDE_PN}"
fi
fi
}
horde_src_unpack() {
if [[ ${EHORDE_CVS} = "true" ]] ; then
cvs_src_unpack
else
unpack ${A}
fi
cd "${S}"
[[ -n ${EHORDE_PATCHES} ]] && epatch ${EHORDE_PATCHES}
for APP in ${HORDE_APPLICATIONS}
do
[[ -f ${APP}/test.php ]] && chmod 000 ${APP}/test.php
done
}
horde_src_install() {
webapp_src_preinst
local destdir=${MY_HTDOCSDIR}
# Work-around when dealing with CVS sources
[[ ${EHORDE_CVS} = "true" ]] && cd ${HORDE_PN}
# Install docs and then delete them (except for CREDITS which
# many horde apps include in their help page #121003)
dodoc README docs/*
mv docs/CREDITS "${T}"/
rm -rf COPYING LICENSE README docs/*
mv "${T}"/CREDITS docs/
dodir ${destdir}
cp -r . "${D}"/${destdir}/ || die "install files"
for APP in ${HORDE_APPLICATIONS}
do
for DISTFILE in ${APP}/config/*.dist
do
if [[ -f ${DISTFILE/.dist/} ]] ; then
webapp_configfile "${MY_HTDOCSDIR}"/${DISTFILE/.dist/}
fi
done
if [[ -f ${APP}/config/conf.php ]] ; then
webapp_serverowned "${MY_HTDOCSDIR}"/${APP}/config/conf.php
webapp_configfile "${MY_HTDOCSDIR}"/${APP}/config/conf.php
fi
done
[[ -n ${HORDE_RECONFIG} ]] && webapp_hook_script ${HORDE_RECONFIG}
[[ -n ${HORDE_POSTINST} ]] && webapp_postinst_txt en ${HORDE_POSTINST}
webapp_src_install
}
horde_pkg_postinst() {
if [[ -e ${ROOT}/usr/share/doc/${PF}/INSTALL.gz ]] ; then
einfo "Please read /usr/share/doc/${PF}/INSTALL.gz"
fi
einfo "Before this package will work, you have to setup"
einfo "the configuration files. Please review the"
einfo "config/ subdirectory of ${HORDE_PN} in the webroot."
if [[ ${HORDE_PN} != "horde" && ${HORDE_PN} != "horde-groupware" && ${HORDE_PN} != "horde-webmail" ]] ; then
ewarn
ewarn "Make sure ${HORDE_PN} is accounted for in horde's root"
ewarn " config/registry.php"
fi
if [[ ${EHORDE_CVS} = "true" ]] ; then
ewarn
ewarn "Use these CVS versions at your own risk."
ewarn "They tend to break things when working with"
ewarn "the non CVS versions of horde."
fi
if use vhosts ; then
echo
ewarn "When installing horde into a vhost dir, you will"
ewarn "need to use the -d option so that it is installed"
ewarn "into the proper location."
fi
webapp_pkg_postinst
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/iiimf.eclass,v 1.16 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,491 @@
# eclass for ant based Java packages
#
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
# Copyright (c) 2004-2005, Gentoo Foundation
# Changes:
# May 2007:
# Made bsfix make one pass for all things and add some glocal targets for
# setting up the whole thing. Contributed by kiorky
# (kiorky@cryptelium.net).
# December 2006:
# I pretty much rewrote the logic of the bsfix functions
# and xml-rewrite.py because they were so slow
# Petteri Räty (betelgeuse@gentoo.org)
#
# Licensed under the GNU General Public License, v2
#
# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.48 2010/02/12 23:51:44 caster Exp $
inherit java-utils-2
# 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.
# -----------------------------------------------------------------------------
# @variable-preinherit WANT_ANT_TASKS
# @variable-default ""
#
# Please see the description in java-utils-2.eclass.
#WANT_ANT_TASKS
# -----------------------------------------------------------------------------
# @variable-preinherit JAVA_ANT_DISABLE_ANT_CORE_DEP
# @variable-default unset for java-pkg-2, true for java-pkg-opt-2
#
# Setting this variable non-empty before inheriting java-ant-2 disables adding
# dev-java/ant-core into DEPEND.
# construct ant-speficic DEPEND
JAVA_ANT_E_DEPEND=""
# add ant-core into DEPEND, unless disabled
if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then
JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.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 portage 2.1 for phase hooks
# and ant dependencies constructed above.
JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND}
${ANT_TASKS_DEPEND}
${JAVA_PKG_PORTAGE_DEP}
>=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 hasq java-pkg-opt-2 ${INHERITED}; then
JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )"
elif ! hasq 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}"
# ------------------------------------------------------------------------------
# @global JAVA_PKG_BSFIX
#
# Should we attempt to 'fix' ant build files to include the source/target
# attributes when calling javac?
#
# default: on
# ------------------------------------------------------------------------------
JAVA_PKG_BSFIX=${JAVA_PKG_BSFIX:-"on"}
# ------------------------------------------------------------------------------
# @global JAVA_PKG_BSFIX_ALL
#
# If we're fixing build files, should we try to fix all the ones we can find?
#
# default: yes
# ------------------------------------------------------------------------------
JAVA_PKG_BSFIX_ALL=${JAVA_PKG_BSFIX_ALL:-"yes"}
# ------------------------------------------------------------------------------
# @global JAVA_PKG_BSFIX_NAME
#
# Filename of build files to fix/search for
#
# default: build.xml
# ------------------------------------------------------------------------------
JAVA_PKG_BSFIX_NAME=${JAVA_PKG_BSFIX_NAME:-"build.xml"}
# ------------------------------------------------------------------------------
# @global JAVA_PKG_BSFIX_TARGETS_TAGS
#
# Targets to fix the 'source' attribute in
#
# default: javac xjavac javac.preset
# ------------------------------------------------------------------------------
JAVA_PKG_BSFIX_TARGET_TAGS=${JAVA_PKG_BSFIX_TARGET_TAGS:-"javac xjavac javac.preset"}
# ------------------------------------------------------------------------------
# @global JAVA_PKG_BSFIX_SOURCE_TAGS
#
# Targets to fix the 'target' attribute in
#
# default: javacdoc javac xjavac javac.preset
# ------------------------------------------------------------------------------
JAVA_PKG_BSFIX_SOURCE_TAGS=${JAVA_PKG_BSFIX_SOURCE_TAGS:-"javadoc javac xjavac javac.preset"}
# ------------------------------------------------------------------------------
# @global JAVA_ANT_CLASSPATH_TAGS
#
# Targets to add the classpath attribute to
#
# default: javac xjavac
# ------------------------------------------------------------------------------
JAVA_ANT_CLASSPATH_TAGS="javac xjavac"
# ------------------------------------------------------------------------------
# @global JAVA_ANT_IGNORE_SYSTEM_CLASSES
#
# Rewrites available tasks to ignore ant classpath.
#
# default: off
# ------------------------------------------------------------------------------
case "${EAPI:-0}" in
0|1) : ;;
*) EXPORT_FUNCTIONS src_configure ;;
esac
# ------------------------------------------------------------------------------
# @eclass-src_configure
#
# src_configure rewrites the build.xml files
# ------------------------------------------------------------------------------
java-ant-2_src_configure() {
# 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"
}
# ------------------------------------------------------------------------------
# @private java-ant_bsfix
#
# Attempts to fix build files. The following variables will affect its behavior
# as listed above:
# JAVA_PKG_BSFIX
# JAVA_PKG_BSFIX_ALL
# JAVA_PKG_BSFIX_NAME,
# ------------------------------------------------------------------------------
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
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 } "
# This voodoo is done for paths with spaces
local bsfix_these
while read line; do
[[ -z ${line} ]] && continue
bsfix_these="${bsfix_these} '${line}'"
done <<-EOF
$(find . ${find_args})
EOF
[[ "${bsfix_these// /}" ]] && eval java-ant_bsfix_files ${bsfix_these}
popd > /dev/null
}
_bsfix_die() {
if has_version dev-python/pyxml; then
eerror "If the output above contains:"
eerror "ImportError:"
eerror "/usr/lib/python2.4/site-packages/_xmlplus/parsers/pyexpat.so:"
eerror "undefined symbol: PyUnicodeUCS2_DecodeUTF8"
eerror "Try re-emerging dev-python/pyxml"
die ${1} " Look at the eerror message above"
else
die ${1}
fi
}
# ------------------------------------------------------------------------------
# @public java-ant_bsfix_files
#
# Attempts to fix named build files. The following variables will affect its behavior
# as listed above:
# 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.
#
# 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="${files} -f '${file}'"
done
# Play nice with paludis
if [[ $(type -t quiet_mode) = function ]] && quiet_mode; then
local output=">/dev/null"
fi
# for javadoc target and all in one pass, we need the new rewriter.
local rewriter3="/usr/share/javatoolkit/xml-rewrite-3.py"
if [[ ! -f ${rewriter3} ]]; then
rewriter3="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py"
fi
local rewriter4="/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}"
eval echo "cElementTree rewriter" ${output}
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"
elif [[ ! -f ${rewriter3} ]]; then
debug-print "Using second generation rewriter"
eval echo "Rewriting source attributes" ${output}
eval xml-rewrite-2.py ${files} \
-c -e ${JAVA_PKG_BSFIX_SOURCE_TAGS// / -e } \
-a source -v ${want_source} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
eval echo "Rewriting target attributes" ${output}
eval xml-rewrite-2.py ${files} \
-c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
-a target -v ${want_target} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
eval echo "Rewriting nowarn attributes" ${output}
eval xml-rewrite-2.py ${files} \
-c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
-a nowarn -v yes ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
if [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
eval echo "Adding gentoo.classpath to javac tasks" ${output}
eval xml-rewrite-2.py ${files} \
-c -e javac -e xjavac -a classpath -v \
'\${gentoo.classpath}' \
|| _bsfix_die "xml-rewrite2 failed"
fi
else
debug-print "Using third generation rewriter"
eval echo "Rewriting attributes" ${output}
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="${bsfix_extra_args} -g -e ${cp_tags}"
bsfix_extra_args="${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 hasq 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="${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="${bsfix_extra_args} ${JAVA_ANT_JAVADOC_INPUT_DIRS// / --source-directory }"
bsfix_extra_args="${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="${bsfix_extra_args} ${JAVA_ANT_BSFIX_EXTRA_ARGS}"
debug-print "bsfix_extra_args: ${bsfix_extra_args}"
eval ${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} \
${output} || _bsfix_die "xml-rewrite2 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
}
# ------------------------------------------------------------------------------
# @public java-ant_bsfix_one
#
# Attempts to fix named build file. The following variables will affect its behavior
# as listed above:
# JAVA_PKG_BSFIX_SOURCE_TAGS
# JAVA_PKG_BSFIX_TARGET_TAGS
# ------------------------------------------------------------------------------
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}"
}
# ------------------------------------------------------------------------------
# @public java-ant_rewrite-classpath
#
# Adds 'classpath="${gentoo.classpath}"' to specified build file.
# Affected by:
# JAVA_ANT_CLASSPATH_TAGS
# @param $1 - the file to rewrite (defaults to build.xml)
# ------------------------------------------------------------------------------
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
}
# ------------------------------------------------------------------------------
# @public java-ant_ignore-system-classes
#
# Makes the available task ignore classes in the system classpath
# @param $1 - the file to rewrite (defaults to build.xml)
# ------------------------------------------------------------------------------
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"
}
# ------------------------------------------------------------------------------
# @public java-ant_xml-rewrite
# Run the right xml-rewrite binary with the given arguments
# ------------------------------------------------------------------------------
java-ant_xml-rewrite() {
local gen2="/usr/bin/xml-rewrite-2.py"
local gen2_1="/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
}
# ------------------------------------------------------------------------------
# @public java-ant_rewrite-bootclasspath
#
# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
# bootclasspath package of given version.
#
# Affected by:
# JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
#
# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
# of the current JDK
# @param $2 - path to desired build.xml file, defaults to 'build.xml'
# @param $3 - (optional) what to prepend the bootclasspath with (to override)
# @param $4 - (optional) what to append to the bootclasspath
# ------------------------------------------------------------------------------
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

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/java-gnome.eclass,v 1.5 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,65 @@
# Eclass for Java packages from bare sources exported by Maven
#
# Copyright (c) 2004-2009, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
# $Header: /var/cvsroot/gentoo-x86/eclass/java-mvn-src.eclass,v 1.1 2010/01/16 18:48:39 weaver Exp $
inherit java-pkg-simple
# -----------------------------------------------------------------------------
# @eclass-begin
# @eclass-summary Eclass for Java packages from bare sources exported by Maven
#
# This class is intended to build pure Java packages from the sources exported
# from the source:jar goal of Maven 2. These archives contain bare Java source
# files, with no build instructions or additional resource files. They are
# unsuitable for packages that require resources besides compiled class files.
# The benefit is that for artifacts developed with Maven, these source files
# are often released together with binary packages, whereas the full build
# environment might be contained in some revision control system or not
# available at all.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# @variable-external GROUP_ID
# @variable-default ${PN}
#
# The groupId of the artifact, in dotted notation.
# -----------------------------------------------------------------------------
: ${GROUP_ID:=${PN}}
# -----------------------------------------------------------------------------
# @variable-external ARTIFACT_ID
# @variable-default ${PN}
#
# The artifactId of the artifact.
# -----------------------------------------------------------------------------
: ${ARTIFACT_ID:=${PN}}
# -----------------------------------------------------------------------------
# @variable-external MAVEN2_REPOSITORIES
# @variable-default http://repo2.maven.org/maven2 http://download.java.net/maven/2
#
# The repositories to search for the artifacts. Must follow Maven2 layout.
# -----------------------------------------------------------------------------
: ${MAVEN2_REPOSITORIES:="http://repo2.maven.org/maven2 http://download.java.net/maven/2"}
# -----------------------------------------------------------------------------
# @variable-internal RELATIVE_SRC_URI
#
# The path of the source artifact relative to the root of the repository.
# Will be set by the eclass to follow Maven 2 repository layout.
# -----------------------------------------------------------------------------
RELATIVE_SRC_URI=${GROUP_ID//./\/}/${ARTIFACT_ID}/${PV}/${ARTIFACT_ID}-${PV}-sources.jar
# Look for source jar in all listed repositories
for repo in ${MAVEN2_REPOSITORIES}; do
SRC_URI="${SRC_URI} ${repo}/${RELATIVE_SRC_URI}"
done
unset repo
# ------------------------------------------------------------------------------
# @eclass-end
# ------------------------------------------------------------------------------

View File

@ -0,0 +1,292 @@
# Base eclass for Java packages that needs to be OSGi compliant
#
# Copyright (c) 2007, Jean-Noël Rivasseau <elvanor@gmail.com>
# Copyright (c) 2007, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
# $Header: /var/cvsroot/gentoo-x86/eclass/java-osgi.eclass,v 1.5 2009/01/12 22:58:36 maekke Exp $
# -----------------------------------------------------------------------------
# @eclass-begin
# @eclass-shortdesc Java OSGi eclass
# @eclass-maintainer java@gentoo.org
#
# 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
# 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
}
# -----------------------------------------------------------------------------
# @ebuild-function _java-osgi_plugin
#
# This is an internal function, not to be called directly.
#
# @example
# _java-osgi_plugin "JSch"
#
# @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
}
# -----------------------------------------------------------------------------
# @ebuild-function _java-osgi_makejar
#
# This is an internal function, not to be called directly.
#
# @example
# _java-osgi_makejar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true"
#
# @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"
}
# -----------------------------------------------------------------------------
# @ebuild-function java-osgi_dojar
#
# 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.
#
# @example
# java-osgi_dojar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true"
#
# @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}"
}
# -----------------------------------------------------------------------------
# @ebuild-function java-osgi_newjar
#
# 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.
#
# @example
# java-osgi_newjar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true"
#
# @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
}
# -----------------------------------------------------------------------------
# @ebuild-function _java-osgi_makejar-fromfile
#
# This is an internal function, not to be called directly.
#
# @example
# _java-osgi_makejar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "JSch" 1
#
# @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"
}
# -----------------------------------------------------------------------------
# @ebuild-function java-osgi_newjar-fromfile()
#
# 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.
#
# @example
# java-osgi_newjar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "Standard Widget Toolkit for GTK 2.0"
#
# @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
}
# -----------------------------------------------------------------------------
# @ebuild-function java-osgi_dojar-fromfile()
#
# 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.
#
# @example
# java-osgi_dojar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "Standard Widget Toolkit for GTK 2.0"
#
# @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

@ -0,0 +1,174 @@
# Eclass for Java packages
#
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
# Copyright (c) 2004-2005, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.35 2010/02/01 09:38:44 caster Exp $
inherit java-utils-2
# -----------------------------------------------------------------------------
# @eclass-begin
# @eclass-summary Eclass for Java Packages
#
# This eclass should be inherited for pure Java packages, or by packages which
# need to use Java.
# -----------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# @IUSE
#
# 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}"
# ------------------------------------------------------------------------------
# @depend
#
# 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}"
# ------------------------------------------------------------------------------
# @rdepend
#
# 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
# ------------------------------------------------------------------------------
# @eclass-pkg_setup
#
# pkg_setup initializes the Java environment
# ------------------------------------------------------------------------------
java-pkg-2_pkg_setup() {
java-pkg_init
java-pkg_ensure-test
}
# ------------------------------------------------------------------------------
# @eclass-src_prepare
#
# wrapper for java-utils-2_src_prepare
# ------------------------------------------------------------------------------
java-pkg-2_src_prepare() {
java-utils-2_src_prepare
}
# ------------------------------------------------------------------------------
# @eclass-src_compile
#
# Default src_compile for java packages
# 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
# param: Parameters are passed to ant verbatim
# ------------------------------------------------------------------------------
java-pkg-2_src_compile() {
if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
[[ "${EANT_FILTER_COMPILER}" ]] && \
java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
local antflags="${EANT_BUILD_TARGET:=jar}"
if hasq 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
}
java-pkg-2_supports-test() {
python << EOF
from xml.dom.minidom import parse
import sys
dom = parse("${1}")
for elem in dom.getElementsByTagName('target'):
if elem.getAttribute('name') == 'test':
sys.exit(0)
sys.exit(1)
EOF
return $?
}
java-pkg-2_src_test() {
[[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
local opts task
if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
fi
ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
ANT_TASKS="${ANT_TASKS} ant-junit"
else
ANT_TASKS="ant-junit"
fi
task=true
fi
if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
opts="-Djunit.jar=\"$(java-pkg_getjar junit junit.jar)\""
if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit"
elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then
EANT_GENTOO_CLASSPATH+=',junit'
else
EANT_GENTOO_CLASSPATH=junit
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
}
# ------------------------------------------------------------------------------
# @eclass-pkg_preinst
#
# wrapper for java-utils-2_pkg_preinst
# ------------------------------------------------------------------------------
java-pkg-2_pkg_preinst() {
java-utils-2_pkg_preinst
}
# ------------------------------------------------------------------------------
# @eclass-end
# ------------------------------------------------------------------------------

View File

@ -0,0 +1,66 @@
# Eclass for optional Java packages
#
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
# Copyright (c) 2004-2005, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
# Major changes:
# 20070805:
# Removed phase hooks because Portage does proper env saving now.
# <betelgeuse@gentoo.org>
#
# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-opt-2.eclass,v 1.14 2010/02/01 09:38:44 caster Exp $
inherit java-utils-2
# ------------------------------------------------------------------------------
# @eclass-begin
# @eclass-summary Eclass for packages with optional Java support
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# @ebuild-variable JAVA_PKG_OPT_USE
#
# USE flag to control if optional Java stuff is build. Defaults to 'java'.
# ------------------------------------------------------------------------------
JAVA_PKG_OPT_USE=${JAVA_PKG_OPT_USE:-java}
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_PKG_E_DEPEND} )"
RDEPEND="${DEPEND}"
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# See java-pkg-2.eclass for JAVA_PKG_IUSE documentation
IUSE="${JAVA_PKG_IUSE} ${JAVA_PKG_OPT_USE}"
case "${EAPI:-0}" in
0|1) EXPORT_FUNCTIONS pkg_setup pkg_preinst ;;
*) EXPORT_FUNCTIONS pkg_setup src_prepare pkg_preinst ;;
esac
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
java-pkg-opt-2_pkg_setup() {
use ${JAVA_PKG_OPT_USE} && java-pkg_init
}
# ------------------------------------------------------------------------------
# @eclass-src_prepare
#
# wrapper for java-utils-2_src_prepare
# ------------------------------------------------------------------------------
java-pkg-opt-2_src_prepare() {
use ${JAVA_PKG_OPT_USE} && java-utils-2_src_prepare
}
# ------------------------------------------------------------------------------
# @eclass-pkg_preinst
#
# wrapper for java-utils-2_pkg_preinst
# ------------------------------------------------------------------------------
java-pkg-opt-2_pkg_preinst() {
use ${JAVA_PKG_OPT_USE} && java-utils-2_pkg_preinst
}

View File

@ -0,0 +1,205 @@
# Eclass for simple bare-source Java packages
#
# Copyright (c) 2004-2009, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-simple.eclass,v 1.1 2010/01/16 18:48:39 weaver Exp $
inherit java-utils-2
if ! hasq java-pkg-2 ${INHERITED}; then
eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2"
fi
# -----------------------------------------------------------------------------
# @eclass-begin
# @eclass-summary Eclass for Java sources without build instructions
#
# 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.
# -----------------------------------------------------------------------------
EXPORT_FUNCTIONS src_compile src_install
# We are only interested in finding all java source files, wherever they may be.
S="${WORKDIR}"
# -----------------------------------------------------------------------------
# @variable-external JAVA_GENTOO_CLASSPATH
# @variable-default ""
#
# 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.
# -----------------------------------------------------------------------------
# JAVA_GENTOO_CLASSPATH
# -----------------------------------------------------------------------------
# @variable-external JAVA_CLASSPATH_EXTRA
# @variable-default ""
#
# Extra list of colon separated path elements to be put on the
# classpath when compiling sources.
# -----------------------------------------------------------------------------
# JAVA_CLASSPATH_EXTRA
# -----------------------------------------------------------------------------
# @variable-external JAVA_SRC_DIR
# @variable-default ""
#
# 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.
# -----------------------------------------------------------------------------
# JAVA_SRC_DIR
# -----------------------------------------------------------------------------
# @variable-external JAVA_ENCODING
# @variable-default UTF-8
#
# The character encoding used in the source files
# -----------------------------------------------------------------------------
: ${JAVA_ENCODING:=UTF-8}
# -----------------------------------------------------------------------------
# @variable-external JAVAC_ARGS
# @variable-default ""
#
# Additional arguments to be passed to javac
# -----------------------------------------------------------------------------
# JAVAC_ARGS
# -----------------------------------------------------------------------------
# @variable-external JAVADOC_ARGS
# @variable-default ""
#
# Additional arguments to be passed to javadoc
# -----------------------------------------------------------------------------
# JAVADOC_ARGS
# ------------------------------------------------------------------------------
# @eclass-src_compile
#
# 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 ${PN}.jar.
#
# variables:
# JAVA_GENTOO_CLASSPATH - list java packages to put on the classpath.
# JAVA_ENCODING - encoding of source files, used by javac and javadoc
# JAVA_SRC_DIR - directories containing source files, relative to ${S}
# JAVAC_ARGS - additional arguments to be passed to javac
# JAVADOC_ARGS - additional arguments to be passed to javadoc
# ------------------------------------------------------------------------------
java-pkg-simple_src_compile() {
local sources=sources.lst classes=target/classes apidoc=target/api
# QA checks
[[ "$(find . -name build.xml -o -name pom.xml)" ]] &&
java-pkg_announce-qa-violation "Package ships with a build file, use that instead of java-pkg-simple!"
# gather sources
find ${JAVA_SRC_DIR:-*} -name \*.java > ${sources}
mkdir -p ${classes} || die "Could not create target directory"
# compile
local classpath="${JAVA_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}"
java-pkg-simple_verbose-cmd \
ejavac -d ${classes} -encoding ${JAVA_ENCODING} \
${classpath:+-classpath ${classpath}} ${JAVAC_ARGS} \
@${sources}
# javadoc
if hasq doc ${JAVA_PKG_IUSE} && use doc; then
mkdir -p ${apidoc}
java-pkg-simple_verbose-cmd \
javadoc -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 ${PN}.jar"
if [[ -e ${classes}/META-INF/MANIFEST.MF ]]; then
jar_args="cfm ${PN}.jar ${classes}/META-INF/MANIFEST.MF"
fi
java-pkg-simple_verbose-cmd \
jar ${jar_args} -C ${classes} . || die "jar failed"
}
# ------------------------------------------------------------------------------
# @eclass-src_install
#
# src_install for simple single jar java packages. Simply packages the
# contents from the target directory and installs it as ${PN}.jar. 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-simple_verbose-cmd \
java-pkg_dojar ${PN}.jar
# javadoc
if hasq doc ${JAVA_PKG_IUSE} && use doc; then
java-pkg-simple_verbose-cmd \
java-pkg_dojavadoc ${apidoc}
fi
# dosrc
if hasq 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-simple_verbose-cmd \
java-pkg_dosrc ${srcdirs}
fi
}
# ------------------------------------------------------------------------------
# @internal-function java-pkg-simple_verbose-cmd
#
# Print a command before executing it. To give user some feedback
# about what is going on, where the time is being spent, and also to
# help debugging ebuilds.
#
# @param $@ - command to be called and its arguments
# ------------------------------------------------------------------------------
java-pkg-simple_verbose-cmd() {
echo "$*"
"$@"
}
# ------------------------------------------------------------------------------
# @eclass-end
# ------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils.eclass,v 1.12 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,44 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/java-virtuals-2.eclass,v 1.6 2009/08/27 21:49:04 ali_bush Exp $
# Original Author: Alistair John Bush <ali_bush@gentoo.org>
# Purpose: 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.1.6"
RDEPEND="${DEPEND}"
EXPORT_FUNCTIONS src_install
java-virtuals-2_src_install() {
java-virtuals-2_do_write
}
# ------------------------------------------------------------------------------
# @internal-function java-pkg_do_virtuals_write
#
# 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

@ -0,0 +1,214 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.29 2009/10/11 11:46:59 maekke Exp $
# -----------------------------------------------------------------------------
# @eclass-begin
# @eclass-shortdesc Java Virtual Machine eclass
# @eclass-maintainer java@gentoo.org
#
# This eclass provides functionality which assists with installing
# virtual machines, and ensures that they are recognized by java-config.
#
# -----------------------------------------------------------------------------
inherit eutils fdo-mime
DEPEND="=dev-java/java-config-2*"
hasq "${EAPI}" 0 1 && DEPEND="${DEPEND} >=sys-apps/portage-2.1"
RDEPEND="
=dev-java/java-config-2*"
export WANT_JAVA_CONFIG=2
JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm"
JAVA_VM_DIR="/usr/lib/jvm"
JAVA_VM_BUILD_ONLY="${JAVA_VM_BUILD_ONLY:-FALSE}"
EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm
java-vm-2_pkg_setup() {
if [[ "${SLOT}" != "0" ]]; then
VMHANDLE=${PN}-${SLOT}
else
VMHANDLE=${PN}
fi
}
java-vm-2_pkg_postinst() {
# Set the generation-2 system VM, if it isn't set
if [[ -z "$(java-config-2 -f)" ]]; then
java_set_default_vm_
fi
java-vm_check-nsplugin
java_mozilla_clean_
fdo-mime_desktop_database_update
}
java-vm_check-nsplugin() {
local libdir
if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then
libdir=lib32
else
libdir=lib
fi
# Install a default nsplugin if we don't already have one
if has nsplugin ${IUSE} && use nsplugin; then
if [[ ! -f /usr/${libdir}/nsbrowser/plugins/javaplugin.so ]]; then
einfo "No system nsplugin currently set."
java-vm_set-nsplugin
else
einfo "System nsplugin is already set, not changing it."
fi
einfo "You can change nsplugin with eselect java-nsplugin."
fi
}
java-vm_set-nsplugin() {
local extra_args
if use amd64; then
if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then
extra_args="32bit"
else
extra_args="64bit"
fi
einfo "Setting ${extra_args} nsplugin to ${VMHANDLE}"
else
einfo "Setting nsplugin to ${VMHANDLE}..."
fi
eselect java-nsplugin set ${extra_args} ${VMHANDLE}
}
java-vm-2_pkg_prerm() {
if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then
ewarn "It appears you are removing your system-vm!"
ewarn "Please run java-config -L to list available VMs,"
ewarn "then use java-config -S to set a new system-vm!"
fi
}
java-vm-2_pkg_postrm() {
fdo-mime_desktop_database_update
}
java_set_default_vm_() {
java-config-2 --set-system-vm="${VMHANDLE}"
einfo " ${P} set as the default system-vm."
}
get_system_arch() {
local sarch
sarch=$(echo ${ARCH} | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/)
if [ -z "${sarch}" ]; then
sarch=$(uname -m | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/)
fi
echo ${sarch}
}
# TODO rename to something more evident, like install_env_file
set_java_env() {
debug-print-function ${FUNCNAME} $*
local platform="$(get_system_arch)"
local env_file="${D}${JAVA_VM_CONFIG_DIR}/${VMHANDLE}"
local old_env_file="${D}/etc/env.d/java/20${P}"
if [[ ${1} ]]; then
local source_env_file="${1}"
else
local source_env_file="${FILESDIR}/${VMHANDLE}.env"
fi
if [[ ! -f ${source_env_file} ]]; then
die "Unable to find the env file: ${source_env_file}"
fi
dodir ${JAVA_VM_CONFIG_DIR}
sed \
-e "s/@P@/${P}/g" \
-e "s/@PN@/${PN}/g" \
-e "s/@PV@/${PV}/g" \
-e "s/@PF@/${PF}/g" \
-e "s/@PLATFORM@/${platform}/g" \
-e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \
< ${source_env_file} \
> ${env_file} || die "sed failed"
(
echo "VMHANDLE=\"${VMHANDLE}\""
echo "BUILD_ONLY=\"${JAVA_VM_BUILD_ONLY}\""
) >> ${env_file}
[[ -n ${JAVA_PROVIDE} ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" >> ${env_file}
local java_home=$(source ${env_file}; echo ${JAVA_HOME})
[[ -z ${java_home} ]] && die "No JAVA_HOME defined in ${env_file}"
# Make the symlink
dosym ${java_home} ${JAVA_VM_DIR}/${VMHANDLE} \
|| die "Failed to make VM symlink at ${JAVA_VM_DIR}/${VMHANDLE}"
}
# -----------------------------------------------------------------------------
# @ebuild-function java-vm_revdep-mask
#
# Installs a revdep-rebuild control file which SEARCH_DIR_MASK set to the path
# where the VM is installed. Prevents pointless rebuilds - see bug #177925.
# Also gives a notice to the user.
#
# @example
# java-vm_revdep-mask
# java-vm_revdep-mask /path/to/jdk/
#
# @param $1 - Path of the VM (defaults to /opt/${P} if not set)
# ------------------------------------------------------------------------------
java-vm_revdep-mask() {
local VMROOT="${1-/opt/${P}}"
dodir /etc/revdep-rebuild/
echo "SEARCH_DIRS_MASK=\"${VMROOT}\""> "${D}/etc/revdep-rebuild/61-${VMHANDLE}"
elog "A revdep-rebuild control file was installed to prevent reinstalls due to"
elog "missing dependencies (see bug #177925 for more info). Note that some parts"
elog "of the JVM may require dependencies that are pulled only through respective"
elog "USE flags (typically X, alsa, odbc) and some Java code may fail without them."
}
java_get_plugin_dir_() {
echo /usr/$(get_libdir)/nsbrowser/plugins
}
install_mozilla_plugin() {
local plugin="${1}"
local variant="${2}"
if [[ ! -f "${D}/${plugin}" ]]; then
die "Cannot find mozilla plugin at ${D}/${plugin}"
fi
if [[ -n "${variant}" ]]; then
variant="-${variant}"
fi
local plugin_dir="/usr/share/java-config-2/nsplugin"
dodir "${plugin_dir}"
dosym "${plugin}" "${plugin_dir}/${VMHANDLE}${variant}-javaplugin.so"
}
java_mozilla_clean_() {
# Because previously some ebuilds installed symlinks outside of pkg_install
# and are left behind, which forces you to manualy remove them to select the
# jdk/jre you want to use for java
local plugin_dir=$(java_get_plugin_dir_)
for file in ${plugin_dir}/javaplugin_*; do
rm -f ${file}
done
for file in ${plugin_dir}/libjavaplugin*; do
rm -f ${file}
done
}
# ------------------------------------------------------------------------------
# @eclass-end
# ------------------------------------------------------------------------------

View File

@ -0,0 +1,16 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/java.eclass,v 1.33 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"
EXPORT_FUNCTIONS pkg_prerm
java_pkg_prerm() {
if java-config -J | grep -q ${P} ; then
ewarn "It appears you are removing your default system VM!"
ewarn "Please run java-config -L then java-config -S to set a new system VM!"
fi
}

View File

@ -0,0 +1,7 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde-dist.eclass,v 1.77 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# To be removed 2011/11/01.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,7 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde-functions.eclass,v 1.176 2010/01/11 20:51:39 abcd Exp $
# @DEAD
# KDE 3 is gone from the tree. Scheduled for removal after 2012/01/12.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,7 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde-meta.eclass,v 1.92 2010/01/11 20:51:39 abcd Exp $
# @DEAD
# KDE 3 is gone from the tree. Scheduled for removal after 2012/01/12.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,8 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde-source.eclass,v 1.26 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# This eclass was only for very old cvs versions of KDE, no longer used by
# anything. Scheduled for removal after 2011/06/04.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,7 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.226 2010/01/11 20:51:39 abcd Exp $
# @DEAD
# KDE 3 is gone from the tree. Scheduled for removal after 2012/01/12.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

View File

@ -0,0 +1,726 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.58 2010/02/02 14:20:16 reavertm Exp $
# @ECLASS: kde4-base.eclass
# @MAINTAINER:
# kde@gentoo.org
# @BLURB: This eclass provides functions for kde 4.X ebuilds
# @DESCRIPTION:
# The kde4-base.eclass provides support for building KDE4 based ebuilds
# and KDE4 applications.
#
# NOTE: KDE 4 ebuilds by default define EAPI="2", this can be redefined but
# eclass will fail with version older than 2.
# @ECLASS-VARIABLE: CMAKE_REQUIRED
# @DESCRIPTION:
# Specify if cmake buildsystem is being used. Possible values are 'always' and 'never'.
# Please note that if it's set to 'never' you need to explicitly override following phases:
# src_configure, src_compile, src_test and src_install.
# Defaults to 'always'.
: ${CMAKE_REQUIRED:=always}
if [[ ${CMAKE_REQUIRED} = false || ${CMAKE_REQUIRED} = never ]]; then
buildsystem_eclass=""
export_fns=""
else
buildsystem_eclass="cmake-utils"
export_fns="src_configure src_compile src_test src_install"
fi
inherit kde4-functions
get_build_type
if [[ ${BUILD_TYPE} = live ]]; then
subversion_eclass="subversion"
fi
inherit base ${buildsystem_eclass} eutils ${subversion_eclass}
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${export_fns} pkg_postinst pkg_postrm
unset buildsystem_eclass
unset export_fns
unset subversion_eclass
case ${KDEBASE} in
kde-base)
HOMEPAGE="http://www.kde.org/"
LICENSE="GPL-2"
;;
koffice)
HOMEPAGE="http://www.koffice.org/"
LICENSE="GPL-2"
;;
esac
# @ECLASS-VARIABLE: OPENGL_REQUIRED
# @DESCRIPTION:
# Is qt-opengl required? Possible values are 'always', 'optional' and 'never'.
# This variable must be set before inheriting any eclasses. Defaults to 'never'.
OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}"
# @ECLASS-VARIABLE: MULTIMEDIA_REQUIRED
# @DESCRIPTION:
# Is qt-multimedia required? Possible values are 'always', 'optional' and 'never'.
# This variable must be set before inheriting any eclasses. Defaults to 'never'.
MULTIMEDIA_REQUIRED="${MULTIMEDIA_REQUIRED:-never}"
# @ECLASS-VARIABLE: WEBKIT_REQUIRED
# @DESCRIPTION:
# Is qt-webkit requred? Possible values are 'always', 'optional' and 'never'.
# This variable must be set before inheriting any eclasses. Defaults to 'never'.
WEBKIT_REQUIRED="${WEBKIT_REQUIRED:-never}"
# @ECLASS-VARIABLE: CPPUNIT_REQUIRED
# @DESCRIPTION:
# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'.
# This variable must be set before inheriting any eclasses. Defaults to 'never'.
CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}"
# @ECLASS-VARIABLE: KDE_REQUIRED
# @DESCRIPTION:
# Is kde required? Possible values are 'always', 'optional' and 'never'.
# This variable must be set before inheriting any eclasses. Defaults to 'always'
# If set to always or optional, KDE_MINIMAL may be overriden as well.
# Note that for kde-base packages this variable is fixed to 'always'.
KDE_REQUIRED="${KDE_REQUIRED:-always}"
# Verify KDE_MINIMAL (display QA notice in pkg_setup, still we need to fix it here)
if [[ -n ${KDE_MINIMAL} ]]; then
for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
[[ ${KDE_MINIMAL} = ${slot} ]] && KDE_MINIMAL_VALID=1 && break
done
unset slot
[[ -z ${KDE_MINIMAL_VALID} ]] && unset KDE_MINIMAL
else
KDE_MINIMAL_VALID=1
fi
# @ECLASS-VARIABLE: KDE_MINIMAL
# @DESCRIPTION:
# This variable is used when KDE_REQUIRED is set, to specify required KDE minimal
# version for apps to work. Currently defaults to 4.3
# One may override this variable to raise version requirements.
# For possible values look at KDE_SLOTS and KDE_LIVE_SLOTS variables.
# Note that it is fixed to ${SLOT} for kde-base packages.
KDE_MINIMAL="${KDE_MINIMAL:-4.3}"
# Setup packages inheriting this eclass
case ${KDEBASE} in
kde-base)
if [[ $BUILD_TYPE = live ]]; then
# Disable tests for live ebuilds
RESTRICT+=" test"
# Live ebuilds in kde-base default to kdeprefix by default
IUSE+=" +kdeprefix"
else
# All other ebuild types default to -kdeprefix as before
IUSE+=" kdeprefix"
fi
# Determine SLOT from PVs
case ${PV} in
*.9999*) SLOT="${PV/.9999*/}" ;; # stable live
4.5* | 4.4.[6-9]*) SLOT="4.5" ;;
4.4* | 4.3.[6-9]*) SLOT="4.4" ;;
4.3*) SLOT="4.3" ;;
9999*) SLOT="live" ;; # regular live
*) die "Unsupported ${PV}" ;;
esac
# This code is to prevent portage from searching GENTOO_MIRRORS for
# packages that will never be mirrored. (As they only will ever be in
# the overlay).
case ${PV} in
*9999* | 4.?.[6-9]?)
RESTRICT+=" mirror"
;;
esac
KDE_MINIMAL="${SLOT}"
_kdedir="${SLOT}"
# Block installation of other SLOTS unless kdeprefix
RDEPEND+=" $(block_other_slots)"
;;
koffice)
SLOT="2"
;;
esac
# @ECLASS-VARIABLE: QT_MINIMAL
# @DESCRIPTION:
# Determine version of qt we enforce as minimal for the package. 4.4.0 4.5.1..
# Currently defaults to 4.5.1 for KDE 4.3 and earlier
# or 4.6.0_rc1 for KDE 4.4 and later
if slot_is_at_least 4.4 "${KDE_MINIMAL}"; then
QT_MINIMAL="${QT_MINIMAL:-4.6.0}"
fi
QT_MINIMAL="${QT_MINIMAL:-4.5.1}"
# OpenGL dependencies
qtopengldepend="
>=x11-libs/qt-opengl-${QT_MINIMAL}:4
"
case ${OPENGL_REQUIRED} in
always)
COMMONDEPEND+=" ${qtopengldepend}"
;;
optional)
IUSE+=" opengl"
COMMONDEPEND+=" opengl? ( ${qtopengldepend} )"
;;
*) ;;
esac
unset qtopengldepend
# MultiMedia dependencies
qtmultimediadepend="
>=x11-libs/qt-multimedia-${QT_MINIMAL}:4
"
case ${MULTIMEDIA_REQUIRED} in
always)
COMMONDEPEND+=" ${qtmultimediadepend}"
;;
optional)
IUSE+=" multimedia"
COMMONDEPEND+=" multimedia? ( ${qtmultimediadepend} )"
;;
*) ;;
esac
unset qtmultimediadepend
# WebKit dependencies
case ${KDE_REQUIRED} in
always)
qtwebkitusedeps="[kde]"
;;
optional)
qtwebkitusedeps="[kde?]"
;;
*) ;;
esac
qtwebkitdepend="
>=x11-libs/qt-webkit-${QT_MINIMAL}:4${qtwebkitusedeps}
"
unset qtwebkitusedeps
case ${WEBKIT_REQUIRED} in
always)
COMMONDEPEND+=" ${qtwebkitdepend}"
;;
optional)
IUSE+=" webkit"
COMMONDEPEND+=" webkit? ( ${qtwebkitdepend} )"
;;
*) ;;
esac
unset qtwebkitdepend
# CppUnit dependencies
cppuintdepend="
dev-util/cppunit
"
case ${CPPUNIT_REQUIRED} in
always)
DEPEND+=" ${cppuintdepend}"
;;
optional)
IUSE+=" test"
DEPEND+=" test? ( ${cppuintdepend} )"
;;
*) ;;
esac
unset cppuintdepend
# KDE dependencies
kdecommondepend="
dev-lang/perl
>=x11-libs/qt-core-${QT_MINIMAL}:4[qt3support,ssl]
>=x11-libs/qt-gui-${QT_MINIMAL}:4[accessibility,dbus]
>=x11-libs/qt-qt3support-${QT_MINIMAL}:4[accessibility,kde]
>=x11-libs/qt-script-${QT_MINIMAL}:4
>=x11-libs/qt-sql-${QT_MINIMAL}:4[qt3support]
>=x11-libs/qt-svg-${QT_MINIMAL}:4
>=x11-libs/qt-test-${QT_MINIMAL}:4
!aqua? (
x11-libs/libXext
x11-libs/libXt
x11-libs/libXxf86vm
)
"
if [[ ${PN} != kdelibs ]]; then
if [[ ${KDEBASE} = kde-base ]]; then
kdecommondepend+=" $(add_kdebase_dep kdelibs)"
# libknotificationitem only when SLOT is 4.3
[[ ${PN} != libknotificationitem ]] && [[ ${SLOT} = 4.3 ]] && \
kdecommondepend+=" $(add_kdebase_dep libknotificationitem)"
else
kdecommondepend+="
>=kde-base/kdelibs-${KDE_MINIMAL}
"
fi
fi
kdedepend="
dev-util/pkgconfig
!aqua? (
|| ( >=x11-libs/libXtst-1.1.0 <x11-proto/xextproto-7.1.0 )
x11-proto/xf86vidmodeproto
)
"
case ${KDE_REQUIRED} in
always)
IUSE+=" aqua"
COMMONDEPEND+=" ${kdecommondepend}"
DEPEND+=" ${kdedepend}"
;;
optional)
IUSE+=" aqua kde"
COMMONDEPEND+=" kde? ( ${kdecommondepend} )"
DEPEND+=" kde? ( ${kdedepend} )"
;;
*) ;;
esac
unset kdecommondepend kdedepend
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: COMMONDEPEND is ${COMMONDEPEND}"
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND (only) is ${DEPEND}"
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND (only) is ${RDEPEND}"
# Accumulate dependencies set by this eclass
DEPEND+=" ${COMMONDEPEND}"
RDEPEND+=" ${COMMONDEPEND}"
unset COMMONDEPEND
# Add experimental kdeenablefinal, disabled by default
IUSE+=" kdeenablefinal"
# Fetch section - If the ebuild's category is not 'kde-base' and if it is not a
# koffice ebuild, the URI should be set in the ebuild itself
case ${BUILD_TYPE} in
live)
# Determine branch URL based on live type
local branch_prefix
case ${PV} in
9999*)
# trunk
branch_prefix="trunk/KDE"
;;
*)
# branch
branch_prefix="branches/KDE/${SLOT}"
# @ECLASS-VARIABLE: ESVN_PROJECT_SUFFIX
# @DESCRIPTION
# Suffix appended to ESVN_PROJECT depending on fetched branch.
# Defaults is empty (for -9999 = trunk), and "-${PV}" otherwise.
ESVN_PROJECT_SUFFIX="-${PV}"
;;
esac
SRC_URI=""
# @ECLASS-VARIABLE: ESVN_MIRROR
# @DESCRIPTION:
# This variable allows easy overriding of default kde mirror service
# (anonsvn) with anything else you might want to use.
ESVN_MIRROR=${ESVN_MIRROR:=svn://anonsvn.kde.org/home/kde}
# Split ebuild, or extragear stuff
if [[ -n ${KMNAME} ]]; then
ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
if [[ -z ${KMNOMODULE} ]] && [[ -z ${KMMODULE} ]]; then
KMMODULE="${PN}"
fi
# Split kde-base/ ebuilds: (they reside in trunk/KDE)
case ${KMNAME} in
kdebase-*)
ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/kdebase/${KMNAME#kdebase-}"
;;
kdelibs-*)
ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/kdelibs/${KMNAME#kdelibs-}"
;;
kdereview*)
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
;;
kdesupport)
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
;;
kde*)
ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/${KMNAME}"
;;
extragear*|playground*)
# Unpack them in toplevel dir, so that they won't conflict with kde4-meta
# build packages from same svn location.
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
;;
koffice)
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
;;
*)
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
;;
esac
else
# kdelibs, kdepimlibs
ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/${PN}"
ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
fi
# @ECLASS-VARIABLE: ESVN_UP_FREQ
# @DESCRIPTION:
# This variable is used for specifying the timeout between svn synces
# for kde-base and koffice modules. Does not affect misc apps.
# Default value is 1 hour.
[[ ${KDEBASE} = kde-base || ${KDEBASE} = koffice ]] && ESVN_UP_FREQ=${ESVN_UP_FREQ:-1}
;;
*)
if [[ -n ${KDEBASE} ]]; then
if [[ -n ${KMNAME} ]]; then
case ${KMNAME} in
kdebase-apps)
_kmname="kdebase" ;;
*)
_kmname="${KMNAME}" ;;
esac
else
_kmname=${PN}
fi
_kmname_pv="${_kmname}-${PV}"
case ${KDEBASE} in
kde-base)
case ${PV} in
4.[34].8[05] | 4.[34].9[0568])
# block for normally packed unstable releases
SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
4.[34].[6-9]*)
# Repacked tarballs: need to depend on xz-utils to ensure that they can be unpacked
SRC_URI="http://dev.gentooexperimental.org/~alexxy/kde/${PV}/${_kmname_pv}.tar.xz"
DEPEND+=" app-arch/xz-utils"
;;
*) SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
esac
;;
koffice)
case ${PV} in
2.0.[6-9]*) SRC_URI="mirror://kde/unstable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2" ;;
*) SRC_URI="mirror://kde/stable/${_kmname_pv}/${_kmname_pv}.tar.bz2" ;;
esac
esac
unset _kmname _kmname_pv
fi
;;
esac
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
# @ECLASS-VARIABLE: PREFIX
# @DESCRIPTION:
# Set the installation PREFIX for non kde-base applications. It defaults to /usr.
# kde-base packages go into KDE4 installation directory (KDEDIR) by default.
# No matter the PREFIX, package will be built against KDE installed in KDEDIR.
# @FUNCTION: kde4-base_pkg_setup
# @DESCRIPTION:
# Do the basic kdeprefix KDEDIR settings and determine with which kde should
# optional applications link
kde4-base_pkg_setup() {
debug-print-function ${FUNCNAME} "$@"
# Prefix compat:
if [[ ${EAPI} == 2 ]] && ! use prefix; then
EPREFIX=
EROOT=${ROOT}
fi
# Append missing trailing slash character
[[ ${EROOT} = */ ]] || EROOT+="/"
# QA ebuilds
[[ -z ${KDE_MINIMAL_VALID} ]] && ewarn "QA Notice: ignoring invalid KDE_MINIMAL (defaulting to ${KDE_MINIMAL})."
# Don't set KDEHOME during compilation, it will cause access violations
unset KDEHOME
if [[ ${KDEBASE} = kde-base ]]; then
if use kdeprefix; then
KDEDIR=/usr/kde/${_kdedir}
else
KDEDIR=/usr
fi
: ${PREFIX:=${KDEDIR}}
else
# Determine KDEDIR by loooking for the closest match with KDE_MINIMAL
KDEDIR=
local kde_minimal_met
for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
[[ -z ${kde_minimal_met} ]] && [[ ${slot} = ${KDE_MINIMAL} ]] && kde_minimal_met=1
if [[ -n ${kde_minimal_met} ]] && has_version "kde-base/kdelibs:${slot}"; then
if has_version "kde-base/kdelibs:${slot}[kdeprefix]"; then
KDEDIR=/usr/kde/${slot}
else
KDEDIR=/usr
fi
break;
fi
done
unset slot
# Bail out if kdelibs required but not found
if [[ ${KDE_REQUIRED} = always ]] || { [[ ${KDE_REQUIRED} = optional ]] && use kde; }; then
[[ -z ${KDEDIR} ]] && die "Failed to determine KDEDIR!"
else
[[ -z ${KDEDIR} ]] && KDEDIR=/usr
fi
: ${PREFIX:=/usr}
fi
EKDEDIR=${EPREFIX}${KDEDIR}
# Point pkg-config path to KDE *.pc files
export PKG_CONFIG_PATH="${EKDEDIR}/$(get_libdir)/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
# Point to correct QT plugins path
QT_PLUGIN_PATH="${EKDEDIR}/$(get_libdir)/kde4/plugins/"
# Fix XDG collision with sandbox
export XDG_CONFIG_HOME="${T}"
# Not needed anymore
unset _kdedir
}
# @FUNCTION: kde4-base_src_unpack
# @DESCRIPTION:
# This function unpacks the source tarballs for KDE4 applications.
kde4-base_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
if [[ ${BUILD_TYPE} = live ]]; then
migrate_store_dir
subversion_src_unpack
elif [[ ${EAPI} == 2 ]]; then
local file
for file in ${A}; do
# This setup is because EAPI <= 2 cannot unpack *.tar.xz files
# directly, so we do it ourselves (using the exact same code as portage)
case ${file} in
*.tar.xz)
echo ">>> Unpacking ${file} to ${PWD}"
xz -dc "${DISTDIR}"/${file} | tar xof -
assert "failed unpacking ${file}"
;;
*)
unpack ${file}
;;
esac
done
else
# For EAPI >= 3, we can just use unpack() directly
unpack ${A}
fi
}
# @FUNCTION: kde4-base_src_prepare
# @DESCRIPTION:
# General pre-configure and pre-compile function for KDE4 applications.
# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
# enable_selected_linguas() and enable_selected_doc_linguas()
# in kde4-functions.eclass(5) for further details.
kde4-base_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
# Only enable selected languages, used for KDE extragear apps.
if [[ -n ${KDE_LINGUAS} ]]; then
enable_selected_linguas
fi
# Enable/disable handbooks for kde4-base packages
# kde-l10n inherits kde4-base but is metpackage, so no check for doc
# kdelibs inherits kde4-base but handle installing the handbook itself
if ! has kde4-meta ${INHERITED}; then
has handbook ${IUSE//+} && [[ ${PN} != kde-l10n ]] && [[ ${PN} != kdelibs ]] && enable_selected_doc_linguas
fi
[[ ${BUILD_TYPE} = live ]] && subversion_src_prepare
# Apply patches
base_src_prepare
epatch_user
# Save library dependencies
if [[ -n ${KMSAVELIBS} ]] ; then
save_library_dependencies
fi
# Inject library dependencies
if [[ -n ${KMLOADLIBS} ]] ; then
load_library_dependencies
fi
}
# @FUNCTION: kde4-base_src_configure
# @DESCRIPTION:
# Function for configuring the build of KDE4 applications.
kde4-base_src_configure() {
debug-print-function ${FUNCNAME} "$@"
# Build tests in src_test only, where we override this value
local cmakeargs=(-DKDE4_BUILD_TESTS=OFF)
if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
cmakeargs+=(-DKDE4_ENABLE_FINAL=ON)
fi
if has debug ${IUSE//+} && use debug; then
# Set "real" debug mode
CMAKE_BUILD_TYPE="Debugfull"
else
# Handle common release builds
append-cppflags -DQT_NO_DEBUG
fi
# Set distribution name
[[ ${PN} = kdelibs ]] && cmakeargs+=(-DKDE_DISTRIBUTION_TEXT=Gentoo)
# Here we set the install prefix
cmakeargs+=(-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}")
# Use colors
QTEST_COLORED=1
# Shadow existing /usr installations
unset KDEDIRS
# Handle kdeprefix-ed KDE
if [[ ${KDEDIR} != /usr ]]; then
# Override some environment variables - only when kdeprefix is different,
# to not break ccache/distcc
PATH="${EKDEDIR}/bin:${PATH}"
LDPATH="${EKDEDIR}/$(get_libdir)${LDPATH+:}${LDPATH}"
# Append full RPATH
cmakeargs+=(-DCMAKE_SKIP_RPATH=OFF)
# Set cmake prefixes to allow buildsystem to locate valid KDE installation
# when more are present
cmakeargs+=(-DCMAKE_SYSTEM_PREFIX_PATH="${EKDEDIR}")
fi
# Handle kdeprefix in application itself
if ! has kdeprefix ${IUSE//+} || ! use kdeprefix; then
# If prefix is /usr, sysconf needs to be /etc, not /usr/etc
cmakeargs+=(-DSYSCONF_INSTALL_DIR="${EPREFIX}"/etc)
fi
if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then
mycmakeargs=(${mycmakeargs})
fi
mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
cmake-utils_src_configure
}
# @FUNCTION: kde4-base_src_compile
# @DESCRIPTION:
# General function for compiling KDE4 applications.
kde4-base_src_compile() {
debug-print-function ${FUNCNAME} "$@"
cmake-utils_src_compile "$@"
}
# @FUNCTION: kde4-base_src_test
# @DESCRIPTION:
# Function for testing KDE4 applications.
kde4-base_src_test() {
debug-print-function ${FUNCNAME} "$@"
# Override this value, set in kde4-base_src_configure()
mycmakeargs+=(-DKDE4_BUILD_TESTS=ON)
cmake-utils_src_configure
kde4-base_src_compile
cmake-utils_src_test
}
# @FUNCTION: kde4-base_src_install
# @DESCRIPTION:
# Function for installing KDE4 applications.
kde4-base_src_install() {
debug-print-function ${FUNCNAME} "$@"
# Prefix support, for usage in ebuilds
if [[ ${EAPI} == 2 ]] && ! use prefix; then
ED=${D}
fi
if [[ -n ${KMSAVELIBS} ]] ; then
install_library_dependencies
fi
kde4-base_src_make_doc
cmake-utils_src_install
}
# @FUNCTION: kde4-base_src_make_doc
# @DESCRIPTION:
# Function for installing the documentation of KDE4 applications.
kde4-base_src_make_doc() {
debug-print-function ${FUNCNAME} "$@"
local doc
for doc in AUTHORS ChangeLog* README* NEWS TODO; do
[[ -s ${doc} ]] && dodoc ${doc}
done
if [[ -z ${KMNAME} ]]; then
for doc in {apps,runtime,workspace,.}/*/{AUTHORS,README*}; do
if [[ -s ${doc} ]]; then
local doc_complete=${doc}
doc="${doc#*/}"
newdoc "$doc_complete" "${doc%/*}.${doc##*/}"
fi
done
fi
}
# @FUNCTION: kde4-base_pkg_postinst
# @DESCRIPTION:
# Function to rebuild the KDE System Configuration Cache after an application has been installed.
kde4-base_pkg_postinst() {
debug-print-function ${FUNCNAME} "$@"
buildsycoca
if [[ ${BUILD_TYPE} = live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
echo
einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}"
einfo "Use it at your own risk."
einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
echo
elif [[ ${BUILD_TYPE} != live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && has kdeprefix ${IUSE//+} && use kdeprefix; then
# warning about kdeprefix for non-live users
echo
ewarn "WARNING! You have the kdeprefix useflag enabled."
ewarn "This setting is strongly discouraged and might lead to potential trouble"
ewarn "with KDE update strategies."
ewarn "You are using this setup at your own risk and the kde team does not"
ewarn "take responsibilities for dead kittens."
echo
fi
if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && ! has_version 'kde-base/kdebase-runtime-meta' && ! has_version 'kde-base/kdebase-startkde'; then
# warn about not supported approach
if [[ ${KDE_REQUIRED} == always ]] || ( [[ ${KDE_REQUIRED} == optional ]] && use kde ); then
echo
ewarn "WARNING! Your system configuration contains neither \"kde-base/kdebase-runtime-meta\""
ewarn "nor \"kde-base/kdebase-startkde\". You need one of above."
ewarn "With this setting you are unsupported by KDE team."
ewarn "All missing features you report for misc packages will be probably ignored or closed as INVALID."
fi
fi
}
# @FUNCTION: kde4-base_pkg_postrm
# @DESCRIPTION:
# Function to rebuild the KDE System Configuration Cache after an application has been removed.
kde4-base_pkg_postrm() {
debug-print-function ${FUNCNAME} "$@"
buildsycoca
}

View File

@ -0,0 +1,523 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.30 2010/02/02 14:20:16 reavertm Exp $
inherit versionator
# @ECLASS: kde4-functions.eclass
# @MAINTAINER:
# kde@gentoo.org
# @BLURB: Common ebuild functions for KDE 4 packages
# @DESCRIPTION:
# This eclass contains all functions shared by the different eclasses,
# for KDE 4 ebuilds.
# @ECLASS-VARIABLE: EAPI
# @DESCRIPTION:
# By default kde4 eclasses want EAPI 2 which might be redefinable to newer
# versions.
case ${EAPI:-0} in
2|3) : ;;
*) DEPEND="EAPI-TOO-OLD" ;;
esac
# @ECLASS-VARIABLE: KDEBASE
# @DESCRIPTION:
# This gets set to a non-zero value when a package is considered a kde or
# koffice ebuild.
if [[ ${CATEGORY} = kde-base ]]; then
debug-print "${ECLASS}: KDEBASE ebuild recognized"
KDEBASE=kde-base
fi
# is this a koffice ebuild?
if [[ ${KMNAME} = koffice || ${PN} = koffice ]]; then
debug-print "${ECLASS}: KOFFICE ebuild recognized"
KDEBASE=koffice
fi
# @ECLASS-VARIABLE: KDE_SLOTS
# @DESCRIPTION:
# The slots used by all KDE versions later than 4.0. The live KDE releases use
# KDE_LIVE_SLOTS instead. Values should be ordered.
KDE_SLOTS=( "4.1" "4.2" "4.3" "4.4" "4.5" )
# @ECLASS-VARIABLE: KDE_LIVE_SLOTS
# @DESCRIPTION:
# The slots used by KDE live versions. Values should be ordered.
KDE_LIVE_SLOTS=( "live" )
# @FUNCTION: slot_is_at_least
# @USAGE: <want> <have>
# @DESCRIPTION:
# Version aware slot comparator.
# Current implementation relies on the fact, that slots can be compared like
# string literals (and let's keep it this way).
slot_is_at_least() {
[[ "${2}" > "${1}" || "${2}" = "${1}" ]]
}
# @FUNCTION: buildsycoca
# @DESCRIPTION:
# Function to rebuild the KDE System Configuration Cache.
# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
buildsycoca() {
debug-print-function ${FUNCNAME} "$@"
if [[ ${EAPI} == 2 ]] && ! use prefix; then
EROOT=${ROOT}
fi
local KDE3DIR="${EROOT}usr/kde/3.5"
if [[ -z ${EROOT%%/} && -x "${KDE3DIR}"/bin/kbuildsycoca ]]; then
# Since KDE3 is aware of shortcuts in /usr, rebuild database
# for KDE3 as well.
touch "${KDE3DIR}"/share/services/ksycoca
chmod 644 "${KDE3DIR}"/share/services/ksycoca
ebegin "Running kbuildsycoca to build global database"
XDG_DATA_DIRS="${EROOT}usr/local/share:${KDE3DIR}/share:${EROOT}usr/share" \
DISPLAY="" \
"${KDE3DIR}"/bin/kbuildsycoca --global --noincremental &> /dev/null
eend $?
fi
# We no longer need to run kbuildsycoca4, as kded does that automatically, as needed
# fix permission for some directories
for x in share/{config,kde4}; do
[[ ${KDEDIR} == /usr ]] && DIRS=${EROOT}usr || DIRS="${EROOT}usr ${EROOT}${KDEDIR}"
for y in ${DIRS}; do
[[ -d "${y}/${x}" ]] || break # nothing to do if directory does not exist
if [[ $(stat --format=%a "${y}/${x}") != 755 ]]; then
ewarn "QA Notice:"
ewarn "Package ${PN} is breaking ${y}/${x} permissions."
ewarn "Please report this issue to gentoo bugzilla."
einfo "Permissions will get adjusted automatically now."
find "${y}/${x}" -type d -print0 | xargs -0 chmod 755
fi
done
done
}
# @FUNCTION: comment_all_add_subdirectory
# @USAGE: [list of directory names]
# @DESCRIPTION:
# Recursively comment all add_subdirectory instructions in listed directories,
# except those in cmake/.
comment_all_add_subdirectory() {
find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
xargs -0 sed -i \
-e '/^[[:space:]]*add_subdirectory/s/^/#DONOTCOMPILE /' \
-e '/^[[:space:]]*ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' \
-e '/^[[:space:]]*macro_optional_add_subdirectory/s/^/#DONOTCOMPILE /' \
-e '/^[[:space:]]*MACRO_OPTIONAL_ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' \
|| die "${LINENO}: Initial sed died"
}
# @ECLASS-VARIABLE: KDE_LINGUAS
# @DESCRIPTION:
# This is a whitespace-separated list of translations this ebuild supports.
# These translations are automatically added to IUSE. Therefore ebuilds must set
# this variable before inheriting any eclasses. To enable only selected
# translations, ebuilds must call enable_selected_linguas(). kde4-{base,meta}.eclass does
# this for you.
#
# Example: KDE_LINGUAS="en_GB de nl"
for _lingua in ${KDE_LINGUAS}; do
IUSE="${IUSE} linguas_${_lingua}"
done
# @FUNCTION: enable_selected_linguas
# @DESCRIPTION:
# Enable translations based on LINGUAS settings and translations supported by
# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
# but this default can be overridden by defining KDE_LINGUAS_DIR.
enable_selected_linguas() {
debug-print-function ${FUNCNAME} "$@"
local lingua linguas sr_mess wp
# if there is no linguas defined we enable everything
if ! $(env | grep -q "^LINGUAS="); then
return 0
fi
# @ECLASS-VARIABLE: KDE_LINGUAS_DIR
# @DESCRIPTION:
# Specified folder where application translations are located.
KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="po"}
[[ -d "${KDE_LINGUAS_DIR}" ]] || die "wrong linguas dir specified"
comment_all_add_subdirectory "${KDE_LINGUAS_DIR}"
pushd "${KDE_LINGUAS_DIR}" > /dev/null
# fix all various crazy sr@Latn variations
# this part is only ease for ebuilds, so there wont be any die when this
# fail at any point
sr_mess="sr@latn sr@latin sr@Latin"
for wp in ${sr_mess}; do
[[ -e "${wp}.po" ]] && mv "${wp}.po" "sr@Latn.po"
if [[ -d "${wp}" ]]; then
# move dir and fix cmakelists
mv "${wp}" "sr@Latn"
sed -i \
-e "s:${wp}:sr@Latin:g" \
CMakeLists.txt
fi
done
for lingua in ${KDE_LINGUAS}; do
if [[ -e "${lingua}.po" ]]; then
mv "${lingua}.po" "${lingua}.po.old"
fi
done
for lingua in ${KDE_LINGUAS}; do
if use linguas_${lingua} ; then
if [[ -d "${lingua}" ]]; then
linguas="${linguas} ${lingua}"
sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
-e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
-i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
fi
if [[ -e "${lingua}.po.old" ]]; then
linguas="${linguas} ${lingua}"
mv "${lingua}.po.old" "${lingua}.po"
fi
fi
done
[[ -n "${linguas}" ]] && einfo "Enabling languages: ${linguas}"
popd > /dev/null
}
# @FUNCTION: enable_selected_doc_linguas
# @DESCRIPTION:
# Enable only selected linguas enabled doc folders.
enable_selected_doc_linguas() {
debug-print-function ${FUNCNAME} "$@"
# if there is no linguas defined we enable everything
if ! $(env | grep -q "^LINGUAS="); then
return 0
fi
# @ECLASS-VARIABLE: KDE_DOC_DIRS
# @DESCRIPTION:
# Variable specifying whitespace separated patterns for documentation locations.
# Default is "doc/%lingua"
KDE_DOC_DIRS=${KDE_DOC_DIRS:='doc/%lingua'}
local linguas
for pattern in ${KDE_DOC_DIRS}; do
local handbookdir=`dirname ${pattern}`
local translationdir=`basename ${pattern}`
# Do filename pattern supplied, treat as directory
[[ "${handbookdir}" = '.' ]] && handbookdir=${translationdir} && translationdir=
[[ -d "${handbookdir}" ]] || die 'wrong doc dir specified'
if ! use handbook; then
# Disable whole directory
sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
-e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
-i CMakeLists.txt || die 'failed to comment out all handbooks'
else
# Disable subdirectories recursively
comment_all_add_subdirectory "${handbookdir}"
# Add requested translations
local lingua
for lingua in en ${KDE_LINGUAS}; do
if [[ ${lingua} = 'en' ]] || use linguas_${lingua}; then
if [[ -d "${handbookdir}/${translationdir//%lingua/${lingua}}" ]]; then
sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \
-e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \
-i "${handbookdir}"/CMakeLists.txt && ! has ${lingua} ${linguas} && linguas="${linguas} ${lingua}"
fi
fi
done
fi
done
[[ -n "${linguas}" ]] && einfo "Enabling handbook translations:${linguas}"
}
# @FUNCTION: get_build_type
# @DESCRIPTION:
# Determine whether we are using live ebuild or tbzs.
get_build_type() {
if [[ ${SLOT} = live || ${PV} = *9999* ]]; then
BUILD_TYPE="live"
else
BUILD_TYPE="release"
fi
export BUILD_TYPE
}
# @FUNCTION: migrate_store_dir
# @DESCRIPTION:
# Universal store dir migration
# * performs split of kdebase to kdebase-apps when needed
# * moves playground/extragear kde4-base-style to toplevel dir
migrate_store_dir() {
local cleandir="${ESVN_STORE_DIR}/KDE"
if [[ -d "${cleandir}" ]]; then
ewarn "'${cleandir}' has been found. Moving contents to new location."
addwrite "${ESVN_STORE_DIR}"
# Split kdebase
local module
if pushd "${cleandir}"/kdebase/kdebase > /dev/null; then
for module in `find . -maxdepth 1 -type d -name [a-z0-9]\*`; do
module="${module#./}"
mkdir -p "${ESVN_STORE_DIR}/kdebase-${module}" && mv -f "${module}" "${ESVN_STORE_DIR}/kdebase-${module}" || \
die "Failed to move to '${ESVN_STORE_DIR}/kdebase-${module}'."
done
popd > /dev/null
rm -fr "${cleandir}/kdebase" || \
die "Failed to remove ${cleandir}/kdebase. You need to remove it manually."
fi
# Move the rest
local pkg
for pkg in "${cleandir}"/*; do
mv -f "${pkg}" "${ESVN_STORE_DIR}"/ || eerror "Failed to move '${pkg}'"
done
rmdir "${cleandir}" || die "Could not move obsolete KDE store dir. Please move '${cleandir}' contents to appropriate location (possibly ${ESVN_STORE_DIR}) and manually remove '${cleandir}' in order to continue."
fi
if ! hasq kde4-meta ${INHERITED}; then
case ${KMNAME} in
extragear*|playground*)
local svnlocalpath="${ESVN_STORE_DIR}"/"${KMNAME}"/"${PN}"
if [[ -d "${svnlocalpath}" ]]; then
local destdir="${ESVN_STORE_DIR}"/"${ESVN_PROJECT}"/"`basename "${ESVN_REPO_URI}"`"
ewarn "'${svnlocalpath}' has been found."
ewarn "Moving contents to new location: ${destdir}"
addwrite "${ESVN_STORE_DIR}"
mkdir -p "${ESVN_STORE_DIR}"/"${ESVN_PROJECT}" && mv -f "${svnlocalpath}" "${destdir}" \
|| die "Failed to move to '${svnlocalpath}'"
# Try cleaning empty directories
rmdir "`dirname "${svnlocalpath}"`" 2> /dev/null
fi
;;
esac
fi
}
# Functions handling KMLOADLIBS and KMSAVELIBS
# @FUNCTION: save_library_dependencies
# @DESCRIPTION:
# Add exporting CMake dependencies for current package
save_library_dependencies() {
local depsfile="${T}/${PN}:${SLOT}"
ebegin "Saving library dependencies in ${depsfile##*/}"
echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
die "Failed to save the library dependencies."
eend $?
}
# @FUNCTION: install_library_dependencies
# @DESCRIPTION:
# Install generated CMake library dependencies to /var/lib/kde
install_library_dependencies() {
local depsfile="${T}/${PN}:${SLOT}"
ebegin "Installing library dependencies as ${depsfile##*/}"
insinto /var/lib/kde
doins "${depsfile}" || die "Failed to install library dependencies."
eend $?
}
# @FUNCTION: load_library_dependencies
# @DESCRIPTION:
# Inject specified library dependencies in current package
load_library_dependencies() {
local pn i depsfile
ebegin "Injecting library dependencies from '${KMLOADLIBS}'"
i=0
for pn in ${KMLOADLIBS} ; do
((i++))
depsfile="${EPREFIX}/var/lib/kde/${pn}:${SLOT}"
[[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
die "Failed to include library dependencies for ${pn}"
done
eend $?
}
# @FUNCTION: block_other_slots
# @DESCRIPTION:
# Create blocks for the current package in other slots when
# installed with USE=-kdeprefix
block_other_slots() {
debug-print-function ${FUNCNAME} "$@"
_do_blocker ${PN} 0:${SLOT}
}
# @FUNCTION: add_blocker
# @DESCRIPTION:
# Create correct RDEPEND value for blocking correct package.
# Useful for file-collision blocks.
# Parameters are package and version(s) to block.
# add_blocker kdelibs 4.2.4
# If no version is specified, then all versions will be blocked
# If any arguments (from 2 on) contain a ":", then different versions
# are blocked in different slots. (Unlisted slots get the version without
# a ":", if none, then all versions are blocked). The parameter is then of
# the form VERSION:SLOT. Any VERSION of 0 means that no blocker will be
# added for that slot (or, if no slot, then for any unlisted slot).
# A parameter of the form :SLOT means to block all versions from that slot.
# If VERSION begins with "<", then "!<foo" will be used instead of "!<=foo".
# As a special case, if a parameter with slot "3.5" is passed, then that slot
# may also be blocked.
#
# Versions that match "4.x.50" are equivalent to all slots up to (and including)
# "4.x", but nothing following slot "4.x"
#
# As an example, if SLOT=live, then
# add_blocker kdelibs 0 :4.3 '<4.3.96:4.4' 9999:live
# will add the following to RDEPEND:
# !kdeprefix? ( !kde-base/kdelibs:4.3[-kdeprefix] )
# !kdeprefix? ( !<kde-base/kdelibs-4.3.96:4.4[-kdeprefix] )
# !<=kde-base/kdelibs-9999:live
add_blocker() {
debug-print-function ${FUNCNAME} "$@"
RDEPEND+=" $(_do_blocker "$@")"
}
# _greater_max_in_slot ver slot
# slot must be 4.x or live
# returns true if ver is >= the maximum possibile version in slot
_greater_max_in_slot() {
local ver=$1
local slot=$2
# If slot is live, then return false
# (nothing is greater than the maximum live version)
[[ $slot == live ]] && return 1
# Otherwise, for slot X.Y, test against X.Y.50
local test=${slot}.50
version_compare $1 ${test}
# 1 = '<', 2 = '=', 3 = '>'
(( $? != 1 ))
}
# _less_min_in_slot ver slot
# slot must be 4.x or live
# returns true if ver is <= the minimum possibile version in slot
_less_min_in_slot() {
local ver=$1
local slot=$2
# If slot == live, then test with "9999_pre", so that 9999 tests false
local test=9999_pre
# If slot == X.Y, then test with X.(Y-1).50
[[ $slot != live ]] && test=${slot%.*}.$((${slot#*.} - 1)).50
version_compare $1 ${test}
# 1 = '<', 2 = '=', 3 = '>'
(( $? != 3 ))
}
# Internal function used for add_blocker and block_other_slots
# This takes the same parameters as add_blocker, but echos to
# stdout instead of updating a variable.
_do_blocker() {
debug-print-function ${FUNCNAME} "$@"
[[ -z ${1} ]] && die "Missing parameter"
local pkg=kde-base/$1
shift
local param slot def="unset" var atom
# The following variables will hold parameters that contain ":"
# - block_3_5
# - block_4_1
# - block_4_2
# - block_4_3
# - block_4_4
# - block_live
for slot in 3.5 ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
local block_${slot//./_}="unset"
done
# This construct goes through each parameter passed, and sets
# either def or block_* to the version passed
for param; do
# If the parameter does not have a ":" in it...
if [[ ${param/:} == ${param} ]]; then
def=${param}
else # the parameter *does* have a ":" in it
# so everything after the : is the slot...
slot=${param#*:}
# ...and everything before the : is the version
local block_${slot//./_}=${param%:*}
fi
done
for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
# ${var} contains the name of the variable we care about for this slot
# ${!var} is it's value
var=block_${slot//./_}
# if we didn't pass *:${slot}, then use the unsloted value
[[ ${!var} == "unset" ]] && var=def
# If no version was passed, or the version is greater than the maximum
# possible version in this slot, block all versions in this slot
if [[ ${!var} == "unset" ]] || [[ -z ${!var} ]] || _greater_max_in_slot ${!var#<} ${slot}; then
atom=${pkg}
# If the version is "0" or less than the minimum possible version in
# this slot, do nothing
elif [[ ${!var} == "0" ]] || _less_min_in_slot ${!var#<} ${slot}; then
continue
# If the version passed begins with a "<", then use "<" instead of "<="
elif [[ ${!var:0:1} == "<" ]]; then
# this also removes the first character of the version, which is a "<"
atom="<${pkg}-${!var:1}"
else
atom="<=${pkg}-${!var}"
fi
# we always block our own slot, ignoring kdeprefix
if [[ ${SLOT} == ${slot} ]]; then
echo " !${atom}:${slot}"
else
# we only block other slots on -kdeprefix
echo " !kdeprefix? ( !${atom}:${slot}[-kdeprefix] )"
fi
done
# This is a special case block for :3.5; it does not use the
# default version passed, and no blocker is output *unless* a version
# is passed, or ":3.5" is passed to explicitly request a block on all
# 3.5 versions.
if [[ ${block_3_5} != "unset" && ${block_3_5} != "0" ]]; then
if [[ -z ${block_3_5} ]]; then
atom=${pkg}
elif [[ ${block_3_5:0:1} == "<" ]]; then
atom="<${pkg}-${block_3_5:1}"
else
atom="<=${pkg}-${block_3_5}"
fi
echo " !${atom}:3.5"
fi
}
# @FUNCTION: add_kdebase_dep
# @DESCRIPTION:
# Create proper dependency for kde-base/ dependencies,
# adding SLOT when needed (and *only* when needed).
# This takes 1 or 2 arguments. The first being the package
# name, the optional second, is additional USE flags to append.
# The output of this should be added directly to DEPEND/RDEPEND, and
# may be wrapped in a USE conditional (but not an || conditional
# without an extra set of parentheses).
add_kdebase_dep() {
debug-print-function ${FUNCNAME} "$@"
[[ -z ${1} ]] && die "Missing parameter"
local use=${2:+,${2}}
echo " !kdeprefix? ( >=kde-base/${1}-${PV}[aqua=,-kdeprefix${use}] )"
echo " kdeprefix? ( >=kde-base/${1}-${PV}:${SLOT}[aqua=,kdeprefix${use}] )"
}

View File

@ -0,0 +1,712 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.33 2010/02/02 14:20:16 reavertm Exp $
#
# @ECLASS: kde4-meta.eclass
# @MAINTAINER:
# kde@gentoo.org
# @BLURB: Eclass for writing "split" KDE packages.
# @DESCRIPTION:
# This eclass provides all necessary functions for writing split KDE ebuilds.
#
# You must define KMNAME to use this eclass, and do so before inheriting it. All other variables are optional.
# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY.
inherit kde4-base versionator
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
[[ -z ${KMNAME} ]] && die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild"
# Add dependencies that all packages in a certain module share.
case ${KMNAME} in
kdebase|kdebase-apps|kdebase-workspace|kdebase-runtime|kdegraphics)
COMMONDEPEND+=" >=kde-base/qimageblitz-0.0.4"
;;
kdepim|kdepim-runtime)
! slot_is_at_least 4.4 ${SLOT} && COMMONDEPEND+=" $(add_kdebase_dep kdepimlibs)"
case ${PN} in
akregator|kaddressbook|kjots|kmail|knode|knotes|korganizer|ktimetracker)
IUSE+=" +kontact"
RDEPEND+=" kontact? ( $(add_kdebase_dep kontact) )"
;;
esac
;;
kdegames)
if [[ ${PN} != libkdegames ]]; then
COMMONDEPEND+=" $(add_kdebase_dep libkdegames)"
fi
;;
koffice)
[[ ${PN} != koffice-data ]] && IUSE+=" debug"
RDEPEND+="
!app-office/${PN}:0
!app-office/koffice:0
!app-office/koffice-meta:0
"
if has openexr ${IUSE//+}; then
COMMONDEPEND+=" media-gfx/imagemagick[openexr?]"
else
COMMONDEPEND+=" media-gfx/imagemagick"
fi
COMMONDEPEND+="
dev-cpp/eigen:2
media-libs/fontconfig
media-libs/freetype:2
"
if [[ ${PN} != koffice-libs && ${PN} != koffice-data ]]; then
COMMONDEPEND+=" >=app-office/koffice-libs-${PV}:${SLOT}"
fi
;;
esac
DEPEND+=" ${COMMONDEPEND}"
RDEPEND+=" ${COMMONDEPEND}"
unset COMMONDEPEND
debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies"
debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies"
# Useful to build kde4-meta style stuff from extragear/playground (plasmoids etc)
case ${BUILD_TYPE} in
live)
case ${KMNAME} in
extragear*|playground*)
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
;;
esac
;;
esac
# @ECLASS-VARIABLE: KMNAME
# @DESCRIPTION:
# Name of the parent-module (e.g. kdebase, kdepim, ...). You _must_ set it
# _before_ inheriting this eclass, (unlike the other parameters), since it's
# used to set $SRC_URI.
# @ECLASS-VARIABLE: KMMODULE
# @DESCRIPTION:
# Specify exactly one subdirectory of $KMNAME here. Defaults to $PN.
# The subdirectory listed here is treated exactly like items in $KMEXTRA.
#
# Example: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n, because
# just 'l10n' would be too confusing. Hence it sets KMMODULE="l10n".
# @ECLASS-VARIABLE: KMNOMODULE
# @DESCRIPTION:
# If set to "true", $KMMODULE doesn't have to be defined.
#
# Example usage: If you're installing subdirectories of a package, like plugins,
# you mark the top subdirectory (containing the package) as $KMEXTRACTONLY, and
# set KMNOMODULE="true".
if [[ -z ${KMMODULE} && ${KMNOMODULE} != true ]]; then
KMMODULE=${PN}
fi
# @ECLASS-VARIABLE: KMEXTRA
# @DESCRIPTION:
# All subdirectories listed here will be extracted, compiled & installed.
# $KMMODULE is always added to $KMEXTRA.
# If the handbook USE-flag is set, and if this directory exists,
# then "doc/$KMMODULE" is added to $KMEXTRA. In other cases, this should be
# handled in the ebuild.
# If the documentation is in a different subdirectory, you should add it to KMEXTRA.
# @ECLASS-VARIABLE: KMCOMPILEONLY
# @DESCRIPTION:
# All subdirectories listed here will be extracted & compiled, but not installed.
# TODO: better formulation may be needed
# @ECLASS-VARIABLE: KMEXTRACTONLY
# @DESCRIPTION:
# All subdirectories listed here will be extracted, but neither compiled nor installed.
# This can be used to avoid compilation in a subdirectory of a directory in $KMMODULE or $KMEXTRA
# @ECLASS-VARIABLE: KMTARPARAMS
# @DESCRIPTION:
# Specify extra parameters to pass to tar, in kde4-meta_src_extract.
# '-xpf -j' are passed to tar by default.
# @FUNCTION: kde4-meta_pkg_setup
# @DESCRIPTION:
# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in
# split ebuilds.
kde4-meta_pkg_setup() {
debug-print-function ${FUNCNAME} "$@"
kde4-base_pkg_setup
}
# @FUNCTION: kde4-meta_src_unpack
# @DESCRIPTION:
# This function unpacks the source for split ebuilds. See also
# kde4-meta-src_extract.
kde4-meta_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
if [[ ${BUILD_TYPE} = live ]]; then
migrate_store_dir
S="${WORKDIR}/${P}"
mkdir -p "${S}"
ESVN_RESTRICT="export" subversion_src_unpack
subversion_wc_info
subversion_bootstrap
kde4-meta_src_extract
else
kde4-meta_src_extract
fi
}
# FIXME: the difference between kde4-meta_src_extract and kde4-meta_src_unpack?
# @FUNCTION: kde4-meta_src_extract
# @DESCRIPTION:
# A function to unpack the source for a split KDE ebuild.
# Also see KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and
# KMTARPARAMS.
kde4-meta_src_extract() {
debug-print-function ${FUNCNAME} "$@"
if [[ ${BUILD_TYPE} = live ]]; then
local rsync_options subdir kmnamedir targetdir
# Export working copy to ${S}
einfo "Exporting parts of working copy to ${S}"
kde4-meta_create_extractlists
rsync_options="--group --links --owner --perms --quiet --exclude=.svn/"
# Copy ${KMNAME} non-recursively (toplevel files)
rsync ${rsync_options} "${ESVN_WC_PATH}"/${kmnamedir}* "${S}" \
|| die "${ESVN}: can't export toplevel files to '${S}'."
# Copy cmake directory
if [[ -d "${ESVN_WC_PATH}/${kmnamedir}cmake" ]]; then
rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}cmake" "${S}" \
|| die "${ESVN}: can't export cmake files to '${S}'."
fi
# Copy all subdirectories
for subdir in $(__list_needed_subdirectories); do
targetdir=""
if [[ $subdir = doc/* && ! -e "$ESVN_WC_PATH/$kmnamedir$subdir" ]]; then
continue
fi
[[ ${subdir%/} = */* ]] && targetdir=${subdir%/} && targetdir=${targetdir%/*} && mkdir -p "${S}/${targetdir}"
rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}${subdir%/}" "${S}/${targetdir}" \
|| die "${ESVN}: can't export subdirectory '${subdir}' to '${S}/${targetdir}'."
done
if [[ ${KMNAME} = kdebase-runtime && ${PN} != kdebase-data ]]; then
sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
"${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
fi
else
local abort tarball tarfile f extractlist moduleprefix postfix
case ${PV} in
4.[34].8[05] | 4.[34].9[0568])
# block for normally packed upstream unstable snapshots
KMTARPARAMS+=" --bzip2" # bz2
postfix="bz2"
;;
4.[34].[6-9]*)
# Not passing --xz, as it doesn't work with stable tar
KMTARPARAMS+=" --use-compress-program=xz" # xz
postfix="xz"
;;
*)
KMTARPARAMS+=" --bzip2" # bz2
postfix="bz2"
;;
esac
case ${KMNAME} in
kdebase-apps)
# kdebase/apps -> kdebase-apps
tarball="kdebase-${PV}.tar.${postfix}"
# Go one level deeper for kdebase-apps in tarballs
moduleprefix=apps/
KMTARPARAMS+=" --transform=s|apps/||"
;;
*)
# Create tarball name from module name (this is the default)
tarball="${KMNAME}-${PV}.tar.${postfix}"
;;
esac
# Full path to source tarball
tarfile="${DISTDIR}/${tarball}"
# Detect real toplevel dir from tarball name - it will be used upon extraction
# and in __list_needed_subdirectories
topdir="${tarball%.tar.*}/"
ebegin "Unpacking parts of ${tarball} to ${WORKDIR}"
kde4-meta_create_extractlists
for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake \
AUTHORS COPYING INSTALL README NEWS ChangeLog
do
extractlist+=" ${topdir}${moduleprefix}${f}"
done
extractlist+=" $(__list_needed_subdirectories)"
pushd "${WORKDIR}" > /dev/null
[[ -n ${KDE4_STRICTER} ]] && echo tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} >&2
tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} 2> /dev/null
# Default $S is based on $P; rename the extracted directory to match $S if necessary
mv ${topdir} ${P} || die "Died while moving \"${topdir}\" to \"${P}\""
popd > /dev/null
eend $?
# We need to clear it here to make verification below work
unset moduleprefix
if [[ -n ${KDE4_STRICTER} ]]; then
for f in $(__list_needed_subdirectories fatal); do
if [[ ! -e "${S}/${f#*/}" ]]; then
eerror "'${f#*/}' is missing"
abort=true
fi
done
[[ -n ${abort} ]] && die "There were missing files."
fi
# We don't need it anymore
unset topdir
fi
}
# @FUNCTION: kde4-meta_create_extractlists
# @DESCRIPTION:
# Create lists of files and subdirectories to extract.
# Also see descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY,
# KMEXTRACTONLY and KMTARPARAMS.
kde4-meta_create_extractlists() {
debug-print-function ${FUNCNAME} "$@"
# TODO change to KMEXTRA for more strict check
if has handbook ${IUSE//+} && use handbook && [[ -n ${KMMODULE} ]]; then
# We use the basename of $KMMODULE because $KMMODULE can contain
# the path to the module subdirectory.
KMEXTRA_NONFATAL+="
doc/${KMMODULE##*/}"
fi
# Add some CMake-files to KMEXTRACTONLY.
# Note that this actually doesn't include KMEXTRA handling.
# In those cases you should care to add the relevant files to KMEXTRACTONLY
case ${KMNAME} in
kdebase)
KMEXTRACTONLY+="
apps/config-apps.h.cmake
apps/ConfigureChecks.cmake"
;;
kdebase-apps)
KMEXTRACTONLY+="
config-apps.h.cmake
ConfigureChecks.cmake"
;;
kdebase-runtime)
KMEXTRACTONLY+="
config-runtime.h.cmake"
;;
kdebase-workspace)
KMEXTRACTONLY+="
config-unix.h.cmake
ConfigureChecks.cmake
config-workspace.h.cmake
config-X11.h.cmake
startkde.cmake
KDE4WorkspaceConfig.cmake.in"
;;
kdegames)
if [[ ${PN} != libkdegames ]]; then
KMEXTRACTONLY+="
libkdegames/"
KMLOADLIBS="${KMLOADLIBS} libkdegames"
fi
;;
kdepim)
if [[ ${PN} != libkdepim ]]; then
KMEXTRACTONLY+="
libkdepim/"
fi
KMEXTRACTONLY+="
config-enterprise.h.cmake
kleopatra/ConfigureChecks.cmake"
if slot_is_at_least 4.5 ${SLOT}; then
KMEXTRACTONLY+="
kdepim-version.h.cmake"
else
KMEXTRACTONLY+="
kdepim-version.h"
fi
if has kontact ${IUSE//+} && use kontact; then
KMEXTRA+="
kontact/plugins/${PLUGINNAME:-${PN}}/"
if ! slot_is_at_least 4.4 ${SLOT}; then
KMEXTRACTONLY+="
kontactinterfaces/"
fi
fi
;;
kdeutils)
KMEXTRACTONLY+="
kdeutils-version.h"
;;
koffice)
KMEXTRACTONLY+="
config-endian.h.cmake
filters/config-filters.h.cmake
config-openexr.h.cmake
config-opengl.h.cmake
config-prefix.h.cmake
"
case ${PV} in
2.0.*)
KMEXTRACTONLY+="
config-openctl.h.cmake"
;;
esac
;;
esac
# Don't install cmake modules for split ebuilds, to avoid collisions.
case ${KMNAME} in
kdebase-runtime|kdebase-workspace|kdeedu|kdegames|kdegraphics)
case ${PN} in
libkdegames|libkdeedu|libkworkspace)
KMEXTRA+="
cmake/modules/"
;;
*)
KMCOMPILEONLY+="
cmake/modules/"
;;
esac
;;
esac
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}"
}
__list_needed_subdirectories() {
local i j kmextra kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist
# We expand KMEXTRA by adding CMakeLists.txt files
kmextra="${KMEXTRA}"
[[ ${1} != fatal ]] && kmextra+=" ${KMEXTRA_NONFATAL}"
for i in ${kmextra}; do
kmextra_expanded+=" ${i}"
j=$(dirname ${i})
while [[ ${j} != "." ]]; do
kmextra_expanded+=" ${j}/CMakeLists.txt";
j=$(dirname ${j})
done
done
# Expand KMMODULE
if [[ -n ${KMMODULE} ]]; then
kmmodule_expanded="${KMMODULE}"
j=$(dirname ${KMMODULE})
while [[ ${j} != "." ]]; do
kmmodule_expanded+=" ${j}/CMakeLists.txt";
j=$(dirname ${j})
done
fi
# Expand KMCOMPILEONLY
for i in ${KMCOMPILEONLY}; do
kmcompileonly_expanded+=" ${i}"
j=$(dirname ${i})
while [[ ${j} != "." ]]; do
kmcompileonly_expanded+=" ${j}/CMakeLists.txt";
j=$(dirname ${j})
done
done
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}"
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}"
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}"
# Create final list of stuff to extract
# We append topdir only when specified (usually for tarballs)
for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \
${KMEXTRACTONLY}
do
extractlist+=" ${topdir}${moduleprefix}${i}"
done
echo ${extractlist}
}
# @FUNCTION: kde4-meta_src_prepare
# @DESCRIPTION:
# Meta-package build system configuration handling - commenting out targets, etc..
kde4-meta_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
kde4-meta_change_cmakelists
kde4-base_src_prepare
}
# FIXME: no comment here?
_change_cmakelists_parent_dirs() {
debug-print-function ${FUNCNAME} "$@"
local _olddir _dir
_dir="${S}"/${1}
until [[ ${_dir} == "${S}" ]]; do
_olddir=$(basename "${_dir}")
_dir=$(dirname "${_dir}")
debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}"
if [[ -f ${_dir}/CMakeLists.txt ]]; then
sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
-e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
-i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}"
fi
done
}
# @FUNCTION: kde4-meta_change_cmakelists
# @DESCRIPTION:
# Adjust CMakeLists.txt to comply to our splitting.
kde4-meta_change_cmakelists() {
debug-print-function ${FUNCNAME} "$@"
pushd "${S}" > /dev/null
comment_all_add_subdirectory ./
# Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt
if [[ -f CMakeLists.txt ]]; then
sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
-e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
-i CMakeLists.txt || die "${LINENO}: cmake sed died"
fi
if [[ -z ${KMNOMODULE} ]]; then
# Restore "add_subdirectory" in $KMMODULE subdirectories
find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | \
xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
die "${LINENO}: died in KMMODULE section"
_change_cmakelists_parent_dirs ${KMMODULE}
fi
local i
# KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY
for i in ${KMEXTRACTONLY}; do
if [[ -d ${i} && -f ${i}/../CMakeLists.txt ]]; then
sed -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" \
-i ${i}/../CMakeLists.txt || \
die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}"
fi
done
# KMCOMPILEONLY
for i in ${KMCOMPILEONLY}; do
debug-print "${LINENO}: KMCOMPILEONLY, processing ${i}"
# Uncomment "add_subdirectory" instructions inside $KMCOMPILEONLY, then comment "install" instructions.
find "${S}"/${i} -name CMakeLists.txt -print0 | \
xargs -0 sed -i \
-e 's/^#DONOTCOMPILE //g' \
-e '/install(.*)/{s/^/#DONOTINSTALL /;}' \
-e '/^install(/,/)/{s/^/#DONOTINSTALL /;}' \
-e '/kde4_install_icons(.*)/{s/^/#DONOTINSTALL /;}' || \
die "${LINENO}: sed died in the KMCOMPILEONLY section while processing ${i}"
_change_cmakelists_parent_dirs ${i}
done
# KMEXTRA section
for i in ${KMEXTRA}; do
debug-print "${LINENO}: KMEXTRA section, processing ${i}"
find "${S}"/${i} -name CMakeLists.txt -print0 | \
xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
_change_cmakelists_parent_dirs ${i}
done
# KMEXTRA_NONFATAL section
for i in ${KMEXTRA_NONFATAL}; do
if [[ -d "${S}"/${i} ]]; then
find "${S}"/${i} -name CMakeLists.txt -print0 | \
xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
_change_cmakelists_parent_dirs ${i}
fi
done
case ${KMNAME} in
kdebase-workspace)
# COLLISION PROTECT section
# Install the startkde script just once, as a part of kde-base/kdebase-startkde,
# not as a part of every package.
if [[ ${PN} != kdebase-startkde && -f CMakeLists.txt ]]; then
# The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0.
sed -e '/startkde/s/^/#DONOTINSTALL /' \
-i CMakeLists.txt || die "${LINENO}: sed died in the kdebase-startkde collision prevention section"
fi
# Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82
if [[ ${PN} != libkworkspace ]]; then
sed -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \
-i CMakeLists.txt || die "${LINENO}: sed died in kdebase-workspace strip config install and fix EXPORT section"
fi
;;
kdebase-runtime)
# COLLISION PROTECT section
# Only install the kde4 script as part of kde-base/kdebase-data
if [[ ${PN} != kdebase-data && -f CMakeLists.txt ]]; then
sed -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
-i CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
fi
;;
kdenetwork)
# Disable hardcoded kdepimlibs check
sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \
-i CMakeLists.txt || die "failed to disable hardcoded checks"
;;
kdepim)
# Disable hardcoded checks
sed -r -e '/find_package\(KdepimLibs/s/REQUIRED//' \
-e '/find_package\((KdepimLibs|Boost|QGpgme|Akonadi|ZLIB|Strigi|SharedDesktopOntologies|Soprano|Nepomuk)/{/macro_optional_/!s/find/macro_optional_&/}' \
-e '/macro_log_feature\((Boost|QGPGME|Akonadi|ZLIB|STRIGI|SHAREDDESKTOPONTOLOGIES|Soprano|Nepomuk)_FOUND/s/ TRUE / FALSE /' \
-i CMakeLists.txt || die "failed to disable hardcoded checks"
if ! slot_is_at_least 4.5 ${SLOT}; then
case ${PN} in
kalarm|kmailcvt|kontact|korganizer|korn)
sed -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \
-e '/add_custom_target(kmail_xml /,/)/p' \
-i kmail/CMakeLists.txt || die "uncommenting xml failed"
_change_cmakelists_parent_dirs kmail
;;
esac
fi
;;
kdewebdev)
# Disable hardcoded checks
sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \
-e 's/find_package(LibXml2 REQUIRED)/macro_optional_find_package(LibXml2)/' \
-e 's/find_package(LibXslt REQUIRED)/macro_optional_find_package(LibXslt)/' \
-e 's/find_package(Boost REQUIRED)/macro_optional_find_package(Boost)/' \
-i CMakeLists.txt || die "failed to disable hardcoded checks"
;;
koffice)
# Prevent collisions
if [[ ${PN} != koffice-data ]]; then
sed -e '/install(.*FindKOfficeLibs.cmake/,/)/ d' \
-i cmake/modules/CMakeLists.txt || die "${LINENO}: sed died in collision prevention section"
sed -e '/install(.\+config-openexr\.h.\+)/d' \
-i CMakeLists.txt || die "${LINENO}: sed died in collision prevention section"
fi
# koffice 2.0
case ${PV} in
2.0.[1-9])
sed -i -n -e '1h;1!H;${g;s/install(.\+config-openexr.h.\+)//;p}' \
"${S}"/CMakeLists.txt || \
die "${LINENO}: sed died in collision prevention section"
;;
*) ;;
esac
esac
popd > /dev/null
}
# @FUNCTION: kde4-meta_src_configure
# @DESCRIPTION:
# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in split
# ebuilds.
kde4-meta_src_configure() {
debug-print-function ${FUNCNAME} "$@"
# backwards-compatibility: make mycmakeargs an array, if it isn't already
if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then
mycmakeargs=(${mycmakeargs})
fi
# Set some cmake default values here (usually workarounds for automagic deps)
case ${KMNAME} in
kdewebdev)
mycmakeargs=(
-DWITH_KdepimLibs=OFF
-DWITH_LibXml2=OFF
-DWITH_LibXslt=OFF
-DWITH_Boost=OFF
-DWITH_LibTidy=OFF
"${mycmakeargs[@]}"
)
;;
esac
kde4-base_src_configure
}
# @FUNCTION: kde4-meta_src_compile
# @DESCRIPTION:
# General function for compiling split KDE4 applications.
# Overrides kde4-base_src_compile.
kde4-meta_src_compile() {
debug-print-function ${FUNCNAME} "$@"
kde4-base_src_compile "$@"
}
# @FUNCTION: kde4-meta_src_test
# @DESCRIPTION:
# Currently just calls its equivalent in kde4-base.eclass(5) if
# I_KNOW_WHAT_I_AM_DOING is set. Use this in split ebuilds.
kde4-meta_src_test() {
debug-print-function $FUNCNAME "$@"
if [[ $I_KNOW_WHAT_I_AM_DOING ]]; then
kde4-base_src_test
else
einfo "Tests disabled"
fi
}
# @FUNCTION: kde4-meta_src_install
# @DESCRIPTION:
# Function for installing KDE4 split applications.
kde4-meta_src_install() {
debug-print-function $FUNCNAME "$@"
kde4-base_src_install
}
# @FUNCTION: kde4-meta_src_make_doc
# @DESCRIPTION:
# This function searches in ${S}/${KMMODULE},
# and tries to install "AUTHORS ChangeLog* README* NEWS TODO" if these files exist.
kde4-meta_src_make_doc() {
debug-print-function ${FUNCNAME} "$@"
local doc
for doc in AUTHORS ChangeLog* README* NEWS TODO; do
[[ -s ${KMMODULE}/${doc} ]] && newdoc "${KMMODULE}/${doc}" "${doc}.${KMMODULE##*/}"
done
kde4-base_src_make_doc
}
# @FUNCTION: kde4-meta_pkg_postinst
# @DESCRIPTION:
# Invoke kbuildsycoca4.
kde4-meta_pkg_postinst() {
debug-print-function ${FUNCNAME} "$@"
kde4-base_pkg_postinst
}
# @FUNCTION: kde4-meta_pkg_postrm
# @DESCRIPTION:
# Currently just calls its equivalent in kde4-base.eclass(5). Use this in split
# ebuilds.
kde4-meta_pkg_postrm() {
debug-print-function ${FUNCNAME} "$@"
kde4-base_pkg_postrm
}

View File

@ -0,0 +1,8 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kernel.eclass,v 1.61 2009/11/30 04:19:36 abcd Exp $
# @DEAD
# Replaced by kernel-2.eclass
# To be removed on 2011/11/30.
ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass"

Some files were not shown because too many files have changed in this diff Show More