Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2013 21:58:28 +0200 (CEST)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/181786: [patch] multimedia/libxine: fix i386 clang build
Message-ID:  <201309031958.r83JwSbt088174@kalimero.tijl.coosemans.org>
Resent-Message-ID: <201309032000.r83K0067039250@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         181786
>Category:       ports
>Synopsis:       [patch] multimedia/libxine: fix i386 clang build
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 03 20:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Tijl Coosemans
>Release:        FreeBSD 10.0-CURRENT i386
>Organization:
>Environment:
>Description:
- Convert to USES=gmake perl5.
- Fix register allocation problems with clang on i386:
  * Remove the q modifier from inline asm such that clang no longer
    uses a 64 bit register.  Instead cast the operand to register_t
    which is 32 bit on i386 and 64 bit on amd64.
  * Add -fomit-frame-pointer to CFLAGS to free up an extra register.
- Fix the issue with WITH_DEBUG by removing some lines from
  patch-src_libreal_xine_real_audio_decoder.c that are already part
  of real_common.h.
- Patch configure so it no longer adds -mtune=i386 to CFLAGS.
>How-To-Repeat:
>Fix:

--- libxine.patch begins here ---
Index: multimedia/libxine/Makefile
===================================================================
--- multimedia/libxine/Makefile	(revision 325982)
+++ multimedia/libxine/Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 PORTNAME=	xine
 PORTVERSION=	1.2.2
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	multimedia ipv6
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}-lib/${PORTVERSION}
 PKGNAMEPREFIX=	lib
@@ -37,14 +37,13 @@ BUILD_DEPENDS+=	v4l_compat>=1.0.20100321
 LIB_DEPENDS+=	dvdcss.${DVDCSS_LIBVERSION}:${PORTSDIR}/multimedia/libdvdcss
 .endif
 
-USES=		pathfix pkgconfig iconv
+USES=		gmake iconv pathfix perl5 pkgconfig
 USE_XZ=		yes
 GNU_CONFIGURE=	yes
 WANT_GNOME=	yes
-USE_GMAKE=	yes
 USE_XORG=	sm x11 xv xinerama
 USE_GL=		gl glu
-USE_PERL5_BUILD=yes
+USE_PERL5=	build
 USE_SDL=	sdl
 USE_LDCONFIG=	yes
 CONFIGURE_ENV=	THREAD_CFLAGS="${PTHREAD_CFLAGS}" \
@@ -82,29 +81,8 @@ PATCH_DIST_ARGS=	-d ${WRKSRC} -p1 --forw
 
 .include <bsd.port.options.mk>
 
-# clang/i386 doesn't like
-#	src/post/deinterlace/plugins/greedy2frame_template_sse2.c :
-# [...]
-# ./greedy2frame_template_sse2.c:175:38: error: register %rax is only available in 64-bit mode
-#            "movdqa  (%3), %%xmm0               \n\t" /* xmm0 = T0 */
-#                                                  ^
-#<inline asm>:3:11: note: instantiated into assembly here
-#        movdqa  (%rax,%esi), %xmm3
-#                 ^~~~
-# [...]
 .if ${ARCH} == "i386"
-USE_GCC=	any
-.endif
-
-# Fix build WITH_DEBUG
-.if defined(WITH_DEBUG)
-DEBUG_FLAGS=	-g -O1
-.endif
-
-# Check for forced -O0 (or no -O)
-.if ${CFLAGS:M-O0} == "-O0" || (${CFLAGS:M-O} == "" && \
-	${CFLAGS:M-O[1-9a-z]*} == "")
-IGNORE=		only builds with -O1 or higher, check CFLAGS
+CFLAGS+=	-fomit-frame-pointer
 .endif
 
 .if ${PORT_OPTIONS:MNLS}
Index: multimedia/libxine/files/patch-configure
===================================================================
--- multimedia/libxine/files/patch-configure	(revision 325982)
+++ multimedia/libxine/files/patch-configure	(working copy)
@@ -9,7 +9,16 @@
          arch_x86=64
  
  $as_echo "#define ARCH_X86_64 /**/" >>confdefs.h
-@@ -26197,7 +26197,7 @@ fi
+@@ -20685,7 +20685,7 @@ fi
+ 
+                 if test "$sarchopt" != "no"; then
+                     case "$host_or_hostalias" in
+-                        i386-*)         archopt_val="i386" ;;
++                        i386-*)         ;;
+                         i486-*)         archopt_val="i486" ;;
+                         i586-*)         archopt_val="pentium" ;;
+                         pentium-mmx-*)  archopt_val="pentium-mmx" ;;
+@@ -26280,7 +26280,7 @@ fi
  
      if test x"$enable_dvb" != x"no"; then
          case "$host_os" in
Index: multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c
===================================================================
--- multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c	(revision 0)
+++ multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c	(working copy)
@@ -0,0 +1,28 @@
+--- src/post/deinterlace/plugins/greedy2frame_template_sse2.c.orig	2013-09-03 20:12:37.000000000 +0200
++++ src/post/deinterlace/plugins/greedy2frame_template_sse2.c	2013-09-03 20:22:34.000000000 +0200
+@@ -173,8 +173,8 @@
+         */
+             "movdqa  (%3), %%xmm1		\n\t" /* xmm1 = T1 */
+             "movdqa  (%4), %%xmm0		\n\t" /* xmm0 = T0 */
+-            "movdqa  (%q5,%3), %%xmm3		\n\t" /* xmm3 = B1 */
+-            "movdqa  (%q5,%4), %%xmm2		\n\t" /* xmm2 = B0 */
++            "movdqa  (%3,%5), %%xmm3		\n\t" /* xmm3 = B1 */
++            "movdqa  (%4,%5), %%xmm2		\n\t" /* xmm2 = B0 */
+ 
+             /* calculate |T1-T0| keep T1 put result in xmm5 */
+             "movdqa  %%xmm1, %%xmm5		\n\t"
+@@ -192,11 +192,11 @@
+             "pcmpgtb %1, %%xmm5			\n\t"
+             "pcmpeqd %%xmm7, %%xmm5		\n\t"
+ 
+-            "prefetcht0  64(%q5,%3)		\n\t"
+-            "prefetcht0  64(%q5,%4)		\n\t"
++            "prefetcht0  64(%3,%5)		\n\t"
++            "prefetcht0  64(%4,%5)		\n\t"
+           :
+           : "r" (M1), "m" (GreedyTwoFrameThreshold128),
+-            "m" (*Destc), "r" (T1), "r" (T0), "r" (Pitch) );
++            "m" (*Destc), "r" (T1), "r" (T0), "r" ((register_t)Pitch) );
+ 
+           asm volatile (
+             /* calculate |B1-B0| keep B1 put result in xmm4 */
Index: multimedia/libxine/files/patch-src_libreal_xine_real_audio_decoder.c
===================================================================
--- multimedia/libxine/files/patch-src_libreal_xine_real_audio_decoder.c	(revision 325982)
+++ multimedia/libxine/files/patch-src_libreal_xine_real_audio_decoder.c	(working copy)
@@ -1,20 +1,15 @@
 --- src/libreal/xine_real_audio_decoder.c.orig	2008-01-01 22:30:08.000000000 +0900
 +++ src/libreal/xine_real_audio_decoder.c	2008-01-20 01:44:15.000000000 +0900
-@@ -45,6 +45,19 @@
+@@ -45,6 +45,14 @@
  
  #include "real_common.h"
  
 +#if defined(__FreeBSD__)
-+void ___brk_addr(void) {exit(0);}
-+void __ctype_b(void) {exit(0);}
 +void __strtod_internal(void) {exit(0);}
 +void __strtold_internal(void) {exit(0);}
 +void __strtof_internal(void) {exit(0);}
 +void __errno_location(void) {exit(0);}
 +void dl_iterate_phdr(void) {exit(0);}
-+char **__environ={NULL};
-+#undef stderr
-+FILE *stderr=NULL;
 +#endif
 +
  typedef struct {
--- libxine.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309031958.r83JwSbt088174>