From: Nicola Smaniotto <smaniotto.nicola@gmail.com>
To: gentoo-guru@lists.gentoo.org
Subject: [gentoo-guru] Fwd: Re: Ebuilds for mpv plugins
Date: Sat, 09 Apr 2022 19:08:07 +0200 [thread overview]
Message-ID: <1987880.YKUYFuaPT4@gentoo-f555l> (raw)
[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]
As requested, I'm sending this to the new mailing list
--
Nicola Smaniotto
---------- Forwarded Message ----------
Subject: Re: Ebuilds for mpv plugins
Date: Friday, 8 April 2022, 10:33:28 CEST
From: Nicola Smaniotto <smaniotto.nicola@gmail.com>
Hi,
I've looked at the devmanual and put together a simple eclass that has the basic functionalities of what I intend it to do.
I attached the eclass, the modified mpv-mpris ebuild (to see how it would change), and a new ebuild for mpv_thumbnail_script (to show another use).
Some observations:
1) I don't understand the meaning of the _MPV_PLUGIN_ECLASS variable, but vim put it there when I created the eclass so I left it.
2) I don't like MPV_FLAGS, it seems too fragile and also requires it to be a string of comma separated USE flags for mpv. Also, if empty the atom is invalid.
3) Are the DEPEND and RDEPEND variables correct? It seems like they may be overwritten in the ebuild. An alternative that comes to mind may be to create a variale that contains the correct mpv atom, and put it in the ebuild (like PYTHON_DEPS from python-any-r1).
4) The postinst function lists all the installed files, since some plugins need more than one, see mpv_tumbnail_script.
Comments welcome. Have a good day!
--
Nicola Smaniotto
On Saturday, 2 April 2022 16:33:11 CEST you wrote:
> Hi everyone,
> I have an idea and would like some feedback.
> Following the outline of media-video/mpv-mpris::guru for install locations, I've been writing some ebuilds for other mpv plugins so that I can manage them all via portage. These for now include mpv-libunity, mpv_thumbnail_script, mpv-plugin-xrandr, but I've not yet uploaded them in ::guru.
> I think it would be nice to create some common rules for these ebuilds, maybe creating an eclass (like vim-plugin) that manages the mpv dependency, the autoload USE flag and the install and symlink location.
> I know many plugins (especially lua ones) are just single files, but for me that's part of the problem, since the code is not versioned and can be hard to keep track of new releases until something breaks.
>
> Does this seem useful, and if so would someone like to help?
> Thank you, have a nice day.
>
>
-----------------------------------------
[-- Attachment #2: mpv_thumbnail_script-0.4.8.ebuild --]
[-- Type: text/plain, Size: 733 bytes --]
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{8..10} )
MPV_FLAGS="lua"
inherit mpv-plugin python-any-r1
DESCRIPTION="A Lua script to show preview thumbnails in mpv's OSC seekbar"
HOMEPAGE="https://github.com/marzzzello/mpv_thumbnail_script"
SRC_URI="https://github.com/marzzzello/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3"
KEYWORDS="~amd64"
BDEPEND="
${PYTHON_DEPS}
"
MPV_PLUGIN_FILES=(
${PN}_client_osc.lua
${PN}_server.lua
)
src_compile() {
${EPYTHON} concat_files.py -r "cat_osc.json" || die
${EPYTHON} concat_files.py -r "cat_server.json" || die
}
src_install() {
mpv-plugin_src_install
einstalldocs
}
[-- Attachment #3: mpv-mpris-0.7.1-r1.ebuild --]
[-- Type: text/plain, Size: 1018 bytes --]
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MPV_FLAGS="cplugins,libmpv"
inherit mpv-plugin toolchain-funcs
DESCRIPTION="MPRIS plugin for mpv"
HOMEPAGE="https://github.com/hoyon/mpv-mpris"
if [[ ${PV} == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/hoyon/${PN}.git"
else
SRC_URI="https://github.com/hoyon/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
fi
LICENSE="MIT"
IUSE="test"
RDEPEND="
dev-libs/glib:2
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig
test? (
app-misc/jq
app-shells/bash
app-text/jo
media-sound/playerctl
net-misc/socat
sys-apps/dbus
virtual/awk
x11-apps/xauth
x11-misc/xvfb-run
x11-themes/sound-theme-freedesktop
)
"
MPV_PLUGIN_FILES=( mpris.so )
RESTRICT="!test? ( test )"
src_compile() {
tc-export CC
emake PKG_CONFIG="$(tc-getPKG_CONFIG)"
}
src_test() {
emake test
}
src_install() {
mpv-plugin_src_install
einstalldocs
}
[-- Attachment #4: mpv-plugin.eclass --]
[-- Type: text/plain, Size: 2142 bytes --]
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: mpv-plugin.eclass
# @MAINTAINER:
# Nicola Smaniotto <smaniotto.nicola@gmail.com>
# @AUTHOR:
# Nicola Smaniotto <smaniotto.nicola@gmail.com>
# @SUPPORTED_EAPIS: 8
# @BLURB: Install mpv plugins
# @DESCRIPTION:
# This eclass simplifies the installation of mpv plugins into system-wide
# directories. Also handles the mpv dependency and provides an USE flag
# for automatic loading of the plugin.
if [[ ! ${_MPV_PLUGIN_ECLASS} ]]; then
case ${EAPI} in
8) ;;
*) die "${ECLASS}: EAPI ${EAPI} unsupported."
esac
_MPV_PLUGIN_ECLASS=1
fi
EXPORT_FUNCTIONS src_install pkg_postinst
SLOT="0"
IUSE="+autoload"
DEPEND="media-video/mpv:=[${MPV_FLAGS}]"
RDEPEND="${DEPEND}"
# @ECLASS_VARIABLE: MPV_FLAGS
# @PRE_INHERIT
# @DEFAULT_UNSET
# @DESCRIPTION:
# List of USE flags to be required from mpv
# @ECLASS_VARIABLE: MPV_PLUGIN_FILES
# @DEFAULT_UNSET
# @REQUIRED
# @DESCRIPTION:
# Array containing the list of files to be installed
# @FUNCTION: mpv-plugin_src_install
# @DESCRIPTION:
# Install the specified files in ${D} and symlink them if the autoload flag is set
# The ebuild must specify the file list in the MPV_PLUGIN_FILES array
mpv-plugin_src_install() {
if [[ ! ${MPV_PLUGIN_FILES} ]]; then
die "No files specified in MPV_PLUGIN_FILES, cannot install"
fi
insinto "/usr/$(get_libdir)/mpv"
for f in "${MPV_PLUGIN_FILES[@]}"; do
doins "${f}"
use autoload && dosym -r "/usr/$(get_libdir)/mpv/${f}" "/etc/mpv/scripts/${f}"
done
}
# @FUNCTION: mpv-plugin_pkg_postinst
# @DESCRIPTION:
# Warns the user of the existence of the autoload use flag
mpv-plugin_pkg_postinst() {
if ! use autoload; then
elog
elog "The plugin has not been installed to /etc/mpv/scripts for autoloading."
elog "You have to activate it manually by passing"
for f in "${MPV_PLUGIN_FILES[@]}"; do
elog " \"${EPREFIX}/usr/$(get_libdir)/mpv/${f}\""
done
elog "as script option to mpv or symlinking the library to \"scripts/\" in your mpv"
elog "config directory."
elog "Alternatively, activate the autoload use flag."
elog
fi
}
next reply other threads:[~2024-11-24 22:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-09 17:08 Nicola Smaniotto [this message]
2022-04-09 17:20 ` [gentoo-guru] [PATCH] mpv-plugin.eclass: new eclass Anna (cybertailor) Vyalkova
2022-04-10 9:49 ` Nicola Smaniotto
2022-04-11 0:54 ` Anna “CyberTailor”
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1987880.YKUYFuaPT4@gentoo-f555l \
--to=smaniotto.nicola@gmail.com \
--cc=gentoo-guru@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox