configure.ac                       |    6 ++++--
 cppuhelper/source/paths.cxx        |    2 ++
 desktop/source/app/app.cxx         |    6 +++---
 desktop/source/app/userinstall.cxx |    6 +++---
 sal/osl/unx/security.cxx           |    6 ++++--
 sal/osl/unx/uunxapi.cxx            |    8 ++++++--
 sal/rtl/bootstrap.cxx              |    3 +++
 sfx2/source/doc/objstor.cxx        |    2 ++
 8 files changed, 27 insertions(+), 12 deletions(-)

New commits:
commit ad5563b4f210b32bcdd7a2efb167ce2c2745f9db
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Sun Jan 9 00:40:43 2022 +0100
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Wed Jan 19 10:50:35 2022 +0100

    WASM setup as non-multiuser, desktop build
    
    Change-Id: I2ee6e006554cf1e5e5e42c2f4f73d8788bff8f4b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128585
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/configure.ac b/configure.ac
index e561a55e1a15..265270f65038 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2942,10 +2942,12 @@ dnl "desktop" one but a "mobile" one, we are always 
cross-compiling.
 dnl Note the direction of the implication; there is no assumption that
 dnl cross-compiling would imply a non-desktop OS.
 
-if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a 
"$enable_fuzzers" != "yes"; then
+if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
     BUILD_TYPE="$BUILD_TYPE DESKTOP"
     AC_DEFINE(HAVE_FEATURE_DESKTOP)
-    AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
+    if test "$_os" != Emscripten; then
+        AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
+    fi
 fi
 
 # Whether to build "avmedia" functionality or not.
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 480dcde48fe7..785fa452d30b 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -61,6 +61,8 @@ OUString cppu::getUnoIniUri() {
     // and since rtlBootstrapHandle is not ref-counted doing anything
     // clean here is hardish.
     OUString uri("file:///assets/program");
+#elif defined(EMSCRIPTEN)
+    OUString uri("file:///instdir/program");
 #else
     OUString uri(get_this_libpath());
 #ifdef MACOSX
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index f936680f7eea..32d5b31278c1 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -499,7 +499,7 @@ void Desktop::Init()
     RequestHandler::Status aStatus = RequestHandler::Enable(true);
     if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR )
     {
-#if defined ANDROID
+#if defined(ANDROID) || defined(EMSCRIPTEN)
         // Ignore crack pipe errors on Android
 #else
         // Keep using this oddly named BE_PATHINFO_MISSING value
@@ -1273,7 +1273,7 @@ int Desktop::Main()
     userinstall::Status inst_fin = userinstall::finalize();
     if (inst_fin != userinstall::EXISTED && inst_fin != userinstall::CREATED)
     {
-        SAL_WARN( "desktop.app", "userinstall failed");
+        SAL_WARN( "desktop.app", "userinstall failed: " << inst_fin);
         if ( inst_fin == userinstall::ERROR_NO_SPACE )
             HandleBootstrapErrors(
                 BE_USERINSTALL_NOTENOUGHDISKSPACE, OUString() );
@@ -1297,7 +1297,7 @@ int Desktop::Main()
 
     SetSplashScreenProgress(25);
 
-#if HAVE_FEATURE_DESKTOP
+#if HAVE_FEATURE_DESKTOP && !defined(EMSCRIPTEN)
     // check user installation directory for lockfile so we can be sure
     // there is no other instance using our data files from a remote host
 
diff --git a/desktop/source/app/userinstall.cxx 
b/desktop/source/app/userinstall.cxx
index bcfd7e3e5596..669a7316cb42 100644
--- a/desktop/source/app/userinstall.cxx
+++ b/desktop/source/app/userinstall.cxx
@@ -27,7 +27,7 @@
 #include <officecfg/Setup.hxx>
 #include <osl/file.h>
 #include <osl/file.hxx>
-#if defined ANDROID || defined IOS
+#if defined ANDROID || defined IOS || defined EMSCRIPTEN
 #include <rtl/bootstrap.hxx>
 #endif
 #include <rtl/ustring.hxx>
@@ -40,7 +40,7 @@ namespace desktop::userinstall {
 
 namespace {
 
-#if !(defined ANDROID || defined IOS)
+#if !(defined ANDROID || defined IOS || defined EMSCRIPTEN)
 osl::FileBase::RC copyRecursive(
     OUString const & srcUri, OUString const & dstUri)
 {
@@ -104,7 +104,7 @@ Status create(OUString const & uri) {
     if (e != osl::FileBase::E_None && e != osl::FileBase::E_EXIST) {
         return ERROR_OTHER;
     }
-#if !(defined ANDROID || defined IOS)
+#if !(defined ANDROID || defined IOS || defined EMSCRIPTEN)
 #if defined UNIX
     // Set safer permissions for the user directory by default:
     osl::File::setAttributes(
diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index f6fc52ce5398..f541c90001b3 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -127,7 +127,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
         if (p == nullptr) {
             return nullptr;
         }
-#if defined(IOS) && defined(X86_64)
+#if (defined(IOS) && defined(X86_64)) || defined(EMSCRIPTEN)
         // getpwuid_r() does not work in the iOS simulator
         (void) found;
         char * buffer = p->m_buffer;
@@ -140,10 +140,13 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
         buffer += strlen(buffer) + 1;
         p->m_pPasswd.pw_uid = geteuid();
         p->m_pPasswd.pw_gid = getegid();
+#if !defined(EMSCRIPTEN)
         p->m_pPasswd.pw_change = 0;
         strcpy(buffer, "");
         p->m_pPasswd.pw_class = buffer;
         buffer += strlen(buffer) + 1;
+        p->m_pPasswd.pw_expire = 0;
+#endif
         strcpy(buffer, "Mobile User");
         p->m_pPasswd.pw_gecos = buffer;
         buffer += strlen(buffer) + 1;
@@ -153,7 +156,6 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
         strcpy(buffer, "");
         p->m_pPasswd.pw_shell = buffer;
         buffer += strlen(buffer) + 1;
-        p->m_pPasswd.pw_expire = 0;
         return p;
 #else
         switch (getpwuid_r(getuid(), &p->m_pPasswd, p->m_buffer, n, &found)) {
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 917476d7ab03..eaa902839428 100644
--- a/sal/osl/unx/uunxapi.cxx
+++ b/sal/osl/unx/uunxapi.cxx
@@ -214,8 +214,12 @@ template<> OUString fromOString(OString const & s)
 template<typename T> bool realpath_(const T& pstrFileName, T& 
ppstrResolvedName)
 {
     OString fn = toOString(pstrFileName);
-#ifdef ANDROID
+#if defined ANDROID || defined(EMSCRIPTEN)
+#if defined ANDROID
     if (fn == "/assets" || fn.startsWith("/assets/"))
+#else
+    if (fn == "/instdir" || fn.startsWith("/instdir/"))
+#endif
     {
         if (osl::access(fn, F_OK) == -1)
             return false;
@@ -224,7 +228,7 @@ template<typename T> bool realpath_(const T& pstrFileName, 
T& ppstrResolvedName)
 
         return true;
     }
-#endif
+#endif // ANDROID || EMSCRIPTEN
 
 #ifdef MACOSX
     fn = macxp_resolveAliasAndConvert(fn);
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 93d1c5a11648..f2bb6d58a962 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -223,6 +223,9 @@ static OUString & getIniFileName_Impl()
         // .apk (zip) archive as the /assets/rc file.
         fileName = OUString("vnd.sun.star.pathname:/assets/rc");
         resolvePathnameUrl(&fileName);
+#elif defined(EMSCRIPTEN)
+        fileName = 
OUString("vnd.sun.star.pathname:/instdir/program/sofficerc");
+        resolvePathnameUrl(&fileName);
 #else
         if (getFromCommandLineArgs("INIFILENAME", &fileName))
         {
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 0dc1b0f7d452..76e7734b402c 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2735,9 +2735,11 @@ bool SfxObjectShell::CommonSaveAs_Impl(const 
INetURLObject& aURL, const OUString
     if (SfxItemState::SET != rItemSet.GetItemState(SID_UNPACK) && 
officecfg::Office::Common::Save::Document::Unpacked::get())
         rItemSet.Put(SfxBoolItem(SID_UNPACK, false));
 
+#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
     OUString aTempFileURL;
     if ( IsDocShared() )
         aTempFileURL = pMedium->GetURLObject().GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
+#endif
 
     if 
(PreDoSaveAs_Impl(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), 
aFilterName,
                          rItemSet, rArgs))

Reply via email to