lv2-postinst-helper: create class for reuse from zynaddsubfx common code

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2018-04-06 13:43:41 +02:00
parent cdce9f02b1
commit 4299dbe116
2 changed files with 54 additions and 41 deletions

View File

@@ -0,0 +1,53 @@
# Helper class to handle ontarget-postinst creation of lv2 turtle files
# File created during compile usually. To create this file makefiles have to be
# aligned - see do_configure_prepend at zynaddsubfx or distrho-ports. The file
# is expected with the following format
# lv2-ttl-generator <path>/plugin.so
LV2-TURTLE-BUILD-DATA = "${WORKDIR}/lv2-ttl-generator-data"
# E.g zynaddsubfx needs to create dummy lv2 turtle files to keep install sane.
# To delete them automatically (see below) the contain a dummy string:
LV2-DUMMY-TURTLE-STR = "lv2-dummy-turtle-string"
# To make ontarget postinst/prerm happen, the names of all plugins with their
# paths as installed on target a stored in a file called lv2-postinst-manifest
LV2-POSTINST-MANIFEST = "${datadir}/${BPN}/lv2-postinst-manifest"
do_install_append() {
# remove dummy lv2-turtles again
cd ${D}/${libdir}/lv2
for tfile in `grep -rl ${LV2-DUMMY-TURTLE-STR}`; do
rm $tfile
done
# create postinst manifest
install -d ${D}`dirname ${LV2-POSTINST-MANIFEST}`
for sofile in `cat ${LV2-TURTLE-BUILD-DATA} | awk '{ print $2 }'`; do
sofile=`basename $sofile`
installed=`find ${D}${libdir}/lv2 -name $sofile | sed 's|${D}||g'`
echo $installed >> ${D}${LV2-POSTINST-MANIFEST}
done
}
pkg_postinst_ontarget_${PN}() {
oldpath=`pwd`
for sofile in `cat ${LV2-POSTINST-MANIFEST}`; do
cd `dirname "$sofile"`
lv2-ttl-generator "$sofile"
done
cd $oldpath
}
pkg_prerm_${PN}() {
for sofile in `cat ${LV2-POSTINST-MANIFEST}`; do
path=`dirname "$sofile"`
for turtle in `find $path -name '*.ttl'`; do
rm $turtle
done
done
}
RDEPENDS_${PN} += "lv2-ttl-generator"

View File

@@ -3,7 +3,7 @@ HOMEPAGE = "http://zynaddsubfx.sourceforge.net"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=21fa88a5e50a1c608d22612c1fbe1971"
inherit cmake qemu-ext pkgconfig gtk-icon-cache distro_features_check
inherit cmake lv2-postinst-helper pkgconfig gtk-icon-cache distro_features_check
REQUIRED_DISTRO_FEATURES = "x11"
@@ -22,8 +22,6 @@ DEPENDS += " \
ntk \
"
CLEANBROKEN = "1"
CXXFLAGS += "-ffast-math -DNDEBUG"
SRC_URI = " \
@@ -37,9 +35,6 @@ SRC_URI = " \
SRC_URI[md5sum] = "66acae0913108f129aa979f3c4b65473"
SRC_URI[sha256sum] = "11de448f9664076e9e8f2bcb8f7f45bf54a13516b7d6693da1ef8c511b8ed7c1"
LV2-TURTLE-BUILD-DATA = "${WORKDIR}/lv2-ttl-generator-data"
LV2-DUMMY-TURTLE-STR = "lv2-dummy-turtle-str"
LV2-POSTINST-MANIFEST = "${datadir}/${BPN}/lv2-postinst-manifest"
do_configure_prepend() {
# reconfigure?
@@ -75,21 +70,6 @@ do_compile_append() {
do_install_append() {
install -m 0755 ${S}/ExternalPrograms/Controller/controller ${D}${bindir}/zynaddsubfx-controller
install -m 0755 ${S}/ExternalPrograms/Spliter/spliter ${D}${bindir}/zynaddsubfx-spliter
# remove dummy lv2-turtles again
cd ${D}/${libdir}/lv2
for tfile in `grep -rl ${LV2-DUMMY-TURTLE-STR}`; do
rm $tfile
done
# create postinst manifest
install -d ${D}`dirname ${LV2-POSTINST-MANIFEST}`
for sofile in `cat ${LV2-TURTLE-BUILD-DATA} | awk '{ print $2 }'`; do
sofile=`basename $sofile`
installed=`find ${D}${libdir}/lv2 -name $sofile | sed 's|${D}||g'`
echo $installed >> ${D}${LV2-POSTINST-MANIFEST}
done
}
FILES_${PN} += " \
@@ -98,23 +78,3 @@ FILES_${PN} += " \
${libdir}/vst \
"
pkg_postinst_ontarget_${PN}() {
oldpath=`pwd`
for sofile in `cat ${LV2-POSTINST-MANIFEST}`; do
cd `dirname "$sofile"`
lv2-ttl-generator "$sofile"
done
cd $oldpath
}
pkg_prerm_${PN}() {
for sofile in `cat ${LV2-POSTINST-MANIFEST}`; do
path=`dirname "$sofile"`
for turtle in `find $path -name '*.ttl'`; do
rm $turtle
done
done
}
RDEPENDS_${PN} += "lv2-ttl-generator"