diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-06-24 11:39:28 +0900 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-07-30 12:55:19 +0200 |
commit | 9024aba032ce4fdcbb800260fef16c3f91a911a6 (patch) | |
tree | bd9dd95e24bc24904970a909e85f77fdff180c36 | |
parent | f1928f6ce9fb27b924d91ee5c5c52ec560fee2b6 (diff) |
Build skia library in LibreOffice
Change-Id: Iaa8156270dd764814a5ddbeb2fd617acae3ae561
-rw-r--r-- | Makefile.fetch | 1 | ||||
-rw-r--r-- | RepositoryExternal.mk | 19 | ||||
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | download.lst | 2 | ||||
-rw-r--r-- | external/Module_external.mk | 1 | ||||
-rw-r--r-- | external/skia/ExternalPackage_skia.mk | 17 | ||||
-rw-r--r-- | external/skia/Makefile | 7 | ||||
-rw-r--r-- | external/skia/Module_skia.mk | 19 | ||||
-rw-r--r-- | external/skia/StaticLibrary_skia.mk | 88 | ||||
-rw-r--r-- | external/skia/UnpackedTarball_skia.mk | 16 | ||||
-rw-r--r-- | external/skia/configs/SkUserConfig.h | 196 |
12 files changed, 390 insertions, 0 deletions
diff --git a/Makefile.fetch b/Makefile.fetch index d8d63cbb9523..0f193fb926e0 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -212,6 +212,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S $(call fetch_Optional,RHINO,RHINO_TARBALL) \ $(call fetch_Optional,RHINO,SWING_TARBALL) \ $(call fetch_Optional,SERF,SERF_TARBALL) \ + $(call fetch_Optional,SKIA,SKIA_TARBALL) \ $(call fetch_Optional,STAROFFICE,STAROFFICE_TARBALL) \ $(if $(filter WNT,$(OS)),TWAIN_DSM_TARBALL) \ $(call fetch_Optional,UCPP,UCPP_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 54ab1dbfdcc3..b2292a8367d5 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -111,6 +111,25 @@ endef endif +ifneq ($(SYSTEM_SKIA),) + +else # !SYSTEM_SKIA + +define gb_LinkTarget__use_skia +$(call gb_LinkTarget_set_include,$(1),\ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/core \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/config \ + $$(INCLUDE) \ +) +$(call gb_LinkTarget_use_external_project,$(1),skia) +endef + +$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo,\ + skia \ +)) + +endif + ifeq (SANE,$(filter SANE,$(BUILD_TYPE))) define gb_LinkTarget__use_sane_headers diff --git a/config_host.mk.in b/config_host.mk.in index 8db0d6ddd779..07c70cdabae3 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -584,6 +584,7 @@ export SYSTEM_WPD=@SYSTEM_WPD@ export SYSTEM_WPG=@SYSTEM_WPG@ export SYSTEM_WPS=@SYSTEM_WPS@ export SYSTEM_XMLSEC=@SYSTEM_XMLSEC@ +export SYSTEM_SKIA=@SYSTEM_SKIA@ export SYSTEM_ZLIB=@SYSTEM_ZLIB@ export SYSTEM_ZMF=@SYSTEM_ZMF@ export TARFILE_LOCATION=@TARFILE_LOCATION@ diff --git a/configure.ac b/configure.ac index f423018d574f..0ff882ed7145 100644 --- a/configure.ac +++ b/configure.ac @@ -1926,6 +1926,11 @@ AC_ARG_WITH(system-glm, [Use glm already on system.]),, [with_system_glm="$with_system_headers"]) +AC_ARG_WITH(system-skia, + AS_HELP_STRING([--with-system-skia], + [Use skia already on system.]),, + [with_system_skia="$with_system_headers"]) + AC_ARG_WITH(system-hunspell, AS_HELP_STRING([--with-system-hunspell], [Use libhunspell already on system.]),, @@ -9335,6 +9340,24 @@ AC_SUBST([GLM_CFLAGS]) AC_SUBST([SYSTEM_GLM]) dnl =================================================================== +dnl Check for system skia +dnl =================================================================== +AC_MSG_CHECKING([which skia to use]) +if test "$with_system_skia" = "yes"; then + AC_MSG_RESULT([external]) + SYSTEM_SKIA=TRUE + AC_LANG_PUSH([C++]) + AC_CHECK_HEADER(skia/SkCanvas.h, [], + [AC_MSG_ERROR(skia/SkCanvas.h not found. install skia)], []) + AC_LANG_POP([C++]) +else + AC_MSG_RESULT([internal]) + BUILD_TYPE="$BUILD_TYPE SKIA" + SYSTEM_SKIA= +fi +AC_SUBST(SYSTEM_SKIA) + +dnl =================================================================== dnl Check for system odbc dnl =================================================================== AC_MSG_CHECKING([which odbc headers to use]) diff --git a/download.lst b/download.lst index b57ed794d2a6..b0968ba75f11 100644 --- a/download.lst +++ b/download.lst @@ -238,6 +238,8 @@ export TWAIN_DSM_SHA256SUM := 82c818be771f242388457aa8c807e4b52aa84dc22b21c6c561 export TWAIN_DSM_TARBALL := twaindsm_2.4.1.orig.tar.gz export UCPP_SHA256SUM := 983941d31ee8d366085cadf28db75eb1f5cb03ba1e5853b98f12f7f51c63b776 export UCPP_TARBALL := 0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz +export SKIA_SHA256SUM := 5a8ff7dbf98e15dc68ccd02a434efca14264ab00bb8694aa22451b249057d70d +export SKIA_TARBALL := skia.zip export VISIO_SHA256SUM := fe1002d3671d53c09bc65e47ec948ec7b67e6fb112ed1cd10966e211a8bb50f9 export VISIO_TARBALL := libvisio-0.1.6.tar.xz export WPD_SHA256SUM := 2465b0b662fdc5d4e3bebcdc9a79027713fb629ca2bff04a3c9251fdec42dd09 diff --git a/external/Module_external.mk b/external/Module_external.mk index 10ed2a6e54db..a80e34e4a8dd 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -92,6 +92,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,REVENGE,librevenge) \ $(call gb_Helper_optional,RHINO,rhino) \ $(call gb_Helper_optional,SERF,serf) \ + $(call gb_Helper_optional,SKIA,skia) \ $(call gb_Helper_optional,STAROFFICE,libstaroffice) \ $(if $(filter WNT,$(OS)),twain_dsm) \ $(call gb_Helper_optional,UCPP,ucpp) \ diff --git a/external/skia/ExternalPackage_skia.mk b/external/skia/ExternalPackage_skia.mk new file mode 100644 index 000000000000..8964ebc494b9 --- /dev/null +++ b/external/skia/ExternalPackage_skia.mk @@ -0,0 +1,17 @@ +# -*- 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/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,skia_inc,skia)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,skia_inc,inc/external/skia,\ + include/config/SkUserConfig.h \ + include/core/SkBitmap.h \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/skia/Makefile b/external/skia/Makefile new file mode 100644 index 000000000000..e4968cf85fb6 --- /dev/null +++ b/external/skia/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/skia/Module_skia.mk b/external/skia/Module_skia.mk new file mode 100644 index 000000000000..3ce127a16d27 --- /dev/null +++ b/external/skia/Module_skia.mk @@ -0,0 +1,19 @@ +# -*- 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/. +# + +$(eval $(call gb_Module_Module,skia)) + +$(eval $(call gb_Module_add_targets,skia,\ + UnpackedTarball_skia \ + StaticLibrary_skia \ + ExternalPackage_skia \ +)) + + +# vim: set noet sw=4 ts=4: diff --git a/external/skia/StaticLibrary_skia.mk b/external/skia/StaticLibrary_skia.mk new file mode 100644 index 000000000000..948e1672d851 --- /dev/null +++ b/external/skia/StaticLibrary_skia.mk @@ -0,0 +1,88 @@ +# -*- 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/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,skia)) + +$(eval $(call gb_StaticLibrary_use_externals,skia,\ + freetype \ + fontconfig \ +)) + +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,skia)) + +$(eval $(call gb_StaticLibrary_use_unpacked,skia,skia)) + +$(eval $(call gb_StaticLibrary_add_defs,skia,\ + -DSK_GAMMA_SRGB \ + -DSK_GAMMA_APPLY_TO_A8 \ + -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 \ + -DSK_SCALAR_IS_FLOAT \ + -DSK_CAN_USE_FLOAT \ + -DSK_SUPPORT_GPU=0 \ + -DSK_SAMPLES_FOR_X \ + -DSK_BUILD_FOR_UNIX \ + -DSK_USE_POSIX_THREADS \ + -DSK_RELEASE \ + -DGR_RELEASE=1 \ + -DNDEBUG \ +)) + +$(eval $(call gb_StaticLibrary_add_cxxflags,skia, \ + -Wno-unused-parameter \ + -Wno-shadow \ + -mssse3 \ +)) + +$(eval $(call gb_StaticLibrary_set_include,skia,\ + $$(INCLUDE) \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/codec \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/core \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/config \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/gpu \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/pipe \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/lazy \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/ports \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/images \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/utils \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/utils/mac \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/utils/win \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/views \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/effects \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/xml \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/pathops \ + -I$(call gb_UnpackedTarball_get_dir,skia)/include/private \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/core \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/lazy \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/image \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/gpu \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/gpu/effects \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/gl \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/utils \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/sfnt \ + -I$(call gb_UnpackedTarball_get_dir,skia)/src/shaders \ +)) + +$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,skia,cpp)) + +$(eval $(call gb_StaticLibrary_add_generated_exception_objects,skia,\ + UnpackedTarball/skia/src/core/SkAAClip \ + UnpackedTarball/skia/src/core/SkAnnotation \ + UnpackedTarball/skia/src/core/SkAlphaRuns \ + UnpackedTarball/skia/src/core/SkBitmap \ + UnpackedTarball/skia/src/core/SkBitmapProcState \ + UnpackedTarball/skia/src/core/SkBitmapProcState_matrixProcs \ + UnpackedTarball/skia/src/core/SkBuffer \ + UnpackedTarball/skia/src/core/SkCanvas \ + UnpackedTarball/skia/src/core/SkColor \ + UnpackedTarball/skia/src/core/SkColorFilter \ + UnpackedTarball/skia/src/core/SkDevice \ + UnpackedTarball/skia/src/core/SkPoint \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk new file mode 100644 index 000000000000..9aac327d2fd2 --- /dev/null +++ b/external/skia/UnpackedTarball_skia.mk @@ -0,0 +1,16 @@ +# -*- 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/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,skia)) + +$(eval $(call gb_UnpackedTarball_set_tarball,skia,$(SKIA_TARBALL))) + +$(eval $(call gb_UnpackedTarball_add_file,skia,SkUserConfig.h,external/skia/configs/SkUserConfig.h)) + +# vim: set noet sw=4 ts=4: diff --git a/external/skia/configs/SkUserConfig.h b/external/skia/configs/SkUserConfig.h new file mode 100644 index 000000000000..77973df77b48 --- /dev/null +++ b/external/skia/configs/SkUserConfig.h @@ -0,0 +1,196 @@ + +/* + * Copyright 2006 The Android Open Source Project + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkUserConfig_DEFINED +#define SkUserConfig_DEFINED + +/* SkTypes.h, the root of the public header files, does the following trick: + + #include "SkPreConfig.h" + #include "SkUserConfig.h" + #include "SkPostConfig.h" + + SkPreConfig.h runs first, and it is responsible for initializing certain + skia defines. + + SkPostConfig.h runs last, and its job is to just check that the final + defines are consistent (i.e. that we don't have mutually conflicting + defines). + + SkUserConfig.h (this file) runs in the middle. It gets to change or augment + the list of flags initially set in preconfig, and then postconfig checks + that everything still makes sense. + + Below are optional defines that add, subtract, or change default behavior + in Skia. Your port can locally edit this file to enable/disable flags as + you choose, or these can be delared on your command line (i.e. -Dfoo). + + By default, this include file will always default to having all of the flags + commented out, so including it will have no effect. +*/ + +/////////////////////////////////////////////////////////////////////////////// + +/* Scalars (the fractional value type in skia) can be implemented either as + floats or 16.16 integers (fixed). Exactly one of these two symbols must be + defined. +*/ +#define SK_SCALAR_IS_FLOAT +//#define SK_SCALAR_IS_FIXED + +/* For some performance-critical scalar operations, skia will optionally work + around the standard float operators if it knows that the CPU does not have + native support for floats. If your environment uses software floating point, + define this flag. + */ +//#define SK_SOFTWARE_FLOAT + +/* Skia has lots of debug-only code. Often this is just null checks or other + parameter checking, but sometimes it can be quite intrusive (e.g. check that + each 32bit pixel is in premultiplied form). This code can be very useful + during development, but will slow things down in a shipping product. + + By default, these mutually exclusive flags are defined in SkPreConfig.h, + based on the presence or absence of NDEBUG, but that decision can be changed + here. + */ +//#define SK_DEBUG +#define SK_RELEASE + +/* Skia has certain debug-only code that is extremely intensive even for debug + builds. This code is useful for diagnosing specific issues, but is not + generally applicable, therefore it must be explicitly enabled to avoid + the performance impact. By default these flags are undefined, but can be + enabled by uncommenting them below. + */ +//#define SK_DEBUG_GLYPH_CACHE +//#define SK_DEBUG_PATH + +/* To assist debugging, Skia provides an instance counting utility in + include/core/SkInstCount.h. This flag turns on and off that utility to + allow instance count tracking in either debug or release builds. By + default it is enabled in debug but disabled in release. + */ +//#define SK_ENABLE_INST_COUNT 1 + +/* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) + it will call SK_CRASH(). If this is not defined it, it is defined in + SkPostConfig.h to write to an illegal address + */ +//#define SK_CRASH() *(int *)(uintptr_t)0 = 0 + +/* preconfig will have attempted to determine the endianness of the system, + but you can change these mutually exclusive flags here. + */ +//#define SK_CPU_BENDIAN +//#define SK_CPU_LENDIAN + +/* Most compilers use the same bit endianness for bit flags in a byte as the + system byte endianness, and this is the default. If for some reason this + needs to be overridden, specify which of the mutually exclusive flags to + use. For example, some atom processors in certain configurations have big + endian byte order but little endian bit orders. +*/ +//#define SK_UINT8_BITFIELD_BENDIAN +//#define SK_UINT8_BITFIELD_LENDIAN + +/* Some compilers don't support long long for 64bit integers. If yours does + not, define this to the appropriate type. + */ +//#define SkLONGLONG int64_t + +/* To write debug messages to a console, skia will call SkDebugf(...) following + printf conventions (e.g. const char* format, ...). If you want to redirect + this to something other than printf, define yours here + */ +//#define SkDebugf(...) MyFunction(__VA_ARGS__) + +/* + * To specify a different default font cache limit, define this. If this is + * undefined, skia will use a built-in value. + */ +//#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) + +/* If defined, use CoreText instead of ATSUI on OS X. +*/ +//#define SK_USE_MAC_CORE_TEXT + +/* If zlib is available and you want to support the flate compression + algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the + include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib + library specified as "#include <zlib.h>". + */ +//#define SK_ZLIB_INCLUDE <zlib.h> +#define SK_SYSTEM_ZLIB + +/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow + them, but modern PDF interpreters should handle them just fine. + */ +#define SK_ALLOW_LARGE_PDF_SCALARS + +/* Define this to provide font subsetter in PDF generation. + */ +//#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h" + +/* Define this to remove dimension checks on bitmaps. Not all blits will be + correct yet, so this is mostly for debugging the implementation. + */ +#define SK_ALLOW_OVER_32K_BITMAPS + +/** + * To revert to int-only srcrect behavior in drawBitmapRect(ToRect), + * define this symbol. + */ +//#define SK_SUPPORT_INT_SRCRECT_DRAWBITMAPRECT + +/* Define this to set the upper limit for text to support LCD. Values that + are very large increase the cost in the font cache and draw slower, without + improving readability. If this is undefined, Skia will use its default + value (e.g. 48) + */ +//#define SK_MAX_SIZE_FOR_LCDTEXT 48 + +/* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST + which will run additional self-tests at startup. These can take a long time, + so this flag is optional. + */ +#ifdef SK_DEBUG +//#define SK_SUPPORT_UNITTEST +#endif + +/* If your system embeds skia and has complex event logging, define this + symbol to name a file that maps the following macros to your system's + equivalents: + SK_TRACE_EVENT0(event) + SK_TRACE_EVENT1(event, name1, value1) + SK_TRACE_EVENT2(event, name1, value1, name2, value2) + src/utils/SkDebugTrace.h has a trivial implementation that writes to + the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, + SkTrace.h will define the above three macros to do nothing. +*/ +//#undef SK_USER_TRACE_INCLUDE_FILE + +/* Change the ordering to work in X windows. + */ +#ifdef SK_SAMPLES_FOR_X +#define SK_R32_SHIFT 16 +#define SK_G32_SHIFT 8 +#define SK_B32_SHIFT 0 +#define SK_A32_SHIFT 24 +#endif + +/* Determines whether to build code that supports the GPU backend. Some classes + that are not GPU-specific, such as SkShader subclasses, have optional code + that is used allows them to interact with the GPU backend. If you'd like to + omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu + directories from your include search path when you're not building the GPU + backend. Defaults to 1 (build the GPU code). + */ +#define SK_SUPPORT_GPU 0 + +#endif |