Subject: pkg/25907: (patch) graphics/freetype2 needs -fno-strict-aliasing
To: None <gnats-bugs@gnats.NetBSD.org>
From: Christopher Richards <richards+netbsd@CS.Princeton.EDU>
List: pkgsrc-bugs
Date: 06/12/2004 08:16:14
>Number:         25907
>Category:       pkg
>Synopsis:       (patch) graphics/freetype2 needs -fno-strict-aliasing
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 12 12:45:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Christopher Richards
>Release:        NetBSD 2.0_BETA
>Organization:
>Environment:
	
	
System: NetBSD zembla.localdomain 2.0_BETA NetBSD 2.0_BETA (ZEMBLA) #4: Sun Jun 6 02:48:45 EDT 2004 richards@zembla.localdomain:/usr/obj/sys/arch/i386/compile/ZEMBLA i386
Architecture: i386
Machine: i386
>Description:
	When compiling freetype2-2.1.8 with newer (>= 2.95) versions
	of gcc, the compiler emits many warnings that the source code
	violates strict aliasing rules.
	
>How-To-Repeat:
	Compile the freetype2 package on NetBSD 1.6 or newer.
	
>Fix:
	Patch follows:

Index: graphics/freetype2/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/freetype2/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- graphics/freetype2/Makefile	29 May 2004 23:36:10 -0000	1.33
+++ graphics/freetype2/Makefile	12 Jun 2004 12:05:52 -0000
@@ -28,6 +28,7 @@
 PKGCONFIG_OVERRIDE=	builds/unix/freetype2.in
 
 .include "../../mk/bsd.prefs.mk"
+.include "../../mk/compiler.mk"
 
 .if defined(MKTTINTERP) &&	\
   !empty(MKTTINTERP:M[yY][eE][sS])
@@ -45,6 +46,14 @@
 .  endif
 .endif
 
+# source code breaks strict aliasing in gcc >= 2.95
+.if !empty(CC_VERSION:Mgcc-*)
+.  if empty(CC_VERSION:Mgcc-2.*) \
+      || !empty(CC_VERSION:Mgcc-2.95*)
+CFLAGS+=	-fno-strict-aliasing
+.  endif
+.endif
+
 post-configure:
 	cd ${WRKSRC} && ${LN} -s builds/unix/unix.mk config.mk
 .if ${OPSYS} == "IRIX"
>Release-Note:
>Audit-Trail:
>Unformatted: