summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/avahi.eclass15
-rw-r--r--eclass/kde-l10n.eclass9
-rw-r--r--eclass/libreoffice-l10n-2.eclass42
-rw-r--r--eclass/sab-patches.eclass114
-rw-r--r--eclass/sabayon-artwork.eclass5
-rw-r--r--eclass/transmission-2.80.eclass262
-rw-r--r--eclass/transmission-2.82.eclass284
7 files changed, 710 insertions, 21 deletions
diff --git a/eclass/avahi.eclass b/eclass/avahi.eclass
index c9a9876d..47164ca3 100644
--- a/eclass/avahi.eclass
+++ b/eclass/avahi.eclass
@@ -48,7 +48,7 @@ fi
MY_P=${P/-${AVAHI_MODULE}}
-inherit autotools eutils flag-o-matic
+inherit autotools eutils flag-o-matic systemd
DESCRIPTION="avahi ${AVAHI_MODULE} module"
HOMEPAGE="http://avahi.org/"
@@ -57,7 +57,7 @@ S="${WORKDIR}/${MY_P}"
LICENSE="LGPL-2.1"
SLOT="0"
-KEYWORDS="~amd64 ~x86"
+KEYWORDS="~amd64 ~arm ~x86"
AVAHI_COMMON_DEPEND=">=dev-util/intltool-0.40.5
>=dev-util/pkgconfig-0.9.0"
@@ -70,6 +70,12 @@ avahi_src_prepare() {
-e "s:\\.\\./\\.\\./\\.\\./doc/avahi-docs/html/:../../../doc/${PF}/html/:" \
doxygen_to_devhelp.xsl || die
+ # Drop DEPRECATED flags, bug #384743
+ sed -i -e 's:-D[A-Z_]*DISABLE_DEPRECATED=1::g' avahi-ui/Makefile.am || die
+
+ # Prevent .pyc files in DESTDIR
+ >py-compile
+
for i in ${!AVAHI_PATCHES[@]}; do
epatch "${AVAHI_PATCHES[i]}"
done
@@ -90,13 +96,14 @@ avahi_src_configure() {
--enable-glib
--enable-gobject
--disable-qt3
- $@"
+ $(systemd_with_unitdir)
+ ${*}"
econf ${myconf}
}
avahi_src_install-cleanup() {
# Remove .la files
- find "${D}" -name '*.la' -exec rm -f {} + || die
+ find "${ED}" -name '*.la' -exec rm -f {} + || die
}
EXPORT_FUNCTIONS src_prepare src_configure
diff --git a/eclass/kde-l10n.eclass b/eclass/kde-l10n.eclass
index 100db755..2974c890 100644
--- a/eclass/kde-l10n.eclass
+++ b/eclass/kde-l10n.eclass
@@ -1,8 +1,8 @@
-# Copyright 2004-2012 Sabayon
+# Copyright 2004-2013 Sabayon
# Distributed under the terms of the GNU General Public License v2
# $
-inherit base kde4-base
+inherit kde4-base
MY_LANG="${PN/kde-l10n-/}"
@@ -14,11 +14,14 @@ DESCRIPTION="KDE4 ${L10N_NAME} localization package"
HOMEPAGE="http://www.kde.org/"
LICENSE="GPL-2"
-KEYWORDS="~amd64 ~x86"
+KEYWORDS="~amd64 ~arm ~x86"
DEPEND=">=sys-devel/gettext-0.15"
RDEPEND=""
IUSE="+handbook"
+URI_BASE="${SRC_URI/-${MY_LANG}-${PV}.tar.xz/}"
+SRC_URI="${SRC_URI} ${URI_BASE}/${PN}-${PV}.tar.xz"
+
kde-l10n_src_prepare() {
# override kde4-base_src_prepare which
# fails at enable_selected_doc_linguas
diff --git a/eclass/libreoffice-l10n-2.eclass b/eclass/libreoffice-l10n-2.eclass
index 79d74359..05a912e8 100644
--- a/eclass/libreoffice-l10n-2.eclass
+++ b/eclass/libreoffice-l10n-2.eclass
@@ -36,20 +36,36 @@ LANGPACK_AVAIL="${LANGPACK_AVAIL:-1}"
DESCRIPTION="LibreOffice.org ${L10N_LANG} localisation"
HOMEPAGE="http://www.documentfoundation.org"
-RESTRICT="nomirror"
+RESTRICT="mirror"
L10N_VER="$(get_version_component_range 1-3)"
-L10N_RC_VERSION="rc2"
+L10N_RC_VERSION="$(get_version_component_range 4)"
LO_BRANCH=$(get_version_component_range 1-2)
-BASE_SRC_URI="http://download.documentfoundation.org/libreoffice/stable/${L10N_VER}/rpm"
+if [ -n "${L10N_RC_VERSION}" ]; then
+ # this is a RC, thus testing
+ BASE_SRC_URI="http://download.documentfoundation.org/libreoffice/testing/${L10N_VER}/rpm"
+ TARBALL_VERSION="${L10N_VER}.${L10N_RC_VERSION}"
+else
+ BASE_SRC_URI="http://download.documentfoundation.org/libreoffice/stable/${L10N_VER}/rpm"
+ TARBALL_VERSION="${L10N_VER}"
+fi
SRC_URI=""
+if [ "$(get_version_component_range 1)" = "3" ]; then
+ URI_PREFIX="LibO"
+ RPM_SUFFIX_LANG="langpack-rpm"
+ RPM_SUFFIX_HELP="helppack-rpm"
+else
+ URI_PREFIX="LibreOffice"
+ RPM_SUFFIX_LANG="rpm_langpack"
+ RPM_SUFFIX_HELP="rpm_helppack"
+fi
# try guessing
if [ "${LANGPACK_AVAIL}" = "1" ]; then
- SRC_URI+="${BASE_SRC_URI}/x86/LibO_${L10N_VER}_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+ SRC_URI+="${BASE_SRC_URI}/x86/${URI_PREFIX}_${TARBALL_VERSION}_Linux_x86_${RPM_SUFFIX_LANG}_${MY_LANG}.tar.gz"
fi
if [ "${HELPPACK_AVAIL}" = "1" ]; then
- SRC_URI+=" ${BASE_SRC_URI}/x86/LibO_${L10N_VER}_Linux_x86_helppack-rpm_${MY_LANG}.tar.gz"
+ SRC_URI+=" ${BASE_SRC_URI}/x86/${URI_PREFIX}_${TARBALL_VERSION}_Linux_x86_${RPM_SUFFIX_HELP}_${MY_LANG}.tar.gz"
fi
IUSE=""
@@ -83,22 +99,20 @@ libreoffice-l10n-2_src_unpack() {
local dir=${lang/_/-}
# for english we provide just helppack, as translation is always there
if [[ "${LANGPACK_AVAIL}" == "1" ]]; then
- rpmdir="LibO_${L10N_VER}${L10N_RC_VERSION}_Linux_x86_langpack-rpm_${dir}/RPMS/"
- [[ -d ${rpmdir} ]] || die "Missing directory: \"${rpmdir}\""
+ rpmdir="${URI_PREFIX}_${TARBALL_VERSION}"*"_Linux_x86_${RPM_SUFFIX_LANG}_${dir}/RPMS/"
# First remove dictionaries, we want to use system ones.
rm -rf "${S}/${rpmdir}/"*dict*.rpm
einfo "Unpacking Langpack"
- rpm_unpack "./${rpmdir}/"*.rpm
+ rpm_unpack ./${rpmdir}/*.rpm
fi
if [[ "${HELPPACK_AVAIL}" == "1" ]]; then
- rpmdir="LibO_${L10N_VER}${L10N_RC_VERSION}_Linux_x86_helppack-rpm_${dir}/RPMS/"
- [[ -d ${rpmdir} ]] || die "Missing directory: \"${rpmdir}\""
+ rpmdir="${URI_PREFIX}_${TARBALL_VERSION}"*"_Linux_x86_${RPM_SUFFIX_HELP}_${dir}/RPMS/"
einfo "Unpacking Helppack"
- rpm_unpack ./"${rpmdir}/"*.rpm
+ rpm_unpack ./${rpmdir}/*.rpm
fi
if [[ -n "${TDEPEND}" ]]; then
if use templates; then
- for i in ${OO_EXTENSIONS[@]}; do
+ for i in "${OO_EXTENSIONS[@]}"; do
if [[ ! -f "${S}/${i}" ]]; then
cp -v "${DISTDIR}/${i}" "${S}"
ooextused+=( "${i}" )
@@ -107,8 +121,8 @@ libreoffice-l10n-2_src_unpack() {
fi
fi
OO_EXTENSIONS=()
- for i in ${ooextused[@]}; do
- OO_EXTENSIONS+=( ${i} )
+ for i in "${ooextused[@]}"; do
+ OO_EXTENSIONS+=( "${i}" )
done
}
diff --git a/eclass/sab-patches.eclass b/eclass/sab-patches.eclass
new file mode 100644
index 00000000..d4e74cef
--- /dev/null
+++ b/eclass/sab-patches.eclass
@@ -0,0 +1,114 @@
+# Copyright 2014 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: sab-patches.eclass
+# @MAINTAINER:
+# slawomir.nizio@sabayon.org
+# @AUTHOR:
+# Sławomir Nizio <slawomir.nizio@sabayon.org>
+# @BLURB: eclass that makes it easier to apply patches from tarballs
+# @DESCRIPTION:
+# Adds a patch or patches to SRC_URI and makes it easy to apply them.
+# It is intended to work with tarballs containing patches, and is
+# made to make it easier for Sabayon split ebuilds.
+# (Plain patches kept in a VCS are very nice, but in the case of split
+# ebuilds, duplicating the patches is not effective.)
+# The eclass does not define any phase function.
+
+# @ECLASS-VARIABLE: SAB_PATCHES_SRC
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array that contains URIs of patches to be added to SRC_URI. Mandatory!
+
+# @ECLASS-VARIABLE: SAB_PATCHES_SKIP
+# @DESCRIPTION:
+# Array that contains patterns of patch names to be skipped.
+# It does not need to be a global variable.
+
+inherit eutils
+
+if [[ ${#SAB_PATCHES_SRC[@]} -eq 0 ]]; then
+ die "SAB_PATCHES_SRC is not set"
+fi
+
+for _sab_patch in "${SAB_PATCHES_SRC[@]}"; do
+ SRC_URI=${_sab_patch}
+done
+unset _sab_patch
+
+# @FUNCTION: sab-patches_apply_all
+# @DESCRIPTION:
+# Applies patches that can be found under
+# ${WORKDIR}/<name of the patch tarball without ext.>, for each tarball.
+# Order of patching is specified by the 'order' file, which must exist in
+# each tarball.
+# Patch names that are listed in SAB_PATCHES_SKIP are skipped
+# by _sab-patches_apply_from_dir.
+sab-patches_apply_all() {
+ local p
+ for p in "${SAB_PATCHES_SRC[@]}"; do
+ local dir=${p##*/}
+ dir=${dir%.tar*}
+ _sab-patches_apply_from_dir "${WORKDIR}/${dir}"
+ done
+}
+
+# @FUNCTION: sab-patches_apply
+# @DESCRIPTION:
+# Apply selected patches. Arguments are the directory containing
+# the patch, followed by one or more patch names.
+sab-patches_apply() {
+ [[ $# -lt 2 ]] && die "sab-patches_apply: missing arguments"
+ local dir=$1
+ shift
+ local patch
+ for patch; do
+ epatch "${dir}/${patch}"
+ done
+}
+
+# @FUNCTION: _sab-patches_apply_from_dir
+# @INTERNAL
+# @DESCRIPTION:
+# Apply all patches from a directory in order. Obeys SAB_PATCHES_SKIP.
+_sab-patches_apply_from_dir() {
+ local dir=$1
+ local order_file=${dir}/order
+ if [[ ! -r ${order_file} ]] || [[ ! -f ${order_file} ]]; then
+ die "Problems with '${order_file}'... (Does it exist?)"
+ fi
+
+ local patch
+ while read patch; do
+ local patch_path=${dir}/${patch}
+ if \
+ [[ -z ${patch} ]] || \
+ [[ ${patch} = *\ * ]] || \
+ [[ ${patch} = */* ]] || \
+ [[ ! -f ${patch_path} ]]; then
+ die "Problems with the patch '${patch}', see ${order_file}."
+ fi
+
+ if _sab-patches_is_skipped "${patch}"; then
+ einfo "(skipping ${patch})"
+ else
+ epatch "${patch_path}"
+ fi
+ done < "${order_file}"
+
+ [[ $? -ne 0 ]] && die "_sab-patches_apply_from_dir: loop failed"
+}
+
+# @FUNCTION: _sab-patches_is_skipped
+# @INTERNAL
+# @DESCRIPTION:
+# Returns success if the patch should be skipped. O(n). :)
+_sab-patches_is_skipped() {
+ local arg=$1
+ local p
+ for p in "${SAB_PATCHES_SKIP[@]}"; do
+ [[ ${arg} = ${p} ]] && return 0
+ done
+ return 1
+}
diff --git a/eclass/sabayon-artwork.eclass b/eclass/sabayon-artwork.eclass
index 59d11cca..f0aac62d 100644
--- a/eclass/sabayon-artwork.eclass
+++ b/eclass/sabayon-artwork.eclass
@@ -15,6 +15,11 @@ KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*}"
# Default splash theme name to use
GFX_SPLASH_NAME="${GFX_SPLASH_NAME:-sabayon}"
+# @ECLASS-VARIABLE: PLYMOUTH_THEME
+# @DESCRIPTION:
+# Default plymouth theme name to use
+PLYMOUTH_THEME="${PLYMOUTH_THEME:-sabayon}"
+
# @FUNCTION: update_kernel_initramfs_splash
# @USAGE: update_kernel_initramfs_splash [splash_theme] [splash_file]
# @RETURN: 1, if something went wrong
diff --git a/eclass/transmission-2.80.eclass b/eclass/transmission-2.80.eclass
new file mode 100644
index 00000000..afaf9a38
--- /dev/null
+++ b/eclass/transmission-2.80.eclass
@@ -0,0 +1,262 @@
+# Copyright 1999-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: transmission-2.xx.eclass
+# @MAINTAINER:
+# slawomir.nizio@sabayon.org
+# @AUTHOR:
+# Sławomir Nizio <slawomir.nizio@sabayon.org>
+# @BLURB: eclass to ease managing of Sabayon split net-p2p/transmission
+# @DESCRIPTION:
+# This eclass is to ease managing of split net-p2p/transmission for Sabayon.
+# Its name contains a version that corresponds to net-p2p/transmission one,
+# because the eclass will change often when needed to follow changes
+# in Gentoo ebuild.
+
+# @ECLASS-VARIABLE: TRANSMISSION_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array that contains patches to apply just before eautoreconf.
+
+# @ECLASS-VARIABLE: TRANSMISSION_ECLASS_VERSION_OK
+# @DESCRIPTION:
+# Set this to x.y if you want to use transmission-x.y.eclass from ebuild
+# with ${PV} different than x.y. This is to catch bugs.
+: ${TRANSMISSION_ECLASS_VERSION_OK:=${PV}}
+
+# @ECLASS-VARIABLE: E_TRANSM_TAIL
+# @INTERNAL
+# @DESCRIPTION:
+# "Tail" of package name. Can take value gtk, qt4, etc. or can be empty.
+E_TRANSM_TAIL=${PN#transmission}
+E_TRANSM_TAIL=${E_TRANSM_TAIL#-}
+
+# @FUNCTION: _transmission_is
+# @INTERNAL
+# @DESCRIPTION:
+# Function used to check which variant of Transmission are we working on.
+# Argument should be one of these: (none), gtk, qt4, daemon, cli, base.
+# If argument is empty or omitted, true value means that it is
+# net-p2p/transmission (metapackage).
+_transmission_is() {
+ local what=$1
+ [[ ${what} = "${E_TRANSM_TAIL}" ]]
+}
+
+MY_ECLASSES=""
+_transmission_is gtk && MY_ECLASSES+="fdo-mime gnome2-utils"
+_transmission_is qt4 && MY_ECLASSES+="fdo-mime qt4-r2"
+_transmission_is "" || MY_ECLASSES+=" autotools"
+_transmission_is base && MY_ECLASSES+=" user"
+
+inherit eutils multilib ${MY_ECLASSES}
+
+unset MY_ECLASSES
+
+case ${EAPI:-0} in
+ 4|5) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile \
+ pkg_preinst pkg_postinst pkg_postrm ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+[[ ${PN} = transmission* ]] || \
+ die "This eclass can only be used with net-p2p/transmission* ebuilds!"
+# Bug catcher!
+if ! [[ ${PV} = *9999* ]] && [[ ${TRANSMISSION_ECLASS_VERSION_OK} != ${ECLASS#*-} ]]; then
+ eerror "used eclass ${ECLASS}"
+ eerror "TRANSMISSION_ECLASS_VERSION_OK=${TRANSMISSION_ECLASS_VERSION_OK}"
+ die "ebuild version ${PV} doesn't match with the eclass"
+fi
+
+MY_PN="transmission"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A Fast, Easy and Free BitTorrent client"
+HOMEPAGE="http://www.transmissionbt.com/"
+SRC_URI="http://download.transmissionbt.com/${MY_PN}/files/${MY_P}.tar.xz"
+
+LICENSE="GPL-2 MIT"
+SLOT="0"
+IUSE=""
+
+# only common dependencies plus blockers
+RDEPEND=""
+_transmission_is base || RDEPEND+="~net-p2p/transmission-base-${PV}"
+if ! _transmission_is ""; then
+ RDEPEND+="
+ >=dev-libs/libevent-2.0.10:=
+ dev-libs/openssl:0=
+ net-libs/libnatpmp:=
+ >=net-libs/miniupnpc-1.6.20120509:=
+ >=net-misc/curl-7.16.3:=[ssl]
+ sys-libs/zlib:="
+fi
+
+DEPEND="${RDEPEND}"
+if _transmission_is base; then
+ RDEPEND+=" !<net-p2p/transmission-gtk-${PV}
+ !<net-p2p/transmission-qt4-${PV}
+ !<net-p2p/transmission-daemon-${PV}
+ !<net-p2p/transmission-cli-${PV}"
+fi
+if ! _transmission_is ""; then
+ DEPEND+=" dev-libs/glib:2
+ dev-util/intltool
+ virtual/pkgconfig
+ sys-devel/gettext
+ virtual/os-headers"
+fi
+
+S="${WORKDIR}/${MY_P}"
+_transmission_is "" && S="${WORKDIR}"
+
+transmission-2.80_pkg_setup() {
+ if _transmission_is base; then
+ enewgroup transmission
+ enewuser transmission -1 -1 -1 transmission
+ fi
+}
+
+transmission-2.80_src_prepare() {
+ _transmission_is "" && return
+
+ sed -i -e '/CFLAGS/s:-ggdb3::' configure.ac || die
+
+ if ! use_if_iuse ayatana; then
+ sed -i -e '/^LIBAPPINDICATOR_MINIMUM/s:=.*:=9999:' configure.ac || die
+ fi
+
+ # http://trac.transmissionbt.com/ticket/4324
+ sed -i -e 's|noinst\(_PROGRAMS = $(TESTS)\)|check\1|' lib${MY_PN}/Makefile.am || die
+
+ if [[ ${#TRANSMISSION_PATCHES[@]} -gt 0 ]]; then
+ epatch "${TRANSMISSION_PATCHES[@]}"
+ fi
+
+ eautoreconf
+
+ if ! _transmission_is base; then
+ local sedcmd="s:\$(top_builddir)/libtransmission/libtransmission.a:"
+ sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+ find . -name Makefile.in -exec sed -i -e "${sedcmd}" {} \; || die
+ sed -i -e '/libtransmission \\/d' Makefile.in || die
+ if _transmission_is qt4; then
+ sedcmd="s:\$\${TRANSMISSION_TOP}/libtransmission/libtransmission.a:"
+ sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+ sed -i -e "${sedcmd}" qt/qtr.pro || die
+ fi
+ fi
+}
+
+transmission-2.80_src_configure() {
+ _transmission_is "" && return
+
+ local econfargs=(
+ --enable-external-natpmp
+ )
+
+ if _transmission_is base; then
+ export ac_cv_header_xfs_xfs_h=$(usex xfs)
+ econfargs+=(
+ --disable-cli
+ --disable-daemon
+ --without-gtk
+ $(use_enable lightweight)
+ )
+ elif _transmission_is cli; then
+ econfargs+=(
+ --enable-cli
+ --disable-daemon
+ --without-gtk
+ )
+ elif _transmission_is daemon; then
+ econfargs+=(
+ --disable-cli
+ --enable-daemon
+ --without-gtk
+ $(use_with systemd systemd-daemon)
+ )
+ elif _transmission_is gtk; then
+ econfargs+=(
+ --disable-cli
+ --disable-daemon
+ --with-gtk
+ )
+ elif _transmission_is qt4; then
+ econfargs+=(
+ --disable-cli
+ --disable-daemon
+ --without-gtk
+ )
+ else
+ die "Something is wrong... (E_TRANSM_TAIL=$E_TRANSM_TAIL)"
+ fi
+
+ econf "${econfargs[@]}"
+ if _transmission_is qt4; then
+ pushd qt >/dev/null
+ eqmake4 qtr.pro
+ popd >/dev/null
+ fi
+}
+
+transmission-2.80_src_compile() {
+ _transmission_is "" && return
+
+ emake
+ if _transmission_is qt4; then
+ pushd qt >/dev/null
+ emake
+ lrelease translations/*.ts
+ popd >/dev/null
+ fi
+}
+
+
+# Note: not providing src_install. Too many differences and too much code
+# which would only clutter this pretty eclass.
+
+transmission-2.80_pkg_preinst() {
+ _transmission_is gtk && gnome2_icon_savelist
+}
+
+transmission-2.80_pkg_postinst() {
+ if _transmission_is gtk || _transmission_is qt4; then
+ fdo-mime_desktop_database_update
+ fi
+
+ _transmission_is gtk && gnome2_icon_cache_update
+
+ if _transmission_is daemon; then
+ elog "If you use ${MY_PN}-daemon, please, set 'rpc-username' and"
+ elog "'rpc-password' (in plain text, ${MY_PN}-daemon will hash it on"
+ elog "start) in settings.json file located at /var/${MY_PN}/config or"
+ elog "any other appropriate config directory."
+ fi
+
+ if _transmission_is gtk; then
+ # in -gtk only?
+ elog
+ elog "To enable sound emerge media-libs/libcanberra and check that at least"
+ elog "some sound them is selected. For this go:"
+ elog "Gnome/system/preferences/sound themes tab and 'sound theme: default'"
+ elog
+ fi
+
+ if _transmission_is base; then
+ elog "Since µTP is enabled by default, ${MY_PN} needs large kernel buffers for"
+ elog "the UDP socket. You can append following lines into /etc/sysctl.conf:"
+ elog " net.core.rmem_max = 4194304"
+ elog " net.core.wmem_max = 1048576"
+ elog "and run sysctl -p"
+ fi
+}
+
+transmission-2.80_pkg_postrm() {
+ if _transmission_is gtk || _transmission_is qt4; then
+ fdo-mime_desktop_database_update
+ fi
+
+ _transmission_is gtk && gnome2_icon_cache_update
+}
diff --git a/eclass/transmission-2.82.eclass b/eclass/transmission-2.82.eclass
new file mode 100644
index 00000000..f9808b04
--- /dev/null
+++ b/eclass/transmission-2.82.eclass
@@ -0,0 +1,284 @@
+# Copyright 1999-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: transmission-2.xx.eclass
+# @MAINTAINER:
+# slawomir.nizio@sabayon.org
+# @AUTHOR:
+# Sławomir Nizio <slawomir.nizio@sabayon.org>
+# @BLURB: eclass to ease managing of Sabayon split net-p2p/transmission
+# @DESCRIPTION:
+# This eclass is to ease managing of split net-p2p/transmission for Sabayon.
+# Its name contains a version that corresponds to net-p2p/transmission one,
+# because the eclass will change often when needed to follow changes
+# in Gentoo ebuild.
+# Always call phase functions using their public names, such like:
+# transmission-2.82_src_configure, and never _transmission_src_configure.
+
+# @ECLASS-VARIABLE: TRANSMISSION_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array that contains patches to apply just before eautoreconf.
+
+# @ECLASS-VARIABLE: TRANSMISSION_ECLASS_VERSION_OK
+# @DESCRIPTION:
+# Set this to x.y if you want to use transmission-x.y.eclass from ebuild
+# with ${PV} different than x.y. This is to catch bugs.
+: ${TRANSMISSION_ECLASS_VERSION_OK:=${PV}}
+
+# @ECLASS-VARIABLE: E_TRANSM_TAIL
+# @INTERNAL
+# @DESCRIPTION:
+# "Tail" of package name. Can take value gtk, qt4, etc. or can be empty.
+E_TRANSM_TAIL=${PN#transmission}
+E_TRANSM_TAIL=${E_TRANSM_TAIL#-}
+
+# @FUNCTION: _transmission_is
+# @INTERNAL
+# @DESCRIPTION:
+# Function used to check which variant of Transmission are we working on.
+# Argument should be one of these: (none), gtk, qt4, daemon, cli, base.
+# If argument is empty or omitted, true value means that it is
+# net-p2p/transmission (metapackage).
+_transmission_is() {
+ local what=$1
+ [[ ${what} = "${E_TRANSM_TAIL}" ]]
+}
+
+# @FUNCTION: _transmission_eclass_setup_functions
+# @INTERNAL
+# @DESCRIPTION:
+# Function to setup functions. The eval uses strictly controlled variables,
+# so it's OK.
+_transmission_eclass_setup_functions() {
+ local v=2.82
+ local func
+ for func in pkg_setup src_prepare src_configure src_compile \
+ pkg_preinst pkg_postinst pkg_postrm; do
+ eval "transmission-${v}_${func}() { _transmission_${func}; }"
+ done
+}
+
+_transmission_eclass_setup_functions
+
+MY_ECLASSES=""
+_transmission_is gtk && MY_ECLASSES+="fdo-mime gnome2-utils"
+_transmission_is qt4 && MY_ECLASSES+="fdo-mime qt4-r2"
+_transmission_is "" || MY_ECLASSES+=" autotools"
+_transmission_is base && MY_ECLASSES+=" user"
+
+inherit eutils multilib ${MY_ECLASSES}
+
+unset MY_ECLASSES
+
+case ${EAPI:-0} in
+ 4|5) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile \
+ pkg_preinst pkg_postinst pkg_postrm ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+[[ ${PN} = transmission* ]] || \
+ die "This eclass can only be used with net-p2p/transmission* ebuilds!"
+# Bug catcher!
+if ! [[ ${PV} = *9999* ]] && [[ ${TRANSMISSION_ECLASS_VERSION_OK} != ${ECLASS#*-} ]]; then
+ eerror "used eclass ${ECLASS}"
+ eerror "TRANSMISSION_ECLASS_VERSION_OK=${TRANSMISSION_ECLASS_VERSION_OK}"
+ die "ebuild version ${PV} doesn't match with the eclass"
+fi
+
+MY_PN="transmission"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A Fast, Easy and Free BitTorrent client"
+HOMEPAGE="http://www.transmissionbt.com/"
+SRC_URI="http://download.transmissionbt.com/${MY_PN}/files/${MY_P}.tar.xz"
+
+LICENSE="GPL-2 MIT"
+SLOT="0"
+IUSE=""
+
+# only common dependencies plus blockers
+RDEPEND=""
+_transmission_is base || RDEPEND+="~net-p2p/transmission-base-${PV}"
+if ! _transmission_is ""; then
+ RDEPEND+="
+ >=dev-libs/libevent-2.0.10:=
+ dev-libs/openssl:0=
+ net-libs/libnatpmp:=
+ >=net-libs/miniupnpc-1.6.20120509:=
+ >=net-misc/curl-7.16.3:=[ssl]
+ sys-libs/zlib:="
+fi
+
+DEPEND="${RDEPEND}"
+if _transmission_is base; then
+ RDEPEND+=" !<net-p2p/transmission-gtk-${PV}
+ !<net-p2p/transmission-qt4-${PV}
+ !<net-p2p/transmission-daemon-${PV}
+ !<net-p2p/transmission-cli-${PV}"
+fi
+if ! _transmission_is ""; then
+ DEPEND+=" dev-libs/glib:2
+ dev-util/intltool
+ virtual/pkgconfig
+ sys-devel/gettext
+ virtual/os-headers"
+fi
+
+S="${WORKDIR}/${MY_P}"
+_transmission_is "" && S="${WORKDIR}"
+
+_transmission_pkg_setup() {
+ if _transmission_is base; then
+ enewgroup transmission
+ enewuser transmission -1 -1 -1 transmission
+ fi
+}
+
+_transmission_src_prepare() {
+ _transmission_is "" && return
+
+ sed -i -e '/CFLAGS/s:-ggdb3::' configure.ac || die
+
+ if ! use_if_iuse ayatana; then
+ # Trick to avoid automagic dependency
+ sed -i -e '/^LIBAPPINDICATOR_MINIMUM/s:=.*:=9999:' configure.ac || die
+ fi
+
+ # Pass our configuration dir to systemd unit file
+ sed -i '/ExecStart/ s|$| -g /var/lib/transmission/config|' daemon/transmission-daemon.service || die
+
+ # http://trac.transmissionbt.com/ticket/4324
+ sed -i -e 's|noinst\(_PROGRAMS = $(TESTS)\)|check\1|' lib${MY_PN}/Makefile.am || die
+
+ if [[ ${#TRANSMISSION_PATCHES[@]} -gt 0 ]]; then
+ epatch "${TRANSMISSION_PATCHES[@]}"
+ fi
+
+ eautoreconf
+
+ if ! _transmission_is base; then
+ local sedcmd="s:\$(top_builddir)/libtransmission/libtransmission.a:"
+ sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+ find . -name Makefile.in -exec sed -i -e "${sedcmd}" {} \; || die
+ sed -i -e '/libtransmission \\/d' Makefile.in || die
+ if _transmission_is qt4; then
+ sedcmd="s:\$\${TRANSMISSION_TOP}/libtransmission/libtransmission.a:"
+ sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+ sed -i -e "${sedcmd}" qt/qtr.pro || die
+ fi
+ fi
+}
+
+_transmission_src_configure() {
+ _transmission_is "" && return
+
+ local econfargs=(
+ --enable-external-natpmp
+ )
+
+ if _transmission_is base; then
+ export ac_cv_header_xfs_xfs_h=$(usex xfs)
+ econfargs+=(
+ --disable-cli
+ --disable-daemon
+ --without-gtk
+ $(use_enable lightweight)
+ )
+ elif _transmission_is cli; then
+ econfargs+=(
+ --enable-cli
+ --disable-daemon
+ --without-gtk
+ )
+ elif _transmission_is daemon; then
+ econfargs+=(
+ --disable-cli
+ --enable-daemon
+ --without-gtk
+ $(use_with systemd systemd-daemon)
+ )
+ elif _transmission_is gtk; then
+ econfargs+=(
+ --disable-cli
+ --disable-daemon
+ --with-gtk
+ )
+ elif _transmission_is qt4; then
+ econfargs+=(
+ --disable-cli
+ --disable-daemon
+ --without-gtk
+ )
+ else
+ die "Something is wrong... (E_TRANSM_TAIL=$E_TRANSM_TAIL)"
+ fi
+
+ econf "${econfargs[@]}"
+ if _transmission_is qt4; then
+ pushd qt >/dev/null
+ eqmake4 qtr.pro
+ popd >/dev/null
+ fi
+}
+
+_transmission_src_compile() {
+ _transmission_is "" && return
+
+ emake
+ if _transmission_is qt4; then
+ pushd qt >/dev/null
+ emake
+ lrelease translations/*.ts
+ popd >/dev/null
+ fi
+}
+
+
+# Note: not providing src_install. Too many differences and too much code
+# which would only clutter this pretty eclass.
+
+_transmission_pkg_preinst() {
+ _transmission_is gtk && gnome2_icon_savelist
+}
+
+_transmission_pkg_postinst() {
+ if _transmission_is gtk || _transmission_is qt4; then
+ fdo-mime_desktop_database_update
+ fi
+
+ _transmission_is gtk && gnome2_icon_cache_update
+
+ if _transmission_is daemon; then
+ elog "If you use ${MY_PN}-daemon, please, set 'rpc-username' and"
+ elog "'rpc-password' (in plain text, ${MY_PN}-daemon will hash it on"
+ elog "start) in settings.json file located at /var/${MY_PN}/config or"
+ elog "any other appropriate config directory."
+ fi
+
+ if _transmission_is gtk; then
+ # in -gtk only?
+ elog
+ elog "To enable sound emerge media-libs/libcanberra and check that at least"
+ elog "some sound them is selected. For this go:"
+ elog "Gnome/system/preferences/sound themes tab and 'sound theme: default'"
+ elog
+ fi
+
+ if _transmission_is base; then
+ elog "Since µTP is enabled by default, ${MY_PN} needs large kernel buffers for"
+ elog "the UDP socket. You can append following lines into /etc/sysctl.conf:"
+ elog " net.core.rmem_max = 4194304"
+ elog " net.core.wmem_max = 1048576"
+ elog "and run sysctl -p"
+ fi
+}
+
+_transmission_pkg_postrm() {
+ if _transmission_is gtk || _transmission_is qt4; then
+ fdo-mime_desktop_database_update
+ fi
+
+ _transmission_is gtk && gnome2_icon_cache_update
+}