distribution/packages/sysutils/v4l-utils/package.mk

110 lines
3.2 KiB
Makefile
Raw Normal View History

2022-02-05 14:23:32 +00:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018 Team LibreELEC (https://libreelec.tv)
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)
# with 1.0.0 repeat delay is broken. test on upgrade
PKG_NAME="v4l-utils"
PKG_VERSION="1.14.2"
PKG_SHA256="e6b962c4b1253cf852c31da13fd6b5bb7cbe5aa9e182881aec55123bae680692"
PKG_LICENSE="GPL"
PKG_SITE="http://linuxtv.org/"
2023-02-24 13:53:43 +00:00
PKG_URL="http://linuxtv.org/downloads/v4l-utils/${PKG_NAME}-${PKG_VERSION}.tar.bz2"
2022-02-05 14:23:32 +00:00
PKG_DEPENDS_TARGET="toolchain alsa-lib systemd"
PKG_LONGDESC="Linux V4L2 and DVB API utilities and v4l libraries (libv4l)."
PKG_STAMP_VAR="$IR_REMOTE_KEYMAPS"
PKG_CONFIGURE_OPTS_TARGET="--without-jpeg \
--enable-static \
--with-udevdir=/usr/lib/udev/ \
--disable-shared"
pre_configure_target() {
# cec-ctl fails to build in subdirs
2023-02-24 13:53:43 +00:00
cd ${PKG_BUILD}
rm -rf .${TARGET_NAME}
2022-02-05 14:23:32 +00:00
}
make_target() {
2023-02-24 13:53:43 +00:00
make -C utils/keytable CFLAGS="${TARGET_CFLAGS}"
make -C utils/ir-ctl CFLAGS="${TARGET_CFLAGS}"
2022-02-05 14:23:32 +00:00
if [ "$CEC_FRAMEWORK_SUPPORT" = "yes" ]; then
2023-02-24 13:53:43 +00:00
make -C utils/cec-ctl CFLAGS="${TARGET_CFLAGS}"
2022-02-05 14:23:32 +00:00
fi
2023-02-24 13:53:43 +00:00
make -C lib CFLAGS="${TARGET_CFLAGS}"
make -C utils/dvb CFLAGS="${TARGET_CFLAGS}"
make -C utils/v4l2-ctl CFLAGS="${TARGET_CFLAGS}"
2022-02-05 14:23:32 +00:00
}
makeinstall_target() {
2023-02-24 13:53:43 +00:00
make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/keytable
make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/ir-ctl
2022-02-05 14:23:32 +00:00
if [ "$CEC_FRAMEWORK_SUPPORT" = "yes" ]; then
2023-02-24 13:53:43 +00:00
make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/cec-ctl
2022-02-05 14:23:32 +00:00
fi
2023-02-24 13:53:43 +00:00
make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/dvb
make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/v4l2-ctl
2022-02-05 14:23:32 +00:00
}
create_multi_keymap() {
local f name protocols
name="$1"
protocols="$2"
shift 2
(
echo "# table $name, type: $protocols"
for f in "$@" ; do
echo "# $f"
2023-02-24 13:53:43 +00:00
grep -v "^#" ${INSTALL}/usr/lib/udev/rc_keymaps/$f
2022-02-05 14:23:32 +00:00
done
2023-02-24 13:53:43 +00:00
) > ${INSTALL}/usr/lib/udev/rc_keymaps/$name
2022-02-05 14:23:32 +00:00
}
post_makeinstall_target() {
local f keymap
2023-02-24 13:53:43 +00:00
rm -rf ${INSTALL}/etc/rc_keymaps
ln -sf /storage/.config/rc_keymaps ${INSTALL}/etc/rc_keymaps
2022-02-05 14:23:32 +00:00
2023-02-24 13:53:43 +00:00
mkdir -p ${INSTALL}/usr/config
cp -PR ${PKG_DIR}/config/* ${INSTALL}/usr/config
2022-02-05 14:23:32 +00:00
2023-02-24 13:53:43 +00:00
rm -rf ${INSTALL}/usr/lib/udev/rules.d
mkdir -p ${INSTALL}/usr/lib/udev/rules.d
cp -PR ${PKG_DIR}/udev.d/*.rules ${INSTALL}/usr/lib/udev/rules.d
2022-02-05 14:23:32 +00:00
# install additional keymaps without overwriting upstream maps
(
set -C
2023-02-24 13:53:43 +00:00
for f in ${PKG_DIR}/keymaps/* ; do
2022-02-05 14:23:32 +00:00
if [ -e $f ] ; then
keymap=$(basename $f)
2023-02-24 13:53:43 +00:00
cat $f > ${INSTALL}/usr/lib/udev/rc_keymaps/$keymap
2022-02-05 14:23:32 +00:00
fi
done
)
# create multi keymap to support several remotes OOTB
if [ -n "$IR_REMOTE_PROTOCOLS" -a -n "$IR_REMOTE_KEYMAPS" ]; then
create_multi_keymap libreelec_multi "$IR_REMOTE_PROTOCOLS" $IR_REMOTE_KEYMAPS
# use multi-keymap instead of default one
2023-02-24 13:53:43 +00:00
sed -i '/^\*\s*rc-rc6-mce\s*rc6_mce/d' ${INSTALL}/etc/rc_maps.cfg
2022-02-05 14:23:32 +00:00
2023-02-24 13:53:43 +00:00
cat << EOF >> ${INSTALL}/etc/rc_maps.cfg
2022-02-05 14:23:32 +00:00
#
# Custom LibreELEC configuration starts here
#
# use combined multi-table on MCE receivers
# * rc-rc6-mce rc6_mce
* rc-rc6-mce libreelec_multi
# table for Xbox DVD Playback Kit
* rc-xbox-dvd xbox_dvd
# multi-table for amlogic devices
meson-ir * libreelec_multi
EOF
fi
}