1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # Original Author: Jim Ramsay <lack@gentoo.org>
8 # Provides common methods used by (almost) all gkrellm plugins:
9 # - Sets up default dependencies
10 # - Adds pkg_setup check to ensure gkrellm was built with USE="X" (bug
12 # - Provides utility routines in lieu of hard-coding the plugin directories.
13 # - Provides the most common src_install method to avoid code duplication.
16 # gkrellm-plugin_dir - Returns the gkrellm-2 plugin directory
17 # gkrellm-plugin_server_dir - Returns the gkrellm-2 server plugin directory
21 # PLUGIN_SO - The name of the plugin's .so file which will be installed in
22 # the plugin dir. Defaults to "${PN}.so".
23 # PLUGIN_DOCS - An optional list of docs to be installed. Defaults to
25 # PLUGIN_SERVER_SO - The name of the plugin's server plugin .so portion.
27 # Important: This will also cause the pkg_setup check to be skipped, so
28 # you need to check 'build_with_use app-admin/gkrellm X' in your
29 # src_compile and only compile the GUI portion if that returns true. (see
30 # x11-plugins/gkrelltop as an example)
33 # 12 March 2007: Jim Ramsay <lack@gentoo.org>
34 # - Added server plugin support
35 # 09 March 2007: Jim Ramsay <lack@gentoo.org>
39 inherit multilib eutils
41 RDEPEND="=app-admin/gkrellm-2*"
45 gkrellm-plugin_dir() {
46 echo /usr/$(get_libdir)/gkrellm2/plugins
49 gkrellm-plugin_server_dir() {
50 echo /usr/$(get_libdir)/gkrellm2/plugins-gkrellmd
53 gkrellm-plugin_pkg_setup() {
54 if [[ -z "${PLUGIN_SERVER_SO}" ]] &&
55 ! built_with_use app-admin/gkrellm X; then
56 eerror "This plugin requires the X frontend of gkrellm."
57 eerror "Please re-emerge app-admin/gkrellm with USE=\"X\""
58 die "Please re-emerge app-admin/gkrellm with USE=\"X\""
62 gkrellm-plugin_src_install() {
63 if built_with_use app-admin/gkrellm X; then
64 insinto $(gkrellm-plugin_dir)
65 doins ${PLUGIN_SO:-${PN}.so} || die "Plugin shared library was not installed"
68 if [[ -n "${PLUGIN_SERVER_SO}" ]]; then
69 insinto $(gkrellm-plugin_server_dir)
70 doins ${PLUGIN_SERVER_SO} || die "Server plugin shared library was not installed"
73 DDOCS="README* Change* AUTHORS FAQ TODO INSTALL"
75 for doc in ${DDOCS}; do
76 [ -s "$doc" ] && dodoc $doc
79 [ -n "${PLUGIN_DOCS}" ] && dodoc ${PLUGIN_DOCS}
82 EXPORT_FUNCTIONS pkg_setup src_install