vdr-2.2.0-r1.ebuild 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. #inherit eutils flag-o-matic multilib toolchain-funcs
  5. inherit flag-o-matic toolchain-funcs
  6. # Switches supported by extensions-patch
  7. EXT_PATCH_FLAGS="alternatechannel graphtft naludump permashift_v1 pinplugin
  8. mainmenuhooks menuorg menuselection resumereset ttxtsubs"
  9. # names of the use-flags
  10. EXT_PATCH_FLAGS_RENAMED=""
  11. # names ext-patch uses internally, here only used for maintainer checks
  12. EXT_PATCH_FLAGS_RENAMED_EXT_NAME="bidi no_kbd sdnotify"
  13. IUSE="bidi debug +kbd html systemd vanilla ${EXT_PATCH_FLAGS} ${EXT_PATCH_FLAGS_RENAMED}"
  14. MY_PV="${PV%_p*}"
  15. MY_P="${PN}-${MY_PV}"
  16. S="${WORKDIR}/${MY_P}"
  17. EXT_P="extpng-${P}-gentoo-edition-v1"
  18. DESCRIPTION="Video Disk Recorder - turns a pc into a powerful set top box for DVB"
  19. HOMEPAGE="http://www.tvdr.de/"
  20. SRC_URI="ftp://ftp.tvdr.de/vdr/${MY_P}.tar.bz2
  21. https://dev.gentoo.org/~hd_brummy/distfiles/${EXT_P}.patch.bz2"
  22. KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
  23. SLOT="0"
  24. LICENSE="GPL-2"
  25. COMMON_DEPEND="virtual/jpeg:*
  26. sys-libs/libcap
  27. >=media-libs/fontconfig-2.4.2
  28. >=media-libs/freetype-2"
  29. DEPEND="${COMMON_DEPEND}
  30. >=virtual/linuxtv-dvb-headers-5.3
  31. sys-devel/gettext"
  32. RDEPEND="${COMMON_DEPEND}
  33. dev-lang/perl
  34. >=media-tv/gentoo-vdr-scripts-2.7
  35. media-fonts/corefonts
  36. bidi? ( dev-libs/fribidi )
  37. systemd? ( sys-apps/systemd )"
  38. CONF_DIR=/etc/vdr
  39. CAP_FILE=${S}/capabilities.sh
  40. CAPS="# Capabilities of the vdr-executable for use by startscript etc."
  41. pkg_setup() {
  42. use debug && append-flags -g
  43. PLUGIN_LIBDIR="/usr/$(get_libdir)/vdr/plugins"
  44. tc-export CC CXX AR
  45. }
  46. add_cap() {
  47. local arg
  48. for arg; do
  49. CAPS="${CAPS}\n${arg}=1"
  50. done
  51. }
  52. enable_patch() {
  53. local arg ARG_UPPER
  54. for arg; do
  55. ARG_UPPER=$(echo $arg|tr '[:lower:]' '[:upper:]')
  56. echo "${ARG_UPPER} = 1" >> Make.config
  57. # codesnippet to bring the extpng defines into the vdr.pc CXXFLAGS CFLAGS
  58. echo "-DUSE_${ARG_UPPER}" >> "${T}"/defines.tmp
  59. cat "${T}"/defines.tmp | tr \\\012 ' ' > "${T}"/defines.IUSE
  60. export DEFINES_IUSE=$( cat ${T}/defines.IUSE )
  61. done
  62. }
  63. extensions_add_make_conf()
  64. {
  65. # copy all ifdef for extensions-patch to Make.config
  66. sed -e '1,/need to touch the following:/d' \
  67. -e '/need to touch the following/,/^$/d' \
  68. Make.config.template >> Make.config
  69. }
  70. extensions_all_defines() {
  71. # extract all possible settings for extensions-patch
  72. sed -e '/^#\?[A-Z].*= 1/!d' -e 's/^#\?//' -e 's/ .*//' \
  73. Make.config.template \
  74. | sort \
  75. | tr '[:upper:]' '[:lower:]'
  76. }
  77. lang_po() {
  78. LING_PO=$( ls ${S}/po | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
  79. }
  80. src_configure() {
  81. # support languages, written from right to left
  82. export "BIDI=$(usex bidi 1 0)"
  83. # systemd notification support
  84. export "SDNOTIFY=$(usex systemd 1 0)"
  85. # with/without keyboard
  86. export "USE_KBD=$(usex kbd 1 0)"
  87. }
  88. src_prepare() {
  89. # apply maintainace-patches
  90. ebegin "Changing paths for gentoo"
  91. local DVBDIR=/usr/include
  92. local i
  93. for i in ${DVB_HEADER_PATH} /usr/include/v4l-dvb-hg /usr/include; do
  94. [[ -d ${i} ]] || continue
  95. if [[ -f ${i}/linux/dvb/dmx.h ]]; then
  96. einfo "Found DVB header files in ${i}"
  97. DVBDIR=${i}
  98. break
  99. fi
  100. done
  101. # checking for s2api headers
  102. local api_version
  103. api_version=$(awk -F' ' '/define DVB_API_VERSION / {print $3}' "${DVBDIR}"/linux/dvb/version.h)
  104. api_version=${api_version}*$(awk -F' ' '/define DVB_API_VERSION_MINOR / {print $3}' "${DVBDIR}"/linux/dvb/version.h)
  105. if [[ ${api_version:-0} -lt 5*3 ]]; then
  106. eerror "DVB header files do not contain s2api support or too old for ${P}"
  107. eerror "You cannot compile VDR against old dvb-header"
  108. die "DVB headers too old"
  109. fi
  110. cat > Make.config <<-EOT
  111. #
  112. # Generated by ebuild ${PF}
  113. #
  114. PREFIX = /usr
  115. DVBDIR = ${DVBDIR}
  116. PLUGINLIBDIR = ${PLUGIN_LIBDIR}
  117. CONFDIR = ${CONF_DIR}
  118. VIDEODIR = /var/vdr/video
  119. LOCDIR = \$(PREFIX)/share/locale
  120. INCDIR = \$(PREFIX)/include
  121. DEFINES += -DCONFDIR=\"\$(CONFDIR)\"
  122. INCLUDES += -I\$(DVBDIR)
  123. # >=vdr-1.7.36-r1; parameter only used for compiletime on vdr
  124. # PLUGINLIBDIR (plugin Makefile old) = LIBDIR (plugin Makefile new)
  125. LIBDIR = ${PLUGIN_LIBDIR}
  126. PCDIR = /usr/$(get_libdir)/pkgconfig
  127. EOT
  128. eend 0
  129. # wrt bug 586070
  130. if has_version ">=sys-apps/systemd-230"; then
  131. sed -e "s:libsystemd-daemon:libsystemd:g" -i Makefile || die "sed libsystemd failed"
  132. fi
  133. if ! use vanilla; then
  134. # Now apply extensions patch
  135. eapply "${WORKDIR}/${EXT_P}.patch"
  136. # This allows us to start even if some plugin does not exist
  137. # or is not loadable.
  138. enable_patch PLUGINMISSING
  139. if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
  140. einfo "Doing maintainer checks:"
  141. # we do not support these patches
  142. # (or have them already hard enabled)
  143. local IGNORE_PATCHES="pluginmissing"
  144. extensions_all_defines > "${T}"/new.IUSE
  145. echo $EXT_PATCH_FLAGS $EXT_PATCH_FLAGS_RENAMED_EXT_NAME \
  146. $IGNORE_PATCHES | \
  147. tr ' ' '\n' |sort > "${T}"/old.IUSE
  148. local DIFFS=$(diff -u "${T}"/old.IUSE "${T}"/new.IUSE|grep '^[+-][^+-]')
  149. if [[ -z ${DIFFS} ]]; then
  150. einfo "EXT_PATCH_FLAGS is up to date."
  151. else
  152. ewarn "IUSE differences!"
  153. local diff
  154. for diff in $DIFFS; do
  155. ewarn "$diff"
  156. done
  157. fi
  158. fi
  159. ebegin "Enabling selected patches"
  160. local flag
  161. for flag in $EXT_PATCH_FLAGS; do
  162. use $flag && enable_patch ${flag}
  163. done
  164. eend 0
  165. extensions_add_make_conf
  166. # add defined use-flags compile options to vdr.pc
  167. sed -e "s:\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR):\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR) \$(DEFINES_IUSE):" \
  168. -i Makefile
  169. ebegin "Make depend"
  170. emake .dependencies >/dev/null
  171. eend $? "make depend failed"
  172. fi
  173. eapply "${FILESDIR}/${P}_gentoo.patch"
  174. # fix some makefile issues
  175. sed -e "s:ifndef NO_KBD:ifeq (\$(USE_KBD),1):" \
  176. -e "s:ifdef BIDI:ifeq (\$(BIDI),1):" \
  177. -e "s:ifdef SDNOTIFY:ifeq (\$(SDNOTIFY),1):" \
  178. -i "${S}"/Makefile
  179. eapply_user
  180. add_cap CAP_UTF8
  181. add_cap CAP_IRCTRL_RUNTIME_PARAM \
  182. CAP_VFAT_RUNTIME_PARAM \
  183. CAP_CHUID \
  184. CAP_SHUTDOWN_AUTO_RETRY
  185. echo -e ${CAPS} > "${CAP_FILE}"
  186. # LINGUAS support
  187. einfo "\n \t VDR supports the LINGUAS values"
  188. lang_po
  189. einfo "\t Please set one of this values in your sytem make.conf"
  190. einfo "\t LINGUAS=\"${LING_PO}\"\n"
  191. if [[ -z ${LINGUAS} ]]; then
  192. einfo "\n \t No values in LINGUAS="
  193. einfo "\t You will get only english text on OSD \n"
  194. fi
  195. strip-linguas ${LING_PO} en
  196. }
  197. src_install() {
  198. # trick makefile not to create a videodir by supplying it with an existing
  199. # directory
  200. emake install \
  201. VIDEODIR="/" \
  202. DESTDIR="${D}" install || die "emake install failed"
  203. keepdir "${PLUGIN_LIBDIR}"
  204. # backup for plugins they don't be able to create this dir
  205. keepdir "${CONF_DIR}"/plugins
  206. if use html; then
  207. local HTML_DOCS=( *.html )
  208. fi
  209. local DOCS=( MANUAL INSTALL README* HISTORY CONTRIBUTORS )
  210. einstalldocs
  211. insinto /usr/share/vdr
  212. doins "${CAP_FILE}"
  213. if use alternatechannel; then
  214. insinto /etc/vdr
  215. doins "${FILESDIR}"/channel_alternative.conf
  216. fi
  217. chown -R vdr:vdr "${D}/${CONF_DIR}"
  218. }
  219. pkg_postinst() {
  220. elog "\n\t---- 15 YEARS ANNIVERSARY EDITON ----\n"
  221. elog "\tA lot of thanks to Klaus Schmidinger"
  222. elog "\tfor this nice piece of Software...\n"
  223. elog "It is a good idea to run vdrplugin-rebuild now."
  224. elog "To get nice symbols in OSD we recommend to install"
  225. elog "\t1. emerge media-fonts/vdrsymbols-ttf"
  226. elog "\t2. select font VDRSymbolsSans in Setup"
  227. elog ""
  228. elog "To get an idea how to proceed now, have a look at our vdr-guide:"
  229. elog "\thttps://wiki.gentoo.org/wiki/VDR"
  230. }