@@ -7,60 +7,10 @@ if WITH_V4LUTILS
SUBDIRS += utils contrib
endif
-EXTRA_DIST = android-config.h bootstrap.sh doxygen_libdvbv5.cfg include COPYING.libv4l \
- COPYING.libdvbv5 README.libv4l README.lib-multi-threading TODO.libdvbv5 \
- doc/libdvbv5-index.doc
+EXTRA_DIST = android-config.h sync-with-kernel.sh bootstrap.sh \
+ doxygen_libdvbv5.cfg include COPYING.libv4l \
+ COPYING.libdvbv5 README.libv4l README.lib-multi-threading \
+ TODO.libdvbv5 doc/libdvbv5-index.doc
include $(top_srcdir)/aminclude.am
-# custom targets
-
-sync-with-kernel:
- @if [ ! -f $(KERNEL_DIR)/usr/include/linux/videodev2.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/fb.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-controls.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-common.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-subdev.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-mediabus.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/ivtv.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/dvb/frontend.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/dvb/dmx.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/lirc.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/bpf.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/bpf_common.h ]; then \
- echo "Error you must set KERNEL_DIR to point to an extracted kernel source dir"; \
- echo "and run 'make headers_install' in \$$KERNEL_DIR."; \
- exit 1; \
- fi
- cp -a $(KERNEL_DIR)/usr/include/linux/videodev2.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/fb.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-controls.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-common.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-subdev.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-mediabus.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/media-bus-format.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/media.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/ivtv.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/dvb/frontend.h $(top_srcdir)/include/linux/dvb
- cp $(top_srcdir)/include/linux/dvb/frontend.h $(top_srcdir)/lib/include/libdvbv5/dvb-frontend.h
- cp -a $(KERNEL_DIR)/usr/include/linux/dvb/dmx.h $(top_srcdir)/include/linux/dvb
- cp -a $(KERNEL_DIR)/usr/include/linux/lirc.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/bpf.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/bpf_common.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/cec.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/usr/include/linux/cec-funcs.h $(top_srcdir)/include/linux
- cp -a $(KERNEL_DIR)/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c $(top_srcdir)/utils/common
- cp -a $(KERNEL_DIR)/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c $(top_srcdir)/utils/common
- cp -a $(KERNEL_DIR)/include/media/tpg/v4l2-tpg.h $(top_srcdir)/utils/common
- cp -a $(KERNEL_DIR)/include/media/fwht-ctrls.h $(top_srcdir)/utils/common
- patch -d $(top_srcdir) --no-backup-if-mismatch -p1 <$(top_srcdir)/utils/common/v4l2-tpg.patch
- cp -a $(KERNEL_DIR)/drivers/media/test-drivers/vicodec/codec-fwht.[ch] $(top_srcdir)/utils/common/
- cp -a $(KERNEL_DIR)/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.[ch] $(top_srcdir)/utils/common/
- patch -d $(top_srcdir) --no-backup-if-mismatch -p1 <$(top_srcdir)/utils/common/codec-fwht.patch
- grep V4L2_.*_FMT.*descr $(KERNEL_DIR)/drivers/media/v4l2-core/v4l2-ioctl.c | grep -v V4L2_PIX_FMT_H264_SLICE | grep -v V4L2_PIX_FMT_VP8_FRAME | grep -v V4L2_PIX_FMT_HEVC_SLICE | perl -pe 's/.*V4L2_(.*)_FMT/\tcase V4L2_\1_FMT/; s/:.*descr = /: return /; s/;.*/;/;' >$(top_srcdir)/utils/common/v4l2-pix-formats.h
-
- $(MAKE) -C utils/keytable $@
- $(MAKE) -C lib/libdvbv5 $@
- $(MAKE) -C contrib/freebsd $@
- $(MAKE) -C contrib/test $@
- $(MAKE) -C contrib/xc3028-firmware $@
@@ -264,11 +264,11 @@ Be sure that you have installed both glibc development packages for
step 3) at v4l-utils tree:
- $ export KERNEL_DIR=location/of/the/kernel/tree make sync-with-kernel
+ $ ./sync-with-kernel.sh location/of/the/kernel/tree
Alternatively, steps 1 to 3 can be replaced with:
-export KERNEL_DIR=location/of/the/kernel/tree && (cd $KERNEL_DIR && make headers_install INSTALL_HDR_PATH=usr/) && make sync-with-kernel
+KERNEL_DIR=location/of/the/kernel/tree && (cd $KERNEL_DIR && make headers_install INSTALL_HDR_PATH=usr/) && ./sync-with-kernel.sh $KERNEL_DIR
step 4)
@@ -128,7 +128,7 @@ fi
AC_DEFINE_UNQUOTED(LOCALEDIR, "$v4l_localedir", [locale directory])
AC_SUBST(localedir)
-# sync-with-kernel and keytable install could make use of them
+# sync-with-kernel.sh and keytable install could make use of them
#AC_PROG_GREP
#AC_PROG_SED
gl_PROMOTED_TYPE_MODE_T
@@ -1,17 +1,3 @@
EXTRA_DIST = \
include \
patches
-
-sync-with-kernel:
- rm -rf .pc
-
- for i in input.h input-event-codes.h ivtv.h uinput.h videodev2.h v4l2-controls.h v4l2-common.h; do \
- mkdir -p include/linux/$$(dirname $$i); \
- cp $(KERNEL_DIR)/usr/include/linux/$$i include/linux/$$i; \
- done
-
- for i in ivtv.h uinput.h videodev2.h v4l2-common.h; do \
- sed -e 's/__u8/uint8_t/g' -e 's/__u16/uint16_t/g' -e 's/__u32/uint32_t/g' -e 's/__u64/uint64_t/g' -e 's/__s8/int8_t/g' -e 's/__s16/int16_t/g' -e 's/__s32/int32_t/g' -e 's/__s64/int64_t/g' -e 's/__le32/uint32_t/g' -e 's/__user//g' -i include/linux/$$i; \
- done
-
- quilt push -a
@@ -57,15 +57,6 @@ capture_example_SOURCES = capture-example.c
ioctl-test.c: ioctl-test.h
-sync-with-kernel:
- ./gen_ioctl_list.pl --gen_ioctl_numbers >.tmp_ioctl.c
- gcc -I ../../include/ .tmp_ioctl.c -o tmp_ioctl32 -m32
- gcc -I ../../include/ .tmp_ioctl.c -o tmp_ioctl64 -m64
- ./tmp_ioctl32 32 >ioctl_32.h
- ./tmp_ioctl64 64 >ioctl_64.h
- rm .tmp_ioctl.c tmp_ioctl32 tmp_ioctl64
- ./gen_ioctl_list.pl >ioctl-test.h
-
EXTRA_DIST = \
gen_ioctl_list.pl \
test-media \
@@ -69,7 +69,7 @@ sub print_ioc()
printf "#define S_IOCTLS sizeof(ioctls)/sizeof(ioctls[0])\n";
}
-printf "/* This file is auto-generated by make sync-with-kernel */\n";
+printf "/* This file is auto-generated by sync-with-kernel.sh */\n";
printf "#include <linux/compiler.h>\n";
foreach my $h (sort keys %headers) {
@@ -110,7 +110,7 @@ my $arg = shift;
if ($arg eq "--gen_ioctl_numbers") {
printf "#include <stdio.h>\n";
printf "int main(int argc, char *argv[]) {\n";
- printf "\tprintf(\"/* This file is auto-generated by make sync-with-kernel */\\n\\n\");\n";
+ printf "\tprintf(\"/* This file is auto-generated by sync-with-kernel.sh */\\n\\n\");\n";
foreach my $ioctl (sort keys %ioc) {
printf "\tprintf(\"#define CMD%%s_%s 0x%%x\\n\", argv[1], %s);\n", $ioctl, $ioctl;
}
@@ -1,4 +1,4 @@
-/* This file is auto-generated by make sync-with-kernel */
+/* This file is auto-generated by sync-with-kernel.sh */
#include <linux/compiler.h>
#include "linux/dvb/dmx.h"
#include "linux/dvb/frontend.h"
@@ -1,4 +1,4 @@
-/* This file is auto-generated by make sync-with-kernel */
+/* This file is auto-generated by sync-with-kernel.sh */
#define CMD32_DMX_ADD_PID 0x40026f33
#define CMD32_DMX_DQBUF 0xc0186f40
@@ -1,4 +1,4 @@
-/* This file is auto-generated by make sync-with-kernel */
+/* This file is auto-generated by sync-with-kernel.sh */
#define CMD64_DMX_ADD_PID 0x40026f33
#define CMD64_DMX_DQBUF 0xc0186f40
@@ -3,12 +3,3 @@ noinst_PROGRAMS = firmware-tool
firmware_tool_SOURCES = firmware-tool.c standards.c extract_head.h standards.h tuner-xc2028-types.h
EXTRA_DIST = README
-
-# custom targets
-
-sync-with-kernel:
- @if [ ! -f $(KERNEL_DIR)/drivers/media/tuners/tuner-xc2028-types.h ]; then \
- echo "Error you must set KERNEL_DIR to point to an extracted kernel source dir"; \
- exit 1; \
- fi
- cp -a $(KERNEL_DIR)/drivers/media/tuners/tuner-xc2028-types.h $(srcdir)/
@@ -122,6 +122,3 @@ libdvbv5_la_LDFLAGS = $(LIBDVBV5_VERSION) $(ENFORCE_LIBDVBV5_STATIC) $(LIBUDEV_L
libdvbv5_la_LIBADD = $(LTLIBICONV)
EXTRA_DIST = README gen_dvb_structs.pl
-
-sync-with-kernel:
- ./gen_dvb_structs.pl $(KERNEL_DIR)/usr/include/
new file mode 100755
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+TOPSRCDIR="$( cd "$( dirname "$0" )" && pwd )"
+
+KERNEL_DIR=$1
+
+if [ -z "${KERNEL_DIR}" -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/videodev2.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/fb.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/v4l2-controls.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/v4l2-common.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/v4l2-subdev.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/v4l2-mediabus.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/ivtv.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/dvb/frontend.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/dvb/dmx.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/lirc.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/bpf.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/bpf_common.h -o \
+ ! -f ${KERNEL_DIR}/drivers/media/tuners/tuner-xc2028-types.h -o \
+ ! -f ${KERNEL_DIR}/usr/include/linux/input-event-codes.h ]; then
+ echo "Usage: $0 KERNEL_DIR"
+ echo
+ echo "KERNEL_DIR must be the path to an extracted kernel source dir"
+ echo "and run 'make headers_install' in KERNEL_DIR."
+ exit 1
+fi
+
+cp -a ${KERNEL_DIR}/usr/include/linux/videodev2.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/fb.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/v4l2-controls.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/v4l2-common.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/v4l2-subdev.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/v4l2-mediabus.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/media-bus-format.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/media.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/ivtv.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/dvb/frontend.h ${TOPSRCDIR}/include/linux/dvb
+cp ${TOPSRCDIR}/include/linux/dvb/frontend.h ${TOPSRCDIR}/lib/include/libdvbv5/dvb-frontend.h
+cp -a ${KERNEL_DIR}/usr/include/linux/dvb/dmx.h ${TOPSRCDIR}/include/linux/dvb
+cp -a ${KERNEL_DIR}/usr/include/linux/lirc.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/bpf.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/bpf_common.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/cec.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/usr/include/linux/cec-funcs.h ${TOPSRCDIR}/include/linux
+cp -a ${KERNEL_DIR}/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c ${TOPSRCDIR}/utils/common
+cp -a ${KERNEL_DIR}/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c ${TOPSRCDIR}/utils/common
+cp -a ${KERNEL_DIR}/include/media/tpg/v4l2-tpg.h ${TOPSRCDIR}/utils/common
+cp -a ${KERNEL_DIR}/include/media/fwht-ctrls.h ${TOPSRCDIR}/utils/common
+patch -d ${TOPSRCDIR} --no-backup-if-mismatch -p1 <${TOPSRCDIR}/utils/common/v4l2-tpg.patch
+cp -a ${KERNEL_DIR}/drivers/media/test-drivers/vicodec/codec-fwht.[ch] ${TOPSRCDIR}/utils/common/
+cp -a ${KERNEL_DIR}/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.[ch] ${TOPSRCDIR}/utils/common/
+patch -d ${TOPSRCDIR} --no-backup-if-mismatch -p1 <${TOPSRCDIR}/utils/common/codec-fwht.patch
+grep V4L2_.*_FMT.*descr ${KERNEL_DIR}/drivers/media/v4l2-core/v4l2-ioctl.c | grep -v V4L2_PIX_FMT_H264_SLICE | grep -v V4L2_PIX_FMT_VP8_FRAME | grep -v V4L2_PIX_FMT_HEVC_SLICE | perl -pe 's/.*V4L2_(.*)_FMT/\tcase V4L2_\1_FMT/; s/:.*descr = /: return /; s/;.*/;/;' >${TOPSRCDIR}/utils/common/v4l2-pix-formats.h
+
+function keytable {
+ SRCDIR=${TOPSRCDIR}/utils/keytable
+
+ cd ${SRCDIR}
+ echo generating ${SRCDIR}/parse.h
+ ./gen_input_events.pl < ${KERNEL_DIR}/usr/include/linux/input-event-codes.h > ${SRCDIR}/parse.h
+ mkdir -p ${SRCDIR}/rc_keymaps
+ rm -f ${SRCDIR}/rc_keymaps/*
+ echo storing existing keymaps at ${SRCDIR}/rc_keymaps/
+ ./gen_keytables.pl ${KERNEL_DIR};
+ cp ${SRCDIR}/rc_keymaps_userspace/* ${SRCDIR}/rc_keymaps/
+}
+
+function libdvbv5 {
+ SRCDIR=${TOPSRCDIR}/lib/libdvbv5
+
+ cd ${SRCDIR}
+ ./gen_dvb_structs.pl ${KERNEL_DIR}/usr/include/
+}
+
+function xc3028-firmware {
+ SRCDIR=${TOPSRCDIR}/contrib/xc3028-firmware
+
+ cp -a ${KERNEL_DIR}/drivers/media/tuners/tuner-xc2028-types.h ${SRCDIR}/
+}
+
+function ioctl-test {
+ SRCDIR=${TOPSRCDIR}/contrib/test
+
+ cd ${SRCDIR}
+
+ ./gen_ioctl_list.pl --gen_ioctl_numbers >.tmp_ioctl.c
+ gcc -I ../../include/ .tmp_ioctl.c -o tmp_ioctl32 -m32
+ gcc -I ../../include/ .tmp_ioctl.c -o tmp_ioctl64 -m64
+ ./tmp_ioctl32 32 >ioctl_32.h
+ ./tmp_ioctl64 64 >ioctl_64.h
+ rm .tmp_ioctl.c tmp_ioctl32 tmp_ioctl64
+ ./gen_ioctl_list.pl >ioctl-test.h
+}
+
+function freebsd {
+ SRCDIR=${TOPSRCDIR}/contrib/freebsd
+
+ cd ${SRCDIR}
+
+ rm -rf .pc
+
+ for i in input.h input-event-codes.h ivtv.h uinput.h videodev2.h v4l2-controls.h v4l2-common.h; do
+ mkdir -p include/linux/$(dirname $i)
+ cp ${KERNEL_DIR}/usr/include/linux/$i include/linux/$i
+ done
+
+ for i in ivtv.h uinput.h videodev2.h v4l2-common.h; do
+ sed -e 's/__u8/uint8_t/g' -e 's/__u16/uint16_t/g' -e 's/__u32/uint32_t/g' -e 's/__u64/uint64_t/g' -e 's/__s8/int8_t/g' -e 's/__s16/int16_t/g' -e 's/__s32/int32_t/g' -e 's/__s64/int64_t/g' -e 's/__le32/uint32_t/g' -e 's/__user//g' -i include/linux/$i
+ done
+
+ quilt push -a
+}
+
+keytable
+libdvbv5
+freebsd
+ioctl-test
+xc3028-firmware
@@ -29,16 +29,3 @@ check:
# custom target
install-data-local:
$(install_sh) -d "$(DESTDIR)$(keytableuserdir)"
-
-sync-with-kernel:
- @if [ ! -f $(KERNEL_DIR)/usr/include/linux/input-event-codes.h ]; then \
- echo "Error you must set KERNEL_DIR to point to an extracted kernel source dir"; \
- exit 1; \
- fi
- @echo generating $(srcdir)/parse.h
- @./gen_input_events.pl < $(KERNEL_DIR)/usr/include/linux/input-event-codes.h > $(srcdir)/parse.h
- @-mkdir -p $(srcdir)/rc_keymaps
- @-rm $(srcdir)/rc_keymaps/*
- @echo storing existing keymaps at $(srcdir)/rc_keymaps/
- @cd $(srcdir) && ./gen_keytables.pl $(KERNEL_DIR);
- @-cp $(srcdir)/rc_keymaps_userspace/* $(srcdir)/rc_keymaps/
The sync-with-kernel target is a collection of shell fragments scattered over the tree. Collect all of them into a single shell script. This makes it is easier to see what sync-with-kernel does, and makes the move away from autotools to meson easier. Signed-off-by: Sean Young <sean@mess.org> --- Changes since v3: - sync-with-kernel.sh takes KERNEL_DIR as argument, not env Changes since v2: - Implemented review changes - Updated to latest master Makefile.am | 58 +------------- README | 4 +- configure.ac | 2 +- contrib/freebsd/Makefile.am | 14 ---- contrib/test/Makefile.am | 9 --- contrib/test/gen_ioctl_list.pl | 4 +- contrib/test/ioctl-test.h | 2 +- contrib/test/ioctl_32.h | 2 +- contrib/test/ioctl_64.h | 2 +- contrib/xc3028-firmware/Makefile.am | 9 --- lib/libdvbv5/Makefile.am | 3 - sync-with-kernel.sh | 119 ++++++++++++++++++++++++++++ utils/keytable/Makefile.am | 13 --- 13 files changed, 131 insertions(+), 110 deletions(-) create mode 100755 sync-with-kernel.sh