[Libreoffice-commits] core.git: bridges/Module_bridges.mk configure.ac distro-configs/LibreOfficeEmscripten.conf external/icu include/osl include/sal sal/osl solenv/gbuild vcl/Library_vcl.mk

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Mon Oct 5 03:25:01 PDT 2015


 bridges/Module_bridges.mk                       |    2 
 configure.ac                                    |   36 +++++++++++++++-
 distro-configs/LibreOfficeEmscripten.conf       |   54 ++++++++++++++++++++++++
 external/icu/ExternalProject_icu.mk             |    2 
 include/osl/endian.h                            |   10 ++++
 include/sal/alloca.h                            |    2 
 include/sal/config.h                            |   10 ++++
 sal/osl/unx/socket.cxx                          |    2 
 sal/osl/unx/system.hxx                          |    5 +-
 solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk |   18 ++++++++
 vcl/Library_vcl.mk                              |    6 ++
 11 files changed, 138 insertions(+), 9 deletions(-)

New commits:
commit 338f19a8cecfa632fa23d42cc27769a832d62104
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Sep 16 17:03:17 2015 +0200

    Emscripten: First steps of porting to Emscripten
    
    See https://wiki.documentfoundation.org/Development/Emscripten for details
    
    Change-Id: I977a8b9e98b9be13c263fef48f567b92347d0492
    Reviewed-on: https://gerrit.libreoffice.org/18643
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 534efda..a876f0b 100644
--- a/bridges/Module_bridges.mk
+++ b/bridges/Module_bridges.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_Module_add_targets,bridges,\
 	) \
 ))
 
+ifneq ($(OS), EMSCRIPTEN)
 ifeq (,$(filter build,$(gb_Module_SKIPTARGETS)))
 ifeq ($(strip $(bridges_SELECTED_BRIDGE)),)
 $(call gb_Output_error,no bridge selected for build: bailing out)
@@ -31,5 +32,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/configure.ac b/configure.ac
index c199248..8554d05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -814,6 +814,27 @@ linux-android*)
     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
     ;;
 
+emscripten*)
+    build_gstreamer_1_0=no
+    build_gstreamer_0_10=no
+    enable_lotuswordpro=no
+    enable_mpl_subset=yes
+    enable_coinmp=yes
+    enable_lpsolve=no
+    enable_report_builder=no
+    with_theme="tango"
+    test_cups=no
+    test_dbus=no
+    test_fontconfig=no
+    test_freetype=no
+    test_gtk=no
+    test_tde=no
+    test_kde4=no
+    test_randr=no
+    test_xrender=no
+    _os=Emscripten
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -4313,6 +4334,17 @@ linux-android*)
     esac
     ;;
 
+emscripten*)
+    COM=emcc
+    USING_X11=
+    OS=EMSCRIPTEN
+    RTL_OS=Emscripten
+    P_SEP=:
+    CPUNAME=INTEL
+    RTL_ARCH=x86
+    PLATFORMID=linux_x86
+    ;;
+
 mingw*)
     COM=GCC
     USING_X11=
@@ -5376,7 +5408,7 @@ else
 fi
 
 dnl check for GNU C++ compiler version
-if test "$GXX" = "yes"; then
+if test "$GXX" = "yes" -a $CXX != "emcc"; then
     AC_MSG_CHECKING([the GNU C++ compiler version])
 
     _gpp_version=`$CXX -dumpversion`
@@ -10067,7 +10099,7 @@ fi
 AC_SUBST(ENABLE_KDE4)
 
 ENABLE_HEADLESS=""
-if test "x$with_x" = "xno"; then
+if test "x$with_x" = "xno" -o $CXX = "emcc"; then
     ENABLE_HEADLESS="TRUE"
     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
     R="headless"
diff --git a/distro-configs/LibreOfficeEmscripten.conf b/distro-configs/LibreOfficeEmscripten.conf
new file mode 100644
index 0000000..2678b92
--- /dev/null
+++ b/distro-configs/LibreOfficeEmscripten.conf
@@ -0,0 +1,54 @@
+# Need to specify --host and --build to enable cross-compilation mode
+# See https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Hosts-and-Cross_002dCompilation.html
+--host=asmjs-local-emscripten
+--build=x86_64-unknown-linux-gnu
+
+# Disable unnecessary stuff
+--disable-cairo-canvas
+--disable-cups
+--disable-gconf
+--disable-dconf
+--disable-gio
+--disable-dbus
+--disable-sdremote-bluetooth
+--disable-gstreamer-0-10
+--disable-gstreamer-1-0
+--disable-liblangtag
+--disable-lockdown
+--disable-odk
+--disable-postgresql-sdbc
+--disable-firebird-sdbc
+--disable-python
+--disable-randr
+--disable-randr-link
+--disable-pdfimport
+--disable-systray
+--disable-gltf
+--disable-collada
+--disable-export
+--disable-report-builder
+--disable-lpsolve
+--disable-coinmp
+--disable-scripting
+--disable-graphite
+--disable-orcus
+--without-fonts
+--without-java
+--without-junit
+--without-helppack-integration
+--without-system-dicts
+--with-theme=no
+--with-system-zlib=no
+
+# This helps spotting build errors
+--with-parallelism=no
+
+# Emscripten doesn't support dynamic loading
+--disable-dynamic-loading
+
+# Not sure whether we need this
+#--disable-ccache
+
+# Specify Emscripten compiler
+CC=emcc
+CXX=emcc
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index bd93be4..5817a6d 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -80,7 +80,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 			--disable-layout --disable-samples \
 			$(if $(CROSS_COMPILING),--disable-tools --disable-extras) \
 			$(if $(filter IOS ANDROID,$(OS)),--disable-dyload) \
-			$(if $(filter ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
+			$(if $(filter ANDROID EMSCRIPTEN,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
 			$(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
 				--enable-static --disable-shared,\
diff --git a/include/osl/endian.h b/include/osl/endian.h
index 5305493..4043c40 100644
--- a/include/osl/endian.h
+++ b/include/osl/endian.h
@@ -68,6 +68,13 @@ extern "C" {
 #   endif
 #endif
 
+#ifdef EMSCRIPTEN
+#   include <endian.h>
+#   ifndef _LITTLE_ENDIAN
+#       define _LITTLE_ENDIAN
+#   endif
+#endif
+
 #ifdef NETBSD
 #   include <machine/endian.h>
 #   if BYTE_ORDER == LITTLE_ENDIAN
@@ -132,7 +139,8 @@ extern "C" {
     !defined(AIX)     && !defined(OPENBSD) && \
     !defined(SOLARIS) && !defined(MACOSX) && !defined(FREEBSD) && \
     !defined(DRAGONFLY) && \
-    !defined(IOS)     && !defined(ANDROID)
+    !defined(IOS)     && !defined(ANDROID) && \
+    !defined(EMSCRIPTEN)
 #   error "Target platform not specified !"
 #endif
 
diff --git a/include/sal/alloca.h b/include/sal/alloca.h
index dfa8089..ad4f512 100644
--- a/include/sal/alloca.h
+++ b/include/sal/alloca.h
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_SAL_ALLOCA_H
 #define INCLUDED_SAL_ALLOCA_H
 
-#if defined (SOLARIS) || defined (LINUX) || defined(AIX) || defined(ANDROID)
+#if defined (SOLARIS) || defined (LINUX) || defined(AIX) || defined(ANDROID) || defined(EMSCRIPTEN)
 
 #ifndef INCLUDED_ALLOCA_H
 #include <alloca.h>
diff --git a/include/sal/config.h b/include/sal/config.h
index e891a6b..c86b12f 100644
--- a/include/sal/config.h
+++ b/include/sal/config.h
@@ -63,6 +63,16 @@
 #define SAL_CONFIGFILE( name ) name "rc"
 #endif
 
+#ifdef EMSCRIPTEN
+#define SAL_UNX
+#define SAL_DLLEXTENSION ".bc"
+#define SAL_DLLPREFIX "lib"
+#define SAL_PATHSEPARATOR ':'
+#define SAL_PATHDELIMITER '/'
+#define SAL_NEWLINE_STRING "\n"
+#define SAL_CONFIGFILE( name ) name "rc"
+#endif
+
 #ifdef MACOSX
 #define SAL_UNX
 #define SAL_DLLEXTENSION ".dylib"
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 614d418..d1a937a 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -728,7 +728,7 @@ static struct hostent* _osl_gethostbyname_r (
     const char *name, struct hostent *result,
     char *buffer, int buflen, int *h_errnop)
 {
-#if defined(LINUX) || defined(ANDROID) || defined(FREEBSD) || defined(DRAGONFLY)
+#if defined(LINUX) || defined(ANDROID) || defined(FREEBSD) || defined(DRAGONFLY) || defined(EMSCRIPTEN)
     struct hostent *__result; /* will be the same as result */
     int __error;
     __error = gethostbyname_r (name, result, buffer, buflen,
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx
index 3d6ab4d..3f19358 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -85,7 +85,7 @@
 
 #endif
 
-#ifdef ANDROID
+#if defined(ANDROID) || defined(EMSCRIPTEN)
 #   include <pthread.h>
 #   include <sys/file.h>
 #   include <sys/ioctl.h>
@@ -243,7 +243,8 @@ int macxp_resolveAlias(char *path, int buflen);
     !defined(AIX)     && \
     !defined(SOLARIS) && !defined(MACOSX) && \
     !defined(OPENBSD) && !defined(DRAGONFLY) && \
-    !defined(IOS) && !defined(ANDROID)
+    !defined(IOS) && !defined(ANDROID) && \
+    !defined(EMSCRIPTEN)
 #   error "Target platform not specified!"
 #endif
 
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
new file mode 100644
index 0000000..7619db7
--- /dev/null
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
@@ -0,0 +1,18 @@
+# -*- 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/.
+#
+
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
+else
+gb_UnoApiHeadersTarget_select_variant = $(2)
+endif
+
+include $(GBUILDDIR)/platform/unxgcc.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6ec0959..f95a999 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -613,9 +613,13 @@ $(eval $(call gb_Library_use_libraries,vcl,\
 ))
 
 $(eval $(call gb_Library_use_externals,vcl,\
-	fontconfig \
 	freetype \
 ))
+ifneq ($(OS),EMSCRIPTEN)
+	$(eval $(call gb_Library_use_externals,vcl,\
+		fontconfig \
+	))
+endif
 endif
 
 ifeq ($(OS),ANDROID)


More information about the Libreoffice-commits mailing list