git: 198f2be1a57f - main - devel/z88dk: the port had been improved (+)

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Thu, 17 Nov 2022 08:45:24 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=198f2be1a57f6f1025f215ab8a5b8396af83a4cf

commit 198f2be1a57f6f1025f215ab8a5b8396af83a4cf
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-11-17 08:43:54 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-11-17 08:43:54 +0000

    devel/z88dk: the port had been improved (+)
    
    - Fix the test suite (renew dependency list, patch some loose ends)
    - Switch to GNU m4 for the time being: while --define= command line
      option can be replaced with -D, there are other things that break
      against our system m4(1) particularly when running the test suite
    - Strip several binaries upon installation as reported by stage Q/A
---
 devel/z88dk/Makefile                               | 23 +++++++++----------
 devel/z88dk/files/patch-src_common_t_run__tests.sh | 26 ++++++++++++++++++++++
 devel/z88dk/files/patch-src_z80asm_Makefile        | 17 ++++++++++++++
 devel/z88dk/files/patch-src_zx0_Makefile           | 13 +++++++++++
 4 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/devel/z88dk/Makefile b/devel/z88dk/Makefile
index 4ae9788f0f93..d4a0396c0da9 100644
--- a/devel/z88dk/Makefile
+++ b/devel/z88dk/Makefile
@@ -18,24 +18,19 @@ BUILD_DEPENDS=	dos2unix:converters/unix2dos \
 		p5-Path-Tiny>=0:devel/p5-Path-Tiny \
 		p5-YAML-Tiny>=0:textproc/p5-YAML-Tiny \
 		ragel:devel/ragel re2c:devel/re2c
-TEST_DEPENDS=	dos2unix:converters/unix2dos \
+TEST_DEPENDS=	dos2unix:converters/unix2dos gm4:devel/m4 \
 		p5-CPU-Z80-Assembler>=0:devel/p5-CPU-Z80-Assembler \
 		p5-Capture-Tiny>=0:devel/p5-Capture-Tiny \
-		p5-Capture-Tiny-Extended>=0:devel/p5-Capture-Tiny-Extended \
-		p5-Clone>=0:devel/p5-Clone \
 		p5-Data-Dump>=0:devel/p5-Data-Dump \
 		p5-Data-HexDump>=0:devel/p5-Data-HexDump \
-		p5-File-Slurp>=0:devel/p5-File-Slurp \
 		p5-Iterator-Simple-Lookahead>=0:devel/p5-Iterator-Simple-Lookahead \
-		p5-List-Uniq>=0:devel/p5-List-Uniq \
 		p5-Modern-Perl>=0:lang/p5-Modern-Perl \
-		p5-Object-Tiny-RW>=0:devel/p5-Object-Tiny-RW \
 		p5-Path-Tiny>=0:devel/p5-Path-Tiny \
 		p5-Regexp-Common>=0:textproc/p5-Regexp-Common \
-		p5-Template-Plugin-YAML>=0:textproc/p5-Template-Plugin-YAML \
-		p5-Test-Differences>=0:devel/p5-Test-Differences \
-		p5-Test-HexDifferences>=0:devel/p5-Test-HexDifferences \
-		p5-Text-Table>=0:textproc/p5-Text-Table
+		p5-Text-Diff>=0:textproc/p5-Text-Diff \
+		p5-Text-Table>=0:textproc/p5-Text-Table \
+		p5-YAML-Tiny>=0:textproc/p5-YAML-Tiny
+RUN_DEPENDS=	gm4:devel/m4
 
 USES=		gmake gnome perl5 shebangfix tar:tgz
 USE_GNOME=	libxml2
@@ -52,10 +47,14 @@ post-patch:
 		${WRKSRC}/src/z80asm/parse_ragel.pl
 	@${REINPLACE_CMD} -e 's,dos2unix -q,dos2unix,' \
 		${WRKSRC}/src/z80asm/Makefile
+	@${REINPLACE_CMD} -e 's/process(".m4", ext, "/&g/' \
+		${WRKSRC}/src/zcc/zcc.c
 	@${REINPLACE_CMD} -e 's,"make,"${MAKE_CMD},' \
 		${WRKSRC}/src/zobjcopy/t/test.t
-	@${REINPLACE_CMD} -e '/\/bin\//s,bash,sh,' \
-		${WRKSRC}/src/common/t/run_tests.sh
+	@${REINPLACE_CMD} -e '179s/$$(CFLAGS)/$$(filter -O%,&)/' \
+		${WRKSRC}/support/multitarget_build/Makefile
+	@${REINPLACE_CMD} -e '/^CFLAGS =/s,$$, -I../../../include,' \
+		${WRKSRC}/test/suites/make.config
 
 pre-build:
 	${LN} -sf z88dk/bin ${BINARY_LINKDIR}
diff --git a/devel/z88dk/files/patch-src_common_t_run__tests.sh b/devel/z88dk/files/patch-src_common_t_run__tests.sh
new file mode 100644
index 000000000000..b50394988f06
--- /dev/null
+++ b/devel/z88dk/files/patch-src_common_t_run__tests.sh
@@ -0,0 +1,26 @@
+--- src/common/t/run_tests.sh.orig	2022-07-06 03:00:02 UTC
++++ src/common/t/run_tests.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ 
+ set +e        # allow tests to fail without aborting make test
+ 
+@@ -10,7 +10,7 @@ for t in $( cat t/test1.hh | sed -e 's/^[^"]*"//' -e '
+ 		touch $f
+ 	fi
+ 	
+-	nr=$[$nr+1]
++	nr=$((nr+1))
+ 	t/test $t > $f.mine.stdout 2> $f.mine.stderr
+ 	rv=$?
+ 	(echo stdout: ; cat $f.mine.stdout ; echo stderr: ; cat $f.mine.stderr ; echo exit: $rv ) > $f.mine
+@@ -25,7 +25,7 @@ for t in $( cat t/test1.hh | sed -e 's/^[^"]*"//' -e '
+ 		else
+ 			diff -w $f $f.mine | sed -e 's/^/\# /'
+ 		fi
+-		fail=$[$fail+1]
++		fail=$((fail+1))
+ 	fi
+ done
+ 
diff --git a/devel/z88dk/files/patch-src_z80asm_Makefile b/devel/z88dk/files/patch-src_z80asm_Makefile
new file mode 100644
index 000000000000..9a8f8ff59c71
--- /dev/null
+++ b/devel/z88dk/files/patch-src_z80asm_Makefile
@@ -0,0 +1,17 @@
+--- src/z80asm/Makefile.orig	2022-07-10 03:00:02 UTC
++++ src/z80asm/Makefile
+@@ -155,10 +155,10 @@ install: $(PROJ)$(EXESUFFIX) z80asm_lib
+ # install
+ #------------------------------------------------------------------------------
+ install: $(PROJ)$(EXESUFFIX) z80asm_lib
+-	$(INSTALL) $(PROJ)$(EXESUFFIX)     $(PREFIX)/bin/$(PROJ)$(EXESUFFIX)
+-	$(INSTALL) $(PROJ)$(EXESUFFIX)     $(PREFIX)/bin/$(BARE_PROJ)$(EXESUFFIX)
+-	$(INSTALL) asmpp.pl      $(PREFIX)/bin/z88dk-asmpp
+-	$(INSTALL) asmstyle.pl   $(PREFIX)/bin/z88dk-asmstyle
++	$(BSD_INSTALL_PROGRAM) $(PROJ)$(EXESUFFIX) $(PREFIX)/bin/$(PROJ)$(EXESUFFIX)
++	$(BSD_INSTALL_PROGRAM) $(PROJ)$(EXESUFFIX) $(PREFIX)/bin/$(BARE_PROJ)$(EXESUFFIX)
++	$(BSD_INSTALL_SCRIPT) asmpp.pl $(PREFIX)/bin/z88dk-asmpp
++	$(BSD_INSTALL_SCRIPT) asmstyle.pl $(PREFIX)/bin/z88dk-asmstyle
+ ifeq ($(CROSS),0)
+ 	$(MAKE) -C dev/z80asm_lib install PREFIX=$(PREFIX_SHARE)
+ endif
diff --git a/devel/z88dk/files/patch-src_zx0_Makefile b/devel/z88dk/files/patch-src_zx0_Makefile
new file mode 100644
index 000000000000..070739f4dee2
--- /dev/null
+++ b/devel/z88dk/files/patch-src_zx0_Makefile
@@ -0,0 +1,13 @@
+--- src/zx0/Makefile.orig	2021-02-08 03:00:08 UTC
++++ src/zx0/Makefile
+@@ -23,8 +23,8 @@ install: z88dk-zx0$(EXESUFFIX) z88dk-dzx0$(EXESUFFIX)
+ 	$(CC) -o z88dk-dzx0$(EXESUFFIX) $(LDFLAGS) $^
+ 
+ install: z88dk-zx0$(EXESUFFIX) z88dk-dzx0$(EXESUFFIX)
+-	$(INSTALL) z88dk-zx0$(EXESUFFIX) $(PREFIX)/bin/z88dk-zx0$(EXESUFFIX)
+-	$(INSTALL) z88dk-dzx0$(EXESUFFIX) $(PREFIX)/bin/z88dk-dzx0$(EXESUFFIX)
++	$(BSD_INSTALL_PROGRAM) z88dk-zx0$(EXESUFFIX) $(PREFIX)/bin/z88dk-zx0$(EXESUFFIX)
++	$(BSD_INSTALL_PROGRAM) z88dk-dzx0$(EXESUFFIX) $(PREFIX)/bin/z88dk-dzx0$(EXESUFFIX)
+ 
+ clean:
+ 	$(RM) z88dk-zx0$(EXESUFFIX) $(OBJS)