pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] fix build of freetype2 on aix with gcc



freetype2 fails to build on aix when using gcc.  This is because
freetype uses the -ansi flag with gcc, and this causes problems with
the aix system headers, leading to undefined symbols.

I've attached a patch that fixes the problem by having freetype not
use the -ansi flag with gcc on aix.  I also sent a patch upstream and
it was accepted, so the patch for pkgsrc should only be needed until
the next version of freetype2 is released and incorporated into
pkgsrc.

Here are the build errors that you get without the patch:

libtool: compile:  gcc -pedantic -ansi
-I/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/freetype-2.6/objs
-I./builds/unix
-I/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/freetype-2.6/include
-I/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/.buildlink/include
-c -Wall -O -fno-strict-aliasing -DFT_CONFIG_OPTION_SYSTEM_ZLIB
-DFT_CONFIG_OPTION_USE_BZIP2 "-DFT_CONFIG_CONFIG_H=<ftconfig.h>"
-DFT2_BUILD_LIBRARY "-DFT_CONFIG_MODULES_H=<ftmodule.h>"
builds/unix/ftsystem.c  -DPIC -o
/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/freetype-2.6/objs/.libs/ftsystem.o
builds/unix/ftsystem.c: In function 'ft_close_stream_by_munmap':
builds/unix/ftsystem.c:197:5: warning: implicit declaration of
function 'munmap' [-Wimplicit-function-declaration]
     munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
     ^
builds/unix/ftsystem.c: In function 'FT_Stream_Open':
builds/unix/ftsystem.c:234:18: error: storage size of 'stat_buf' isn't known
     struct stat  stat_buf;
                  ^
builds/unix/ftsystem.c:241:12: warning: implicit declaration of
function 'open' [-Wimplicit-function-declaration]
     file = open( filepathname, O_RDONLY );
            ^
builds/unix/ftsystem.c:241:32: error: 'O_RDONLY' undeclared (first use
in this function)
     file = open( filepathname, O_RDONLY );
                                ^
builds/unix/ftsystem.c:241:32: note: each undeclared identifier is
reported only once for each function it appears in
builds/unix/ftsystem.c:262:10: warning: implicit declaration of
function 'fstat' [-Wimplicit-function-declaration]
     if ( fstat( file, &stat_buf ) < 0 )
          ^
builds/unix/ftsystem.c:292:37: warning: implicit declaration of
function 'mmap' [-Wimplicit-function-declaration]
     stream->base = (unsigned char *)mmap( NULL,
                                     ^
builds/unix/ftsystem.c:294:43: error: 'PROT_READ' undeclared (first
use in this function)
                                           PROT_READ,
                                           ^
builds/unix/ftsystem.c:295:54: error: 'MAP_PRIVATE' undeclared (first
use in this function)
                                           MAP_FILE | MAP_PRIVATE,
                                                      ^
builds/unix/ftsystem.c:304:7: error: unknown type name 'ssize_t'
       ssize_t  total_read_count;
       ^
builds/unix/ftsystem.c:322:9: error: unknown type name 'ssize_t'
         ssize_t  read_count;
         ^
builds/unix/ftsystem.c:325:22: warning: implicit declaration of
function 'read' [-Wimplicit-function-declaration]
         read_count = read( file,
                      ^
builds/unix/ftsystem.c:346:5: warning: implicit declaration of
function 'close' [-Wimplicit-function-declaration]
     close( file );
     ^
builds/unix/ftsystem.c:234:18: warning: unused variable 'stat_buf'
[-Wunused-variable]
     struct stat  stat_buf;
                  ^
/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/freetype-2.6/builds/freetype.mk:207:
recipe for target
'/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/freetype-2.6/objs/ftsystem.lo'
failed
gmake: *** [/home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2/work/freetype-2.6/objs/ftsystem.lo]
Error 1
*** Error code 2

Stop.
bmake[1]: stopped in /home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2
*** Error code 1

Stop.
bmake: stopped in /home/pkgsrc/pkgsrc-2015Q4/graphics/freetype2
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/freetype2/distinfo,v
retrieving revision 1.55
diff -u -r1.55 distinfo
--- distinfo	3 Nov 2015 21:33:57 -0000	1.55
+++ distinfo	6 Mar 2016 09:34:46 -0000
@@ -6,3 +6,4 @@
 Size (freetype-2.6.tar.bz2) = 1726219 bytes
 SHA1 (patch-aa) = d89f3f452354129df49d02d5063e712b57e8ba0e
 SHA1 (patch-ab) = cb8c9552e2db1e1f3da3d20971c22f174e343162
+SHA1 (patch-builds_unix_configure) = 6d570cd3612b1b894ba2d5d207a5fad2fe99c449
Index: patches/patch-builds_unix_configure
===================================================================
RCS file: patches/patch-builds_unix_configure
diff -N patches/patch-builds_unix_configure
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-builds_unix_configure	6 Mar 2016 09:34:46 -0000
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- builds/unix/configure.orig	2016-03-06 09:17:54 +0000
++++ builds/unix/configure
+@@ -12815,6 +12815,9 @@ if test "x$GCC" = xyes; then
+   *-*-mingw*)
+     XX_ANSIFLAGS="-pedantic"
+     ;;
++  *-*-aix*)
++    XX_ANSIFLAGS="-pedantic"
++    ;;
+   *)
+     GCC_VERSION=`$CC -dumpversion`
+     GCC_MAJOR=`echo "$GCC_VERSION" | sed 's/\([^.][^.]*\).*/\1/'`


Home | Main Index | Thread Index | Old Index