Skip to content

Commit

Permalink
devel/libzakalwe: Add new port
Browse files Browse the repository at this point in the history
A Shared tools library required by the Unix Amiga Delitracker Emulator.
  • Loading branch information
ehaupt committed Sep 12, 2023
1 parent c9e55ae commit 2ded8fa
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 0 deletions.
1 change: 1 addition & 0 deletions devel/Makefile
Expand Up @@ -1455,6 +1455,7 @@
SUBDIR += libxo
SUBDIR += libxs
SUBDIR += libxtend
SUBDIR += libzakalwe
SUBDIR += libzim
SUBDIR += libzookeeper
SUBDIR += libzvbi
Expand Down
26 changes: 26 additions & 0 deletions 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>
3 changes: 3 additions & 0 deletions 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
37 changes: 37 additions & 0 deletions 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
30 changes: 30 additions & 0 deletions 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,
1 change: 1 addition & 0 deletions devel/libzakalwe/pkg-descr
@@ -0,0 +1 @@
A Shared tools library required by the Unix Amiga Delitracker Emulator.
22 changes: 22 additions & 0 deletions 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

0 comments on commit 2ded8fa

Please sign in to comment.