commit a3732bb6b798b7e4979938729f9047ebf6191027 from: Thomas Adam date: Sat Feb 26 17:37:09 2022 UTC portable: support NetBSD This adds support for NetBSD, using the following external dependencies: libuuid ncursesw There is no CI (yet) as enabling that on Cirrus-CI requires some work, so for now, these builds will be run manually before releases. The test suite will also need tweaking to be fully supported but the key tests are supported for now. commit - c0ec9f52ab701cae25bc952225bb5e21c2a0ab16 commit + a3732bb6b798b7e4979938729f9047ebf6191027 blob - ce2d4cc88d90c3611d0543805a07ce183e3989d7 blob + 4ba02d32941f40565485eceae7dc3ca2532d32f6 --- compat/Makefile.am +++ compat/Makefile.am @@ -34,6 +34,10 @@ if HOST_DARWIN libopenbsd_compat_a_SOURCES += uuid.c bsd-poll.c bsd-poll.h endif +if HOST_NETBSD +libopenbsd_compat_a_SOURCES += bsd-poll.c bsd-poll.h +endif + if HOST_LINUX libopenbsd_compat_a_SOURCES += uuid.c endif blob - 6276286954e17d1e3e2f6c42868c4f3c734eac38 blob + f8fad91edf58eb3afa4f49c52ddf717292fbce4f --- compat/bsd-poll.c +++ compat/bsd-poll.c @@ -27,6 +27,10 @@ #define MAX(_a,_b) ((_a) > (_b) ? (_a) : (_b)) #endif +#ifndef howmany +#define howmany(x,y) (((x)+((y)-1))/(y)) +#endif + /* * A minimal implementation of ppoll(2), built on top of pselect(2). * blob - 02490499adb28ffd6366dab21a4eeefd8f2af8ff blob + be4faec4993b5407d2ea0b2f06ddcce83b3787c5 --- compat/recallocarray.c +++ compat/recallocarray.c @@ -75,6 +75,8 @@ recallocarray(void *ptr, size_t oldnmemb, size_t newnm #ifdef __APPLE__ memset_s(ptr, oldsize, 0, oldsize); +#elif defined(__NetBSD__) + explicit_memset(ptr, oldsize, 0); #else explicit_bzero(ptr, oldsize); #endif blob - c1dadc78e3d333acc31fde5ea029c5ecc6f5f3dc blob + 9768907e1618da91b009fb8a54357638500a9551 --- configure.ac +++ configure.ac @@ -160,6 +160,10 @@ case "$host_os" in *darwin*) AC_MSG_RESULT(darwin) PLATFORM=darwin + ;; + *netbsd*) + AC_MSG_RESULT(netbsd) + PLATFORM=netbsd ;; *) AC_MSG_RESULT(unknown) @@ -170,6 +174,7 @@ AC_SUBST(PLATFORM) AM_CONDITIONAL([HOST_FREEBSD], [test "$PLATFORM" = "freebsd"]) AM_CONDITIONAL([HOST_LINUX], [test "$PLATFORM" = "linux"]) AM_CONDITIONAL([HOST_DARWIN], [test "$PLATFORM" = "darwin"]) +AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"]) # Landlock detection. AC_MSG_CHECKING([for landlock]) @@ -382,6 +387,13 @@ if test "$PLATFORM" = "linux"; then panelw, found_panel=yes, AC_MSG_ERROR("*** couldn't find -lpanel from ncurses") + ) +elif test "$PLATFORM" = "netbsd"; then + PKG_CHECK_MODULES( + LIBPANELW, + gnupanelw, + found_panel=yes, + AC_MSG_ERROR("*** couldn't find -lgnupanelw from ncurses") ) else AC_CHECK_LIB(panelw, update_panels,,