Stefan Hagen wrote:
> Daniël Hörchner wrote:
> > Hi, On OpenBSD Ports (https://openports.se/) some projects are maintained
> > by "The OpenBSD ports mailing-list".I would like to see the port of
> > uCON64 (https://openports.se/emulators/ucon64) updated, because version
> > 2.2.2 was released last month.How does this work? Will one of you just
> > pick it up or should I contact someone in particular? Kind regards,Dani?l
> 
> The fastest way is to updated it and send the patch to this mailing 
> list. Otherwise, asking here is good too.
> 
> Below the diff for the update to version 2.2.2.
> 
> Port changes:
> - bump version, removed revision
> - patches have been upstreamed
> 
> If there are no objections, I'll do more testing in the next days and 
> commit.

Hi all,

In a private follow up email, Daniël asked if it would be possible
to include the libcd64 extension that can be enabled with the
--with-libcd64 configure switch on amd64 and i386.

I tried it and it failed right away with the error "gcc not found".

Then I looked at the Makefiles a bit closer and realized that our build 
leads to many warnings because we're running clang, but end up in most 
gcc branches within the Makefiles. But only the cd64 Makefile fails.

The reason is, that the Makefiles examine CC and react in case they find 
clang or gcc there. This lead to an error on libcd64 because this 
Makefile set CC=gcc when CC is "cc".

Patching the Makefiles would be messy, so I decided to set CC to what the 
Makefile expects in the hope that this is fine for our ports system.

The patch below:
- includes libcd64 for amd64 and i368
- sets CC to clang on clang archs and gcc on gcc archs
- adds PFRAG.cd64 to allow the partial installation of libcd64.so
- reformats the arch ".if" for better readability (at least my brain
  works better with foo || bar instead of !foo && !bar)

I tested the diff on amd64 (clang) and sparc64 (gcc).

Better ideas?
OK?

Best Regards,
Stefan

Index: emulators/ucon64/Makefile
===================================================================
RCS file: /home/cvs/ports/emulators/ucon64/Makefile,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 Makefile
--- emulators/ucon64/Makefile   15 Dec 2021 19:38:35 -0000      1.11
+++ emulators/ucon64/Makefile   18 Dec 2021 19:00:38 -0000
@@ -4,6 +4,7 @@ COMMENT =       swiss army knife for video gam
 
 DISTNAME =     ucon64-2.2.2-src
 PKGNAME =      ${DISTNAME:S/-src//}
+REVISION =     0
 
 CATEGORIES =   emulators
 
@@ -18,12 +19,16 @@ MASTER_SITES =      ${MASTER_SITE_SOURCEFORGE
 
 WRKSRC =       ${WRKDIST}/src
 
-CONFIGURE_STYLE = gnu
+CONFIGURE_STYLE =      gnu
 
-CONFIGURE_ARGS = --disable-dload --with-libdiscmage
+CONFIGURE_ARGS =       --disable-dload --with-libdiscmage
 
-.if ${MACHINE_ARCH} != "amd64" && ${MACHINE_ARCH} != "i386"
-CONFIGURE_ARGS += --disable-parallel
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+PKG_ARGS +=            -Dcd64=1
+CONFIGURE_ARGS +=      --with-libcd64
+.else
+PKG_ARGS +=            -Dcd64=0
+CONFIGURE_ARGS +=      --disable-parallel
 .endif
 
 USE_GMAKE =    Yes
@@ -31,13 +36,23 @@ USE_GMAKE = Yes
 NO_TEST =      Yes
 
 pre-configure:
-       @sed -i 's,-O3,,' ${WRKSRC}/Makefile \
+       @sed -i 's,-O3 ,,' ${WRKSRC}/Makefile \
+               ${WRKSRC}/backup/libcd64/Makefile \
                ${WRKSRC}/libdiscmage/Makefile.in
 
 do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/ucon64 ${PREFIX}/bin
        ${INSTALL_DATA} ${WRKSRC}/libdiscmage/libdiscmage.so ${PREFIX}/lib
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+       ${INSTALL_DATA} ${WRKSRC}/backup/libcd64/libcd64.so ${PREFIX}/lib
+.endif
        ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/ucon64
        ${INSTALL_DATA} ${WRKDIST}/faq.html ${PREFIX}/share/doc/ucon64
 
 .include <bsd.port.mk>
+
+.if ${CHOSEN_COMPILER} == "base-clang"
+MAKE_FLAGS =   CC=clang
+.else
+MAKE_FLAGS =   CC=gcc
+.endif
Index: emulators/ucon64/pkg/PFRAG.cd64
===================================================================
RCS file: emulators/ucon64/pkg/PFRAG.cd64
diff -N emulators/ucon64/pkg/PFRAG.cd64
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ emulators/ucon64/pkg/PFRAG.cd64     18 Dec 2021 18:31:46 -0000
@@ -0,0 +1,2 @@
+@comment $OpenBSD: PFRAG.cd64,v 1.3 2020/12/05 16:53:26 fcambus Exp $
+@so lib/libcd64.so
Index: emulators/ucon64/pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/emulators/ucon64/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 PLIST
--- emulators/ucon64/pkg/PLIST  5 Dec 2020 16:53:26 -0000       1.3
+++ emulators/ucon64/pkg/PLIST  18 Dec 2021 18:46:01 -0000
@@ -1,5 +1,6 @@
-@comment $OpenBSD: PLIST,v 1.3 2020/12/05 16:53:26 fcambus Exp $
+@comment $OpenBSD: PLIST,v$
 @bin bin/ucon64
+%%cd64%%
 @so lib/libdiscmage.so
 share/doc/ucon64/
 share/doc/ucon64/faq.html

Reply via email to