From a46ef637d5f37962f826969cb2d7eb4cb9ba81c6 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 15 Nov 2015 04:39:24 +0100 Subject: include breakpad into the build Change-Id: I1bfd107502332fc86ae5e96bbc1f475b8d669c6c Reviewed-on: https://gerrit.libreoffice.org/22547 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- Makefile.fetch | 1 + RepositoryExternal.mk | 37 ++++++++++++++++++++++++ config_host.mk.in | 1 + config_host/config_features.h.in | 5 ++++ configure.ac | 20 +++++++++++++ desktop/Library_sofficeapp.mk | 4 +++ desktop/source/app/sofficemain.cxx | 31 ++++++++++++++++++++ distro-configs/LibreOfficeLinux.conf | 1 + download.lst | 2 ++ external/breakpad/ExternalProject_breakpad.mk | 41 +++++++++++++++++++++++++++ external/breakpad/Makefile | 14 +++++++++ external/breakpad/Module_breakpad.mk | 17 +++++++++++ external/breakpad/README | 1 + external/breakpad/UnpackedTarball_breakpad.mk | 14 +++++++++ vcl/opengl/x11/X11DeviceInfo.cxx | 2 ++ 15 files changed, 191 insertions(+) create mode 100644 external/breakpad/ExternalProject_breakpad.mk create mode 100644 external/breakpad/Makefile create mode 100644 external/breakpad/Module_breakpad.mk create mode 100644 external/breakpad/README create mode 100644 external/breakpad/UnpackedTarball_breakpad.mk diff --git a/Makefile.fetch b/Makefile.fetch index 13138cd5b27f..633202e16c7a 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -108,6 +108,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR) $(call fetch_Optional,APR,APR_TARBALL) \ $(call fetch_Optional,APR,APR_UTIL_TARBALL) \ $(call fetch_Optional,BOOST,BOOST_TARBALL) \ + $(call fetch_Optional,BREAKPAD,BREAKPAD_TARBALL) \ $(call fetch_Optional,BSH,BSH_TARBALL) \ $(call fetch_Optional,BZIP2,BZIP2_TARBALL) \ $(call fetch_Optional,CAIRO,CAIRO_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index d0ee166edf34..8ce914d5ef68 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -3346,6 +3346,43 @@ endif # SYSTEM_NSS endif # DESKTOP +ifeq ($(ENABLE_BREAKPAD),TRUE) + +# ifneq ($(SYSTEM_LIBBREAKPAD),TRUE) + +define gb_LinkTarget__use_breakpad +$(call gb_LinkTarget_set_include,$(1),\ + -I$(call gb_UnpackedTarball_get_dir,breakpad)/src \ + $$(INCLUDE) \ +) + +ifeq ($(COM),MSC) +$(call gb_LinkTarget_add_libs,$(1),\ + $(call gb_UnpackedTarball_get_dir,breakpad)/build/win32/$(wnt_arch_subdir_optional)$(if $(MSVC_USE_DEBUG_RUNTIME),Debug/breakpad.lib,Release/breakpad.lib) \ +) +else +$(call gb_LinkTarget_add_libs,$(1),\ + $(call gb_UnpackedTarball_get_dir,breakpad)/src/client/linux/libbreakpad_client.a \ +) +endif + +$(call gb_LinkTarget_use_external_project,$(1),breakpad) + +endef + +# else # SYSTEM_LIBBREAKPAD +# +# define gb_LinkTarget__use_libgltf +# $(call gb_LinkTarget_set_include,$(1),\ +# $$(INCLUDE) \ +# $(LIBBREAKPAD_CFLAGS) \ +# ) +# $(call gb_LinkTarget_add_libs,$(1),$(LIBBREAKPAD_LIBS)) +# +# endef + +endif # SYSTEN_LIBBREAKPAD + ifeq ($(ENABLE_GLTF),TRUE) ifneq ($(SYSTEM_LIBGLTF),TRUE) diff --git a/config_host.mk.in b/config_host.mk.in index 617022783d79..8becc9ef4cfb 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -108,6 +108,7 @@ export DPKG=@DPKG@ export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@ export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@ export ENABLE_AVAHI=@ENABLE_AVAHI@ +export ENABLE_BREAKPAD=@ENABLE_BREAKPAD@ export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@ export ENABLE_CHART_TESTS=@ENABLE_CHART_TESTS@ export ENABLE_CMIS=@ENABLE_CMIS@ diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 77fea97e4450..5426bf389e28 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -146,4 +146,9 @@ */ #define HAVE_FEATURE_COLLADA 0 +/* + * Whether we support breakpad as crash reporting lib. + */ +#define HAVE_FEATURE_BREAKPAD 0 + #endif diff --git a/configure.ac b/configure.ac index aabe5583c738..78253497f883 100644 --- a/configure.ac +++ b/configure.ac @@ -1038,6 +1038,11 @@ AC_ARG_ENABLE(graphite, [Disables the compilation of Graphite smart font rendering.]) ) +AC_ARG_ENABLE(breakpad, + AS_HELP_STRING([--enable-breakpad], + [Enables breakpad for crash reporting.]) +) + AC_ARG_ENABLE(orcus, AS_HELP_STRING([--enable-orcus], [Enables orcus for extra file import filters for Calc.]) @@ -9079,6 +9084,21 @@ else fi AC_SUBST(ENABLE_GRAPHITE) +dnl ================================================================== +dnl Breakpad +dnl ================================================================== +AC_MSG_CHECKING([whether to enable breakpad]) +if test "$enable_breakpad" != yes; then + AC_MSG_RESULT([no]) +else + AC_MSG_RESULT([yes]) + ENABLE_BREAKPAD="TRUE" + AC_DEFINE(ENABLE_BREAKPAD) + AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1) + BUILD_TYPE="$BUILD_TYPE BREAKPAD" +fi +AC_SUBST(ENABLE_BREAKPAD) + dnl =================================================================== dnl Orcus dnl =================================================================== diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index d7b6dbac4b2f..13b81153ad6b 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -117,6 +117,10 @@ $(eval $(call gb_Library_add_libs,sofficeapp,\ endif endif +ifeq ($(ENABLE_BREAKPAD),TRUE) +$(eval $(call gb_Library_use_external,sofficeapp,breakpad)) +endif + # LibreOfficeKit bits ifneq ($(filter $(OS),ANDROID IOS MACOSX WNT),) $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index c94d5f146553..b14df2f30a15 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -18,6 +18,7 @@ */ #include +#include #include "desktopdllapi.h" @@ -40,6 +41,14 @@ #include #include +#if HAVE_FEATURE_BREAKPAD + +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#include +#endif + +#endif + #ifdef ANDROID # include @@ -50,8 +59,30 @@ # define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__)) #endif +#if HAVE_FEATURE_BREAKPAD + +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* /*context*/, bool succeeded) +{ + // send the minidump to the server (not yet implemented) + SAL_WARN("sofficemain", "minidump generated: " << descriptor.path()); + return succeeded; +} +#endif + +#endif + extern "C" int DESKTOP_DLLPUBLIC soffice_main() { +#if HAVE_FEATURE_BREAKPAD + +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID + google_breakpad::MinidumpDescriptor descriptor("/tmp"); + google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL, true, -1); +#endif + +#endif + #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) /* Run test for OpenGL support in own process to avoid crash with broken * OpenGL drivers. Start process as early as possible. diff --git a/distro-configs/LibreOfficeLinux.conf b/distro-configs/LibreOfficeLinux.conf index d57706cb5e6a..efa314fc5858 100644 --- a/distro-configs/LibreOfficeLinux.conf +++ b/distro-configs/LibreOfficeLinux.conf @@ -34,3 +34,4 @@ --enable-online-update --disable-dconf --enable-mergelibs +--enable-breakpad diff --git a/download.lst b/download.lst index 7bf361b0e6fb..7a9835fc8f90 100644 --- a/download.lst +++ b/download.lst @@ -8,6 +8,8 @@ export APR_UTIL_MD5SUM := 71a11d037240b292f824ba1eb537b4e3 export APR_UTIL_TARBALL := apr-util-1.5.3.tar.gz export BOOST_MD5SUM := 65a840e1a0b13a558ff19eeb2c4f0cbe export BOOST_TARBALL := boost_1_60_0.tar.bz2 +export BREAKPAD_TARBALL := breakpad.zip +export BREAKPAD_MD5SUM := 415ce291aa6f2ee1d5db7b62bf62ade8 export BSH_TARBALL := ec1941a74d3ef513c4ce57a9092b74e1-bsh-2.0b5-src.zip export BZIP2_TARBALL := 00b516f4704d4a7cb50a1d97e6e8e15b-bzip2-1.0.6.tar.gz export CAIRO_TARBALL := f101a9e88b783337b20b2e26dfd26d5f-cairo-1.10.2.tar.gz diff --git a/external/breakpad/ExternalProject_breakpad.mk b/external/breakpad/ExternalProject_breakpad.mk new file mode 100644 index 000000000000..713276e1cbc7 --- /dev/null +++ b/external/breakpad/ExternalProject_breakpad.mk @@ -0,0 +1,41 @@ +# -*- 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_ExternalProject_ExternalProject,breakpad)) + +$(eval $(call gb_ExternalProject_use_autoconf,breakpad,build)) + +$(eval $(call gb_ExternalProject_register_targets,breakpad,\ + build \ +)) + + +ifeq ($(COM),MSC) + +$(call gb_ExternalProject_get_state_target,breakpad,build) : + $(call gb_ExternalProject_run,build,\ + msbuild.exe breakpad.vcxproj /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \ + /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \ + $(if $(filter 120,$(VCVER)),/p:PlatformToolset=v120 /p:VisualStudioVersion=12.0 /ToolsVersion:12.0) \ + $(if $(filter 140,$(VCVER)),/p:PlatformToolset=v140 /p:VisualStudioVersion=14.0 /ToolsVersion:14.0) \ + '/p:AdditionalIncludeDirectories=$(subst $(WHITESPACE),;,$(subst /,\,$(strip $(libgltf_AdditionalIncludes))))' \ + /p:AdditionalLibraryDirectories=$(if $(SYSTEM_GLEW),,"$(subst /,\,$(call gb_UnpackedTarball_get_dir,glew))\lib\$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)\Win32") \ + ,build/win32) + +else # !ifeq($(COM),MSC) + +$(call gb_ExternalProject_get_state_target,breakpad,build) : + $(call gb_ExternalProject_run,build,\ + ./configure \ + && $(MAKE) \ + ) + +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/breakpad/Makefile b/external/breakpad/Makefile new file mode 100644 index 000000000000..569ad8a0ba7a --- /dev/null +++ b/external/breakpad/Makefile @@ -0,0 +1,14 @@ +# -*- 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/. +# + +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/breakpad/Module_breakpad.mk b/external/breakpad/Module_breakpad.mk new file mode 100644 index 000000000000..9750c312a799 --- /dev/null +++ b/external/breakpad/Module_breakpad.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_Module_Module,breakpad)) + +$(eval $(call gb_Module_add_targets,breakpad,\ + ExternalProject_breakpad \ + UnpackedTarball_breakpad \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/breakpad/README b/external/breakpad/README new file mode 100644 index 000000000000..41fbde692e70 --- /dev/null +++ b/external/breakpad/README @@ -0,0 +1 @@ +Render glTF 3D models. diff --git a/external/breakpad/UnpackedTarball_breakpad.mk b/external/breakpad/UnpackedTarball_breakpad.mk new file mode 100644 index 000000000000..ab09d66602ff --- /dev/null +++ b/external/breakpad/UnpackedTarball_breakpad.mk @@ -0,0 +1,14 @@ +# -*- 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,breakpad)) + +$(eval $(call gb_UnpackedTarball_set_tarball,breakpad,$(BREAKPAD_TARBALL))) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx index 49593c7b297c..4a5a9c30d0e6 100644 --- a/vcl/opengl/x11/X11DeviceInfo.cxx +++ b/vcl/opengl/x11/X11DeviceInfo.cxx @@ -10,6 +10,8 @@ #include "opengl/x11/X11DeviceInfo.hxx" #include "opengl/x11//glxtest.hxx" +#include + #include #include -- cgit