mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-21 04:53:07 -04:00
mpv-plugin.eclass: handle multi-file scripts
The eclass behaves differently if a "main" file is present, since mpv should only execute that one. Also fix indentation to use tabs only. Signed-off-by: Nicola Smaniotto <smaniotto.nicola@gmail.com>
This commit is contained in:
@@ -59,22 +59,22 @@ _mpv-plugin_set_globals() {
|
|||||||
|
|
||||||
MPV_PKG_DEP="media-video/mpv"
|
MPV_PKG_DEP="media-video/mpv"
|
||||||
case ${USE_MPV:-depend} in
|
case ${USE_MPV:-depend} in
|
||||||
rdepend)
|
rdepend)
|
||||||
;;
|
;;
|
||||||
depend)
|
depend)
|
||||||
MPV_PKG_DEP+=":="
|
MPV_PKG_DEP+=":="
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "Invalid USE_MPV=${USE_MPV}"
|
die "Invalid USE_MPV=${USE_MPV}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ ${MPV_REQ_USE} ]; then
|
if [ ${MPV_REQ_USE} ]; then
|
||||||
MPV_PKG_DEP+="[${MPV_REQ_USE}]"
|
MPV_PKG_DEP+="[${MPV_REQ_USE}]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RDEPEND="${MPV_PKG_DEP}"
|
RDEPEND="${MPV_PKG_DEP}"
|
||||||
if [[ ${USE_MPV} == depend ]]; then
|
if [[ ${USE_MPV} == depend ]]; then
|
||||||
DEPEND="${MPV_PKG_DEP}"
|
DEPEND="${MPV_PKG_DEP}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
_mpv-plugin_set_globals
|
_mpv-plugin_set_globals
|
||||||
@@ -85,6 +85,16 @@ _mpv-plugin_set_globals
|
|||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Array containing the list of files to be installed.
|
# Array containing the list of files to be installed.
|
||||||
|
|
||||||
|
# @FUNCTION: _mpv-plugin_has_main
|
||||||
|
# @INTERNAL
|
||||||
|
# @USAGE:
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# Checks for the existance of a file named main. This means the plugin needs
|
||||||
|
# all files to be installed together, and mpv will only run the one called main.
|
||||||
|
_mpv-plugin_has_main() {
|
||||||
|
[[ " ${MPV_PLUGIN_FILES[*]} " =~ " main."[[:alnum:]]+" " ]]
|
||||||
|
}
|
||||||
|
|
||||||
# @FUNCTION: mpv-plugin_src_install
|
# @FUNCTION: mpv-plugin_src_install
|
||||||
# @USAGE:
|
# @USAGE:
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@@ -93,15 +103,27 @@ _mpv-plugin_set_globals
|
|||||||
# The ebuild must specify the file list in the MPV_PLUGIN_FILES array.
|
# The ebuild must specify the file list in the MPV_PLUGIN_FILES array.
|
||||||
mpv-plugin_src_install() {
|
mpv-plugin_src_install() {
|
||||||
if [[ ! ${MPV_PLUGIN_FILES} ]]; then
|
if [[ ! ${MPV_PLUGIN_FILES} ]]; then
|
||||||
die "${ECLASS}: no files specified in MPV_PLUGIN_FILES, cannot install"
|
die "${ECLASS}: no files specified in MPV_PLUGIN_FILES, cannot install"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
insinto /usr/$(get_libdir)/mpv
|
local MPV_INSTALL_DIR="/usr/$(get_libdir)/mpv"
|
||||||
|
if _mpv-plugin_has_main; then
|
||||||
|
MPV_INSTALL_DIR+="/${PN}"
|
||||||
|
fi
|
||||||
|
insinto "${MPV_INSTALL_DIR}"
|
||||||
|
|
||||||
for f in "${MPV_PLUGIN_FILES[@]}"; do
|
for f in "${MPV_PLUGIN_FILES[@]}"; do
|
||||||
doins "${f}"
|
doins "${f}"
|
||||||
use autoload && dosym -r "/usr/$(get_libdir)/mpv/${f}" "/etc/mpv/scripts/${f}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
use autoload && if _mpv-plugin_has_main; then
|
||||||
|
dosym -r "${MPV_INSTALL_DIR}" "/etc/mpv/scripts/${PN}"
|
||||||
|
else
|
||||||
|
for f in "${MPV_PLUGIN_FILES[@]}"; do
|
||||||
|
dosym -r "${MPV_INSTALL_DIR}/${f}" "/etc/mpv/scripts/${f}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
einstalldocs
|
einstalldocs
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,16 +133,20 @@ mpv-plugin_src_install() {
|
|||||||
# Warns the user of the existence of the autoload use flag.
|
# Warns the user of the existence of the autoload use flag.
|
||||||
mpv-plugin_pkg_postinst() {
|
mpv-plugin_pkg_postinst() {
|
||||||
if ! use autoload; then
|
if ! use autoload; then
|
||||||
elog
|
elog
|
||||||
elog "The plugin has not been installed to /etc/mpv/scripts for autoloading."
|
elog "The plugin has not been installed to /etc/mpv/scripts for autoloading."
|
||||||
elog "You have to activate it manually by passing"
|
elog "You have to activate it manually by passing"
|
||||||
for f in "${MPV_PLUGIN_FILES[@]}"; do
|
if _mpv-plugin_has_main; then
|
||||||
elog " \"${EPREFIX}/usr/$(get_libdir)/mpv/${f}\""
|
elog " \"${EPREFIX}/usr/$(get_libdir)/mpv/${PN}\""
|
||||||
done
|
else
|
||||||
elog "as script option to mpv or symlinking the library to \"scripts/\" in your mpv"
|
for f in "${MPV_PLUGIN_FILES[@]}"; do
|
||||||
elog "config directory."
|
elog " \"${EPREFIX}/usr/$(get_libdir)/mpv/${f}\""
|
||||||
elog "Alternatively, activate the autoload use flag."
|
done
|
||||||
elog
|
fi
|
||||||
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user