Before anything else, the version we ship is soon 18 years old. Newer
versions seem being closed source.

So here is the failure in the current macppc bulk:

> /usr/bin/libtool --mode=compile cc -c -I/usr/local/include -DHAVE_DLFCN_H=1  
> -O2 -pipe   -DPDF_PLATFORM=\""OpenBSD 6.7"\"    ./p_basic.c
> cc -c -I/usr/local/include -DHAVE_DLFCN_H=1 -O2 -pipe -DPDF_PLATFORM="OpenBSD 
> 6.7" ./p_basic.c -fPIC -DPIC -o .libs/p_basic.o
> In file included from ./p_basic.c:42:
> In file included from ./p_intern.h:43:
> ./p_config.h:142:9: warning: 'PDF_PLATFORM' macro redefined 
> [-Wmacro-redefined]
> #define PDF_PLATFORM    "Mac OS"
> <command line>:2:9: note: previous definition is here
> #define PDF_PLATFORM "OpenBSD 6.7"
> ./p_basic.c:61:10: fatal error: 'Files.h' file not found
> #include <Files.h>

It appears that because ${WRKSRC}/pdflib/p_config.h assumes
__POWERPC__ is Mac OS 9 (no endianness involved). It's breaking with
clang because gcc does not define __POWERPC__.

Instead of patching, because that ifdef is at various places, i've
chosen to undef __POWERPC__ globally, reverting to the gcc situation.

With the below diff it builds on macppc [0]. I've updated HOMEPAGE,
the distfile is not fetchable from upstream, it's not due to that
change.

Comments/feedback are welcome,

Charlène.


[0] https://bin.charlenew.xyz/macppc/paths/print/pdflib.log


Index: Makefile
===================================================================
RCS file: /cvs/ports/print/pdflib/Makefile,v
retrieving revision 1.29
diff -u -p -u -p -r1.29 Makefile
--- Makefile    14 Jul 2019 00:39:39 -0000      1.29
+++ Makefile    28 Apr 2020 17:17:44 -0000
@@ -3,15 +3,15 @@
 COMMENT=               C library to produce PDF files
 
 DISTNAME=              pdflib-4.0.3
-REVISION =             5
+REVISION =             6
 CATEGORIES=            print
 SHARED_LIBS=           pdf     2.3
 
-HOMEPAGE=              http://www.pdflib.com/pdflib/
+HOMEPAGE=              https://www.pdflib.com/pdflib/
 
 PERMIT_PACKAGE=        Yes
 
-MASTER_SITES=          http://www.pdflib.com/pdflib/download/
+MASTER_SITES=          ${HOMEPAGE}download/
 
 WANTLIB=               m z jpeg png>=2 tiff>=35
 
@@ -38,6 +38,12 @@ CONFIGURE_ENV=               LDFLAGS="-L${LOCALBASE}/
 MAKE_ENV=              ${CONFIGURE_ENV}
 
 TEST_TARGET=           test
+
+# In various places in the code, it's assumed that the __POWERPC__ define
+# is Mac OS 9 specific, but our clang defines it as well, breaking the build.
+.if ${MACHINE_ARCH:Mpowerpc}
+CFLAGS +=              -U__POWERPC__
+.endif
 
 post-install:
        ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/pdflib

Reply via email to