From 8a4173987edfeeb7e49c70617d43e3adc911d333 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Fri, 23 Apr 2021 13:45:05 +0200 Subject: WASM: add initial support for Emscripten cross build - configure with: - --host=wasm64-local-emscripten - had to make a few externals optional, so adding: - --disable-nss - --disable-cmis - --disable-curl Change-Id: I48d1c73d2675ad2e2beaf2c341578199efbd24ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111130 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- .gitignore | 6 + README.md | 4 + Repository.mk | 10 +- autogen.sh | 12 +- bridges/Module_bridges.mk | 2 + config_host.mk.in | 13 ++ configure.ac | 140 ++++++++++++++++++--- desktop/Library_sofficeapp.mk | 4 +- external/apr/ExternalProject_apr.mk | 2 +- external/apr/ExternalProject_apr_util.mk | 2 +- external/boost/UnpackedTarball_boost.mk | 1 + external/boost/boost-emscripten-noshm.patch.0 | 11 ++ external/breakpad/ExternalProject_breakpad.mk | 2 +- external/cairo/ExternalProject_cairo.mk | 9 +- external/cairo/ExternalProject_pixman.mk | 3 +- external/coinmp/ExternalProject_coinmp.mk | 2 +- external/cppunit/ExternalProject_cppunit.mk | 5 +- external/cppunit/disable-dynloading.patch | 2 +- external/curl/ExternalProject_curl.mk | 2 +- external/epm/ExternalProject_epm.mk | 2 +- external/expat/ExternalProject_expat.mk | 2 +- external/firebird/ExternalProject_firebird.mk | 2 +- external/fontconfig/ExternalProject_fontconfig.mk | 5 +- external/freetype/ExternalProject_freetype.mk | 2 +- external/gpgmepp/ExternalProject_gpgmepp.mk | 4 +- external/harfbuzz/ExternalProject_harfbuzz.mk | 2 +- external/hunspell/ExternalProject_hunspell.mk | 4 +- external/hyphen/ExternalProject_hyphen.mk | 2 +- external/icu/ExternalProject_icu.mk | 8 +- external/icu/UnpackedTarball_icu.mk | 1 + external/icu/icu4c-emscripten-cross.patch.1 | 99 +++++++++++++++ external/lcms2/ExternalProject_lcms2.mk | 2 +- external/libabw/ExternalProject_libabw.mk | 2 +- external/libassuan/ExternalProject_libassuan.mk | 4 +- .../libatomic_ops/ExternalProject_libatomic_ops.mk | 2 +- external/libcdr/ExternalProject_libcdr.mk | 2 +- external/libebook/ExternalProject_libebook.mk | 2 +- external/libeot/ExternalProject_libeot.mk | 2 +- external/libepubgen/ExternalProject_libepubgen.mk | 2 +- external/libetonyek/ExternalProject_libetonyek.mk | 2 +- .../libexttextcat/ExternalProject_libexttextcat.mk | 2 +- external/libffi/ExternalProject_libffi.mk | 2 +- .../libfreehand/ExternalProject_libfreehand.mk | 2 +- .../libgpg-error/ExternalProject_libgpg-error.mk | 4 +- .../libjpeg-turbo/ExternalProject_libjpeg-turbo.mk | 2 +- external/liblangtag/ExternalProject_liblangtag.mk | 4 +- external/libmspub/ExternalProject_libmspub.mk | 2 +- external/libmwaw/ExternalProject_libmwaw.mk | 2 +- .../libnumbertext/ExternalProject_libnumbertext.mk | 2 +- external/libodfgen/ExternalProject_libodfgen.mk | 2 +- external/liborcus/ExternalProject_liborcus.mk | 4 +- .../libpagemaker/ExternalProject_libpagemaker.mk | 2 +- external/libqxp/ExternalProject_libqxp.mk | 2 +- external/librevenge/ExternalProject_librevenge.mk | 2 +- .../libstaroffice/ExternalProject_libstaroffice.mk | 2 +- external/libvisio/ExternalProject_libvisio.mk | 2 +- external/libwpd/ExternalProject_libwpd.mk | 2 +- external/libwpg/ExternalProject_libwpg.mk | 2 +- external/libwps/ExternalProject_libwps.mk | 2 +- external/libxml2/ExternalProject_libxml2.mk | 6 +- external/libxslt/ExternalProject_libxslt.mk | 2 +- external/libzmf/ExternalProject_libzmf.mk | 2 +- external/mythes/ExternalProject_mythes.mk | 2 +- external/openldap/ExternalProject_openldap.mk | 2 +- external/openssl/ExternalProject_openssl.mk | 2 + external/postgresql/ExternalProject_postgresql.mk | 2 +- external/python3/ExternalProject_python3.mk | 2 +- external/redland/ExternalProject_raptor.mk | 2 +- external/redland/ExternalProject_rasqal.mk | 2 +- external/redland/ExternalProject_redland.mk | 2 +- external/xmlsec/ExternalProject_xmlsec.mk | 4 +- i18nutil/source/utility/paper.cxx | 2 +- idl/source/objects/types.cxx | 2 +- include/osl/endian.h | 2 + include/sal/alloca.h | 2 +- include/sal/config.h | 11 ++ sal/osl/unx/system.hxx | 22 +++- sc/source/core/tool/math.cxx | 5 + solenv/bin/run-configure | 9 ++ solenv/gbuild/gbuild.mk | 2 + solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk | 64 ++++++++++ solenv/gbuild/platform/com_GCC_defs.mk | 9 +- xmlsecurity/Library_xsec_xmlsec.mk | 50 ++++++-- xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx | 2 + 84 files changed, 522 insertions(+), 119 deletions(-) create mode 100644 external/boost/boost-emscripten-noshm.patch.0 create mode 100644 external/icu/icu4c-emscripten-cross.patch.1 create mode 100755 solenv/bin/run-configure create mode 100644 solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk diff --git a/.gitignore b/.gitignore index d89e5b12035f..1e210142c8a3 100644 --- a/.gitignore +++ b/.gitignore @@ -175,3 +175,9 @@ LibreOffice.VC.VC.opendb # vim-ide-integration /compile_commands.json + +# Some emscripten configure artifacts +/a.out +/a.wasm +/a.out.js +/a.out.wasm diff --git a/README.md b/README.md index 35a68bcf4795..20912732da3d 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,10 @@ run and compile LibreOffice, also used by the TDF builds: * Build: Xcode 9.3 and iPhone SDK 11.4 * Android: * Build: NDK r19c and SDK 22.6.2 +* Emscripten / WASM: + * Runtime: a browser with SharedMemory support (threads + atomics) + * Build: Qt 5.15 with Qt supported Emscripten 1.39.8 + * See README.wasm If you want to use Clang with the LibreOffice compiler plugins, the minimal version of Clang is 5.0.2. Since Xcode doesn't provide the compiler plugin diff --git a/Repository.mk b/Repository.mk index 6af72d71058e..db52290e90c7 100644 --- a/Repository.mk +++ b/Repository.mk @@ -552,9 +552,13 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \ ) \ log_uno_uno \ unsafe_uno_uno \ - $(if $(filter MSC,$(COM)), \ - $(if $(filter INTEL,$(CPUNAME)),msci, \ - $(if $(filter AARCH64,$(CPUNAME)),msca,mscx)),gcc3)_uno \ + $(if $(filter EMSCRIPTEN,$(OS)),, \ + $(if $(filter MSC,$(COM)), \ + $(if $(filter INTEL,$(CPUNAME)),msci_uno) \ + $(if $(filter X86_64,$(CPUNAME)),mscx_uno) \ + $(if $(filter AARCH64,$(CPUNAME)),msca_uno) \ + , gcc3_uno) \ + ) \ )) $(eval $(call gb_Helper_register_libraries_for_install,PRIVATELIBS_URE,ure, \ diff --git a/autogen.sh b/autogen.sh index 1779de77e6f3..bef1f7faf561 100755 --- a/autogen.sh +++ b/autogen.sh @@ -295,15 +295,21 @@ if (defined $ENV{NOCONFIGURE}) { push @args, "--srcdir=$src_path"; push @args, "--enable-option-checking=$option_checking"; - print "Running ./configure with '" . join (" ", @args), "'\n"; - # When running a shell script from Perl on WSL, weirdly named # environment variables like the "ProgramFiles(x86)" one don't get # imported by the shell. So export it as PROGRAMFILESX86 instead. my $building_for_linux = 0; + my $building_with_emscripten = 0; foreach my $arg (@args) { $building_for_linux = 1 if ($arg =~ /--host=x86_64.*linux/); + $building_with_emscripten = 1 if ($arg =~ /^--host=wasm.*-emscripten$/); } + + unshift @args, "./configure"; + unshift @args, "emconfigure" if ($building_with_emscripten); + + print "Running '" . join (" ", @args), "'\n"; + if (`wslsys 2>/dev/null` ne "" && !$building_for_linux) { if (!$ENV{"ProgramFiles(x86)"}) { print STDERR "To build for Windows on WSL, you need to set the WSLENV environment variable in the Control Panel to 'ProgramFiles(x86)'\n"; @@ -313,7 +319,7 @@ if (defined $ENV{NOCONFIGURE}) { $ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"}; } - system ("./configure", @args) && die "Error running configure"; + system (@args) && die "Error running configure"; } # Local Variables: diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk index 3016bf2c404f..1c7fb1789b8e 100644 --- a/bridges/Module_bridges.mk +++ b/bridges/Module_bridges.mk @@ -9,6 +9,7 @@ $(eval $(call gb_Module_Module,bridges)) +ifneq ($(OS),EMSCRIPTEN) $(eval $(call gb_Module_add_targets,bridges,\ Library_cpp_uno \ $(if $(ENABLE_JAVA),\ @@ -29,5 +30,6 @@ else ifneq ($(words $(bridges_SELECTED_BRIDGE)),1) $(call gb_Output_error,multiple bridges selected for build: $(bridges_SELECTED_BRIDGE)) endif endif +endif # vim: set noet sw=4 ts=4: diff --git a/config_host.mk.in b/config_host.mk.in index b6012d793893..5cc02e393589 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -325,6 +325,7 @@ export KF5_LIBS=$(gb_SPACE)@KF5_LIBS@ export KRB5_LIBS=@KRB5_LIBS@ export LCMS2_CFLAGS=$(gb_SPACE)@LCMS2_CFLAGS@ export LCMS2_LIBS=$(gb_SPACE)@LCMS2_LIBS@ +export LD=@LD@ export LD_GC_SECTIONS=@LD_GC_SECTIONS@ export LD_PLUGIN=@LD_PLUGIN@ @x_LDFLAGS@ export LDFLAGS=@LDFLAGS@ @@ -474,6 +475,16 @@ export PERL=@PERL@ export PKGFORMAT=@PKGFORMAT@ export PKGMK=@PKGMK@ export PKG_CONFIG=@PKG_CONFIG@ +ifneq (@PKG_CONFIG_PATH@,) +export PKG_CONFIG_PATH=@PKG_CONFIG_PATH@ +else +unexport PKG_CONFIG_PATH +endif +ifneq (@PKG_CONFIG_LIBDIR@,) +export PKG_CONFIG_LIBDIR=@PKG_CONFIG_LIBDIR@ +else +unexport PKG_CONFIG_LIBDIR +endif export PLATFORMID=@PLATFORMID@ export POPPLER_CFLAGS=$(gb_SPACE)@POPPLER_CFLAGS@ export POPPLER_LIBS=$(gb_SPACE)@POPPLER_LIBS@ @@ -506,6 +517,7 @@ export QT5_LIBS=$(gb_SPACE)@QT5_LIBS@ export QT5_GOBJECT_CFLAGS=$(gb_SPACE)@QT5_GOBJECT_CFLAGS@ export QT5_GOBJECT_LIBS=$(gb_SPACE)@QT5_GOBJECT_LIBS@ export QT5_HAVE_GOBJECT=@QT5_HAVE_GOBJECT@ +export QT5_PLATFORMS_SRCDIR=@QT5_PLATFORMS_SRCDIR@ export QXP_CFLAGS=$(gb_SPACE)@QXP_CFLAGS@ export QXP_LIBS=$(gb_SPACE)@QXP_LIBS@ export RANLIB=@RANLIB@ @@ -639,6 +651,7 @@ export USE_XINERAMA=@USE_XINERAMA@ export UPDATE_CONFIG=@UPDATE_CONFIG@ export UUIDGEN=@UUIDGEN@ export VALGRIND_CFLAGS=$(gb_SPACE)@VALGRIND_CFLAGS@ +export VCL_PLUGIN_INFO=@VCL_PLUGIN_INFO@ export VCVER=@VCVER@ export DEVENV=@DEVENV@ export VISIO_CFLAGS=$(gb_SPACE)@VISIO_CFLAGS@ diff --git a/configure.ac b/configure.ac index 1b0521624ac2..e5ce5560c661 100644 --- a/configure.ac +++ b/configure.ac @@ -804,6 +804,8 @@ dnl Sequential to keep the logic very simple dnl These values may be checked and reset later. dnl =================================================================== #defaults unless the os test overrides this: +test_cmis=yes +test_curl=yes test_randr=yes test_xrender=yes test_cups=yes @@ -957,6 +959,7 @@ darwin*|macos*) # macOS ;; ios*) # iOS + test_cmis=no test_randr=no test_xrender=no test_freetype=no @@ -1104,6 +1107,29 @@ haiku*) _os=Haiku ;; +emscripten) + build_gstreamer_1_0=no + enable_lpsolve=no + enable_report_builder=no + with_theme="breeze" + test_cmis=no + test_cups=no + test_curl=no + test_dbus=no + test_fontconfig=no + test_freetype=no + test_gtk=no + test_randr=no + test_xrender=no + enable_postgresql_sdbc=no + enable_firebird_sdbc=no + enable_mariadb_sdbc=no + with_system_zlib=no + _os=Emscripten + + BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE" + ;; + *) AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!]) ;; @@ -1254,10 +1280,24 @@ if test $_os != "WINNT"; then fi AC_SUBST(DLOPEN_LIBS) -AC_ARG_ENABLE(ios-simulator, - AS_HELP_STRING([--enable-ios-simulator], - [build for iOS simulator]) -) +dnl =================================================================== +dnl Sanity checks for Emscripten SDK setup +dnl =================================================================== + +if test "$_os" = "Emscripten"; then + EMSCRIPTEN_ERROR=0 + if ! which emconfigure >/dev/null 2>&1; then + AC_MSG_WARN([emconfigure must be in your \$PATH]) + EMSCRIPTEN_ERROR=1 + fi + if test -z "$EMMAKEN_JUST_CONFIGURE"; then + AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh]) + 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 ############################################################################### # Extensions switches --enable/--disable @@ -1272,6 +1312,11 @@ AC_ARG_ENABLE(ios-simulator, # if you use --disable-extension-integration. Is that really the # case? +AC_ARG_ENABLE(ios-simulator, + AS_HELP_STRING([--enable-ios-simulator], + [build for iOS simulator]) +) + libo_FUZZ_ARG_ENABLE(extension-integration, AS_HELP_STRING([--disable-extension-integration], [Disable integration of the built extensions in the installer of the @@ -1462,7 +1507,8 @@ libo_FUZZ_ARG_ENABLE(optimized, [Whether to compile with optimization flags. By default, disabled for --enable-debug and --enable-dbgutil, enabled otherwise. Using 'debug' will try to use only optimizations that should - not interfere with debugging.])) + not interfere with debugging. For Emscripten we default to optimized (-O1) + debug build, as otherwise biaries become too large.])) libo_FUZZ_ARG_ENABLE(runtime-optimizations, AS_HELP_STRING([--disable-runtime-optimizations], @@ -1789,6 +1835,13 @@ libo_FUZZ_ARG_ENABLE(cipher-openssl-backend, [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality. Requires --enable-openssl.])) +AC_ARG_ENABLE(nss, + AS_HELP_STRING([--disable-nss], + [Disable using NSS. If disabled, + components will either use GNUTLS or openssl. Work in progress, + use only if you are hacking on it.]), +,enable_nss=yes) + AC_ARG_ENABLE(library-bin-tar, AS_HELP_STRING([--enable-library-bin-tar], [Enable the building and reused of tarball of binary build for some 'external' libraries. @@ -1832,6 +1885,16 @@ libo_FUZZ_ARG_ENABLE(librelogo, [Do not build LibreLogo.]), ,enable_librelogo=yes) +AC_ARG_ENABLE(cmis, + AS_HELP_STRING([--disable-cmis], + [Disable CMIS support.]), +,enable_cmis=yes) + +AC_ARG_ENABLE(curl, + AS_HELP_STRING([--disable-curl], + [Disable CURL support.]), +,enable_curl=yes) + dnl =================================================================== dnl Optional Packages (--with/without-) dnl =================================================================== @@ -2817,7 +2880,7 @@ 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 "$enable_fuzzers" != "yes"; then +if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then BUILD_TYPE="$BUILD_TYPE DESKTOP" AC_DEFINE(HAVE_FEATURE_DESKTOP) AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT) @@ -2868,7 +2931,7 @@ fi if test -z "$enable_scripting"; then # Disable scripting for iOS unless specifically overridden # with --enable-scripting. - if test $_os != iOS; then + if test $_os != iOS -o $_os = Emscripten; then enable_scripting=yes fi fi @@ -2882,7 +2945,7 @@ else SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING" fi -if test $_os = iOS -o $_os = Android; then +if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then # Disable dynamic_loading always for iOS and Android enable_dynamic_loading=no elif test -z "$enable_dynamic_loading"; then @@ -4105,6 +4168,8 @@ if test "$COM_IS_CLANG" = TRUE; then [my_apple_clang=yes],[my_apple_clang=]) if test "$my_apple_clang" = yes; then AC_MSG_RESULT([assumed yes (Apple Clang)]) + elif test "$_os" = Emscripten; then + AC_MSG_RESULT([assumed yes (Emscripten Clang)]) else if test "$_os" = WINNT; then dnl In which case, assume clang-cl: @@ -4186,7 +4251,7 @@ fi # =================================================================== HAVE_GCC_GGDB2= -if test "$GCC" = "yes"; then +if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2]) save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror -ggdb2" @@ -4414,7 +4479,7 @@ fi AC_SUBST(USE_LD) HAVE_LD_BSYMBOLIC_FUNCTIONS= -if test "$GCC" = "yes"; then +if test "$GCC" = "yes" -a "$_os" != Emscripten ; then AC_MSG_CHECKING([for -Bsymbolic-functions linker support]) bsymbolic_functions_ldflags_save=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions" @@ -4600,7 +4665,7 @@ elif test "$enable_optimized" = debug; then ENABLE_OPTIMIZED_DEBUG=TRUE AC_MSG_RESULT([yes (debug)]) HAVE_GCC_OG= - if test "$GCC" = "yes"; then + if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then AC_MSG_CHECKING([whether $CC_BASE supports -Og]) save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror -Og" @@ -4612,7 +4677,7 @@ elif test "$enable_optimized" = debug; then AC_MSG_RESULT([no]) fi fi - if test -z "$HAVE_GCC_OG"; then + if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.]) fi else @@ -5055,6 +5120,25 @@ solaris*) SOLARINC="$SOLARINC -I/usr/local/include" ;; +emscripten*) + COM=GCC + USING_X11= + OS=EMSCRIPTEN + RTL_OS=Emscripten + P_SEP=: + + case "$host_cpu" in + wasm32|wasm64) + ;; + *) + AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os]) + ;; + esac + CPUNAME=INTEL + RTL_ARCH=x86 + PLATFORMID=linux_x86 + ;; + *) AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!]) ;; @@ -5179,9 +5263,10 @@ if test "$cross_compiling" = "yes"; then ( unset COM USING_X11 OS CPUNAME unset CC CXX SYSBASE CFLAGS - unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP + unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP unset CPPUNIT_CFLAGS CPPUNIT_LIBS - unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR + unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC + unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH if test -n "$CC_FOR_BUILD"; then export CC="$CC_FOR_BUILD" CC_BASE=`first_arg_basename "$CC"` @@ -5193,6 +5278,7 @@ if test "$cross_compiling" = "yes"; then test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD" cd CONF-FOR-BUILD + # Handle host configuration, which affects the cross-toolset too sub_conf_opts="" test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache" test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home" @@ -5227,6 +5313,7 @@ if test "$cross_compiling" = "yes"; then --disable-gstreamer-1-0 \ --disable-gtk3 \ --disable-mariadb-sdbc \ + --disable-nss \ --disable-online-update \ --disable-opencl \ --disable-pdfimport \ @@ -5249,7 +5336,9 @@ if test "$cross_compiling" = "yes"; then PERMITTED_BUILD_TARGETS=" AVMEDIA BOOST + CAIRO CLUCENE + CURL DBCONNECTIVITY DESKTOP DYNLOADING @@ -6062,9 +6151,12 @@ if test "$_os" != "WINNT"; then fi AC_SUBST(AR) AC_SUBST(DLLTOOL) +AC_SUBST(LD) AC_SUBST(NM) AC_SUBST(OBJDUMP) AC_SUBST(PKG_CONFIG) +AC_SUBST(PKG_CONFIG_PATH) +AC_SUBST(PKG_CONFIG_LIBDIR) AC_SUBST(RANLIB) AC_SUBST(READELF) AC_SUBST(STRIP) @@ -7054,7 +7146,7 @@ dnl =================================================================== dnl Check for system libcmis dnl =================================================================== # libcmis requires curl and we can't build curl for iOS -if test $_os != iOS; then +if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2]) ENABLE_LIBCMIS=TRUE else @@ -9207,6 +9299,9 @@ if test "$with_system_libxml" = "auto"; then WINNT|iOS|Android) with_system_libxml="$with_system_libs" ;; + Emscripten) + with_system_libxml=no + ;; *) if test "$enable_fuzzers" != "yes"; then with_system_libxml=yes @@ -9349,7 +9444,11 @@ no|disable) # Python is required to build LibreOffice. In theory we could separate the build-time Python # requirement from the choice whether to include Python stuff in the installer, but why # bother? - AC_MSG_ERROR([Python is required at build time.]) + if test "$cross_compiling" = yes; then + enable_python=system + else + AC_MSG_ERROR([Python is required at build time.]) + fi fi enable_python=no AC_MSG_RESULT([none]) @@ -10037,7 +10136,7 @@ if test "$with_system_curl" = "auto"; then with_system_curl="$with_system_libs" fi -if test "$with_system_curl" = "yes"; then +if test "$test_curl" = "yes" -a "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then AC_MSG_RESULT([external]) SYSTEM_CURL=TRUE @@ -10069,6 +10168,8 @@ if test "$with_system_curl" = "yes"; then fi ENABLE_CURL=TRUE +elif test "$test_curl" = "no"; then + AC_MSG_RESULT([none]) else AC_MSG_RESULT([internal]) SYSTEM_CURL= @@ -10211,7 +10312,7 @@ AC_SUBST(SYSTEM_OPENLDAP) dnl =================================================================== dnl Check for system NSS dnl =================================================================== -if test "$enable_fuzzers" != "yes"; then +if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8]) AC_DEFINE(HAVE_FEATURE_NSS) ENABLE_NSS="TRUE" @@ -11372,6 +11473,8 @@ if test -z "$build_vcl_plugins"; then build_vcl_plugins="none" fi AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins]) +VCL_PLUGIN_INFO=$R +AC_SUBST([VCL_PLUGIN_INFO]) dnl =================================================================== dnl check for dbus support @@ -12412,6 +12515,7 @@ MOC5="moc" QT5_GOBJECT_CFLAGS="" QT5_GOBJECT_LIBS="" QT5_HAVE_GOBJECT="" +QT5_PLATFORMS_SRCDIR="" if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \ \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \ \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \) diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 33deef07a69a..fd4dc5ccaa33 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -30,8 +30,8 @@ $(eval $(call gb_Library_use_externals,sofficeapp, \ icu_headers \ icui18n \ icuuc \ - $(if $(filter-out iOS,$(OS)), \ - curl \ + $(if $(filter-out EMSCRIPTEN iOS,$(OS)), \ + curl \ )\ $(if $(ENABLE_ONLINE_UPDATE_MAR),\ orcus-parser \ diff --git a/external/apr/ExternalProject_apr.mk b/external/apr/ExternalProject_apr.mk index 1c94480e5ab7..7f3a631e933e 100644 --- a/external/apr/ExternalProject_apr.mk +++ b/external/apr/ExternalProject_apr.mk @@ -30,7 +30,7 @@ $(call gb_ExternalProject_get_state_target,apr,build): $(call gb_Trace_StartRange,apr,EXTERNAL) +$(call gb_ExternalProject_run,build,\ $(if $(ENABLE_MACOSX_SANDBOX),ac_cv_func_fdatasync=no) \ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ --enable-static --disable-shared \ --with-pic \ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\ diff --git a/external/apr/ExternalProject_apr_util.mk b/external/apr/ExternalProject_apr_util.mk index a311f32e8e01..a94b0e38d43b 100644 --- a/external/apr/ExternalProject_apr_util.mk +++ b/external/apr/ExternalProject_apr_util.mk @@ -31,7 +31,7 @@ else $(call gb_ExternalProject_get_state_target,apr_util,build): $(call gb_Trace_StartRange,apr_util,EXTERNAL) +$(call gb_ExternalProject_run,build,\ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ --enable-static --disable-shared \ --with-pic \ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\ diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk index bdacdcd9856e..c10ed5a55048 100644 --- a/external/boost/UnpackedTarball_boost.mk +++ b/external/boost/UnpackedTarball_boost.mk @@ -46,6 +46,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,boost,3)) $(eval $(call gb_UnpackedTarball_add_patches,boost,\ $(foreach patch,$(boost_patches),external/boost/$(patch)) \ + external/boost/boost-emscripten-noshm.patch.0 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/boost/boost-emscripten-noshm.patch.0 b/external/boost/boost-emscripten-noshm.patch.0 new file mode 100644 index 000000000000..f9d27b0b6e11 --- /dev/null +++ b/external/boost/boost-emscripten-noshm.patch.0 @@ -0,0 +1,11 @@ +--- boost/interprocess/detail/workaround.hpp.orig 2020-12-15 06:31:51.037665526 +0100 ++++ boost/interprocess/detail/workaround.hpp 2020-12-15 06:32:39.741281893 +0100 +@@ -31,7 +31,7 @@ + ////////////////////////////////////////////////////// + //Check for XSI shared memory objects. They are available in nearly all UNIX platforms + ////////////////////////////////////////////////////// +- #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) ++ #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !defined(__EMSCRIPTEN__) + #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + #endif + diff --git a/external/breakpad/ExternalProject_breakpad.mk b/external/breakpad/ExternalProject_breakpad.mk index 9e7e72485849..56a7be987837 100644 --- a/external/breakpad/ExternalProject_breakpad.mk +++ b/external/breakpad/ExternalProject_breakpad.mk @@ -21,7 +21,7 @@ else # !ifeq($(COM),MSC) $(call gb_ExternalProject_get_state_target,breakpad,build) : $(call gb_Trace_StartRange,breakpad,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \ + $(gb_RUN_CONFIGURE) ./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \ && $(MAKE) \ ) $(call gb_Trace_EndRange,breakpad,EXTERNAL) diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk index 41e7621c789f..471ae6104361 100644 --- a/external/cairo/ExternalProject_cairo.mk +++ b/external/cairo/ExternalProject_cairo.mk @@ -64,14 +64,15 @@ else $(call gb_ExternalProject_get_state_target,cairo,build) : $(call gb_Trace_StartRange,cairo,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ $(if $(debug),STRIP=" ") \ $(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \ - $(if $(filter-out ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \ + $(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="") \ + $(if $(filter-out EMSCRIPTEN ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \ $(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \ LIBS="$(ZLIB_LIBS)" \ $(if $(filter -fsanitize=%,$(LDFLAGS)),LDFLAGS="$(LDFLAGS) -fuse-ld=bfd") \ - pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \ + pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman -pthread" \ pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1 \ $(if $(filter LINUX,$(OS)),-Wl$(COMMA)-z$(COMMA)origin \ -Wl$(COMMA)-rpath$(COMMA)\\\$$\$$ORIGIN) \ @@ -84,7 +85,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) : $(if $(SYSTEM_FONTCONFIG),,FONTCONFIG_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,fontconfig)") \ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \ - $(if $(filter ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \ + $(if $(filter EMSCRIPTEN ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \ $(if $(filter iOS,$(OS)),--enable-quartz --enable-quartz-font) \ --disable-valgrind \ $(if $(filter iOS,$(OS)),--disable-ft,--enable-ft --enable-fc) \ diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk index fec943762df8..03dffbd01312 100644 --- a/external/cairo/ExternalProject_pixman.mk +++ b/external/cairo/ExternalProject_pixman.mk @@ -34,11 +34,12 @@ else $(call gb_ExternalProject_get_state_target,pixman,build) : $(call gb_Trace_StartRange,pixman,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \ $(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ $(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \ + $(if $(filter EMSCRIPTEN,$(OS)),CFLAGS="-pthread") \ && $(MAKE) \ ) $(call gb_Trace_EndRange,pixman,EXTERNAL) diff --git a/external/coinmp/ExternalProject_coinmp.mk b/external/coinmp/ExternalProject_coinmp.mk index e1484e656619..9bd5a4cd2685 100644 --- a/external/coinmp/ExternalProject_coinmp.mk +++ b/external/coinmp/ExternalProject_coinmp.mk @@ -29,7 +29,7 @@ else $(call gb_ExternalProject_get_state_target,coinmp,build) : $(call gb_Trace_StartRange,coinmp,EXTERNAL) +$(call gb_ExternalProject_run,build,\ - ./configure COIN_SKIP_PROJECTS="Data/Sample" \ + $(gb_RUN_CONFIGURE) ./configure COIN_SKIP_PROJECTS="Data/Sample" \ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ $(if $(DISABLE_DYNLOADING),--disable-shared) \ diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk index 1c5ac725af59..92db8a1953f3 100644 --- a/external/cppunit/ExternalProject_cppunit.mk +++ b/external/cppunit/ExternalProject_cppunit.mk @@ -43,7 +43,7 @@ endif $(call gb_ExternalProject_get_state_target,cppunit,build) : $(call gb_Trace_StartRange,cppunit,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ --disable-dependency-tracking \ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \ --disable-doxygen \ @@ -55,7 +55,8 @@ $(call gb_ExternalProject_get_state_target,cppunit,build) : $(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \ $(if $(filter SOLARIS,$(OS)),LIBS="-lm") \ $(if $(filter ANDROID,$(OS)),LIBS="$(gb_STDLIBS)") \ - CXXFLAGS="$(cppunit_CXXFLAGS)" \ + $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \ + CXXFLAGS="$(cppunit_CXXFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS)" \ && cd src \ && $(MAKE) \ ) diff --git a/external/cppunit/disable-dynloading.patch b/external/cppunit/disable-dynloading.patch index a9aa37f6f45d..62ed1deeb635 100644 --- a/external/cppunit/disable-dynloading.patch +++ b/external/cppunit/disable-dynloading.patch @@ -17,7 +17,7 @@ +// Actually this is for iOS and Android where we build the cppunit tests libraries +// as plain archives and just link them statically into test fixture programs, +// and don't want any stinking duplicate main(), but shouldn't hurt for MacOSX either. -+#elif defined(__APPLE__) || defined(__ANDROID__) ++#elif defined(__APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) +#define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \ + typedef char __CppUnitPlugInImplementMainDummyTypeDef // Unix diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index 138b50afd0e0..11d1fcc57d4a 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -40,7 +40,7 @@ endif $(call gb_ExternalProject_get_state_target,curl,build): $(call gb_Trace_StartRange,curl,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ $(if $(filter iOS MACOSX,$(OS)),\ --with-darwinssl,\ $(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out"),--without-nss)) \ diff --git a/external/epm/ExternalProject_epm.mk b/external/epm/ExternalProject_epm.mk index 68a61a78a744..7b0dde219e4b 100644 --- a/external/epm/ExternalProject_epm.mk +++ b/external/epm/ExternalProject_epm.mk @@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,epm,\ $(call gb_ExternalProject_get_state_target,epm,build) : $(call gb_Trace_StartRange,epm,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure --disable-fltk \ + $(gb_RUN_CONFIGURE) ./configure --disable-fltk \ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \ && $(MAKE) \ && touch $@ \ diff --git a/external/expat/ExternalProject_expat.mk b/external/expat/ExternalProject_expat.mk index 4f4f0301c1bc..b69e6544f55f 100644 --- a/external/expat/ExternalProject_expat.mk +++ b/external/expat/ExternalProject_expat.mk @@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,expat,\ $(call gb_ExternalProject_get_state_target,expat,configure) : $(call gb_Trace_StartRange,expat,EXTERNAL) $(call gb_ExternalProject_run,configure,\ - ./configure --without-docbook \ + $(gb_RUN_CONFIGURE) ./configure --without-docbook \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ $(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \ ,,expat_configure.log) diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk index 2a491d965699..94a62e418124 100644 --- a/external/firebird/ExternalProject_firebird.mk +++ b/external/firebird/ExternalProject_firebird.mk @@ -66,7 +66,7 @@ $(call gb_ExternalProject_get_state_target,firebird,build): " \ && export LIBREOFFICE_ICU_LIB="$(call gb_UnpackedTarball_get_dir,icu)/source/lib" \ && export MSVC_USE_INDIVIDUAL_PDBS=TRUE \ - && MAKE=$(MAKE) ./configure \ + && MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \ --without-editline \ --with-wire-compress=no \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ diff --git a/external/fontconfig/ExternalProject_fontconfig.mk b/external/fontconfig/ExternalProject_fontconfig.mk index b82c7657395b..fdcb80a38363 100644 --- a/external/fontconfig/ExternalProject_fontconfig.mk +++ b/external/fontconfig/ExternalProject_fontconfig.mk @@ -21,14 +21,15 @@ $(eval $(call gb_ExternalProject_register_targets,fontconfig,\ $(call gb_ExternalProject_get_state_target,fontconfig,build) : $(call gb_Trace_StartRange,fontconfig,EXTERNAL) $(call gb_ExternalProject_run,build,\ - CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \ - ./configure \ + CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS) $(if $(filter EMSCRIPTEN,$(OS)),-pthread)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \ + $(gb_RUN_CONFIGURE) ./configure \ --disable-shared \ --disable-silent-rules \ $(if $(filter ANDROID,$(OS)),--with-arch=arm) \ --with-expat-includes=$(call gb_UnpackedTarball_get_dir,expat)/lib \ --with-expat-lib=$(gb_StaticLibrary_WORKDIR) \ --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ + $(if $(filter EMSCRIPTEN,$(OS)),ac_cv_func_fstatfs=no ac_cv_func_fstatvfs=no) \ && $(MAKE) -C src \ ) $(call gb_Trace_EndRange,fontconfig,EXTERNAL) diff --git a/external/freetype/ExternalProject_freetype.mk b/external/freetype/ExternalProject_freetype.mk index 3f4a719d5663..8b49abbab13a 100644 --- a/external/freetype/ExternalProject_freetype.mk +++ b/external/freetype/ExternalProject_freetype.mk @@ -25,7 +25,7 @@ else $(call gb_ExternalProject_get_state_target,freetype,build) : $(call gb_Trace_StartRange,freetype,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ --disable-shared \ --without-zlib \ --without-bzip2 \ diff --git a/external/gpgmepp/ExternalProject_gpgmepp.mk b/external/gpgmepp/ExternalProject_gpgmepp.mk index 1ba51cfb3bce..92348e426c80 100644 --- a/external/gpgmepp/ExternalProject_gpgmepp.mk +++ b/external/gpgmepp/ExternalProject_gpgmepp.mk @@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_ $(call gb_ExternalProject_run,build, \ $(gb_WIN_GPG_cross_setup_exports) \ && autoreconf \ - && ./configure \ + && $(gb_RUN_CONFIGURE) ./configure \ --disable-shared \ --disable-languages \ --disable-gpgconf-test \ @@ -48,7 +48,7 @@ $(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Trace_StartRange,gpgmepp,EXTERNAL) $(call gb_ExternalProject_run,build,\ autoreconf \ - && ./configure \ + && $(gb_RUN_CONFIGURE) ./configure \ --disable-gpgconf-test \ --disable-gpg-test \ --disable-gpgsm-test \ diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk b/external/harfbuzz/ExternalProject_harfbuzz.mk index 7219d402df3c..caf6bcd5f922 100644 --- a/external/harfbuzz/ExternalProject_harfbuzz.mk +++ b/external/harfbuzz/ExternalProject_harfbuzz.mk @@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) : $(if $(SYSTEM_ICU),,ICU_CONFIG=$(SRCDIR)/external/icu/cross-bin/icu-config) \ GRAPHITE2_CFLAGS="$(GRAPHITE_CFLAGS)" \ GRAPHITE2_LIBS="$(GRAPHITE_LIBS)" \ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ --enable-static \ --disable-shared \ --disable-gtk-doc \ diff --git a/external/hunspell/ExternalProject_hunspell.mk b/external/hunspell/ExternalProject_hunspell.mk index 43da1c254e34..91fd5c431ef8 100644 --- a/external/hunspell/ExternalProject_hunspell.mk +++ b/external/hunspell/ExternalProject_hunspell.mk @@ -24,11 +24,11 @@ endif $(call gb_ExternalProject_get_state_target,hunspell,build): $(call gb_Trace_StartRange,hunspell,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure --disable-shared --disable-nls --with-pic \ + $(gb_RUN_CONFIGURE) ./configure --disable-shared --disable-nls --with-pic \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\ $(if $(filter AIX,$(OS)),CFLAGS="-D_LINUX_SOURCE_COMPAT") \ $(if $(hunspell_CPPFLAGS),CPPFLAGS='$(hunspell_CPPFLAGS)') \ - CXXFLAGS="$(CXXFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(debug),$(gb_DEBUGINFO_FLAGS))" \ + CXXFLAGS="$(CXXFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(debug),$(gb_DEBUGINFO_FLAGS))" \ && cd src/hunspell && $(MAKE) \ ) $(call gb_Trace_EndRange,hunspell,EXTERNAL) diff --git a/external/hyphen/ExternalProject_hyphen.mk b/external/hyphen/ExternalProject_hyphen.mk index 21cef66d85d0..63d167f7804b 100644 --- a/external/hyphen/ExternalProject_hyphen.mk +++ b/external/hyphen/ExternalProject_hyphen.mk @@ -18,7 +18,7 @@ $(eval $(call gb_ExternalProject_register_targets,hyphen,\ $(call gb_ExternalProject_get_state_target,hyphen,build): $(call gb_Trace_StartRange,hyphen,EXTERNAL) $(call gb_ExternalProject_run,build,\ - ./configure --disable-shared \ + $(gb_RUN_CONFIGURE) ./configure --disable-shared \ $(if $(filter-out iOS,$(OS)),--with-pic) \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) gio_can_sniff=no) \ && $(MAKE) \ diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk index 4ff8370ebd50..18a8f3838834 100644 --- a/external/icu/ExternalProject_icu.mk +++ b/external/icu/ExternalProject_icu.mk @@ -25,7 +25,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) : gb_ICU_XFLAGS="-FS $(SOLARINC) $(gb_DEBUGINFO_FLAGS) $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD -Gy)" \ && CFLAGS="$${gb_ICU_XFLAGS}" CPPFLAGS="$(SOLARINC)" CXXFLAGS="$${gb_ICU_XFLAGS}" \ INSTALL=`cygpath -m /usr/bin/install` $(if $(MSVC_USE_DEBUG_RUNTIME),LDFLAGS="-DEBUG") \ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ $(if $(MSVC_USE_DEBUG_RUNTIME),--enable-debug --disable-release) \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ --with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \ @@ -70,11 +70,10 @@ $(call gb_ExternalProject_get_state_target,icu,build) : CPPFLAGS=$(icu_CPPFLAGS) CFLAGS=$(icu_CFLAGS) \ CXXFLAGS=$(icu_CXXFLAGS) LDFLAGS=$(icu_LDFLAGS) \ PYTHONWARNINGS="default" \ - ./configure \ + $(gb_RUN_CONFIGURE) ./configure \ --disable-layout --disable-samples \ $(if $(filter FUZZERS,$(BUILD_TYPE)),--disable-release) \ - $(if $(filter iOS ANDROID,$(OS)),--disable-dyload) \ - $(if $(filter ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \ + $(if $(filter EMSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \ $(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\ --with-data-packaging=static --enable-static --disable-shared --disable-dyload,\ @@ -82,6 +81,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) : $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)\ --with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \ --disable-tools --disable-extras) \ + AR="$(AR)" RANLIB="$(RANLIB)" \ && $(MAKE) $(if $(CROSS_COMPILING),DATASUBDIR=data) $(if $(verbose),VERBOSE=1) \ $(if $(filter MACOSX,$(OS)), \ && $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl \ diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk index 435382fa7988..a59d6e8b97d7 100644 --- a/external/icu/UnpackedTarball_icu.mk +++ b/external/icu/UnpackedTarball_icu.mk @@ -41,6 +41,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\ external/icu/icu4c-windows-cygwin-cross.patch.1 \ external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \ $(if $(filter-out ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \ + external/icu/icu4c-emscripten-cross.patch.1 \ )) $(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict)) diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1 new file mode 100644 index 000000000000..84c88a68a87d --- /dev/null +++ b/external/icu/icu4c-emscripten-cross.patch.1 @@ -0,0 +1,99 @@ +--- icu/source/acinclude.m4.orig 2020-04-22 22:04:20.000000000 +0200 ++++ icu/source/acinclude.m4 2020-11-04 06:10:29.993070072 +0100 +@@ -84,6 +84,7 @@ + *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;; + *-*-nto*) icu_cv_host_frag=mh-qnx ;; + *-ncr-*) icu_cv_host_frag=mh-mpras ;; ++wasm*-*-emscripten*) icu_cv_host_frag=mh-emscripten ;; + *) icu_cv_host_frag=mh-unknown ;; + esac + ] +--- /dev/null ++++ icu/source/config/mh-emscripten 2015-10-06 12:01:00.497972406 +0200 +@@ -0,0 +1,86 @@ ++## Emscripten-specific setup ++## Copyright (c) 1999-2013, International Business Machines Corporation and ++## others. All Rights Reserved. ++## Commands to generate dependency files ++GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) ++GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS) ++ ++## Flags for position independent code ++SHAREDLIBCFLAGS = -fPIC ++SHAREDLIBCXXFLAGS = -fPIC ++SHAREDLIBCPPFLAGS = -DPIC ++ ++## Additional flags when building libraries and with threads ++THREADSCPPFLAGS = -D_REENTRANT ++LIBCPPFLAGS = ++ ++## Compiler switch to embed a runtime search path ++LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN ++LD_RPATH_PRE = -Wl,-rpath, ++ ++## Force RPATH=$ORIGIN to locate own dependencies w/o need for LD_LIBRARY_PATH: ++ENABLE_RPATH=YES ++RPATHLDFLAGS=${LD_RPATH_PRE}'$$ORIGIN' ++ ++## These are the library specific LDFLAGS ++#LDFLAGSICUDT=-nodefaultlibs -nostdlib ++# Debian change: linking icudata as data only causes too many problems. ++LDFLAGSICUDT= ++ ++## Compiler switch to embed a library name ++# The initial tab in the next line is to prevent icu-config from reading it. ++ LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET)) ++#SH# # We can't depend on MIDDLE_SO_TARGET being set. ++#SH# LD_SONAME= ++ ++## Shared library options ++LD_SOOPTIONS= -Wl,-Bsymbolic-functions ++ ++## Shared object suffix ++SO = so ++## Non-shared intermediate object suffix ++STATIC_O = o ++ ++## Compilation rules ++# WASM needs -pthread for atomics support ++%.$(STATIC_O): $(srcdir)/%.c ++ $(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -pthread -o $@ $<) ++ ++%.$(STATIC_O): $(srcdir)/%.cpp ++ $(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -pthread -o $@ $<) ++ ++ ++## Dependency rules ++%.d: $(srcdir)/%.c ++ $(call ICU_MSG,(deps)) $< ++ @$(SHELL) -ec '$(GEN_DEPS.c) $< \ ++ | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ ++ [ -s $@ ] || rm -f $@' ++ ++%.d: $(srcdir)/%.cpp ++ $(call ICU_MSG,(deps)) $< ++ @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ ++ | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ ++ [ -s $@ ] || rm -f $@' ++ ++## Versioned libraries rules ++ ++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) ++ $(RM) $@ && ln -s ${/dev/null", "r" ); diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index 9622d85aebf5..57d62c49c24c 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -251,7 +251,7 @@ void SvMetaType::WriteSfxItem( // write the implementation part rOutStm.WriteCharPtr( "#ifdef SFX_TYPEMAP" ) << endl; - rOutStm.WriteCharPtr( "#if !defined(_WIN32) && (defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS) || defined(LINUX)))" ) << endl; + rOutStm.WriteCharPtr( "#if !defined(_WIN32) && (defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS) || defined(EMSCRIPTEN) || defined(LINUX)))" ) << endl; rOutStm.WriteCharPtr( "__attribute__((__weak__))" ) << endl; rOutStm.WriteCharPtr( "#endif" ) << endl; rOutStm.WriteOString( aTypeName ).WriteOString( aVarName ) diff --git a/include/osl/endian.h b/include/osl/endian.h index c3a2344f77fb..fb9b514c128a 100644 --- a/include/osl/endian.h +++ b/include/osl/endian.h @@ -74,6 +74,8 @@ extern "C" { # elif defined _BIG_ENDIAN # define OSL_BIGENDIAN # endif +#elif defined EMSCRIPTEN +# define OSL_LITENDIAN #else # error "Target platform not specified !" #endif diff --git a/include/sal/alloca.h b/include/sal/alloca.h index a8edc5af2872..ce6b60cc9f8f 100644 --- a/include/sal/alloca.h +++ b/include/sal/alloca.h @@ -25,7 +25,7 @@ #define INCLUDED_SAL_ALLOCA_H #if defined(__sun) || defined(LINUX) || defined(AIX) || defined(ANDROID) || defined(HAIKU) \ - || defined(MACOSX) || defined(IOS) + || defined(MACOSX) || defined(IOS) || defined(EMSCRIPTEN) #ifndef INCLUDED_ALLOCA_H #include diff --git a/include/sal/config.h b/include/sal/config.h index 74d482fc7631..bf5958519426 100644 --- a/include/sal/config.h +++ b/include/sal/config.h @@ -83,6 +83,17 @@ #define SAL_CONFIGFILE(name) name "rc" #endif +#ifdef EMSCRIPTEN +#define SAL_UNX +#define SAL_DLLEXTENSION ".bc" +#define SAL_EXEEXTENSION "" +#define SAL_DLLPREFIX "lib" +#define SAL_PATHSEPARATOR ':' +#define SAL_PATHDELIMITER '/' +#define SAL_NEWLINE_STRING "\n" +#define SAL_CONFIGFILE(name) name "rc" +#endif + /* The following spell is for Solaris and its descendants. * See the "Solaris" section of * , and diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx index a8b0e10cd163..8b1f1dccced4 100644 --- a/sal/osl/unx/system.hxx +++ b/sal/osl/unx/system.hxx @@ -269,13 +269,33 @@ int macxp_resolveAlias(char *path, int buflen); # define NO_PTHREAD_RTL #endif +#ifdef EMSCRIPTEN +# ifndef ETIME +# define ETIME ETIMEDOUT +# endif +# include +# include +# include +# include +# include +# include +# include +# include +# include +# define IORESOURCE_TRANSFER_BSD +# define IOCHANNEL_TRANSFER_BSD_RENO +# define pthread_testcancel() +# define NO_PTHREAD_PRIORITY +# define INIT_GROUPS(name, gid) false +#endif + #if !defined(_WIN32) && \ !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && \ !defined(AIX) && \ !defined(__sun) && !defined(MACOSX) && \ !defined(OPENBSD) && !defined(DRAGONFLY) && \ !defined(IOS) && !defined(ANDROID) && \ - !defined(HAIKU) + !defined(HAIKU) && !defined(EMSCRIPTEN) # error "Target platform not specified!" #endif diff --git a/sc/source/core/tool/math.cxx b/sc/source/core/tool/math.cxx index a077d5c3521a..3c496f83833c 100644 --- a/sc/source/core/tool/math.cxx +++ b/sc/source/core/tool/math.cxx @@ -53,8 +53,13 @@ double power(const double& fVal1, const double& fVal2) } // The pow() call must had been the most recent call to check errno or exception. if ((((math_errhandling & MATH_ERRNO) != 0) && (errno == EDOM || errno == ERANGE)) +// emscripten is currently broken by https://github.com/emscripten-core/emscripten/pull/11087 +// While the removal is correct for C99, it's not for C++11 (see http://www.cplusplus.com/reference/cfenv/FE_INEXACT/) +// But since emscripten currently doesn't support any math exceptions, we simply ignore them +#ifndef __EMSCRIPTEN__ || (((math_errhandling & MATH_ERREXCEPT) != 0) && std::fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)) +#endif || !std::isfinite(fPow)) { fPow = CreateDoubleError(FormulaError::IllegalFPOperation); diff --git a/solenv/bin/run-configure b/solenv/bin/run-configure new file mode 100755 index 000000000000..9758ff1d86c6 --- /dev/null +++ b/solenv/bin/run-configure @@ -0,0 +1,9 @@ +#!/bin/sh + +# We could run emconfigure here, but LO's gbuild should have set up everything +# correctly. If something breaks because of this, we likely have mre problems. +if test "$OS" = "EMSCRIPTEN"; then + export EMMAKEN_JUST_CONFIGURE=1 +fi + +exec "$@" diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index fa5c767271b7..1afa9e0451af 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -191,6 +191,7 @@ include $(SRCDIR)/RepositoryExternal.mk $(eval $(call gb_Helper_collect_knownlibs)) gb_Library_DLLPOSTFIX := lo +gb_RUN_CONFIGURE := # Include platform/cpu/compiler specific config/definitions @@ -278,6 +279,7 @@ gb_TEST_ENV_VARS += SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION=1 ifeq (,$(SAL_USE_VCLPLUGIN)) gb_TEST_ENV_VARS += SAL_USE_VCLPLUGIN=svp endif +gb_TEST_ENV_VARS += UNO_HOME=file://$$I/program # This is used to detect whether LibreOffice is being built (as opposed to building # 3rd-party code). Used for tag deprecation for API we want to diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk new file mode 100644 index 000000000000..3131bbec0959 --- /dev/null +++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk @@ -0,0 +1,64 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) + +include $(GBUILDDIR)/platform/unxgcc.mk + +gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure +# avoid -s SAFE_HEAP=1 - c.f. gh#8584 this breaks source maps +gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 +gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=2 -s EXIT_RUNTIME=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] +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 +gb_EMSCRIPTEN_EXCEPT := -s DISABLE_EXCEPTION_CATCHING=0 + +gb_LinkTarget_CFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_QTDEFS) +gb_LinkTarget_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_QTDEFS) $(gb_EMSCRIPTEN_EXCEPT) +gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_LDFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_EXCEPT) + +# Linker and compiler optimize + debug flags are handled in LinkTarget.mk +gb_LINKEROPTFLAGS := +gb_LINKERSTRIPDEBUGFLAGS := +# This maps to g4, AKA sorce maps. The LO default would otherwise be g2! +gb_DEBUGINFO_FLAGS = -g +# We need at least code elimination, otherwise linking OOMs even with 64GB. +# So we "fake" -Og support to mean -O1 for Emscripten and always enable it for debug in configure. +gb_COMPILERDEBUGOPTFLAGS := -O1 +gb_COMPILERNOOPTFLAGS := -O1 -fstrict-aliasing -fstrict-overflow + +# cleanup addition JS and wasm files for binaries +define gb_Executable_Executable_platform +$(call gb_LinkTarget_add_auxtargets,$(2),\ + $(patsubst %.lib,%.wasm,$(3)) \ + $(patsubst %.lib,%.js,$(3)) \ + $(patsubst %.lib,%.worker.js,$(3)) \ +) + +endef + +define gb_CppunitTest_CppunitTest_platform +$(call gb_LinkTarget_add_auxtargets,$(2),\ + $(patsubst %.lib,%.wasm,$(3)) \ + $(patsubst %.lib,%.js,$(3)) \ + $(patsubst %.lib,%.worker.js,$(3)) \ +) + +endef + +gb_SUPPRESS_TESTS := $(true) + +define gb_Library_get_rpath +endef + +define gb_Executable_get_rpath +endef + +# vim: set noet sw=4 ts=4 diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index e07bd2824ff5..fe99e98ea4c4 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -49,6 +49,7 @@ gb_COMPILERDEFS := \ -DBOOST_ERROR_CODE_HEADER_ONLY \ -DBOOST_SYSTEM_NO_DEPRECATED \ -DCPPU_ENV=$(gb_CPPU_ENV) \ + $(if $(filter EMSCRIPTEN,$(OS)),-U_FORTIFY_SOURCE) \ gb_CFLAGS_COMMON := \ -Wall \ @@ -63,7 +64,7 @@ gb_CFLAGS_COMMON := \ -fmessage-length=0 \ -fno-common \ -pipe \ - -fstack-protector-strong \ + $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) \ $(if $(gb_COLOR),-fdiagnostics-color=always) \ gb_CXXFLAGS_COMMON := \ @@ -80,7 +81,7 @@ gb_CXXFLAGS_COMMON := \ -fmessage-length=0 \ -fno-common \ -pipe \ - -fstack-protector-strong \ + $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) \ $(if $(gb_COLOR),-fdiagnostics-color=always) \ ifeq ($(HAVE_WDEPRECATED_COPY_DTOR),TRUE) @@ -109,8 +110,10 @@ endif ifeq ($(DISABLE_DYNLOADING),TRUE) gb_CFLAGS_COMMON += -ffunction-sections -fdata-sections gb_CXXFLAGS_COMMON += -ffunction-sections -fdata-sections +ifneq ($(OS),EMSCRIPTEN) gb_LinkTarget_LDFLAGS += -Wl,--gc-sections endif +endif ifeq ($(COM_IS_CLANG),TRUE) gb_CXXFLAGS_COMMON += \ @@ -143,7 +146,7 @@ endif gb_VISIBILITY_FLAGS_CXX := -fvisibility-inlines-hidden gb_CXXFLAGS_COMMON += $(gb_VISIBILITY_FLAGS_CXX) -gb_LinkTarget_LDFLAGS += -fstack-protector-strong +gb_LinkTarget_LDFLAGS += $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) ifneq ($(gb_ENABLE_PCH),) ifeq ($(COM_IS_CLANG),TRUE) diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk index bd2cb6abef20..450e19b3267b 100644 --- a/xmlsecurity/Library_xsec_xmlsec.mk +++ b/xmlsecurity/Library_xsec_xmlsec.mk @@ -51,7 +51,7 @@ endif $(eval $(call gb_Library_use_externals,xsec_xmlsec,\ boost_headers \ - gpgmepp \ + $(if $(ENABLE_GPGMEPP),gpgmepp) \ libxml2 \ xmlsec \ )) @@ -65,9 +65,6 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\ xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl \ xmlsecurity/source/xmlsec/xmlsec_init \ xmlsecurity/source/xmlsec/xmlstreamio \ - xmlsecurity/source/xmlsec/nss/ciphercontext \ - xmlsecurity/source/xmlsec/nss/digestcontext \ - xmlsecurity/source/xmlsec/nss/nssinitializer \ )) ifeq ($(ENABLE_GPGMEPP),TRUE) @@ -110,24 +107,36 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\ xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl \ )) -else +ifeq ($(ENABLE_NSS),TRUE) -$(eval $(call gb_Library_add_defs,xsec_xmlsec,\ - -DXMLSEC_CRYPTO_NSS \ +$(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\ + xmlsecurity/source/xmlsec/nss/ciphercontext \ + xmlsecurity/source/xmlsec/nss/digestcontext \ + xmlsecurity/source/xmlsec/nss/nssinitializer \ )) +# nss3 after static libs to appease --as-needed linkers +$(eval $(call gb_Library_use_externals,xsec_xmlsec,\ + nss3 \ +)) + +endif + +else # !$(OS),WNT + ifeq ($(SYSTEM_XMLSEC),) $(eval $(call gb_Library_add_libs,xsec_xmlsec,\ - $(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \ - $(call gb_UnpackedTarball_get_dir,xmlsec)/src/.libs/libxmlsec1.a \ + $(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \ + $(call gb_UnpackedTarball_get_dir,xmlsec)/src/.libs/libxmlsec1.a \ )) endif -$(eval $(call gb_Library_use_externals,xsec_xmlsec,\ - plc4 \ -)) +ifeq ($(ENABLE_NSS),TRUE) $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\ + xmlsecurity/source/xmlsec/nss/ciphercontext \ + xmlsecurity/source/xmlsec/nss/digestcontext \ + xmlsecurity/source/xmlsec/nss/nssinitializer \ xmlsecurity/source/xmlsec/nss/sanextension_nssimpl \ xmlsecurity/source/xmlsec/nss/secerror \ xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl \ @@ -137,17 +146,32 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\ xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl \ )) -endif +$(eval $(call gb_Library_add_defs,xsec_xmlsec,\ + -DXMLSEC_CRYPTO_NSS \ +)) +$(eval $(call gb_Library_use_externals,xsec_xmlsec,\ + plc4 \ +)) # nss3 after static libs to appease --as-needed linkers $(eval $(call gb_Library_use_externals,xsec_xmlsec,\ nss3 \ )) +else # ! $(ENABLE_NSS) + +ifeq ($(ENABLE_OPENSSL),TRUE) +$(eval $(call gb_Library_use_external,xsec_xmlsec,openssl)) +endif + +endif # !$(ENABLE_NSS) + ifeq ($(OS),SOLARIS) $(eval $(call gb_Library_add_libs,xsec_xmlsec,\ -ldl \ )) endif +endif # !$(OS),WNT + # vim: set noet sw=4 ts=4: diff --git a/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx b/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx index 31365ab4bb53..3ed7749687d1 100644 --- a/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx +++ b/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx @@ -33,7 +33,9 @@ #include #include #include +#ifdef XMLSEC_CRYPTO_NSS #include +#endif #include #include #include -- cgit