Bug#647508: FTBFS on GNU/kFreeBSD
Package: libv4l-dev
Version: 0.8.5-5
Severity: important
Tags: patch
User: debian-bsd@lists.debian.org
Usertags: kfreebsd
This patch fixes FTBFS on GNU/kFreeBSD for libv4l. Unfortunately not all
of this package is meant to be usable on non-Linux, my patch only enables
the libraries, which already had basic support for FreeBSD in upstream.
-- System Information:
Debian Release: 6.0.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.1-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file 'debian/control'
--- debian/control 2011-11-03 11:11:32 +0000
+++ debian/control 2011-11-03 11:55:04 +0000
@@ -7,7 +7,7 @@ Uploaders: Martin Pitt <mpitt@debian.org
DM-Upload-Allowed: yes
Build-Depends: debhelper (>= 8.1.3),
libjpeg-dev,
- libqt4-dev,
+ libqt4-dev [linux-any],
gcc-multilib [amd64]
Standards-Version: 3.9.2
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/libv4l.git
@@ -16,7 +16,7 @@ Homepage: http://linuxtv.org/downloads/v
Package: libv4l-0
Section: libs
-Architecture: linux-any
+Architecture: linux-any kfreebsd-any
Depends: libv4lconvert0 (= ${binary:Version}),
${shlibs:Depends},
${misc:Depends}
@@ -40,7 +40,7 @@ Description: Collection of video4linux s
Package: libv4lconvert0
Section: libs
-Architecture: linux-any
+Architecture: linux-any kfreebsd-any
Depends: ${shlibs:Depends},
${misc:Depends}
Pre-Depends: ${misc:Pre-Depends}
@@ -55,7 +55,7 @@ Description: Video4linux frame format co
Package: libv4l-dev
Section: libdevel
-Architecture: linux-any
+Architecture: linux-any kfreebsd-any
Depends: libv4l-0 (= ${binary:Version}),
libv4lconvert0 (= ${binary:Version}),
${shlibs:Depends},
=== added file 'debian/patches/kfreebsd.diff'
--- debian/patches/kfreebsd.diff 1970-01-01 00:00:00 +0000
+++ debian/patches/kfreebsd.diff 2011-11-03 11:51:50 +0000
@@ -0,0 +1,89 @@
+--- a/include/linux/videodev2.h
++++ b/include/linux/videodev2.h
+@@ -61,9 +61,27 @@
+ #else
+ #include <sys/time.h>
+ #endif
++#include <sys/ioctl.h>
++
++#ifdef __linux__
+ #include <linux/compiler.h>
+-#include <linux/ioctl.h>
+ #include <linux/types.h>
++#else
++#include <stdint.h>
++typedef int8_t __s8;
++typedef int16_t __s16;
++typedef int32_t __s32;
++typedef int64_t __s64;
++typedef uint8_t __u8;
++typedef uint16_t __u16;
++typedef uint32_t __u32;
++typedef uint64_t __u64;
++typedef uint8_t __u8;
++typedef uint16_t __le16;
++typedef uint32_t __le32;
++typedef uint64_t __le64;
++#define __user
++#endif
+
+ /*
+ * Common stuff for both V4L1 and V4L2
+--- a/lib/include/libv4l1-videodev.h
++++ b/lib/include/libv4l1-videodev.h
+@@ -2,7 +2,7 @@
+ #ifndef __LINUX_VIDEODEV_H
+ #define __LINUX_VIDEODEV_H
+
+-#include <linux/ioctl.h>
++#include <sys/ioctl.h>
+ #include <stdint.h>
+
+ #define VID_TYPE_CAPTURE 1 /* Can capture */
+--- a/lib/include/libv4lconvert.h
++++ b/lib/include/libv4lconvert.h
+@@ -28,7 +28,7 @@
+ #include <linux/ioctl.h>
+ #endif
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
+--- a/lib/libv4lconvert/libv4lsyscall-priv.h
++++ b/lib/libv4lconvert/libv4lsyscall-priv.h
+@@ -49,7 +49,7 @@
+ #endif
+ #endif
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #include <sys/time.h>
+ #include <sys/syscall.h>
+ #include <sys/types.h>
+@@ -83,9 +83,9 @@
+ #define SYS_WRITE(fd, buf, len) \
+ syscall(SYS_write, (int)(fd), (void *)(buf), (size_t)(len));
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #define SYS_MMAP(addr, len, prot, flags, fd, off) \
+- __syscall(SYS_mmap, (void *)(addr), (size_t)(len), \
++ syscall(SYS_mmap, (void *)(addr), (size_t)(len), \
+ (int)(prot), (int)(flags), (int)(fd), (__off_t)(off))
+ #else
+ #define SYS_MMAP(addr, len, prot, flags, fd, off) \
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,10 @@
++UNAME = $(uname -s)
++
+ all install:
+ $(MAKE) -C lib $@
++ifeq ($(UNAME), Linux)
+ $(MAKE) -C utils $@
++endif
+
+ sync-with-kernel:
+ @if [ ! -f $(KERNEL_DIR)/include/linux/videodev2.h -o \
=== modified file 'debian/patches/series'
--- debian/patches/series 2011-11-03 11:11:32 +0000
+++ debian/patches/series 2011-11-03 11:39:41 +0000
@@ -8,3 +8,4 @@ update_upside_down_table-5.diff
update_upside_down_table-6.diff
separate_libsubdir_for_v4lconvert.diff
fix_spelling_error.diff
+kfreebsd.diff
=== modified file 'debian/rules'
--- debian/rules 2011-11-03 11:11:32 +0000
+++ debian/rules 2011-11-03 11:53:49 +0000
@@ -9,6 +9,7 @@ V4L_COMMON_FLAGS = PREFIX=/usr DESTDIR=$
# else
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
V4L_COMMON_FLAGS += CPPFLAGS+="$(shell dpkg-buildflags --get CPPFLAGS)"
V4L_COMMON_FLAGS += CFLAGS+="$(shell dpkg-buildflags --get CFLAGS)"
@@ -38,9 +39,11 @@ build-stamp:
# build shared libs and install
$(MAKE) $(V4L_NATIVE_FLAGS)
$(MAKE) $(V4L_NATIVE_FLAGS) install
+ifeq ($(DEB_HOST_ARCH_OS), linux)
# prefix filenames with /lib/udev/rc_keymaps
mv $(CURDIR)/debian/tmp/etc/rc_maps.cfg $(CURDIR)/debian/tmp/etc/rc_maps.cfg.orig
sed -e 's,^\([^#][[:graph:]]*[[:space:]]\+[[:graph:]]\+[[:space:]]\+\)\([[:graph:]]\+.*\),\1/lib/udev/rc_keymaps/\2,' -e 's,^\(#[[:space:]]\+\*[[:space:]]\+\*[[:space:]]\+\)\([[:alnum:]].*\),\1/lib/udev/rc_keymaps/\2,' < $(CURDIR)/debian/tmp/etc/rc_maps.cfg.orig > $(CURDIR)/debian/tmp/etc/rc_maps.cfg
+endif
ifeq ($(DEB_HOST_ARCH), amd64)
# clean object files
$(MAKE) clean
Reply to: