From fee9d49c73ebb43de8f12c73f7d502044850818e Mon Sep 17 00:00:00 2001 From: BlackNoxis Date: Fri, 26 Jun 2015 11:03:32 +0300 Subject: [eclass/*] added transmission eclasses --- eclass/transmission-2.83.eclass | 287 +++++++++++++++++++++++++++++++++++++++ eclass/transmission-2.84.eclass | 291 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 578 insertions(+) create mode 100644 eclass/transmission-2.83.eclass create mode 100644 eclass/transmission-2.84.eclass (limited to 'eclass') diff --git a/eclass/transmission-2.83.eclass b/eclass/transmission-2.83.eclass new file mode 100644 index 00000000..075a5025 --- /dev/null +++ b/eclass/transmission-2.83.eclass @@ -0,0 +1,287 @@ +# 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 +# @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.83_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.83 + 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.7:= + >=net-misc/curl-7.16.3:=[ssl] + sys-libs/zlib:=" +fi + +DEPEND="${RDEPEND}" +if _transmission_is base; then + RDEPEND+=" !/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 +} diff --git a/eclass/transmission-2.84.eclass b/eclass/transmission-2.84.eclass new file mode 100644 index 00000000..94f21620 --- /dev/null +++ b/eclass/transmission-2.84.eclass @@ -0,0 +1,291 @@ +# Copyright 1999-2014 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 +# @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.83_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.84 + 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" + +# web/LICENSE is always GPL-2 whereas COPYING allows either GPL-2 or GPL-3 for the rest +# transmission in licenses/ is for mentioning OpenSSL linking exception +# MIT is in several libtransmission/ headers +LICENSE="|| ( GPL-2 GPL-3 Transmission-OpenSSL-exception ) 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.7:= + >=net-misc/curl-7.16.3:=[ssl] + sys-libs/zlib:=" +fi + +DEPEND="${RDEPEND}" +if _transmission_is base; then + RDEPEND+=" !/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 +} -- cgit v1.2.3