Browse Source

libv4l: Import from oldpackages, upgrade to 1.2.1, fix build

    Update copyright, license info, add myself as pkg maintainer

Signed-off-by: Ted Hess <thess@kitschensync.net>
Ted Hess 10 years ago
parent
commit
f08fd93c25

+ 120
- 0
libs/libv4l/Makefile View File

@@ -0,0 +1,120 @@
1
+#
2
+# Copyright (C) 2009-2014 OpenWrt.org
3
+# Copyright (C) 2009 David Cooper <dave@kupesoft.com>
4
+#
5
+# This is free software, licensed under the GNU General Public License v2.
6
+# See /LICENSE for more information.
7
+#
8
+
9
+include $(TOPDIR)/rules.mk
10
+
11
+PKG_NAME:=v4l-utils
12
+PKG_VERSION:=1.2.1
13
+PKG_RELEASE:=1
14
+
15
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16
+PKG_SOURCE_URL:=http://www.linuxtv.org/downloads/v4l-utils
17
+PKG_MD5SUM:=4cc0fb4ded302ea9e89e5e1b56a7252b
18
+
19
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
20
+
21
+PKG_LICENSE:=GPL-2.0 LGPL-2.1
22
+PKG_LICENSE_FILE:=COPYING COPYING.libv4l
23
+
24
+PKG_BUILD_DEPENDS:=argp-standalone
25
+
26
+include $(INCLUDE_DIR)/uclibc++.mk
27
+include $(INCLUDE_DIR)/package.mk
28
+
29
+define Package/libv4l/Default
30
+  TITLE:=Video 4 Linux
31
+  URL:=http://www.linuxtv.org/
32
+endef
33
+
34
+define Package/libv4l/Default/description
35
+  libv4l is a collection of libraries which adds a thin abstraction layer on
36
+  top of video4linux2 devices. The purpose of this (thin) layer is to make it
37
+  easy for application writers to support a wide variety of devices without
38
+  having to write separate code for different devices in the same class. libv4l
39
+  consists of 3 different libraries: libv4lconvert, libv4l1 and libv4l2.
40
+
41
+  libv4l1 offers the (deprecated) v4l1 API on top of v4l2 devices, independent
42
+  of the drivers for those devices supporting v4l1 compatibility (which many
43
+  v4l2 drivers do not).
44
+
45
+  libv4l2 offers the v4l2 API on top of v4l2 devices, while adding for the
46
+  application transparent libv4lconvert conversion where necessary.
47
+endef
48
+
49
+define Package/libv4l
50
+  $(call Package/libv4l/Default)
51
+  SECTION:=libs
52
+  CATEGORY:=Libraries
53
+  TITLE+= wrapper libraries
54
+  DEPENDS := +libpthread +librt
55
+endef
56
+
57
+define Package/libv4l/description
58
+  $(call Package/libv4l/Default/description)
59
+endef
60
+
61
+define Package/v4l-utils
62
+  $(call Package/libv4l/Default)
63
+  SECTION:=utils
64
+  CATEGORY:=Utilities
65
+  TITLE+= utilities
66
+  DEPENDS := +libv4l $(CXX_DEPENDS)
67
+endef
68
+
69
+define Package/v4l-utils/description
70
+  $(call Package/libv4l/Default/description)
71
+  This package contains the video4linux utilities.
72
+endef
73
+
74
+TARGET_CFLAGS += $(FPIC)
75
+TARGET_LDFLAGS += -largp
76
+
77
+CONFIGURE_ARGS+= \
78
+	--disable-libdvbv5 \
79
+	--disable-qv4l2 \
80
+	--without-jpeg \
81
+
82
+define Build/Compile
83
+	$(MAKE) -C $(PKG_BUILD_DIR) \
84
+		DESTDIR="$(PKG_INSTALL_DIR)" \
85
+		all install
86
+	$(MAKE) -C $(PKG_BUILD_DIR) \
87
+		DESTDIR="$(PKG_INSTALL_DIR)" \
88
+		LINKTYPE="static" \
89
+		all install
90
+endef
91
+
92
+define Build/InstallDev
93
+	$(INSTALL_DIR) $(1)/usr/include
94
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
95
+	$(INSTALL_DIR) $(1)/usr/lib
96
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libv4l{1,2,convert}.{a,so*} $(1)/usr/lib/
97
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
98
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libv4l{1,2,convert}.pc $(1)/usr/lib/pkgconfig/
99
+endef
100
+
101
+define Package/libv4l/install
102
+	$(INSTALL_DIR) $(1)/usr/lib
103
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libv4l{1,2,convert}.so.* $(1)/usr/lib/
104
+	$(INSTALL_DIR) $(1)/usr/lib/libv4l
105
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libv4l/v4l{1compat,2convert}.so $(1)/usr/lib/libv4l/
106
+endef
107
+
108
+define Package/v4l-utils/install
109
+	$(INSTALL_DIR) $(1)/etc
110
+	$(CP) $(PKG_INSTALL_DIR)/etc/rc_maps.cfg $(1)/etc/
111
+	$(CP) $(PKG_INSTALL_DIR)/etc/rc_keymaps $(1)/etc/
112
+	$(INSTALL_DIR) $(1)/usr/bin
113
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/{cx18,ivtv}-ctl $(1)/usr/bin/
114
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/decode_tm6000 $(1)/usr/bin/
115
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/ir-keytable $(1)/usr/bin/
116
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/v4l2-{compliance,ctl,sysfs-path} $(1)/usr/bin/
117
+endef
118
+
119
+$(eval $(call BuildPackage,libv4l))
120
+$(eval $(call BuildPackage,v4l-utils))

+ 57
- 0
libs/libv4l/patches/001-no-shm_open-fix.patch View File

@@ -0,0 +1,57 @@
1
+--- a/lib/libv4lconvert/control/libv4lcontrol.c
2
++++ b/lib/libv4lconvert/control/libv4lcontrol.c
3
+@@ -570,7 +570,7 @@ static void v4lcontrol_get_flags_from_db
4
+ struct v4lcontrol_data *v4lcontrol_create(int fd, void *dev_ops_priv,
5
+ 	const struct libv4l_dev_ops *dev_ops, int always_needs_conversion)
6
+ {
7
+-	int shm_fd;
8
++	int shm_fd, fdflags;
9
+ 	int i, rc, got_usb_info, speed, init = 0;
10
+ 	char *s, shm_name[256], pwd_buf[1024];
11
+ 	struct v4l2_capability cap;
12
+@@ -695,33 +695,38 @@ struct v4lcontrol_data *v4lcontrol_creat
13
+ 
14
+ 	if (getpwuid_r(geteuid(), &pwd, pwd_buf, sizeof(pwd_buf), &pwd_p) == 0) {
15
+ 		if (got_usb_info)
16
+-			snprintf(shm_name, 256, "/libv4l-%s:%s:%04x:%04x:%s", pwd.pw_name,
17
++			snprintf(shm_name, 256, "/dev/shm/libv4l-%s:%s:%04x:%04x:%s", pwd.pw_name,
18
+ 					cap.bus_info, (int)vendor_id, (int)product_id, cap.card);
19
+ 		else
20
+-			snprintf(shm_name, 256, "/libv4l-%s:%s:%s", pwd.pw_name,
21
++			snprintf(shm_name, 256, "/dev/shm/libv4l-%s:%s:%s", pwd.pw_name,
22
+ 					cap.bus_info, cap.card);
23
+ 	} else {
24
+ 		perror("libv4lcontrol: error getting username using uid instead");
25
+ 		if (got_usb_info)
26
+-			snprintf(shm_name, 256, "/libv4l-%lu:%s:%04x:%04x:%s",
27
++			snprintf(shm_name, 256, "/dev/shm/libv4l-%lu:%s:%04x:%04x:%s",
28
+ 					(unsigned long)geteuid(), cap.bus_info,
29
+ 					(int)vendor_id, (int)product_id, cap.card);
30
+ 		else
31
+-			snprintf(shm_name, 256, "/libv4l-%lu:%s:%s", (unsigned long)geteuid(),
32
++			snprintf(shm_name, 256, "/dev/shm/libv4l-%lu:%s:%s", (unsigned long)geteuid(),
33
+ 					cap.bus_info, cap.card);
34
+ 	}
35
+ 
36
+ 	/* / is not allowed inside shm names */
37
+-	for (i = 1; shm_name[i]; i++)
38
++	for (i = 9; shm_name[i]; i++) /* start after "/dev/shm", i = 9 */
39
+ 		if (shm_name[i] == '/')
40
+ 			shm_name[i] = '-';
41
+ 
42
+ 	/* Open the shared memory object identified by shm_name */
43
+-	shm_fd = shm_open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE));
44
++	shm_fd = open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE));
45
+ 	if (shm_fd >= 0)
46
+ 		init = 1;
47
+ 	else
48
+-		shm_fd = shm_open(shm_name, O_RDWR, (S_IREAD | S_IWRITE));
49
++		shm_fd = open(shm_name, O_RDWR, (S_IREAD | S_IWRITE));
50
++
51
++	/* This is all uClibc > 0.9.30 seems to do for shm_open() in librt/shm.c */
52
++	fdflags = fcntl(shm_fd, F_GETFD, 0);
53
++	if (fdflags >= 0)
54
++		fdflags = fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
55
+ 
56
+ 	if (shm_fd >= 0) {
57
+ 		/* Set the shared memory size */

+ 10
- 0
libs/libv4l/patches/020-add-missing-includes.patch View File

@@ -0,0 +1,10 @@
1
+--- a/utils/rds-ctl/rds-ctl.cpp
2
++++ b/utils/rds-ctl/rds-ctl.cpp
3
+@@ -29,6 +29,7 @@
4
+ #include <inttypes.h>
5
+ #include <getopt.h>
6
+ #include <sys/types.h>
7
++#include <ctype.h>
8
+ #include <fcntl.h>
9
+ #include <errno.h>
10
+ #include <sys/ioctl.h>