| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gkrellm-plugin.eclass,v 1.3 2007/04/23 19:35:05 swegener Exp $
|
| 4 |
|
| 5 |
#
|
| 6 |
# Original Author: Jim Ramsay <lack@gentoo.org>
|
| 7 |
#
|
| 8 |
# Purpose:
|
| 9 |
# Provides common methods used by (almost) all gkrellm plugins:
|
| 10 |
# - Sets up default dependencies
|
| 11 |
# - Adds pkg_setup check to ensure gkrellm was built with USE="X" (bug
|
| 12 |
# 167227)
|
| 13 |
# - Provides utility routines in lieu of hard-coding the plugin directories.
|
| 14 |
# - Provides the most common src_install method to avoid code duplication.
|
| 15 |
#
|
| 16 |
# Utility Routines:
|
| 17 |
# gkrellm-plugin_dir - Returns the gkrellm-2 plugin directory
|
| 18 |
# gkrellm-plugin_server_dir - Returns the gkrellm-2 server plugin directory
|
| 19 |
#
|
| 20 |
# Environment:
|
| 21 |
# For src_install:
|
| 22 |
# PLUGIN_SO - The name of the plugin's .so file which will be installed in
|
| 23 |
# the plugin dir. Defaults to "${PN}.so".
|
| 24 |
# PLUGIN_DOCS - An optional list of docs to be installed. Defaults to
|
| 25 |
# unset.
|
| 26 |
# PLUGIN_SERVER_SO - The name of the plugin's server plugin .so portion.
|
| 27 |
# Defaults to unset.
|
| 28 |
# Important: This will also cause the pkg_setup check to be skipped, so
|
| 29 |
# you need to check 'build_with_use app-admin/gkrellm X' in your
|
| 30 |
# src_compile and only compile the GUI portion if that returns true. (see
|
| 31 |
# x11-plugins/gkrelltop as an example)
|
| 32 |
#
|
| 33 |
# Changelog:
|
| 34 |
# 12 March 2007: Jim Ramsay <lack@gentoo.org>
|
| 35 |
# - Added server plugin support
|
| 36 |
# 09 March 2007: Jim Ramsay <lack@gentoo.org>
|
| 37 |
# - Initial commit
|
| 38 |
#
|
| 39 |
|
| 40 |
inherit multilib eutils
|
| 41 |
|
| 42 |
RDEPEND="=app-admin/gkrellm-2*"
|
| 43 |
DEPEND="${RDEPEND}
|
| 44 |
virtual/pkgconfig"
|
| 45 |
|
| 46 |
gkrellm-plugin_dir() {
|
| 47 |
echo /usr/$(get_libdir)/gkrellm2/plugins
|
| 48 |
}
|
| 49 |
|
| 50 |
gkrellm-plugin_server_dir() {
|
| 51 |
echo /usr/$(get_libdir)/gkrellm2/plugins-gkrellmd
|
| 52 |
}
|
| 53 |
|
| 54 |
gkrellm-plugin_pkg_setup() {
|
| 55 |
if [[ -z "${PLUGIN_SERVER_SO}" ]] &&
|
| 56 |
! built_with_use app-admin/gkrellm X; then
|
| 57 |
eerror "This plugin requires the X frontend of gkrellm."
|
| 58 |
eerror "Please re-emerge app-admin/gkrellm with USE=\"X\""
|
| 59 |
die "Please re-emerge app-admin/gkrellm with USE=\"X\""
|
| 60 |
fi
|
| 61 |
}
|
| 62 |
|
| 63 |
gkrellm-plugin_src_install() {
|
| 64 |
if built_with_use app-admin/gkrellm X; then
|
| 65 |
insinto $(gkrellm-plugin_dir)
|
| 66 |
doins ${PLUGIN_SO:-${PN}.so} || die "Plugin shared library was not installed"
|
| 67 |
fi
|
| 68 |
|
| 69 |
if [[ -n "${PLUGIN_SERVER_SO}" ]]; then
|
| 70 |
insinto $(gkrellm-plugin_server_dir)
|
| 71 |
doins ${PLUGIN_SERVER_SO} || die "Server plugin shared library was not installed"
|
| 72 |
fi
|
| 73 |
|
| 74 |
DDOCS="README* Change* AUTHORS FAQ TODO INSTALL"
|
| 75 |
|
| 76 |
for doc in ${DDOCS}; do
|
| 77 |
[ -s "$doc" ] && dodoc $doc
|
| 78 |
done
|
| 79 |
|
| 80 |
[ -n "${PLUGIN_DOCS}" ] && dodoc ${PLUGIN_DOCS}
|
| 81 |
}
|
| 82 |
|
| 83 |
EXPORT_FUNCTIONS pkg_setup src_install
|