sys-process/glances: 3.1.4.1-r1 amd64 stable, bug #720368
[gentoo.git] / eclass / gkrellm-plugin.eclass
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: gkrellm-plugin.eclass
5 # @MAINTAINER:
6 # maintainer-needed@gentoo.org
7 # @AUTHOR:
8 # Original author: Jim Ramsay
9 #   EAPI 6 author: David Seifert
10 # @SUPPORTED_EAPIS: 6
11 # @BLURB: Provides src_install used by (almost) all gkrellm plugins
12 # @DESCRIPTION:
13 # - Sets up default dependencies
14 # - Provides a common src_install method to avoid code duplication
15 #
16 # Changelog:
17 #   03 January 2018: David Seifert <soap@gentoo.org>
18 #     - Port to EAPI 6, remove built_with_use, simplify a lot
19 #   12 March 2007: Jim Ramsay <lack@gentoo.org>
20 #     - Added server plugin support
21 #   09 March 2007: Jim Ramsay <lack@gentoo.org>
22 #     - Initial commit
23 #
24
25 # @ECLASS-VARIABLE: PLUGIN_SO
26 # @DESCRIPTION:
27 # The name of the plugin's .so file which will be installed in
28 # the plugin dir. Defaults to "${PN}$(get_modname)". Has to be a bash array.
29
30 # @ECLASS-VARIABLE: PLUGIN_SERVER_SO
31 # @DESCRIPTION:
32 # The name of the plugin's server plugin $(get_modname) portion.
33 # Unset by default. Has to be a bash array.
34
35 # @ECLASS-VARIABLE: PLUGIN_DOCS
36 # @DESCRIPTION:
37 # An optional list of docs to be installed, in addition to the default
38 # DOCS variable which is respected too. Has to be a bash array.
39
40 case ${EAPI:-0} in
41         [0-5])
42                 die "${ECLASS} is banned in EAPI ${EAPI:-0}"
43                 ;;
44         6)
45                 ;;
46         *)
47                 die "Unknown EAPI ${EAPI:-0}"
48                 ;;
49 esac
50
51 inherit multilib
52
53 EXPORT_FUNCTIONS src_install
54
55 if [[ ! ${_GKRELLM_PLUGIN_R1} ]]; then
56
57 DEPEND="virtual/pkgconfig"
58
59 # @FUNCTION: gkrellm-plugin_src_install
60 # @DESCRIPTION:
61 # Install the plugins and call einstalldocs
62 gkrellm-plugin_src_install() {
63         exeinto /usr/$(get_libdir)/gkrellm2/plugins
64
65         if ! declare -p PLUGIN_SO >/dev/null 2>&1 ; then
66                 doexe ${PN}$(get_modname)
67         elif declare -p PLUGIN_SO | grep -q "^declare -a " ; then
68                 doexe "${PLUGIN_SO[@]}"
69         else
70                 die "PLUGIN_SO has to be a bash array!"
71         fi
72
73
74         if [[ -n ${PLUGIN_SERVER_SO} ]]; then
75                 exeinto /usr/$(get_libdir)/gkrellm2/plugins-gkrellmd
76
77                 if declare -p PLUGIN_SERVER_SO | grep -q "^declare -a " ; then
78                         doexe "${PLUGIN_SERVER_SO[@]}"
79                 else
80                         die "PLUGIN_SERVER_SO has to be a bash array!"
81                 fi
82         fi
83
84         einstalldocs
85         local d
86         for d in Changelog* ChangeLog*; do
87                 [[ -s "${d}" ]] && dodoc "${d}"
88         done
89
90         if [[ -n ${PLUGIN_DOCS} ]]; then
91                 if declare -p PLUGIN_DOCS | grep -q "^declare -a " ; then
92                         dodoc "${PLUGIN_DOCS[@]}"
93                 else
94                         die "PLUGIN_DOCS has to be a bash array!"
95                 fi
96         fi
97 }
98
99 _GKRELLM_PLUGIN_R1=1
100 fi