summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-08-22 11:49:08 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-08-22 14:24:35 +0200
commit2d9f8f45be0c9bc5f56864f66a37c3cc60069fe5 (patch)
treef2cbf2c9dfdfd035c38be4e48bbdc1d725e0aa9d /external
parent0afb4cfc5ed1e926dfd287007c5a35585584daec (diff)
Emscripten: Experimental -sPROXY_POSIX_SOCKETS support
...see <https://emscripten.org/docs/porting/networking.html#full-posix-sockets-over-websocket-proxy-server>. This requires <https://github.com/stbergmann/emscripten/commit/4aff1f28b88480791236adcc6d5cb2d919ad4bf3> "-sPROXY_POSIX_SOCKETS: Add websocket_proxy_poll". When configured with --disable-socketpair (which appears to have no negative consequences), external/curl appears to only call poll(2) with socket-related file descriptors, so we can use websocket_proxy_poll instead. The URL on which the websocket_to_posix_proxy process listens must be specified as Module.uno_websocket_to_posix_socket_url. Change-Id: I4ad23098b5bbc0646fa50859c0aeb9870d1cc92a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172243 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'external')
-rw-r--r--external/curl/ExternalProject_curl.mk1
-rw-r--r--external/curl/UnpackedTarball_curl.mk6
-rw-r--r--external/curl/emscripten-proxy-poll.patch.020
3 files changed, 27 insertions, 0 deletions
diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk
index 9d39e62e6fd3..45aa6d561389 100644
--- a/external/curl/ExternalProject_curl.mk
+++ b/external/curl/ExternalProject_curl.mk
@@ -65,6 +65,7 @@ $(call gb_ExternalProject_get_state_target,curl,build):
$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
$(if $(filter MACOSX,$(OS)),CFLAGS='$(CFLAGS) \
-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)') \
+ $(if $(ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS),--disable-socketpair) \
$(if $(filter -fsanitize=undefined,$(CC)),CC='$(CC) -fno-sanitize=function') \
CPPFLAGS='$(curl_CPPFLAGS)' \
CFLAGS="$(gb_CFLAGS) $(call gb_ExternalProject_get_build_flags,curl)" \
diff --git a/external/curl/UnpackedTarball_curl.mk b/external/curl/UnpackedTarball_curl.mk
index 4412857d36a0..4f21212eff8d 100644
--- a/external/curl/UnpackedTarball_curl.mk
+++ b/external/curl/UnpackedTarball_curl.mk
@@ -33,4 +33,10 @@ $(eval $(call gb_UnpackedTarball_add_patches,curl, \
))
endif
+ifeq ($(ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS),TRUE)
+$(eval $(call gb_UnpackedTarball_add_patches,curl, \
+ external/curl/emscripten-proxy-poll.patch.0 \
+))
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/external/curl/emscripten-proxy-poll.patch.0 b/external/curl/emscripten-proxy-poll.patch.0
new file mode 100644
index 000000000000..ac1f4a84d25c
--- /dev/null
+++ b/external/curl/emscripten-proxy-poll.patch.0
@@ -0,0 +1,20 @@
+--- lib/select.c
++++ lib/select.c
+@@ -51,6 +51,8 @@
+ #include "curl_printf.h"
+ #include "curl_memory.h"
+ #include "memdebug.h"
++
++int websocket_proxy_poll(struct pollfd *fds, nfds_t nfds, int timeout);
+
+ /*
+ * Internal function used for waiting a specific amount of ms
+@@ -318,7 +320,7 @@
+ pending_ms = -1;
+ else
+ pending_ms = 0;
+- r = poll(ufds, nfds, pending_ms);
++ r = websocket_proxy_poll(ufds, nfds, pending_ms);
+ if(r <= 0) {
+ if((r == -1) && (SOCKERRNO == EINTR))
+ /* make EINTR from select or poll not a "lethal" error */