From nobody@FreeBSD.org  Wed Mar  3 23:26:46 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DB0DB16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  3 Mar 2004 23:26:46 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D570843D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  3 Mar 2004 23:26:46 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i247Qk72029751
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 3 Mar 2004 23:26:46 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i247QksZ029750;
	Wed, 3 Mar 2004 23:26:46 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200403040726.i247QksZ029750@www.freebsd.org>
Date: Wed, 3 Mar 2004 23:26:46 -0800 (PST)
From: michael johnson <ahze@ahze.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [Patch] multimedia/mjpegtools -- Fix build on 5.x
X-Send-Pr-Version: www-2.3

>Number:         63745
>Category:       ports
>Synopsis:       [Patch] multimedia/mjpegtools -- Fix build on 5.x
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lioux
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 03 23:30:23 PST 2004
>Closed-Date:    Sat Mar 06 02:56:01 PST 2004
>Last-Modified:  Sat Mar 06 02:56:01 PST 2004
>Originator:     michael johnson
>Release:        5.2-CURRENT
>Organization:
>Environment:
>Description:
This fixes build on 5.x current

I tested on both 4.x and 5.x. 

patch-gcc-yuvdenoise::motion.c came from gentoo portage.

I wasn't quite sure what to do with 
 @${REINPLACE_CMD} -e 's|#include <getopt.h>|#include "/usr/include/getop
t.h"|'
this might be the wrong way to include /usr/include/getopt.h instead of /usr/local/include/getopt.h. please tell me if this is wrong.
>How-To-Repeat:
      
>Fix:
diff -ruN multimedia/mjpegtools.orig/Makefile multimedia/mjpegtools/Makefile
--- multimedia/mjpegtools.orig/Makefile	Wed Mar  3 23:36:15 2004
+++ multimedia/mjpegtools/Makefile	Thu Mar  4 02:16:40 2004
@@ -54,10 +54,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 502102
-BROKEN=		"Does not compile"
-.endif
-
 .if ${ARCH} != "i386"
 PLIST_SUB+=	DIVX='@comment '
 .else
@@ -142,6 +138,12 @@
 .endif
 
 post-patch:
+	@${REINPLACE_CMD} -e 's|#include <getopt.h>|#include "/usr/include/getopt.h"|' \
+		${WRKSRC}/lavtools/divxdec.cpp \
+		${WRKSRC}/lavtools/lav2divx.cpp \
+		${WRKSRC}/lavtools/lavplay.c \
+		${WRKSRC}/lavtools/lavrec.c \
+		${WRKSRC}/lavtools/yuv2divx.cpp
 	@${REINPLACE_CMD} -E -e 's|^(pkgconfigdir = )\$$\(libdir\)/(pkgconfig)|\1${PREFIX}/libdata/\2|' \
 		${WRKSRC}/Makefile.in
 	@${REINPLACE_CMD} -e 's|stdint.h|sys/types.h|' \
diff -ruN multimedia/mjpegtools.orig/files/patch-gcc3-yuvdenoise::motion.c multimedia/mjpegtools/files/patch-gcc3-yuvdenoise::motion.c
--- multimedia/mjpegtools.orig/files/patch-gcc3-yuvdenoise::motion.c	Wed Dec 31 19:00:00 1969
+++ multimedia/mjpegtools/files/patch-gcc3-yuvdenoise::motion.c	Thu Mar  4 02:13:46 2004
@@ -0,0 +1,60 @@
+diff -uNr yuvdenoise/motion.c yuvdenoise/motion.c.orig
+--- yuvdenoise/motion.c	2002-05-06 04:13:37.000000000 -0400
++++ yuvdenoise/motion.c.orig	2003-07-25 01:52:38.339744992 -0400
+@@ -251,6 +251,9 @@
+     " movl         %1    , %%eax;          /* load frameadress into eax                          */\n"
+     " movl         %2    , %%ebx;          /* load frameadress into ebx                          */\n"
+     " movl         %3    , %%ecx;          /* load width       into ecx                          */\n"
++	" shrl         $1    , %%ecx;          /* shift width to scale it in the asm.                */\n"
++	"                                      /* why? we need an lvalue as input... gcc33...        */\n"
++	"                                      /* (carrbc1@wfu.edu)                                  */\n"
+     "                                      /*                                                    */\n"
+     ".rept 4                    ;          /* Loop for 4 lines                                   */\n"
+     " movd        (%%eax), %%mm1;          /* 4 Pixels from filtered frame to mm1                */\n"
+@@ -270,7 +273,7 @@
+     "                                      /*                                                    */\n"
+     " movq         %%mm0 , %0   ;          /* make mm0 available to gcc ...                      */\n"
+     :"=m" (a)     
+-    :"m" (frm), "m" (ref), "m" (denoiser.frame.w/2)
++    :"m" (frm), "m" (ref), "m" (denoiser.frame.w)
+     :"%eax", "%ebx", "%ecx"
+     );
+ #endif
+@@ -295,7 +298,10 @@
+     " movl         %1    , %%eax;          /* load frameadress into eax                          */\n"
+     " movl         %2    , %%ebx;          /* load frameadress into ebx                          */\n"
+     " movl         %3    , %%ecx;          /* load width       into ecx                          */\n"
+-    "                           ;          /*                                                    */\n"
++	" shrl         $1    , %%ecx;          /* shift width to scale it in the asm.                */\n"
++	"                                      /* why? we need an lvalue as input... gcc33...        */\n"
++	"                                      /* (carrbc1@wfu.edu)                                  */\n"
++    "                                      /*                                                    */\n"
+     " .rept 4                   ;          /*                                                    */\n"
+     " movd        (%%eax), %%mm1;          /* 4 Pixels from filtered frame to mm1                */\n"
+     " movd        (%%ebx), %%mm2;          /* 4 Pixels from filtered frame to mm2                */\n"
+@@ -307,7 +313,7 @@
+     "                                      /*                                                    */\n"
+     " movq         %%mm0 , %0   ;          /* make mm0 available to gcc ...                      */\n"
+     :"=m" (a)     
+-    :"m" (frm), "m" (ref), "m" (denoiser.frame.w/2)
++    :"m" (frm), "m" (ref), "m" (denoiser.frame.w)
+     :"%eax", "%ebx", "%ecx"
+     );
+ #endif
+@@ -349,6 +355,7 @@
+   static uint32_t a;
+ #ifdef HAVE_ASM_MMX
+   static uint32_t bit_mask[2] = {0x7f7f7f7f,0x7f7f7f7f};
++  static uint32_t* bit_mask_addr = bit_mask;
+ 
+   __asm__ __volatile__
+       (
+@@ -380,7 +387,7 @@
+ 	  "                                      /*                                                    */"
+ 	  " movq         %%mm0 , %0   ;          /* make mm0 available to gcc ...                      */"
+ 	  :"=m" (a)     
+-	  :"m" (frm1),"m" (frm2), "m" (ref), "m" (denoiser.frame.w), "m" (bit_mask)
++	  :"m" (frm1),"m" (frm2), "m" (ref), "m" (denoiser.frame.w), "m" (bit_mask_addr)
+ 	  :"%eax", "%ebx", "%ecx", "%edx"
+ 	  );
+ #endif
diff -ruN multimedia/mjpegtools.orig/files/patch-mplex::systems.hh multimedia/mjpegtools/files/patch-mplex::systems.hh
--- multimedia/mjpegtools.orig/files/patch-mplex::systems.hh	Wed Dec 31 19:00:00 1969
+++ multimedia/mjpegtools/files/patch-mplex::systems.hh	Thu Mar  4 01:47:07 2004
@@ -0,0 +1,11 @@
+--- mplex/systems.hh.orig	Thu Mar  4 01:45:50 2004
++++ mplex/systems.hh	Thu Mar  4 01:46:04 2004
+@@ -4,6 +4,8 @@
+ #include <sys/param.h>
+ #include "inputstrm.hh"
+ 
++#include <cassert>
++
+ #include <vector>
+ 
+ using std::vector;

>Release-Note:
>Audit-Trail:

From: Mike Johnson <ahze@ahze.net>
To: freebsd-ports-bugs@FreeBSD.org, FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/63745: [Patch] multimedia/mjpegtools -- Fix build on 5.x
Date: Thu, 4 Mar 2004 03:01:53 -0500

 lav2divx & yuv2divx core dump and don't work.
 
 I'm not sure what to do about that.
 
Responsible-Changed-From-To: freebsd-ports-bugs->lioux 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Mar 4 03:59:29 PST 2004 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63745 
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Sat Mar 6 02:55:21 PST 2004 
State-Changed-Why:  
Committed, thanks, except getopt.h part which seems 
bogus (no /usr/include/getopt.h on -STABLE) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63745 
>Unformatted:
