Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Solved: media-video/motion on new kernels without videodev.h
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Krellan
n00b
n00b


Joined: 27 Aug 2010
Posts: 31

PostPosted: Wed Aug 31, 2011 6:41 am    Post subject: Solved: media-video/motion on new kernels without videodev.h Reply with quote

Good news, I solved a problem with media-video/motion (motion detection webcam program). It was broken on new kernels that lack the deprecated videodev.h file. After stumbling around for a while, an easy solution was found, simply use the headers from the "libv4l" userspace compatibility library instead.

This is for motion-3.2.12 (the most current version in the Portage tree that I have).

Here's the patch for changing the motion-3.2.12.ebuild file (apply this by hand):

Code:

--- motion-3.2.12.ebuild.old   2011-05-19 11:50:35.000000000 -0700
+++ motion-3.2.12.ebuild   2011-08-30 23:29:23.000000000 -0700
@@ -20,23 +20,23 @@
    mysql? ( virtual/mysql )
    postgres? ( dev-db/postgresql-base )"
 DEPEND="${RDEPEND}
-   v4l? ( virtual/os-headers )"
+   v4l? ( virtual/os-headers media-libs/libv4l )"
 
 pkg_setup() {
    enewuser motion -1 -1 -1 video
 }
 
-src_configure() {
-   local hack
-   has_version '>=sys-kernel/linux-headers-2.6.38' && hack="--without-v4l" #361509
+src_prepare() {
+   epatch "${FILESDIR}/${P}-v4l-headers.patch"
+}
 
+src_configure() {
    econf \
       $(use_with v4l) \
       $(use_with ffmpeg) \
       $(use_with mysql) \
       $(use_with postgres pgsql) \
-      --without-optimizecpu \
-      ${hack}
+      --without-optimizecpu
 }
 
 src_install() {


It adds a patch file. Here is the contents of the patch file, which should be placed in the "files" directory, here: media-video/motion/files/motion-3.2.12-v4l-headers.patch

Code:

diff -urN motion-3.2.12-OLD/motion.h motion-3.2.12-NEW/motion.h
--- motion-3.2.12-OLD/motion.h   2010-05-31 23:48:23.000000000 -0700
+++ motion-3.2.12-NEW/motion.h   2011-08-30 02:11:08.000000000 -0700
@@ -40,7 +40,7 @@
 
 #define _LINUX_TIME_H 1
 #if !defined(WITHOUT_V4L) && !defined(BSD)
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
 #endif
 
 #include <pthread.h>
diff -urN motion-3.2.12-OLD/track.c motion-3.2.12-NEW/track.c
--- motion-3.2.12-OLD/track.c   2010-05-31 23:48:23.000000000 -0700
+++ motion-3.2.12-NEW/track.c   2011-08-30 23:05:09.000000000 -0700
@@ -11,6 +11,7 @@
 #include "motion.h"
 
 #ifndef WITHOUT_V4L
+#include <linux/videodev2.h>
 #include "pwc-ioctl.h"
 #endif
 
diff -urN motion-3.2.12-OLD/video.h motion-3.2.12-NEW/video.h
--- motion-3.2.12-OLD/video.h   2010-05-31 23:48:23.000000000 -0700
+++ motion-3.2.12-NEW/video.h   2011-08-30 02:11:12.000000000 -0700
@@ -12,7 +12,7 @@
 
 #define _LINUX_TIME_H 1
 #ifndef WITHOUT_V4L
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
 #include <sys/mman.h>
 #include "pwc-ioctl.h"
 #endif


With these 2 changes, it works, and I'm happily running motion now, under kernel 3.0.3!

Josh
Back to top
View user's profile Send private message
dtbiedrzycki
n00b
n00b


Joined: 10 Dec 2011
Posts: 1

PostPosted: Sat Dec 10, 2011 11:06 am    Post subject: Patch Not Working Reply with quote

Hello,
I am currently running into the same problem that you had with motion.
I have applied your changes to motion-3.2.12-r1.ebuild as well as added your motion-3.2.12-v4l-headers.patch.
Unfortunately, this is what I am getting after updating the digest and emerging with the new ebuild:

Code:

Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) media-video/motion-3.2.12-r1 from x-portage
 * motion-3.2.12.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                 [ ok ]
>>> Unpacking source...
>>> Unpacking motion-3.2.12.tar.gz to /var/tmp/portage/media-video/motion-3.2.12-r1/work
>>> Source unpacked in /var/tmp/portage/media-video/motion-3.2.12-r1/work
>>> Preparing source in /var/tmp/portage/media-video/motion-3.2.12-r1/work/motion-3.2.12 ...
 * Applying ffmpeg08.patch ...                                                          [ ok ]
 * Applying motion-3.2.12-v4l-headers.patch ...

 * Failed Patch: motion-3.2.12-v4l-headers.patch !
 *  ( /usr/local/portage/media-video/motion/files/motion-3.2.12-v4l-headers.patch )
 *
 * Include in your bugreport the contents of:
 *
 *   /var/tmp/portage/media-video/motion-3.2.12-r1/temp/motion-3.2.12-v4l-headers.patch.out

 * ERROR: media-video/motion-3.2.12-r1 failed (prepare phase):
 *   Failed Patch: motion-3.2.12-v4l-headers.patch!
 *
 * Call stack:
 *     ebuild.sh, line   56:  Called src_prepare
 *   environment, line 2192:  Called epatch '/usr/local/portage/media-video/motion/files/motion-3.2.12-v4l-headers.patch'
 *   environment, line 1109:  Called die
 * The specific snippet of code:
 *               die "Failed Patch: ${patchname}!";
 *
 * If you need support, post the output of 'emerge --info =media-video/motion-3.2.12-r1',
 * the complete build log and the output of 'emerge -pqv =media-video/motion-3.2.12-r1'.
 * This ebuild is from an overlay named 'x-portage': '/usr/local/portage/'
 * The complete build log is located at '/var/tmp/portage/media-video/motion-3.2.12-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-video/motion-3.2.12-r1/temp/environment'.
 * S: '/var/tmp/portage/media-video/motion-3.2.12-r1/work/motion-3.2.12'



I am still fairly new to Gentoo (a few months in) and have never edited ebuilds before, so I am not sure if there is something that I am doing wrong, or if the patch is broken.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum