diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-08-21 08:00:48 +0200 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-08-21 11:20:54 +0200 |
commit | e180d2a8fda78d1373dc3ecec4bd69992bc4337c (patch) | |
tree | e89990c210da369444e236c1b3a41d9f440a3e0d | |
parent | b20e7aaac5b35972e0b7c40a34841417e5514824 (diff) |
Emscripten: Enable the WebDAV UCP
* Which also requires external/curl. But implicitly use --without-gssapi,
checking for it in configure.ac would fail with
> configure: error: could not find function 'gss_init_sec_context' required for GSSAPI
And building ExternalProject_curl needs to see the -pthread from
gb_EMSCRIPTEN_CPPFLAGS, otherwise linking Executable_soffice_bin would fail with
> wasm-ld: error: --shared-memory is disallowed by libcurl_la-easy.o because it was not compiled with 'atomics' or 'bulk-memory' features.
* By default, GetCABundleFile in include/systools/opensslinit.hxx will fail
now. (But to make https work, applications could bring along their own such
file in the Emscripten FS, in one of the places where GetCABundleFile checks for
it.) So, for Emscripten only, make failure of GetCABundleFile non-fatal in
InitCurl_easy.
* Some code in sw was erroneously hidden behind !ENABLE_WASM_STRIP_EXTRA (off
by default for Emscripten), but is needed with HAVE_FEATURE_CURL.
* See <https://emscripten.org/docs/porting/networking.html> for how to actually
use networking in an Emscripten application.
Change-Id: I2bbe9f3fd0e20143e18eb1e8104568b1c7a304de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172167
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | external/curl/ExternalProject_curl.mk | 4 | ||||
-rw-r--r-- | include/systools/curlinit.hxx | 17 | ||||
-rw-r--r-- | include/systools/opensslinit.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/translatehelper.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/translatehelper.cxx | 4 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 15 |
7 files changed, 30 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac index 61f961f66370..123c03e35661 100644 --- a/configure.ac +++ b/configure.ac @@ -3204,7 +3204,6 @@ if test "$enable_wasm_strip" = "yes"; then enable_libcmis=no enable_coinmp=no enable_cups=no - test "$_os" = Emscripten && enable_curl=no enable_database_connectivity=no enable_dbus=no enable_dconf=no @@ -3239,10 +3238,9 @@ if test "$enable_wasm_strip" = "yes"; then test_libqxp=no test_libvisio=no test_libzmf=no - test_webdav=no with_galleries=no + with_gssapi=no with_templates=no - with_webdav=no with_x=no test "${with_fonts+set}" = set || with_fonts=yes diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index d44f8e77ee2c..9d39e62e6fd3 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -20,7 +20,11 @@ $(eval $(call gb_ExternalProject_register_targets,curl,\ ifneq ($(OS),WNT) +ifeq ($(OS),EMSCRIPTEN) +curl_CPPFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) +else curl_CPPFLAGS := +endif curl_LDFLAGS := $(if $(filter LINUX FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN) ifneq ($(OS),ANDROID) diff --git a/include/systools/curlinit.hxx b/include/systools/curlinit.hxx index 7fe72370c858..5167a06d995f 100644 --- a/include/systools/curlinit.hxx +++ b/include/systools/curlinit.hxx @@ -34,10 +34,21 @@ static void InitCurl_easy(CURL* const pCURL) #if defined(LO_CURL_NEEDS_CA_BUNDLE) char const* const path = GetCABundleFile(); - rc = curl_easy_setopt(pCURL, CURLOPT_CAINFO, path); - if (rc != CURLE_OK) // only if OOM? + if (path == nullptr) { - throw css::uno::RuntimeException(u"CURLOPT_CAINFO failed"_ustr); +#if defined EMSCRIPTEN + SAL_WARN("ucb.ucp.webdav.curl", "no OpenSSL CA certificate bundle found"); +#else + throw css::uno::RuntimeException(u"no OpenSSL CA certificate bundle found"_ustr); +#endif + } + else + { + rc = curl_easy_setopt(pCURL, CURLOPT_CAINFO, path); + if (rc != CURLE_OK) // only if OOM? + { + throw css::uno::RuntimeException(u"CURLOPT_CAINFO failed"_ustr); + } } #endif diff --git a/include/systools/opensslinit.hxx b/include/systools/opensslinit.hxx index be9cd43c58d5..45715d1bc0bf 100644 --- a/include/systools/opensslinit.hxx +++ b/include/systools/opensslinit.hxx @@ -36,7 +36,7 @@ static char const* GetCABundleFile() } } - throw css::uno::RuntimeException(u"no OpenSSL CA certificate bundle found"_ustr); + return nullptr; } #endif diff --git a/sw/source/uibase/inc/translatehelper.hxx b/sw/source/uibase/inc/translatehelper.hxx index 9e473d68e039..8c0be7af8c9d 100644 --- a/sw/source/uibase/inc/translatehelper.hxx +++ b/sw/source/uibase/inc/translatehelper.hxx @@ -40,7 +40,7 @@ struct SW_DLLPUBLIC TranslateAPIConfig final }; SW_DLLPUBLIC OString ExportPaMToHTML(SwPaM* pCursor); SW_DLLPUBLIC void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData); -#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL SW_DLLPUBLIC void TranslateDocument(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig); SW_DLLPUBLIC void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig, diff --git a/sw/source/uibase/shells/translatehelper.cxx b/sw/source/uibase/shells/translatehelper.cxx index eb9bcaedbb05..79615f3b126e 100644 --- a/sw/source/uibase/shells/translatehelper.cxx +++ b/sw/source/uibase/shells/translatehelper.cxx @@ -94,7 +94,7 @@ void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData) } } -#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL void TranslateDocument(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig) { bool bCancel = false; @@ -212,5 +212,5 @@ void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const TranslateAPIConfig& if (xStatusIndicator.is()) xStatusIndicator->end(); } -#endif // HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA +#endif // HAVE_FEATURE_CURL } diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index fd5ea7b3ef0b..2da2344daf97 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -201,18 +201,17 @@ int ImplSVMain() OUString temp; if (osl_getEnvironment(name.pData, &temp.pData) == osl_Process_E_NotFound) { - try // to point bundled OpenSSL to some system certificate file - { // ... this only works if the client actually calls - // SSL_CTX_set_default_verify_paths() or similar; e.g. python ssl. - char const*const path = GetCABundleFile(); + // Try to point bundled OpenSSL to some system certificate file + // ... this only works if the client actually calls + // SSL_CTX_set_default_verify_paths() or similar; e.g. python ssl. + char const*const path = GetCABundleFile(); + if (path == nullptr) { + SAL_WARN("vcl", "no OpenSSL CA certificate bundle found"); + } else { OUString const filepath(::rtl::OStringToOUString( ::std::string_view(path), osl_getThreadTextEncoding())); osl_setEnvironment(name.pData, filepath.pData); } - catch (uno::RuntimeException const& e) - { - SAL_WARN("vcl", e.Message); - } } } #endif |