Bug 181786 - [patch] multimedia/libxine: fix i386 clang build
[patch] multimedia/libxine: fix i386 clang build
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Juergen Lock
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-03 21:00 UTC by Tijl Coosemans
Modified: 2013-10-23 22:40 UTC (History)
0 users

See Also:


Attachments
libxine.patch (5.25 KB, patch)
2013-09-03 21:00 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tijl Coosemans freebsd_committer 2013-09-03 21:00:00 UTC
- 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.
Comment 1 Edwin Groothuis freebsd_committer 2013-09-03 21:00:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nox

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 nox 2013-09-03 22:40:58 UTC
Hmm at least WITH_DEBUG still seems broken:

  CC     xine_real_video_decoder.lo
In file included from xine_real_video_decoder.c:49:
real_common.h:49: error: '__environ' defined both normally and as an alias
real_common.h:59: error: 'stderr' defined both normally and as an alias
gmake[2]: *** [xine_real_video_decoder.lo] Error 1
gmake[2]: Leaving directory `/data/ports/multimedia/libxine/work/xine-lib-1.2.2/src/libreal'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/data/ports/multimedia/libxine/work/xine-lib-1.2.2/src'
gmake: *** [all-recursive] Error 1
*** Error code 1

 Thanx, :)
	Juergen
Comment 3 Tijl Coosemans freebsd_committer 2013-09-03 23:11:58 UTC
On Tue, 3 Sep 2013 23:40:58 +0200 Juergen Lock wrote:
> Hmm at least WITH_DEBUG still seems broken:
> 
>   CC     xine_real_video_decoder.lo
> In file included from xine_real_video_decoder.c:49:
> real_common.h:49: error: '__environ' defined both normally and as an alias
> real_common.h:59: error: 'stderr' defined both normally and as an alias
> gmake[2]: *** [xine_real_video_decoder.lo] Error 1
> gmake[2]: Leaving directory `/data/ports/multimedia/libxine/work/xine-lib-1.2.2/src/libreal'
> gmake[1]: *** [all-recursive] Error 1
> gmake[1]: Leaving directory `/data/ports/multimedia/libxine/work/xine-lib-1.2.2/src'
> gmake: *** [all-recursive] Error 1
> *** Error code 1
> 
>  Thanx, :)
> 	Juergen

Hmm, can you grep for stderr (and environ) in src/libreal ?
Comment 4 dfilter freebsd_committer 2013-09-04 17:45:22 UTC
Author: nox
Date: Wed Sep  4 16:45:13 2013
New Revision: 326292
URL: http://svnweb.freebsd.org/changeset/ports/326292

Log:
  - 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 adding --disable-real-codecs
    which apparently never really worked anyway.
  - Patch configure so it no longer adds -mtune=i386 to CFLAGS.
  - Bump PORTREVISION.
  
  PR:		ports/181786
  Submitted by:	tijl

Added:
  head/multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c   (contents, props changed)
Deleted:
  head/multimedia/libxine/files/patch-src_libreal_real_common.c
  head/multimedia/libxine/files/patch-src_libreal_xine_real_audio_decoder.c
Modified:
  head/multimedia/libxine/Makefile
  head/multimedia/libxine/files/patch-configure   (contents, props changed)
  head/multimedia/libxine/pkg-plist

Modified: head/multimedia/libxine/Makefile
==============================================================================
--- head/multimedia/libxine/Makefile	Wed Sep  4 16:42:19 2013	(r326291)
+++ head/multimedia/libxine/Makefile	Wed Sep  4 16:45:13 2013	(r326292)
@@ -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}" \
@@ -60,6 +59,7 @@ CONFIGURE_ARGS=	--with-w32-path=${LOCALB
 		--with-libflac \
 		--with-external-ffmpeg \
 		--with-external-libfaad \
+		--disable-real-codecs \
 		--disable-v4l \
 		--without-alsa \
 		--disable-musepack \
@@ -82,29 +82,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}

Modified: head/multimedia/libxine/files/patch-configure
==============================================================================
--- head/multimedia/libxine/files/patch-configure	Wed Sep  4 16:42:19 2013	(r326291)
+++ head/multimedia/libxine/files/patch-configure	Wed Sep  4 16:45:13 2013	(r326292)
@@ -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

Added: head/multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c	Wed Sep  4 16:45:13 2013	(r326292)
@@ -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 */

Modified: head/multimedia/libxine/pkg-plist
==============================================================================
--- head/multimedia/libxine/pkg-plist	Wed Sep  4 16:42:19 2013	(r326291)
+++ head/multimedia/libxine/pkg-plist	Wed Sep  4 16:45:13 2013	(r326292)
@@ -108,7 +108,6 @@ share/xine-lib/fonts/serif-64.xinefont.g
 %%PLUGINSDIR%%/xineplug_decode_mad.so
 %%PLUGINSDIR%%/xineplug_decode_mpeg2.so
 %%WITH_VIDIX%%%%PLUGINSDIR%%/xineplug_decode_qt.so
-%%PLUGINSDIR%%/xineplug_decode_real.so
 %%PLUGINSDIR%%/xineplug_decode_rgb.so
 %%PLUGINSDIR%%/xineplug_decode_spu.so
 %%PLUGINSDIR%%/xineplug_decode_spucc.so
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Juergen Lock freebsd_committer 2013-09-04 19:56:37 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 6 dfilter freebsd_committer 2013-10-23 22:33:14 UTC
Author: nox
Date: Wed Oct 23 21:33:06 2013
New Revision: 331432
URL: http://svnweb.freebsd.org/changeset/ports/331432

Log:
  (Attempt to) fix build on i386 by readding equivalent patch from
  ports/181786 that was lost in the update to 1.2.4 .
  
  PR:		ports/183248 [1], ports/181786 (related to)
  Submitted by:	Milan Obuch <bsd@dino.sk> [1]

Added:
  head/multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c   (contents, props changed)

Added: head/multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libxine/files/patch-src-post-deinterlace-plugins-greedy2frame_template_sse2.c	Wed Oct 23 21:33:06 2013	(r331432)
@@ -0,0 +1,28 @@
+--- src/post/deinterlace/plugins/greedy2frame_template_sse2.c.orig
++++ src/post/deinterlace/plugins/greedy2frame_template_sse2.c
+@@ -174,8 +174,8 @@ static void DeinterlaceGreedy2Frame_SSE2
+         */
+             "movdqa  (%2), %%xmm1		\n\t" /* xmm1 = T1 */
+             "movdqa  (%3), %%xmm0		\n\t" /* xmm0 = T0 */
+-            "movdqa  (%q4,%2), %%xmm3		\n\t" /* xmm3 = B1 */
+-            "movdqa  (%q4,%3), %%xmm2		\n\t" /* xmm2 = B0 */
++            "movdqa  (%2,%4), %%xmm3		\n\t" /* xmm3 = B1 */
++            "movdqa  (%3,%4), %%xmm2		\n\t" /* xmm2 = B0 */
+ 
+             /* calculate |T1-T0| keep T1 put result in xmm5 */
+             "movdqa  %%xmm1, %%xmm5		\n\t"
+@@ -192,11 +192,11 @@ static void DeinterlaceGreedy2Frame_SSE2
+             "pcmpgtb %0, %%xmm5			\n\t"
+             "pcmpeqd %%xmm7, %%xmm5		\n\t"
+ 
+-            "prefetcht0  64(%q4,%2)		\n\t"
+-            "prefetcht0  64(%q4,%3)		\n\t"
++            "prefetcht0  64(%2,%4)		\n\t"
++            "prefetcht0  64(%3,%4)		\n\t"
+           :
+           : "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 */
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"