summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-09-16 17:03:17 +0200
committerAndras Timar <andras.timar@collabora.com>2017-04-23 21:58:54 +0200
commitcd5e1202eef8dfd8aa8fec2b8775137ef94858c4 (patch)
tree8abee94dc816ab90eb13fa11d78f0f05ff10200e
parente7b15e556ca462f85678753f43e17769ffded244 (diff)
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@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 338f19a8cecfa632fa23d42cc27769a832d62104)
-rw-r--r--bridges/Module_bridges.mk2
-rw-r--r--configure.ac36
-rw-r--r--distro-configs/LibreOfficeEmscripten.conf54
-rw-r--r--external/icu/ExternalProject_icu.mk2
-rw-r--r--include/osl/endian.h10
-rw-r--r--include/sal/alloca.h2
-rw-r--r--include/sal/config.h10
-rw-r--r--sal/osl/unx/socket.cxx2
-rw-r--r--sal/osl/unx/system.hxx5
-rw-r--r--solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk18
-rw-r--r--vcl/Library_vcl.mk6
11 files changed, 138 insertions, 9 deletions
diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 534efda6936b..a876f0b01deb 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 05fcb104d9e7..689aae2faa74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -792,6 +792,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!])
;;
@@ -4297,6 +4318,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
GUIBASE=not-used
@@ -5362,7 +5394,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`
@@ -9983,7 +10015,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 000000000000..2678b929d7cc
--- /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 bd93be4f2f3f..5817a6d4a7f0 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 0819deebba41..34efcd9367cb 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 dfa808967a91..ad4f512f7ff0 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 e891a6b09424..c86b12ffd9f9 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 6aba809bce4f..7de16d6e0d1f 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 75c3d9d90d36..cca52ddf12bc 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -92,7 +92,7 @@
#endif
-#ifdef ANDROID
+#if defined(ANDROID) || defined(EMSCRIPTEN)
# include <pthread.h>
# include <sys/file.h>
# include <sys/ioctl.h>
@@ -280,7 +280,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 000000000000..7619db753db3
--- /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 c6b33e64272d..05d390085bc8 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -616,9 +616,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)