Saturday, May 02, 2020

Re: [macppc] Unbreak print/pdflib

On Sat, 02 May 2020 01:25:54 +0200
Jeremie Courreges-Anglas wrote:

> On Tue, Apr 28 2020, Charlene Wendling <julianaito@posteo.jp> wrote:
> > Before anything else, the version we ship is soon 18 years old.
> > Newer versions seem being closed source.
>
> I think we should remove this port. Two other ports depend on it:
> - math/grace (we're at 5.1.15 from 2004, latest upstream is 5.1.25
> from 2015). Use of pdflib can be disabled in the current version
> with --without-pdf-library
> - print/bg5pdf (no update since import in 2001)
>
> However I suspect it would be nicer to wait after 6.7 is tagged to
> discuss the fate of those ports.
>
> > 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.
>
> Well in that case you might as well zap MASTER_SITES.

I did that in the following diff, i'll wait a bit before committing as
there were concerns about distribution rights.

> > Comments/feedback are welcome,
>
> ok jca@
>
> > 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 2 May 2020 09:12:42 -0000
@@ -3,16 +3,14 @@
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/
-
WANTLIB= m z jpeg png>=2 tiff>=35

LIB_DEPENDS= graphics/png \
@@ -38,6 +36,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

No comments:

Post a Comment