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