git: 538a001f90bb - main - archivers/zstd: Change build system from meson to gmake

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sat, 27 Aug 2022 10:31:05 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=538a001f90bbf14b5bdaa556119925699adb1849

commit 538a001f90bbf14b5bdaa556119925699adb1849
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-08-27 10:23:30 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-08-27 10:23:30 +0000

    archivers/zstd: Change build system from meson to gmake
    
    - Use BINARY_ALIAS and remove TEST_DEPENDS: md5sum from base system works fine
    - Remove TEST option
    - Bump PORTREVISION for package change
    
    from README.md [1]:
    make is the officially maintained build system of this project. All other build
    systems are "compatible" and 3rd-party maintained, they may feature small
    differences in advanced options. When your system allows it, prefer using make
    to build zstd and libzstd.
    
    Reference:      https://github.com/facebook/zstd/blob/dev/README.md#build-instructions [1]
---
 archivers/zstd/Makefile                      | 31 ++++++++--------
 archivers/zstd/files/patch-lib-Makefile      | 55 ++++++++++++++++++++++++++++
 archivers/zstd/files/patch-programs-Makefile | 44 ++++++++++++++++++++++
 archivers/zstd/files/patch-tests-meson.build | 27 --------------
 4 files changed, 115 insertions(+), 42 deletions(-)

diff --git a/archivers/zstd/Makefile b/archivers/zstd/Makefile
index 49255dbd1187..ed8af4b8bddf 100644
--- a/archivers/zstd/Makefile
+++ b/archivers/zstd/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	zstd
 PORTVERSION=	1.5.2
+PORTREVISION=	1
 CATEGORIES=	archivers
 MASTER_SITES=	https://github.com/facebook/zstd/releases/download/v${PORTVERSION}/
 
@@ -8,29 +9,29 @@ COMMENT=	Fast real-time compression algorithm
 
 LICENSE=	BSD3CLAUSE GPLv2
 LICENSE_COMB=	dual
-LICENSE_FILE_BSD3CLAUSE=${WRKSRC}/../../LICENSE
-LICENSE_FILE_GPLv2=	${WRKSRC}/../../COPYING
+LICENSE_FILE_BSD3CLAUSE=${WRKSRC}/LICENSE
+LICENSE_FILE_GPLv2=	${WRKSRC}/COPYING
 
-TEST_DEPENDS=	gmd5sum:sysutils/coreutils
+LIB_DEPENDS=	liblz4.so:archivers/liblz4
 
-USES=		meson pkgconfig python:3.7+,build shebangfix tar:zst
+USES=		gmake localbase:ldflags tar:zst
 
-MESON_ARGS=	-Ddefault_library=both
+ALL_TARGET=	default
+BINARY_ALIAS=	gmd5sum=md5sum
+TEST_TARGET=	test
 USE_LDCONFIG=	yes
-WRKSRC_SUBDIR=	build/meson
 
 PLIST_SUB=	PORTVERSION=${PORTVERSION}
 
-SHEBANG_FILES=	*.py
+OPTIONS_DEFINE=	OPTIMIZED_CFLAGS
 
-OPTIONS_DEFINE=	LTO LZ4 OPTIMIZED_CFLAGS TEST
-OPTIONS_DEFAULT=LZ4
-
-LTO_MESON_TRUE=		b_lto
-LZ4_LIB_DEPENDS=	liblz4.so:archivers/liblz4
-LZ4_MESON_ENABLED=	lz4
-LZ4_USES=		localbase:ldflags
 OPTIMIZED_CFLAGS_VARS=	CFLAGS+=-O3
-TEST_MESON_TRUE=	bin_tests
+
+post-build:
+	cd ${WRKSRC}/programs && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} zstd-frugal
+
+post-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/programs/zstd-frugal ${STAGEDIR}${PREFIX}/bin/zstd-frugal
+	${LN} -s zstd.1.gz ${STAGEDIR}${PREFIX}/man/man1/zstdmt.1.gz
 
 .include <bsd.port.mk>
diff --git a/archivers/zstd/files/patch-lib-Makefile b/archivers/zstd/files/patch-lib-Makefile
new file mode 100644
index 000000000000..a769fa8296c7
--- /dev/null
+++ b/archivers/zstd/files/patch-lib-Makefile
@@ -0,0 +1,55 @@
+% sed -i .orig -e 's|INSTALL_|BSD_&|' lib/Makefile
+
+--- lib/Makefile.orig	2022-01-20 21:17:18 UTC
++++ lib/Makefile
+@@ -292,8 +292,8 @@ else
+   INSTALL ?= install
+ endif
+ 
+-INSTALL_PROGRAM ?= $(INSTALL)
+-INSTALL_DATA    ?= $(INSTALL) -m 644
++BSD_INSTALL_PROGRAM ?= $(INSTALL)
++BSD_INSTALL_DATA    ?= $(INSTALL) -m 644
+ 
+ 
+ libzstd.pc: libzstd.pc.in
+@@ -314,7 +314,7 @@ install: install-pc install-static install-shared inst
+ .PHONY: install-pc
+ install-pc: libzstd.pc
+ 	[ -e $(DESTDIR)$(PKGCONFIGDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
+-	$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
++	$(BSD_INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
+ 
+ .PHONY: install-static
+ install-static:
+@@ -322,7 +322,7 @@ install-static:
+ 	[ -e libzstd.a ] || $(MAKE) libzstd.a-release
+ 	[ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
+ 	@echo Installing static library
+-	$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
++	$(BSD_INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
+ 
+ .PHONY: install-shared
+ install-shared:
+@@ -330,7 +330,7 @@ install-shared:
+ 	[ -e $(LIBZSTD) ] || $(MAKE) libzstd-release
+ 	[ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
+ 	@echo Installing shared library
+-	$(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
++	$(BSD_INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
+ 	ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
+ 	ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
+ 
+@@ -338,9 +338,9 @@ install-shared:
+ install-includes:
+ 	[ -e $(DESTDIR)$(INCLUDEDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
+ 	@echo Installing includes
+-	$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
+-	$(INSTALL_DATA) zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
+-	$(INSTALL_DATA) zdict.h $(DESTDIR)$(INCLUDEDIR)
++	$(BSD_INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
++	$(BSD_INSTALL_DATA) zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
++	$(BSD_INSTALL_DATA) zdict.h $(DESTDIR)$(INCLUDEDIR)
+ 
+ .PHONY: uninstall
+ uninstall:
diff --git a/archivers/zstd/files/patch-programs-Makefile b/archivers/zstd/files/patch-programs-Makefile
new file mode 100644
index 000000000000..ee30a0cacc19
--- /dev/null
+++ b/archivers/zstd/files/patch-programs-Makefile
@@ -0,0 +1,44 @@
+% sed -i .orig -e 's|INSTALL_|BSD_&|' programs/Makefile
+
+--- programs/Makefile.orig	2022-01-20 21:17:18 UTC
++++ programs/Makefile
+@@ -391,10 +391,10 @@ else
+   INSTALL ?= install
+ endif
+ 
+-INSTALL_PROGRAM ?= $(INSTALL)
+-INSTALL_SCRIPT  ?= $(INSTALL_PROGRAM)
+-INSTALL_DATA    ?= $(INSTALL) -m 644
+-INSTALL_MAN     ?= $(INSTALL_DATA)
++BSD_INSTALL_PROGRAM ?= $(INSTALL)
++BSD_INSTALL_SCRIPT  ?= $(INSTALL_PROGRAM)
++BSD_INSTALL_DATA    ?= $(INSTALL) -m 644
++BSD_INSTALL_MAN     ?= $(INSTALL_DATA)
+ 
+ .PHONY: install
+ install:
+@@ -403,18 +403,18 @@ install:
+ 	[ -e $(DESTDIR)$(BINDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/
+ 	[ -e $(DESTDIR)$(MAN1DIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)/
+ 	@echo Installing binaries
+-	$(INSTALL_PROGRAM) zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT)
++	$(BSD_INSTALL_PROGRAM) zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT)
+ 	ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdcat$(EXT)
+ 	ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/unzstd$(EXT)
+ 	ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdmt$(EXT)
+-	$(INSTALL_SCRIPT) zstdless $(DESTDIR)$(BINDIR)/zstdless
+-	$(INSTALL_SCRIPT) zstdgrep $(DESTDIR)$(BINDIR)/zstdgrep
++	$(BSD_INSTALL_SCRIPT) zstdless $(DESTDIR)$(BINDIR)/zstdless
++	$(BSD_INSTALL_SCRIPT) zstdgrep $(DESTDIR)$(BINDIR)/zstdgrep
+ 	@echo Installing man pages
+-	$(INSTALL_MAN) zstd.1 $(DESTDIR)$(MAN1DIR)/zstd.1
++	$(BSD_INSTALL_MAN) zstd.1 $(DESTDIR)$(MAN1DIR)/zstd.1
+ 	ln -sf zstd.1 $(DESTDIR)$(MAN1DIR)/zstdcat.1
+ 	ln -sf zstd.1 $(DESTDIR)$(MAN1DIR)/unzstd.1
+-	$(INSTALL_MAN) zstdgrep.1 $(DESTDIR)$(MAN1DIR)/zstdgrep.1
+-	$(INSTALL_MAN) zstdless.1 $(DESTDIR)$(MAN1DIR)/zstdless.1
++	$(BSD_INSTALL_MAN) zstdgrep.1 $(DESTDIR)$(MAN1DIR)/zstdgrep.1
++	$(BSD_INSTALL_MAN) zstdless.1 $(DESTDIR)$(MAN1DIR)/zstdless.1
+ 	@echo zstd installation completed
+ 
+ .PHONY: uninstall
diff --git a/archivers/zstd/files/patch-tests-meson.build b/archivers/zstd/files/patch-tests-meson.build
deleted file mode 100644
index 08e972a33fb8..000000000000
--- a/archivers/zstd/files/patch-tests-meson.build
+++ /dev/null
@@ -1,27 +0,0 @@
---- tests/meson.build.orig	2020-05-22 05:04:00 UTC
-+++ tests/meson.build
-@@ -143,15 +143,15 @@ checkTag = executable('checkTag',
- # Tests (Use "meson test --list" to list all tests)
- # =============================================================================
- 
--if tests_supported_oses.contains(host_machine_os)
--  valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: true)
--  valgrindTest_py = files('valgrindTest.py')
--  test('valgrindTest',
--    valgrindTest_py,
--    args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench],
--    depends: [zstd, datagen, fuzzer, fullbench],
--    timeout: 600) # Timeout should work on HDD drive
--endif
-+#if tests_supported_oses.contains(host_machine_os)
-+#  valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: true)
-+#  valgrindTest_py = files('valgrindTest.py')
-+#  test('valgrindTest',
-+#    valgrindTest_py,
-+#    args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench],
-+#    depends: [zstd, datagen, fuzzer, fullbench],
-+#    timeout: 600) # Timeout should work on HDD drive
-+#endif
- 
- if host_machine_os != os_windows
-   playTests_sh = find_program(join_paths(zstd_rootdir, 'tests/playTests.sh'), required: true)