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