ocamlPackages.luv: backport patch; fix clang build

clang build fails with an incompatible pointer type error. Backport a
patch from 0.5.14 which fixes this. Can not just update to 0.5.14 as it
contains breaking changes and breaks most of luv's consumers.

ad7f953fcc
(cherry picked from commit 8330c77eab)
This commit is contained in:
Reno Dakota 2024-11-17 08:42:09 -08:00 committed by github-actions[bot]
parent 96fa49303e
commit bd3280283a
2 changed files with 93 additions and 0 deletions

View File

@ -15,6 +15,12 @@ buildDunePackage rec {
sha256 = "sha256-dp9qCIYqSdROIAQ+Jw73F3vMe7hnkDe8BgZWImNMVsA="; sha256 = "sha256-dp9qCIYqSdROIAQ+Jw73F3vMe7hnkDe8BgZWImNMVsA=";
}; };
patches = [
# backport of patch to fix incompatible pointer type. remove next update
# https://github.com/aantron/luv/commit/ad7f953fccb8732fe4eb9018556e8d4f82abf8f2
./incompatible-pointer-type-fix.diff
];
postConfigure = '' postConfigure = ''
for f in src/c/vendor/configure/{ltmain.sh,configure}; do for f in src/c/vendor/configure/{ltmain.sh,configure}; do
substituteInPlace "$f" --replace /usr/bin/file file substituteInPlace "$f" --replace /usr/bin/file file

View File

@ -0,0 +1,87 @@
addapted from https://github.com/aantron/luv/commit/ad7f953fccb8732fe4eb9018556e8d4f82abf8f2
diff --git a/src/c/helpers.c b/src/c/helpers.c
index 7fcd8b6..bc1b926 100755
--- a/src/c/helpers.c
+++ b/src/c/helpers.c
@@ -175,7 +175,8 @@ static void luv_getaddrinfo_trampoline(
}
static void luv_getnameinfo_trampoline(
- uv_getnameinfo_t *c_request, int status, char *hostname, char *service)
+ uv_getnameinfo_t *c_request, int status, const char *hostname,
+ const char *service)
{
caml_acquire_runtime_system();
value callback;
@@ -407,7 +408,7 @@ uv_getaddrinfo_cb luv_get_getaddrinfo_trampoline()
return luv_getaddrinfo_trampoline;
}
-luv_getnameinfo_cb luv_get_getnameinfo_trampoline()
+uv_getnameinfo_cb luv_get_getnameinfo_trampoline()
{
return luv_getnameinfo_trampoline;
}
@@ -613,15 +614,6 @@ int luv_fs_poll_start(
return uv_fs_poll_start(handle, (uv_fs_poll_cb)poll_cb, path, interval);
}
-int luv_getnameinfo(
- uv_loop_t *loop, uv_getnameinfo_t *req, luv_getnameinfo_cb getnameinfo_cb,
- const struct sockaddr *addr, int flags)
-{
- return
- uv_getnameinfo(
- loop, req, (uv_getnameinfo_cb)getnameinfo_cb, addr, flags);
-}
-
int luv_read_start(
uv_stream_t *stream, uv_alloc_cb alloc_cb, luv_read_cb read_cb)
{
diff --git a/src/c/helpers.h b/src/c/helpers.h
index f73e32f..2cc1200 100755
--- a/src/c/helpers.h
+++ b/src/c/helpers.h
@@ -55,9 +55,6 @@ typedef void (*luv_fs_event_cb)(
typedef void (*luv_fs_poll_cb)(
uv_fs_poll_t *handle, int status, uv_stat_t *prev, uv_stat_t *curr);
-typedef void (*luv_getnameinfo_cb)(
- uv_getnameinfo_t *req, int status, char *hostname, char *service);
-
typedef void (*luv_read_cb)(uv_stream_t *stream, ssize_t nread, uv_buf_t *buf);
typedef void (*luv_udp_recv_cb)(
@@ -78,7 +75,7 @@ uv_fs_cb luv_null_fs_callback_pointer();
luv_fs_event_cb luv_get_fs_event_trampoline();
luv_fs_poll_cb luv_get_fs_poll_trampoline();
uv_getaddrinfo_cb luv_get_getaddrinfo_trampoline();
-luv_getnameinfo_cb luv_get_getnameinfo_trampoline();
+uv_getnameinfo_cb luv_get_getnameinfo_trampoline();
uv_idle_cb luv_get_idle_trampoline();
luv_once_cb luv_get_once_trampoline();
uv_poll_cb luv_get_poll_trampoline();
@@ -173,10 +170,6 @@ int luv_fs_poll_start(
uv_fs_poll_t *handle, luv_fs_poll_cb poll_cb, const char *path,
unsigned int interval);
-int luv_getnameinfo(
- uv_loop_t *loop, uv_getnameinfo_t *req, luv_getnameinfo_cb getnameinfo_cb,
- const struct sockaddr *addr, int flags);
-
int luv_read_start(
uv_stream_t *stream, uv_alloc_cb alloc_cb, luv_read_cb read_cb);
diff --git a/src/c/luv_c_function_descriptions.ml b/src/c/luv_c_function_descriptions.ml
index 684a46b..7ac1421 100755
--- a/src/c/luv_c_function_descriptions.ml
+++ b/src/c/luv_c_function_descriptions.ml
@@ -1336,7 +1336,7 @@ struct
(void @-> returning trampoline)
let getnameinfo =
- foreign "luv_getnameinfo"
+ foreign "uv_getnameinfo"
(ptr Loop.t @->
ptr t @->
trampoline @->