enigma2-plugins: add missing build deps, inherit autotools-brokensep and pkgconfig
[opendreambox.git] / meta-opendreambox / recipes-dreambox / enigma2 / enigma2-plugins_4.3.0.bb
1 SUMMARY = "Additional plugins for Enigma2"
2 LICENSE = "Proprietary"
3 LIC_FILES_CHKSUM = "file://COPYING;md5=8e37f34d0e40d32ea2bc90ee812c9131"
4 DEPENDS = " \
5         aio-grab \
6         avahi \
7         cdrkit \
8         cdtextinfo \
9         dbttcd \
10         dvdbackup \
11         enigma2 \
12         enigma2-streamproxy \
13         gst-plugins-bad \
14         gst-plugins-good \
15         hdparm \
16         python-flickrapi \
17         python-gdata \
18         python-google-api-client \
19         python-mutagen \
20         python-pycrypto \
21         python-pyopenssl \
22         python-simplejson \
23         python-transmissionrpc \
24         python-twisted \
25         python-youtube-dl \
26         smartmontools \
27         streamripper \
28         satip-client \
29 "
30 SRCREV = "${@opendreambox_srcrev('e0a36c7ec1f85800249322eb92e9c4bb8bc370b5', d)}"
31
32 SRC_URI += "file://print.mak"
33
34 inherit autotools-brokensep opendreambox-github pkgconfig pythonnative
35
36 export BUILD_SYS
37 export HOST_SYS
38 export STAGING_INCDIR
39 export STAGING_LIBDIR
40
41 do_install_append() {
42         # create lists of files installed outside of "${libdir}/enigma2/python/Plugins" or "${datadir}/meta"
43         rm -rf ${INSTALL_ROOTDIR}
44         install -d ${INSTALL_ROOTDIR}
45         SUBDIRS=`make -f Makefile -f ${WORKDIR}/print.mak print-SUBDIRS`
46         for SUBDIR in $SUBDIRS; do
47                 oe_runmake -C $SUBDIR "DESTDIR=${INSTALL_DESTDIR}" install
48                 CATEGORY=`ls -1 ${INSTALL_PLUGINSDIR} | head -n1 | tr '[:upper:]' '[:lower:]'`
49                 NAME=`echo $SUBDIR | tr '[:upper:]' '[:lower:]'`
50                 PKG="enigma2-plugin-$CATEGORY-$NAME"
51                 rm -rf ${INSTALL_METADIR} ${INSTALL_PODIR} ${INSTALL_PLUGINSDIR}
52                 find ${INSTALL_DESTDIR} -type f -name "*.la" -delete -fprintf ${INSTALL_ROOTDIR}/$PKG-dev '/%P\n'
53                 [ -s ${INSTALL_ROOTDIR}/$PKG-dev ] || rm ${INSTALL_ROOTDIR}/$PKG-dev
54                 find ${INSTALL_DESTDIR} -type f -name "*.a" -delete -fprintf ${INSTALL_ROOTDIR}/$PKG-staticdev '/%P\n'
55                 [ -s ${INSTALL_ROOTDIR}/$PKG-staticdev ] || rm ${INSTALL_ROOTDIR}/$PKG-staticdev
56                 find ${INSTALL_DESTDIR} -type f -fprintf ${INSTALL_ROOTDIR}/$PKG '/%P\n'
57                 [ -s ${INSTALL_ROOTDIR}/$PKG ] || rm ${INSTALL_ROOTDIR}/$PKG
58                 rm -rf ${INSTALL_DESTDIR}
59         done
60 }
61
62 PACKAGES_DYNAMIC = "enigma2-plugin-*"
63 PACKAGES += "${PN}-meta"
64 PACKAGES =+ "${PN}-po"
65
66 FILES_${PN} += "${datadir}/enigma2 ${datadir}/fonts"
67 FILES_${PN}-meta = "${datadir}/meta"
68 FILES_${PN}-po = "${datadir}/enigma2/po"
69
70 python populate_packages_prepend() {
71     enigma2_plugindir = bb.data.expand('${libdir}/enigma2/python/Plugins', d)
72     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+)', 'enigma2-plugin-%s', '%s', recursive=True, match_path=True, prepend=True)
73     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+).*/.*\.la$', 'enigma2-plugin-%s-dev', '%s (development)', recursive=True, match_path=True, prepend=True)
74     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+).*/.*\.a$', 'enigma2-plugin-%s-staticdev', '%s (static development)', recursive=True, match_path=True, prepend=True)
75     do_split_packages(d, enigma2_plugindir, '^(\w+/\w+).*/\.debug/', 'enigma2-plugin-%s-dbg', '%s (debug)', recursive=True, match_path=True, prepend=True)
76     def parseControlFile(dir, d, package):
77         src = open(dir + "/" + package.split('-')[-1] + "/CONTROL/control").read()
78         for line in src.splitlines():
79             try:
80                 name, value = line.strip().split(': ', 1)
81                 if name == 'Description':
82                     d.setVar('DESCRIPTION_' + package, value)
83                 elif name == 'Depends':
84                     d.setVar('RDEPENDS_' + package, ' '.join(value.split(', ')))
85                 elif name == 'Replaces':
86                     d.setVar('RREPLACES_' + package, ' '.join(value.split(', ')))
87                 elif name == 'Conflicts':
88                     d.setVar('RCONFLICTS_' + package, ' '.join(value.split(', ')))
89             except:
90                 bb.fatal("Error parsing control file for package %s" % package)
91     def parseFileList(dir, d, package):
92         filename = os.path.join(dir, package)
93         if os.path.exists(filename):
94             varname = 'FILES_%s' % package
95             files = (d.getVar(varname, True) or "").split()
96             src = open(filename).read()
97             for line in src.splitlines():
98                 if not line in files:
99                     files.append(line)
100             d.setVar(varname, ' '.join(files))
101     tempdir = d.getVar('INSTALL_ROOTDIR', True)
102     srcdir = d.getVar('S', True)
103     for package in d.getVar('PACKAGES', True).split():
104         if package.startswith('enigma2-plugin-'):
105             parseFileList(tempdir, d, package)
106             if not package.endswith('-dev') and not package.endswith('-dbg') and not package.endswith('-staticdev'):
107                 parseControlFile(srcdir, d, package)
108 }
109
110 INSTALL_ROOTDIR = "${WORKDIR}/${PN}-packaging-tempdir"
111 INSTALL_DESTDIR = "${INSTALL_ROOTDIR}/destdir"
112 INSTALL_METADIR = "${INSTALL_DESTDIR}${datadir}/meta"
113 INSTALL_PODIR = "${INSTALL_DESTDIR}${datadir}/enigma2/po"
114 INSTALL_PLUGINSDIR = "${INSTALL_DESTDIR}${libdir}/enigma2/python/Plugins"
115
116 COMPATIBLE_MACHINE = "^(dm520|dm820|dm7080)$"