vdr-plugin-2.eclass 18 KB

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