meson.eclass: Don't mix host *FLAGS with build *FLAGS
[gentoo.git] / eclass / vdr-plugin-2.eclass
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: vdr-plugin-2.eclass
5 # @MAINTAINER:
6 # Gentoo VDR Project <vdr@gentoo.org>
7 # @AUTHOR:
8 # Matthias Schwarzott <zzam@gentoo.org>
9 # Joerg Bornkessel <hd_brummy@gentoo.org>
10 # Christian Ruppert <idl0r@gentoo.org>
11 # (undisclosed contributors)
12 # @BLURB: common vdr plugin ebuild functions
13 # @DESCRIPTION:
14 # Eclass for easing maintenance of vdr plugin ebuilds
15
16 # @ECLASS-VARIABLE: VDR_CONFD_FILE
17 # @DEFAULT_UNSET
18 # @DESCRIPTION:
19 # A plugin config file can be specified through the $VDR_CONFD_FILE variable, it
20 # defaults to ${FILESDIR}/confd. Each config file will be installed as e.g.
21 # ${D}/etc/conf.d/vdr.${VDRPLUGIN}
22
23 # @ECLASS-VARIABLE: VDR_RCADDON_FILE
24 # @DEFAULT_UNSET
25 # @DESCRIPTION:
26 # Installing rc-addon files is basically the same as for plugin config files
27 # (see above), it's just using the $VDR_RCADDON_FILE variable instead.
28 # The default value when $VDR_RCADDON_FILE is undefined is:
29 # ${FILESDIR}/rc-addon.sh and will be installed as
30 # ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh
31 #
32 # The rc-addon files will be sourced by the startscript when the specific plugin
33 # has been enabled.
34 # rc-addon files may be used to prepare everything that is necessary for the
35 # plugin start/stop, like passing extra command line options and so on.
36 #
37 # NOTE: rc-addon files must be valid shell scripts!
38
39 # @ECLASS-VARIABLE: GENTOO_VDR_CONDITIONAL
40 # @DEFAULT_UNSET
41 # @DESCRIPTION:
42 # This is a hack for ebuilds like vdr-xineliboutput that want to
43 # conditionally install a vdr-plugin
44
45 # @ECLASS-VARIABLE: PO_SUBDIR
46 # @DEFAULT_UNSET
47 # @DESCRIPTION:
48 # By default, translation are found in"${S}"/po but this
49 # default can be overridden by defining PO_SUBDIR.
50 #
51 # Example:
52 # @CODE
53 # PO_SUBDIR="bla foo/bla"
54 # @CODE
55
56 # @ECLASS-VARIABLE: VDR_MAINTAINER_MODE
57 # @DEFAULT_UNSET
58 # @DESCRIPTION:
59 # Output from function vdr_dev_check if it is defined in ebuild or eclass,
60 # helpfull for gentoo ebuild developer
61 #
62 # This will also install any debug files in /usr/share/vdr/maintainer-data
63 #
64 # This is intended to be set by user in make.conf. Ebuilds must not set
65 # it.
66 #
67 # VDR_MAINTAINER_MODE=1
68
69 # @FUNCTION: fix_vdr_libsi_include
70 # @DESCRIPTION:
71 # Plugins failed on compile with wrong path of libsi includes,
72 # this can be fixed by 'function + space separated list of files'
73 #
74 # Example:
75 # @CODE
76 # fix_vdr_libsi_include bla.c foo.c
77 # @CODE
78
79 # @FUNCTION: vdr_remove_i18n_include
80 # @DESCRIPTION:
81 # Compile will fail if plugin still use the old i18n language handling,
82 # most parts are fixed by vdr-plugin-2.eclass internal functions itself.
83 # Remove unneeded i18.n includes from files, if they are still wrong there,
84 # this can be fixed by 'function + space separated list of files"
85 #
86 # Example:
87 # @CODE
88 # vdr_remove_i18n_include bla.n foo.n
89 # @CODE
90
91 # Applying your own local/user patches:
92 # This is done by using the
93 # (EAPI = 4,5) epatch_user() function of the eutils.eclass,
94 # (EAPI = 6) eapply_user function integrated in EAPI = 6.
95 # Simply add your patches into one of these directories:
96 # /etc/portage/patches/<CATEGORY>/<PF|P|PN>/
97 # Quote: where the first of these three directories to exist will be the one to
98 # use, ignoring any more general directories which might exist as well.
99 #
100 # For more details about it please take a look at the eutils.class.
101
102 [[ ${EAPI} == [45] ]] && inherit eutils multilib
103 inherit flag-o-matic toolchain-funcs unpacker
104
105 case ${EAPI:-0} in
106         4|5|6)
107         ;;
108         *) die "EAPI ${EAPI} unsupported."
109         ;;
110 esac
111
112 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config
113
114 IUSE=""
115
116 # Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
117 VDRPLUGIN="${PN/#vdrplugin-/}"
118 VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
119 VDRPLUGIN="${VDRPLUGIN/%-cvs/}"
120
121 DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on vdr-plugin-2.eclass)"
122
123 # Works in most cases
124 S="${WORKDIR}/${VDRPLUGIN}-${PV}"
125
126 # depend on headers for DVB-driver
127 COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2"
128
129 DEPEND="${COMMON_DEPEND}
130         virtual/linuxtv-dvb-headers"
131 RDEPEND="${COMMON_DEPEND}
132         >=app-eselect/eselect-vdr-0.0.2"
133
134 if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
135         IUSE="${IUSE} vdr"
136         DEPEND="vdr? ( ${DEPEND} )"
137         RDEPEND="vdr? ( ${RDEPEND} )"
138 fi
139
140 # New method of storing plugindb
141 #   Called from src_install
142 #   file maintained by normal portage-methods
143 vdr_create_plugindb_file() {
144         local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
145         local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
146         insinto "${NEW_VDRPLUGINDB_DIR}"
147
148 #       BUG: portage-2.1.4_rc9 will delete the EBUILD= line, so we cannot use this code.
149 #       cat <<-EOT > "${D}/${DB_FILE}"
150 #               VDRPLUGIN_DB=1
151 #               CREATOR=ECLASS
152 #               EBUILD=${CATEGORY}/${PN}
153 #               EBUILD_V=${PVR}
154 #       EOT
155 #       obsolet? fix me later...
156         {
157                 echo "VDRPLUGIN_DB=1"
158                 echo "CREATOR=ECLASS"
159                 echo "EBUILD=${CATEGORY}/${PN}"
160                 echo "EBUILD_V=${PVR}"
161                 echo "PLUGINS=\"$@\""
162         } > "${D}/${DB_FILE}"
163 }
164
165 vdr_create_header_checksum_file() {
166         # Danger: Not using $ROOT here, as compile will also not use it !!!
167         # If vdr in $ROOT and / differ, plugins will not run anyway
168
169         local CHKSUM="header-md5-vdr"
170
171         if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
172                 cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
173         elif type -p md5sum >/dev/null 2>&1; then
174                 (
175                         cd "${VDR_INCLUDE_DIR}"
176                         md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
177                 ) > "${CHKSUM}"
178         else
179                 die "Could not create md5 checksum of headers"
180         fi
181
182         insinto "${VDR_CHECKSUM_DIR}"
183         local p_name
184         for p_name; do
185                 newins "${CHKSUM}" "header-md5-${p_name}"
186         done
187 }
188
189 fix_vdr_libsi_include() {
190         vdr_dev_check "Fixing include of libsi-headers"
191         local f
192         for f; do
193                 sed -i "${f}" \
194                         -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
195                         -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
196         done
197 }
198
199 vdr_patchmakefile() {
200         einfo "Patching Makefile"
201         [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
202         cp Makefile "${WORKDIR}"/Makefile.before
203
204         # plugin makefiles use VDRDIR in strange ways
205         # assumptions:
206         #   1. $(VDRDIR) contains Make.config
207         #   2. $(VDRDIR) contains config.h
208         #   3. $(VDRDIR)/include/vdr contains the headers
209         #   4. $(VDRDIR) contains main vdr Makefile
210         #   5. $(VDRDIR)/locale exists
211         #   6. $(VDRDIR) allows to access vdr source files
212         #
213         # We only have one directory (for now /usr/include/vdr),
214         # that contains vdr-headers and Make.config.
215         # To satisfy 1-3 we do this:
216         #   Set VDRDIR=/usr/include/vdr
217         #   Set VDRINCDIR=/usr/include
218         #   Change $(VDRDIR)/include to $(VDRINCDIR)
219
220         sed -i Makefile \
221                 -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
222                 -e "/^VDRDIR/a VDRINCDIR = ${VDR_INCLUDE_DIR%/vdr}" \
223                 -e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
224                 \
225                 -e 's:-I$(DVBDIR)/include::' \
226                 -e 's:-I$(DVBDIR)::'
227
228         # may be needed for multiproto:
229         #sed -i Makefile \
230         #       -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
231         #       -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
232         # obsolet? fix me later...
233
234         if ! grep -q APIVERSION Makefile; then
235                 ebegin "  Converting to APIVERSION"
236                 sed -i Makefile \
237                         -e 's:^APIVERSION = :APIVERSION ?= :' \
238                         -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
239                         -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
240                 eend $?
241         fi
242
243         # Correcting Compile-Flags
244         # Do not overwrite CXXFLAGS, add LDFLAGS if missing
245         sed -i Makefile \
246                 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
247                 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
248
249         # Disabling file stripping, the package manager takes care of it
250         sed -i Makefile \
251                 -e '/@.*strip/d' \
252                 -e '/strip \$(LIBDIR)\/\$@/d' \
253                 -e 's/STRIP.*=.*$/STRIP = true/'
254
255         # Use a file instead of a variable as single-stepping via ebuild
256         # destroys environment.
257         touch "${WORKDIR}"/.vdr-plugin_makefile_patched
258 }
259
260 vdr_dev_check() {
261         # A lot useful debug infos
262         # set VDR_MAINTAINER_MODE="1" in make.conf
263         if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
264                 eerror "\t Gentoo Developer Debug: $@"
265         fi
266 }
267
268 vdr_gettext_missing() {
269         # plugins without converting to gettext
270
271         local GETTEXT_MISSING=$( grep xgettext Makefile )
272         if [[ -z ${GETTEXT_MISSING} ]]; then
273                 vdr_dev_check "Plugin isn't converted to gettext handling \n"
274         fi
275 }
276
277 vdr_detect_po_dir() {
278         # helper function
279
280         [[ -f po ]] && local po_dir="${S}"
281         local po_subdir=( ${S}/${PO_SUBDIR} )
282         local f
283
284         pofile_dir=( ${po_dir} ${po_subdir[*]} )
285 }
286
287 vdr_linguas_support() {
288 #       Patching Makefile for linguas support.
289 #       Only locales, enabled through the LINGUAS (make.conf) variable will be
290 #       compiled and installed.
291
292         einfo "Patching for Linguas support"
293         einfo "available Languages for ${P} are:"
294
295         vdr_detect_po_dir
296
297         for f in ${pofile_dir[*]}; do
298                 PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
299                 einfo "LINGUAS=\"${PLUGIN_LINGUAS}\""
300
301                 sed -i ${f}/Makefile \
302                         -e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \
303                         || die "sed failed for Linguas"
304         done
305
306         strip-linguas ${PLUGIN_LINGUAS} en
307 }
308
309 vdr_i18n() {
310 #       i18n handling was deprecated since >=media-video/vdr-1.5.9,
311 #       finally with >=media-video/vdr-1.7.27 it has been dropped entirely and some
312 #       plugins will fail to compile because they're still using the old variant.
313 #       Simply remove the i18n.o object from Makefile (OBJECT) and
314 #       remove "static const tI18nPhrase*" from i18n.h.
315
316         vdr_gettext_missing
317
318         local I18N_OBJECT=$( grep i18n.o Makefile )
319         if [[ -n ${I18N_OBJECT} ]]; then
320
321                 if [[ "${KEEP_I18NOBJECT:-no}" = "yes" ]]; then
322                         vdr_dev_check "Forced to keep i18n.o"
323                 else
324                         sed -i "s:i18n.o::g" Makefile
325                         vdr_dev_check "OBJECT i18n.o found"
326                         vdr_dev_check "removed per sed \n"
327                 fi
328
329         else
330                 vdr_dev_check "OBJECT i18n.o not found in Makefile"
331                 vdr_dev_check "all fine or manual review needed? \n"
332         fi
333
334         local I18N_STRING=$( [[ -e i18n.h ]] && grep tI18nPhrase i18n.h )
335         if [[ -n ${I18N_STRING} ]]; then
336                 sed -i "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const tI18nPhrase:" i18n.h
337                 vdr_dev_check "obsolete tI18nPhrase found"
338                 vdr_dev_check "disabled per sed, please recheck \n"
339         else
340                 vdr_dev_check "obsolete tI18nPhrase not found, fine..."
341                 vdr_dev_check "please review, may be in subdir... \n"
342         fi
343 }
344
345 vdr_remove_i18n_include() {
346         # remove uneeded i18.n includes
347
348         local f
349         for f; do
350                 sed -i "${f}" \
351                 -e "s:^#include[[:space:]]*\"i18n.h\"://:"
352         done
353
354         vdr_dev_check "removed i18n.h include in ${@}"
355 }
356
357 vdr-plugin-2_print_enable_command() {
358         local p_name c=0 l=""
359         for p_name in ${vdr_plugin_list}; do
360                 c=$(( c+1 ))
361                 l="$l ${p_name#vdr-}"
362         done
363
364         elog
365         case $c in
366         1)      elog "Installed plugin${l}" ;;
367         *)      elog "Installed $c plugins:${l}" ;;
368         esac
369         elog "To activate a plugin execute this command:"
370         elog "\teselect vdr-plugin enable <plugin_name> ..."
371         elog
372 }
373
374 has_vdr() {
375         [[ -f "${VDR_INCLUDE_DIR}"/config.h ]]
376 }
377
378 ## exported functions
379
380 vdr-plugin-2_pkg_setup() {
381         # missing ${chost}- tag
382         tc-export CC CXX
383
384         # -fPIC is needed for shared objects on some platforms (amd64 and others)
385         append-flags -fPIC
386
387         # Plugins need to be compiled with position independent code, otherwise linking
388         # VDR against it will fail
389         # depricated if fi, as we have only >=vdr-2 in the tree, fix me later...
390         if has_version ">=media-video/vdr-1.7.13"; then
391                 append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
392         fi
393
394         # Where should the plugins live in the filesystem
395         VDR_PLUGIN_DIR=$(pkg-config --variable=libdir vdr)
396
397         VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
398
399         VDR_RC_DIR="/usr/share/vdr/rcscript"
400
401         # Pathes to includes
402         VDR_INCLUDE_DIR="/usr/include/vdr"
403         DVB_INCLUDE_DIR="/usr/include"
404
405         TMP_LOCALE_DIR="${WORKDIR}/tmp-locale"
406
407         LOCDIR=$(pkg-config --variable=locdir vdr)
408
409         if ! has_vdr; then
410                 # set to invalid values to detect abuses
411                 VDRVERSION="eclass_no_vdr_installed"
412                 APIVERSION="eclass_no_vdr_installed"
413
414                 if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]] && ! use vdr; then
415                         einfo "VDR not found!"
416                 else
417                         # if vdr is required
418                         die "VDR not found!"
419                 fi
420                 return
421         fi
422
423         VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
424         APIVERSION=$(pkg-config --variable=apiversion vdr)
425
426         einfo "Compiling against"
427         einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
428
429         if [[ -n "${VDR_LOCAL_PATCHES_DIR}" ]]; then
430                 eerror "Using VDR_LOCAL_PATCHES_DIR is deprecated!"
431                 eerror "Please move all your patches into"
432                 eerror "${EROOT}/etc/portage/patches/${CATEGORY}/${P}"
433                 eerror "and remove or unset the VDR_LOCAL_PATCHES_DIR variable."
434                 die
435         fi
436 }
437
438 vdr-plugin-2_src_util() {
439         while [ "$1" ]; do
440                 case "$1" in
441                 all)
442                         vdr-plugin-2_src_util unpack add_local_patch patchmakefile linguas_patch i18n
443                         ;;
444                 prepare)
445                         vdr-plugin-2_src_util add_local_patch patchmakefile linguas_patch i18n
446                         ;;
447                 unpack)
448                         unpacker_src_unpack
449                         ;;
450                 add_local_patch)
451                         cd "${S}" || die "Could not change to plugin-source-directory (src_util)"
452                         if [[ ${EAPI} != [45] ]]; then
453                                 eapply_user
454                         else
455                                 epatch_user
456                         fi
457                         ;;
458                 patchmakefile)
459                         cd "${S}" || die "Could not change to plugin-source-directory (src_util)"
460                         vdr_patchmakefile
461                         ;;
462                 i18n)
463                         vdr_i18n
464                         ;;
465                 linguas_patch)
466                         vdr_linguas_support
467                         ;;
468                 esac
469
470                 shift
471         done
472 }
473
474 vdr-plugin-2_src_unpack() {
475         if [[ -z ${VDR_INCLUDE_DIR} ]]; then
476                 eerror "Wrong use of vdr-plugin-2.eclass."
477                 eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_unpack."
478                 echo
479                 eerror "Please report this at bugs.gentoo.org."
480                 die "vdr-plugin-2_src_unpack not called!"
481         fi
482
483         if [ -z "$1" ]; then
484                 vdr-plugin-2_src_util unpack
485         else
486                 vdr-plugin-2_src_util $@
487         fi
488 }
489
490 vdr-plugin-2_src_prepare() {
491         if [[ -z ${VDR_INCLUDE_DIR} ]]; then
492                 eerror "Wrong use of vdr-plugin-2.eclass."
493                 eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_prepare."
494                 echo
495                 eerror "Please report this at bugs.gentoo.org."
496                 die "vdr-plugin-2_src_prepare not called!"
497         fi
498
499         [[ ${EAPI} == [45] ]] && [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
500         [[ ${EAPI} != [45] ]] && [[ ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
501
502         debug-print "$FUNCNAME: applying user patches"
503
504         vdr-plugin-2_src_util prepare
505 }
506
507 vdr-plugin-2_src_compile() {
508         [ -z "$1" ] && vdr-plugin-2_src_compile compile
509
510         while [ "$1" ]; do
511                 case "$1" in
512                 compile)
513                         if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then
514                                 eerror "Wrong use of vdr-plugin-2.eclass."
515                                 eerror "An ebuild for a vdr-plugin will not work without"
516                                 eerror "calling vdr-plugin-2_src_compile to patch the Makefile."
517                                 echo
518                                 eerror "Please report this at bugs.gentoo.org."
519                                 die "vdr-plugin-2_src_compile not called!"
520                         fi
521                         cd "${S}" || die "could not change to plugin source directory (src_compile)"
522
523                         emake all ${BUILD_PARAMS} \
524                                 LOCALEDIR="${TMP_LOCALE_DIR}" \
525                                 LOCDIR="${TMP_LOCALE_DIR}" \
526                                 LIBDIR="${S}" \
527                                 TMPDIR="${T}" \
528                                 || die "emake all failed"
529                         ;;
530                 esac
531
532                 shift
533         done
534 }
535
536 vdr-plugin-2_src_install() {
537         if [[ -z ${VDR_INCLUDE_DIR} ]]; then
538                 eerror "Wrong use of vdr-plugin-2.eclass."
539                 eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_install."
540                 echo
541                 eerror "Please report this at bugs.gentoo.org."
542                 die "vdr-plugin-2_src_install not called!"
543         fi
544
545         cd "${WORKDIR}" || die "could not change to plugin workdir directory (src_install)"
546
547         if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
548                 local mname="${P}-Makefile"
549                 cp "${S}"/Makefile "${mname}.patched"
550                 cp Makefile.before "${mname}.before"
551
552                 diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff"
553
554                 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
555                 doins "${mname}.diff"
556
557                 insinto "/usr/share/vdr/maintainer-data/makefile-before"
558                 doins "${mname}.before"
559
560                 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
561                 doins "${mname}.patched"
562
563         fi
564
565         cd "${S}" || die "could not change to plugin source directory (src_install)"
566
567         local SOFILE_STRING=$(grep SOFILE Makefile)
568         if [[ -n ${SOFILE_STRING} ]]; then
569                 emake install \
570                 ${BUILD_PARAMS} \
571                 TMPDIR="${T}" \
572                 DESTDIR="${D}" \
573                 || die "emake install (makefile target) failed"
574         else
575                 vdr_dev_check "Plugin use still the old Makefile handling"
576                 insinto "${VDR_PLUGIN_DIR}"
577                 doins libvdr-*.so.*
578         fi
579
580         if [[ -d ${TMP_LOCALE_DIR} ]]; then
581                 einfo "Installing locales"
582                 cd "${TMP_LOCALE_DIR}" || die "could not change to TMP_LOCALE_DIR"
583
584                 local linguas
585                 for linguas in ${LINGUAS[*]}; do
586                 insinto "${LOCDIR}"
587                 cp -r --parents ${linguas}* ${D}/${LOCDIR}
588                 done
589         fi
590
591         cd "${D}/usr/$(get_libdir)/vdr/plugins" || die "could not change to D/usr/libdir/vdr/plugins"
592
593         # create list of all created plugin libs
594         vdr_plugin_list=""
595         local p_name
596         for p in libvdr-*.so.*; do
597                 p_name="${p%.so*}"
598                 p_name="${p_name#lib}"
599                 vdr_plugin_list="${vdr_plugin_list} ${p_name}"
600         done
601
602         cd "${S}" || die "could not change to plugin source directory (src_install)"
603
604         vdr_create_header_checksum_file ${vdr_plugin_list}
605         vdr_create_plugindb_file ${vdr_plugin_list}
606
607         if [[ ${EAPI} != [45] ]]; then
608                 einstalldocs
609         else
610                 local docfile
611                         for docfile in README* HISTORY CHANGELOG; do
612                                 [[ -f ${docfile} ]] && dodoc ${docfile}
613                         done
614         fi
615
616         # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
617         [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd
618
619         if [[ -n ${VDR_CONFD_FILE} ]]; then
620                 newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN}
621         fi
622
623         # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it
624         [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh
625
626         if [[ -n ${VDR_RCADDON_FILE} ]]; then
627                 insinto "${VDR_RC_DIR}"
628                 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
629         fi
630 }
631
632 vdr-plugin-2_pkg_postinst() {
633         vdr-plugin-2_print_enable_command
634
635         if [[ -n "${VDR_CONFD_FILE}" ]]; then
636                 elog "Please have a look at the config-file"
637                 elog "\t/etc/conf.d/vdr.${VDRPLUGIN}"
638                 elog
639         fi
640 }
641
642 vdr-plugin-2_pkg_postrm() {
643 :
644 }
645
646 vdr-plugin-2_pkg_config() {
647 :
648 }