ports: Add libuv port

This commit is contained in:
Bananymous 2025-07-30 23:50:20 +03:00
parent 8c598a6902
commit 08ed405a5b
8 changed files with 179 additions and 0 deletions

23
ports/libuv/build.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash ../install.sh
NAME='libuv'
VERSION='1.51.0'
DOWNLOAD_URL="https://dist.libuv.org/dist/v$VERSION/libuv-v$VERSION.tar.gz#5f0557b90b1106de71951a3c3931de5e0430d78da1d9a10287ebc7a3f78ef8eb"
TAR_CONTENT="libuv-v$VERSION"
configure() {
$BANAN_CMAKE \
--toolchain="$BANAN_TOOLCHAIN_DIR/Toolchain.txt" \
-B build -GNinja --fresh \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_TESTING=OFF \
. || exit 1
}
build() {
$BANAN_CMAKE --build build || exit 1
}
install() {
$BANAN_CMAKE --install build || exit 1
}

View File

@ -0,0 +1,21 @@
diff -ruN libuv-v1.51.0/src/unix/tty.c libuv-1.51.0-x86_64/src/unix/tty.c
--- libuv-v1.51.0/src/unix/tty.c 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/src/unix/tty.c 2025-07-23 17:12:21.857957334 +0300
@@ -30,7 +30,7 @@
#include <errno.h>
#include <sys/ioctl.h>
-#if defined(__MVS__) && !defined(IMAXBEL)
+#if (defined(__MVS__) || defined(__banan_os__)) && !defined(IMAXBEL)
#define IMAXBEL 0
#endif
@@ -244,7 +244,7 @@
static void uv__tty_make_raw(struct termios* tio) {
assert(tio != NULL);
-#if defined __sun || defined __MVS__
+#if defined __sun || defined __MVS__ || defined(__banan_os__)
/*
* This implementation of cfmakeraw for Solaris and derivatives is taken from
* http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html.

View File

@ -0,0 +1,12 @@
diff -ruN libuv-v1.51.0/src/unix/core.c libuv-1.51.0-x86_64/src/unix/core.c
--- libuv-v1.51.0/src/unix/core.c 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/src/unix/core.c 2025-07-23 17:11:06.844349261 +0300
@@ -1036,7 +1036,7 @@
rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec;
rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec;
-#if !defined(__MVS__) && !defined(__HAIKU__)
+#if !defined(__MVS__) && !defined(__HAIKU__) && !defined(__banan_os__)
rusage->ru_maxrss = usage.ru_maxrss;
rusage->ru_ixrss = usage.ru_ixrss;
rusage->ru_idrss = usage.ru_idrss;

View File

@ -0,0 +1,33 @@
diff -ruN libuv-v1.51.0/src/unix/fs.c libuv-1.51.0-x86_64/src/unix/fs.c
--- libuv-v1.51.0/src/unix/fs.c 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/src/unix/fs.c 2025-07-23 17:14:28.118310214 +0300
@@ -77,7 +77,8 @@
defined(__MVS__) || \
defined(__NetBSD__) || \
defined(__HAIKU__) || \
- defined(__QNX__)
+ defined(__QNX__) || \
+ defined(__banan_os__)
# include <sys/statvfs.h>
#else
# include <sys/statfs.h>
@@ -683,7 +684,8 @@
defined(__MVS__) || \
defined(__NetBSD__) || \
defined(__HAIKU__) || \
- defined(__QNX__)
+ defined(__QNX__) || \
+ defined(__banan_os__)
struct statvfs buf;
if (0 != statvfs(req->path, &buf))
@@ -705,7 +707,8 @@
defined(__OpenBSD__) || \
defined(__NetBSD__) || \
defined(__HAIKU__) || \
- defined(__QNX__)
+ defined(__QNX__) || \
+ defined(__banan_os__)
stat_fs->f_type = 0; /* f_type is not supported. */
#else
stat_fs->f_type = buf.f_type;

View File

@ -0,0 +1,13 @@
diff -ruN libuv-v1.51.0/src/unix/process.c libuv-1.51.0-x86_64/src/unix/process.c
--- libuv-v1.51.0/src/unix/process.c 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/src/unix/process.c 2025-07-23 17:16:04.548824726 +0300
@@ -390,7 +390,9 @@
* aren't root, so don't bother checking the return value, this
* is just done as an optimistic privilege dropping function.
*/
+ #if !defined(__banan_os__)
SAVE_ERRNO(setgroups(0, NULL));
+ #endif
}
if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid))

View File

@ -0,0 +1,22 @@
diff -ruN libuv-v1.51.0/src/unix/thread.c libuv-1.51.0-x86_64/src/unix/thread.c
--- libuv-v1.51.0/src/unix/thread.c 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/src/unix/thread.c 2025-07-23 17:16:19.619749435 +0300
@@ -897,7 +897,7 @@
abort();
}
-#if defined(_AIX) || defined(__MVS__) || defined(__PASE__)
+#if defined(_AIX) || defined(__MVS__) || defined(__PASE__) || defined(__banan_os__)
int uv__thread_setname(const char* name) {
return UV_ENOSYS;
}
@@ -938,7 +938,8 @@
#if (defined(__ANDROID_API__) && __ANDROID_API__ < 26) || \
defined(_AIX) || \
defined(__MVS__) || \
- defined(__PASE__)
+ defined(__PASE__) || \
+ defined(__banan_os__)
int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
return UV_ENOSYS;
}

View File

@ -0,0 +1,23 @@
diff -ruN libuv-v1.51.0/src/unix/udp.c libuv-1.51.0-x86_64/src/unix/udp.c
--- libuv-v1.51.0/src/unix/udp.c 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/src/unix/udp.c 2025-07-23 17:15:38.986952773 +0300
@@ -767,7 +767,8 @@
!defined(__ANDROID__) && \
!defined(__DragonFly__) && \
!defined(__QNX__) && \
- !defined(__GNU__)
+ !defined(__GNU__) && \
+ !defined(__banan_os__)
static int uv__udp_set_source_membership4(uv_udp_t* handle,
const struct sockaddr_in* multicast_addr,
const char* interface_addr,
@@ -958,7 +959,8 @@
!defined(__ANDROID__) && \
!defined(__DragonFly__) && \
!defined(__QNX__) && \
- !defined(__GNU__)
+ !defined(__GNU__) && \
+ !defined(__banan_os__)
int err;
union uv__sockaddr mcast_addr;
union uv__sockaddr src_addr;

View File

@ -0,0 +1,32 @@
diff -ruN libuv-v1.51.0/include/uv/unix.h libuv-1.51.0-x86_64/include/uv/unix.h
--- libuv-v1.51.0/include/uv/unix.h 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/include/uv/unix.h 2025-07-28 14:06:18.220856588 +0300
@@ -66,7 +66,8 @@
defined(__MSYS__) || \
defined(__HAIKU__) || \
defined(__QNX__) || \
- defined(__GNU__)
+ defined(__GNU__) || \
+ defined(__banan_os__)
# include "uv/posix.h"
#endif
diff -ruN libuv-v1.51.0/CMakeLists.txt libuv-1.51.0-x86_64/CMakeLists.txt
--- libuv-v1.51.0/CMakeLists.txt 2025-04-25 12:50:27.000000000 +0300
+++ libuv-1.51.0-x86_64/CMakeLists.txt 2025-07-28 13:57:21.518563402 +0300
@@ -283,6 +283,15 @@
list(APPEND uv_sources src/unix/proctitle.c)
endif()
+if(CMAKE_SYSTEM_NAME STREQUAL "banan-os")
+ list(APPEND uv_sources
+ src/unix/no-fsevents.c
+ src/unix/no-proctitle.c
+ src/unix/posix-hrtime.c
+ src/unix/posix-poll.c
+ )
+endif()
+
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
list(APPEND uv_sources src/unix/freebsd.c)
endif()