configure.ac                                        |    5 +-
 instsetoo_native/CustomTarget_emscripten-install.mk |   35 ++++++++++++++++++++
 instsetoo_native/Module_instsetoo_native.mk         |    6 +++
 static/README.wasm.md                               |    6 ++-
 4 files changed, 49 insertions(+), 3 deletions(-)

New commits:
commit 7d5c62537cce395fb46aac9403d42b1597c8186d
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Fri Jul 26 11:17:36 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Fri Jul 26 13:02:11 2024 +0200

    Add --with-package-format=emscripten
    
    ...to have $(WORKDIR)/installation/LibreOffice/emscripten populated with 
just
    the relevant files from $(INSTDIR).  (This doesn't reuse the complicated
    CustomTarget_instsetoo_native/install used for other PKGFORMATs; as a 
special
    case, it uses a much simpler 
CustomTarget_instsetoo_native/emscripten-install.)
    
    Change-Id: I9c7509aadbc0e6e49ec95bf51c748c2ff9f778b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171066
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Tested-by: Jenkins

diff --git a/configure.ac b/configure.ac
index f4dcde811f30..81dfe1a3b924 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2278,7 +2278,7 @@ AC_ARG_WITH(package-format,
     AS_HELP_STRING([--with-package-format],
         [Specify package format(s) for LibreOffice installation sets. The
          implicit --without-package-format leads to no installation sets being
-         generated. Possible values: archive, bsd, deb, dmg,
+         generated. Possible values: archive, bsd, deb, dmg, emscripten,
          installed, msi, pkg, and rpm.
          Example: --with-package-format='deb rpm']),
 ,)
@@ -5725,7 +5725,7 @@ AC_MSG_CHECKING([which package format to use])
 if test -n "$with_package_format" -a "$with_package_format" != no; then
     for i in $with_package_format; do
         case "$i" in
-        bsd | deb | pkg | rpm | archive | dmg | installed | msi)
+        bsd | deb | pkg | rpm | archive | dmg | installed | msi | emscripten)
             ;;
         *)
             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
@@ -5737,6 +5737,7 @@ rpm - RedHat software distribution
 LibreOffice additionally supports:
 archive - .tar.gz or .zip
 dmg - macOS .dmg
+emscripten - directory with qt_soffice.html etc.
 installed - installation tree
 msi - Windows .msi
         ])
diff --git a/instsetoo_native/CustomTarget_emscripten-install.mk 
b/instsetoo_native/CustomTarget_emscripten-install.mk
new file mode 100644
index 000000000000..a4a2031c45cb
--- /dev/null
+++ b/instsetoo_native/CustomTarget_emscripten-install.mk
@@ -0,0 +1,35 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 
100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call 
gb_CustomTarget_CustomTarget,instsetoo_native/emscripten-install))
+
+$(if $(or $(gb_not $(filter emscripten,$(PKGFORMAT))),$(filter-out 
emscripten,$(PKGFORMAT))), \
+    $(error Emscripten only supports --with-package-format=emscripten))
+
+emscripten_install_files := \
+    favicon.ico \
+    qt_soffice.html \
+    qtloader.js \
+    qtlogo.svg \
+    soffice.data \
+    soffice.data.js.metadata \
+    soffice.js \
+    soffice.wasm \
+    soffice.worker.js \
+    $(if $(ENABLE_SYMBOLS_FOR),soffice.wasm.dwp) \
+
+$(call gb_CustomTarget_get_target,instsetoo_native/emscripten-install): \
+    $(foreach 
i,$(emscripten_install_files),$(WORKDIR)/installation/LibreOffice/emscripten/$(i))
+
+$(foreach 
i,$(emscripten_install_files),$(WORKDIR)/installation/LibreOffice/emscripten/$(i)):
 \
+$(WORKDIR)/installation/LibreOffice/emscripten/%: $(INSTDIR)/program/%
+       mkdir -p $(dir $@)
+       cp $< $@
+
+# vim: set noet sw=4 ts=4:
diff --git a/instsetoo_native/Module_instsetoo_native.mk 
b/instsetoo_native/Module_instsetoo_native.mk
index 9ba7bd8b8182..1b24ebaaed85 100644
--- a/instsetoo_native/Module_instsetoo_native.mk
+++ b/instsetoo_native/Module_instsetoo_native.mk
@@ -11,9 +11,15 @@ $(eval $(call gb_Module_Module,instsetoo_native))
 
 ifneq (,$(PKGFORMAT)$(filter TRUE,$(LIBO_TEST_INSTALL) $(ENABLE_WIX)))
 
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Module_add_targets,instsetoo_native, \
+    CustomTarget_emscripten-install \
+))
+else
 $(eval $(call gb_Module_add_targets,instsetoo_native,\
        CustomTarget_install \
 ))
+endif
 
 endif
 
diff --git a/static/README.wasm.md b/static/README.wasm.md
index 4cf0688d0796..cb5d0aa7fc3e 100644
--- a/static/README.wasm.md
+++ b/static/README.wasm.md
@@ -15,9 +15,12 @@ purpose, look towards the end of the document for the section
 
 ## Status of LibreOffice as WASM with Qt
 
+Configure `--with-package-format=emscripten` to have 
`workdir/installation/LibreOffice/emscripten`
+populated with just the relevant files from `instdir`.
+
 The build generates a Writer-only LO build. You should be able to run either
 
-    $ emrun --serve_after_close instdir/program/qt_soffice.html
+    $ emrun --serve_after_close 
workdir/installation/LibreOffice/emscripten/qt_soffice.html
     $ emrun --serve_after_close workdir/LinkTarget/Executable/qt_vcldemo.html
     $ emrun --serve_after_close 
workdir/LinkTarget/Executable/qt_wasm-qt5-mandelbrot.html
 
@@ -399,6 +402,7 @@ For instance, this autogen.input works for me:
 `--host=wasm32-local-emscripten`
 `--disable-gui`
 `--with-main-module=writer`
+`--with-package-format=emscripten`
 
 For building LO core for use in COWASM, it is known to work to use
 Emscripten 3.1.30 (and not just 2.0.31 which is what the LO+Qt5 work

Reply via email to