git: 2ded8fa10c76 - main - devel/libzakalwe: Add new port

From: Emanuel Haupt <ehaupt_at_FreeBSD.org>
Date: Tue, 12 Sep 2023 19:34:49 UTC
The branch main has been updated by ehaupt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ded8fa10c76265b9d9a27cf75b817a977074848

commit 2ded8fa10c76265b9d9a27cf75b817a977074848
Author:     Emanuel Haupt <ehaupt@FreeBSD.org>
AuthorDate: 2023-09-12 19:24:06 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2023-09-12 19:24:06 +0000

    devel/libzakalwe: Add new port
    
    A Shared tools library required by the Unix Amiga Delitracker Emulator.
---
 devel/Makefile                                     |  1 +
 devel/libzakalwe/Makefile                          | 26 +++++++++++++++
 devel/libzakalwe/distinfo                          |  3 ++
 devel/libzakalwe/files/patch-Makefile              | 37 ++++++++++++++++++++++
 .../libzakalwe/files/patch-include_zakalwe_array.h | 30 ++++++++++++++++++
 devel/libzakalwe/pkg-descr                         |  1 +
 devel/libzakalwe/pkg-plist                         | 22 +++++++++++++
 7 files changed, 120 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 70aa3121432f..3e229e197e45 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1455,6 +1455,7 @@
     SUBDIR += libxo
     SUBDIR += libxs
     SUBDIR += libxtend
+    SUBDIR += libzakalwe
     SUBDIR += libzim
     SUBDIR += libzookeeper
     SUBDIR += libzvbi
diff --git a/devel/libzakalwe/Makefile b/devel/libzakalwe/Makefile
new file mode 100644
index 000000000000..e4db9c5a569b
--- /dev/null
+++ b/devel/libzakalwe/Makefile
@@ -0,0 +1,26 @@
+PORTNAME=	libzakalwe
+DISTVERSION=	g20230909
+CATEGORIES=	devel
+
+MAINTAINER=	ehaupt@FreeBSD.org
+COMMENT=	Shared tools library required by UADE
+WWW=		https://gitlab.com/hors/libzakalwe
+
+LICENSE=	BSD2CLAUSE
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+BUILD_DEPENDS=	bash:shells/bash
+
+USES=		gmake shebangfix
+USE_GITLAB=	yes
+GL_ACCOUNT=	hors
+GL_TAGNAME=	521bc3ba81d78859fb3cabae88dae6ebe41f9c03
+
+SHEBANG_FILES=	configure
+
+HAS_CONFIGURE=	yes
+
+post-patch:
+	@${REINPLACE_CMD} -e "s|gcc|${CC}|" ${WRKSRC}/configure
+
+.include <bsd.port.mk>
diff --git a/devel/libzakalwe/distinfo b/devel/libzakalwe/distinfo
new file mode 100644
index 000000000000..d80abfe5f73d
--- /dev/null
+++ b/devel/libzakalwe/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1694249586
+SHA256 (hors-libzakalwe-521bc3ba81d78859fb3cabae88dae6ebe41f9c03_GL0.tar.gz) = 2e43c83737c94d9b9b0ace39d85c2eb6b35d8f1f47a1fa9ba1eab1772d15a561
+SIZE (hors-libzakalwe-521bc3ba81d78859fb3cabae88dae6ebe41f9c03_GL0.tar.gz) = 333539
diff --git a/devel/libzakalwe/files/patch-Makefile b/devel/libzakalwe/files/patch-Makefile
new file mode 100644
index 000000000000..c6fd77224b5e
--- /dev/null
+++ b/devel/libzakalwe/files/patch-Makefile
@@ -0,0 +1,37 @@
+--- Makefile.orig	2022-10-06 20:04:46 UTC
++++ Makefile
+@@ -1,10 +1,10 @@
+-AR = ar
+-CC = cgcc
+-GCC = gcc
+-CFLAGS = -W -Wall -O2 -I include -g -pthread -D_DEFAULT_SOURCE
+-LDFLAGS = -lm -lpthread
++AR ?= ar
++CC ?= cgcc
++GCC ?= gcc
++CFLAGS += -W -Wall -I include -pthread -D_DEFAULT_SOURCE
++LDFLAGS += -lm -lpthread
+ INSTALL = install
+-PREFIX = /usr/local
++PREFIX ?= /usr/local
+ 
+ TEST_LINK_FLAG = -Wl,-rpath,.
+ 
+@@ -177,10 +177,13 @@ unix-support.o:	unix-support.c include/zakalwe/unix-su
+ unix-support.lo:	unix-support.c include/zakalwe/unix-support.h $(GENERAL_DEPS)
+ unix-support.o:	unix-support.c include/zakalwe/unix-support.h $(GENERAL_DEPS)
+ 
+-install:	all
+-	$(INSTALL) -m 644 libzakalwe.so "$(PREFIX)/lib"/
+-	mkdir -p -m 755 "$(PREFIX)/include/zakalwe"
+-	$(INSTALL) -m 644 include/zakalwe/*.h "$(PREFIX)/include/zakalwe"/
++strip:
++	strip libzakalwe.so
++
++install:	strip all
++	$(INSTALL) -m 644 libzakalwe.so "$(DESTDIR)$(PREFIX)/lib"/
++	mkdir -p -m 755 "$(DESTDIR)$(PREFIX)/include/zakalwe"
++	$(INSTALL) -m 644 include/zakalwe/*.h "$(DESTDIR)$(PREFIX)/include/zakalwe"/
+ 
+ clean:	
+ 	rm -f $(Z_TEST_BIN) *.o *.lo *.so
diff --git a/devel/libzakalwe/files/patch-include_zakalwe_array.h b/devel/libzakalwe/files/patch-include_zakalwe_array.h
new file mode 100644
index 000000000000..5890ddecd796
--- /dev/null
+++ b/devel/libzakalwe/files/patch-include_zakalwe_array.h
@@ -0,0 +1,30 @@
+--- include/zakalwe/array.h.orig	2022-10-06 20:04:46 UTC
++++ include/zakalwe/array.h
+@@ -13,7 +13,7 @@ extern "C" {
+ extern "C" {
+ #endif
+ 
+-static inline void *z_array_util_double_if_needed(void *ptr,
++static inline void *z_array_util_double_if_needed(void **ptr,
+ 						  const size_t num_members,
+ 						  size_t *num_allocated,
+ 						  const size_t size)
+@@ -24,10 +24,14 @@ static inline void *z_array_util_double_if_needed(void
+ 	if (!z_mul2_size_t(&new_num_allocated, *num_allocated, 2))
+ 		return NULL;
+ 	new_num_allocated = Z_MAX(new_num_allocated, 1);
+-	ptr = reallocarray(ptr, new_num_allocated, size);
+-	if (ptr != NULL)
+-		*num_allocated = new_num_allocated;
+-	return ptr;
++	// ptr = reallocarray(ptr, new_num_allocated, size);
++	void *new_ptr = realloc(*ptr, new_num_allocated * size);
++	if (new_ptr == NULL)
++		return NULL;
++
++	*ptr = new_ptr;
++	*num_allocated = new_num_allocated;
++	return new_ptr;
+ }
+ 
+ int _z_array_allocate(const size_t new_num_items,
diff --git a/devel/libzakalwe/pkg-descr b/devel/libzakalwe/pkg-descr
new file mode 100644
index 000000000000..03c142095a51
--- /dev/null
+++ b/devel/libzakalwe/pkg-descr
@@ -0,0 +1 @@
+A Shared tools library required by the Unix Amiga Delitracker Emulator.
diff --git a/devel/libzakalwe/pkg-plist b/devel/libzakalwe/pkg-plist
new file mode 100644
index 000000000000..2abbefb1aa3e
--- /dev/null
+++ b/devel/libzakalwe/pkg-plist
@@ -0,0 +1,22 @@
+include/zakalwe/array.h
+include/zakalwe/base.h
+include/zakalwe/bitfield.h
+include/zakalwe/char_array.h
+include/zakalwe/compiler.h
+include/zakalwe/config.h
+include/zakalwe/endianess.h
+include/zakalwe/file.h
+include/zakalwe/hash-utils.h
+include/zakalwe/input.h
+include/zakalwe/map.h
+include/zakalwe/math.h
+include/zakalwe/mem.h
+include/zakalwe/random.h
+include/zakalwe/size_t_array.h
+include/zakalwe/str_array.h
+include/zakalwe/string.h
+include/zakalwe/time.h
+include/zakalwe/tree.h
+include/zakalwe/unix-support.h
+include/zakalwe/ztree.h
+lib/libzakalwe.so