1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 # Original Author: Jim Ramsay <lack@gentoo.org>
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
13 # - Provides utility routines in lieu of hard-coding the plugin directories.
14 # - Provides the most common src_install method to avoid code duplication.
17 # gkrellm-plugin_dir - Returns the gkrellm-2 plugin directory
18 # gkrellm-plugin_server_dir - Returns the gkrellm-2 server plugin directory
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
26 # PLUGIN_SERVER_SO - The name of the plugin's server plugin .so portion.
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)
34 # 12 March 2007: Jim Ramsay <lack@gentoo.org>
35 # - Added server plugin support
36 # 09 March 2007: Jim Ramsay <lack@gentoo.org>
40 inherit multilib eutils
42 RDEPEND="=app-admin/gkrellm-2*"
46 gkrellm-plugin_dir() {
47 echo /usr/$(get_libdir)/gkrellm2/plugins
50 gkrellm-plugin_server_dir() {
51 echo /usr/$(get_libdir)/gkrellm2/plugins-gkrellmd
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\""
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"
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"
74 DDOCS="README* Change* AUTHORS FAQ TODO INSTALL"
76 for doc in ${DDOCS}; do
77 [ -s "$doc" ] && dodoc $doc
80 [ -n "${PLUGIN_DOCS}" ] && dodoc ${PLUGIN_DOCS}
83 EXPORT_FUNCTIONS pkg_setup src_install