WASM create and link the Emscripten FS image

There are three posibilites to add files to the image:
- gb_emscripten_fs_image_files to add individual files
- gb_emscripten_fs_image_autoinstall to add files from AutoInstall
- gb_emscripten_fs_image_filelists to add files from a .filelist

Change-Id: If6804e282a37a37ffae1d291d2af8430e60b59d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128598
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
Jan-Marek Glogowski 2021-07-23 14:17:26 +02:00
parent c367a2781f
commit 88b94aafc2
8 changed files with 1212 additions and 2 deletions

View file

@ -993,6 +993,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
) \
resource_fonts \
cui \
static/emscripten_fs_image \
))
$(eval $(call gb_Helper_register_packages_for_install,ooo_fonts,\

View file

@ -132,6 +132,7 @@ export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
export DPKG=@DPKG@
export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@
export EMSDK_FILE_PACKAGER=@EMSDK_FILE_PACKAGER@
export ENABLE_ANDROID_LOK=@ENABLE_ANDROID_LOK@
export ENABLE_ANDROID_EDITING=@ENABLE_ANDROID_EDITING@
export ENABLE_AVAHI=@ENABLE_AVAHI@

View file

@ -1383,10 +1383,16 @@ if test "$_os" = "Emscripten"; then
AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
EMSCRIPTEN_ERROR=1
fi
EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
if ! test -x "$EMSDK_FILE_PACKAGER"; then
AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
EMSCRIPTEN_ERROR=1
fi
if test $EMSCRIPTEN_ERROR -ne 0; then
AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
fi
fi
AC_SUBST(EMSDK_FILE_PACKAGER)
###############################################################################
# Extensions switches --enable/--disable

View file

@ -75,6 +75,9 @@ $(call gb_Executable_get_runtime_target,$(1)) : $(call gb_Executable_get_target_
$(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS :=
$(call gb_Executable_Executable_platform,$(1),$(2),$(gb_Executable_BINDIR)/$(1).lib)
ifeq ($(OS),EMSCRIPTEN)
$(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,$(1))) : $(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link
endif
$$(eval $$(call gb_Module_register_target,$(call gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),Executable)

View file

@ -14,6 +14,7 @@ include $(GBUILDDIR)/platform/unxgcc.mk
# don't sort; later can override previous settings!
gb_EMSCRIPTEN_PRE_JS_FILES = \
$(SRCDIR)/static/emscripten/environment.js \
$(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link \
gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure
# avoid -s SAFE_HEAP=1 - c.f. gh#8584 this breaks source maps
@ -26,7 +27,7 @@ gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=4
# To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
# See emscrypten.py, finalize_wasm, modify_wasm = True
# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
gb_EMSCRIPTEN_LDFLAGS += --bind -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr"]
gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr"]
gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
gb_Executable_EXT := .html

View file

@ -174,7 +174,10 @@ $(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
$(WORKDIR)/LinkTarget/$(2).exports,$(1))))
$(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter EMSCRIPTEN,$(OS)),$(filter TRUE,$(ENABLE_QT5))), \
cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) ; \
sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)))
sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)) ; \
ln -sf $(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data $(dir $(1))/soffice.data ; \
ln -sf $(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.metadata $(dir $(1))/soffice.data.js.metadata ; \
)
endef
define gb_LinkTarget__command_staticlink

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,12 @@ $(eval $(call gb_Module_add_targets,static,\
Library_components \
))
ifeq (EMSCRIPTEN,$(OS))
$(eval $(call gb_Module_add_targets,static,\
CustomTarget_emscripten_fs_image \
))
endif
endif
# vim: set noet sw=4 ts=4: