diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /solenv/gbuild/platform | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'solenv/gbuild/platform')
62 files changed, 4465 insertions, 0 deletions
diff --git a/solenv/gbuild/platform/ANDROID_AARCH64_GCC.mk b/solenv/gbuild/platform/ANDROID_AARCH64_GCC.mk new file mode 100644 index 000000000..0fab5ede8 --- /dev/null +++ b/solenv/gbuild/platform/ANDROID_AARCH64_GCC.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/. +# + +# please make generic modifications to unxgcc.mk or android.mk +gb_CPUDEFS += -DARM32 +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/unxgcc.mk +include $(GBUILDDIR)/platform/android.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/ANDROID_ARM_GCC.mk b/solenv/gbuild/platform/ANDROID_ARM_GCC.mk new file mode 100644 index 000000000..0fab5ede8 --- /dev/null +++ b/solenv/gbuild/platform/ANDROID_ARM_GCC.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/. +# + +# please make generic modifications to unxgcc.mk or android.mk +gb_CPUDEFS += -DARM32 +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/unxgcc.mk +include $(GBUILDDIR)/platform/android.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/ANDROID_INTEL_GCC.mk b/solenv/gbuild/platform/ANDROID_INTEL_GCC.mk new file mode 100644 index 000000000..597366a7f --- /dev/null +++ b/solenv/gbuild/platform/ANDROID_INTEL_GCC.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/. +# + +# please make generic modifications to unxgcc.mk or android.mk +gb_CPUDEFS += -DX86 +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/unxgcc.mk +include $(GBUILDDIR)/platform/android.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/ANDROID_X86_64_GCC.mk b/solenv/gbuild/platform/ANDROID_X86_64_GCC.mk new file mode 100644 index 000000000..bb57e8ae0 --- /dev/null +++ b/solenv/gbuild/platform/ANDROID_X86_64_GCC.mk @@ -0,0 +1,15 @@ +# -*- 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/. +# + +# please make generic modifications to unxgcc.mk or android.mk + +include $(GBUILDDIR)/platform/unxgcc.mk +include $(GBUILDDIR)/platform/android.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/DRAGONFLY_INTEL_GCC.mk b/solenv/gbuild/platform/DRAGONFLY_INTEL_GCC.mk new file mode 100644 index 000000000..00ccf8a03 --- /dev/null +++ b/solenv/gbuild/platform/DRAGONFLY_INTEL_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +gb_CPUDEFS := -DX86 + +include $(GBUILDDIR)/platform/unxgcc.mk + +gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs:/usr/pkg/lib + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/DRAGONFLY_X86_64_GCC.mk b/solenv/gbuild/platform/DRAGONFLY_X86_64_GCC.mk new file mode 100644 index 000000000..71b53d522 --- /dev/null +++ b/solenv/gbuild/platform/DRAGONFLY_X86_64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +include $(GBUILDDIR)/platform/unxgcc.mk + +gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs:/usr/pkg/lib + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/DeclareDPIAware.manifest b/solenv/gbuild/platform/DeclareDPIAware.manifest new file mode 100644 index 000000000..bb0123062 --- /dev/null +++ b/solenv/gbuild/platform/DeclareDPIAware.manifest @@ -0,0 +1,7 @@ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> +</assembly> diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk new file mode 100644 index 000000000..61424f72c --- /dev/null +++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk @@ -0,0 +1,95 @@ +# -*- 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 + +# don't sort; later can override previous settings! +gb_EMSCRIPTEN_PRE_JS_FILES = \ + $(SRCDIR)/static/emscripten/environment.js \ + $(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link \ + +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 USE_PTHREADS=1 +gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) + +# Initial memory size and worker thread pool +gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=4 + +# To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize +# See emscripten.py, finalize_wasm, modify_wasm = True +# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK) +gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr"] +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 +ifeq ($(ENABLE_WASM_EXCEPTIONS),TRUE) +gb_EMSCRIPTEN_EXCEPT = -fwasm-exceptions -s SUPPORT_LONGJMP=wasm +gb_EMSCRIPTEN_CPPFLAGS += -s SUPPORT_LONGJMP=wasm +else +gb_EMSCRIPTEN_EXCEPT = -s DISABLE_EXCEPTION_CATCHING=0 +endif + +gb_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) +gb_LinkTarget_EXCEPTIONFLAGS += $(gb_EMSCRIPTEN_EXCEPT) +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 g3, no source maps, but DWARF with current emscripten! +# https://developer.chrome.com/blog/wasm-debugging-2020/ +gb_DEBUGINFO_FLAGS = -g +#gb_DEBUGINFO_FLAGS = -gsource-map --source-map-base=file://$(WORKDIR)/LinkTarget/Executable + +ifeq ($(HAVE_EXTERNAL_DWARF),TRUE) +gb_DEBUGINFO_FLAGS += -gseparate-dwarf +endif + +# 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)) \ +) + +$(foreach pre_js,$(gb_EMSCRIPTEN_PRE_JS_FILES),$(call gb_Executable_add_prejs,$(1),$(pre_js))) + +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)) \ +) + +$(foreach pre_js,$(gb_EMSCRIPTEN_PRE_JS_FILES),$(call gb_CppunitTest_add_prejs,$(1),$(pre_js))) + +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/FREEBSD_AARCH64_GCC.mk b/solenv/gbuild/platform/FREEBSD_AARCH64_GCC.mk new file mode 100644 index 000000000..6199f17b3 --- /dev/null +++ b/solenv/gbuild/platform/FREEBSD_AARCH64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/FREEBSD_INTEL_GCC.mk b/solenv/gbuild/platform/FREEBSD_INTEL_GCC.mk new file mode 100644 index 000000000..5582d2dc8 --- /dev/null +++ b/solenv/gbuild/platform/FREEBSD_INTEL_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +gb_CPUDEFS := -DX86 + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/FREEBSD_POWERPC64_GCC.mk b/solenv/gbuild/platform/FREEBSD_POWERPC64_GCC.mk new file mode 100644 index 000000000..93fdf8126 --- /dev/null +++ b/solenv/gbuild/platform/FREEBSD_POWERPC64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DPPC -DPOWERPC64 +gb_COMPILERDEFAULTOPTFLAGS := -O2 +gb_CXXFLAGS += -mminimal-toc + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/FREEBSD_POWERPC_GCC.mk b/solenv/gbuild/platform/FREEBSD_POWERPC_GCC.mk new file mode 100644 index 000000000..48c29b6f1 --- /dev/null +++ b/solenv/gbuild/platform/FREEBSD_POWERPC_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DPPC -DPOWERPC +gb_COMPILERDEFAULTOPTFLAGS := -O2 + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk b/solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk new file mode 100644 index 000000000..6199f17b3 --- /dev/null +++ b/solenv/gbuild/platform/FREEBSD_X86_64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/HAIKU_INTEL_GCC.mk b/solenv/gbuild/platform/HAIKU_INTEL_GCC.mk new file mode 100644 index 000000000..5582d2dc8 --- /dev/null +++ b/solenv/gbuild/platform/HAIKU_INTEL_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +gb_CPUDEFS := -DX86 + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/HAIKU_X86_64_GCC.mk b/solenv/gbuild/platform/HAIKU_X86_64_GCC.mk new file mode 100644 index 000000000..6199f17b3 --- /dev/null +++ b/solenv/gbuild/platform/HAIKU_X86_64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_AARCH64_GCC.mk b/solenv/gbuild/platform/LINUX_AARCH64_GCC.mk new file mode 100644 index 000000000..431485a7c --- /dev/null +++ b/solenv/gbuild/platform/LINUX_AARCH64_GCC.mk @@ -0,0 +1,12 @@ +# -*- 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/. +# + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_ARM_GCC.mk b/solenv/gbuild/platform/LINUX_ARM_GCC.mk new file mode 100644 index 000000000..cccf5772b --- /dev/null +++ b/solenv/gbuild/platform/LINUX_ARM_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DARM32 +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_AXP_GCC.mk b/solenv/gbuild/platform/LINUX_AXP_GCC.mk new file mode 100644 index 000000000..b0d41078f --- /dev/null +++ b/solenv/gbuild/platform/LINUX_AXP_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_COMPILEROPTFLAGS := -Os +gb_LinkTarget_LDFLAGS += -Wl,--no-relax + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_GODSON64_GCC.mk b/solenv/gbuild/platform/LINUX_GODSON64_GCC.mk new file mode 100644 index 000000000..4a0a619e4 --- /dev/null +++ b/solenv/gbuild/platform/LINUX_GODSON64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DMIPS64 +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_GODSON_GCC.mk b/solenv/gbuild/platform/LINUX_GODSON_GCC.mk new file mode 100644 index 000000000..976aaedf9 --- /dev/null +++ b/solenv/gbuild/platform/LINUX_GODSON_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DMIPS +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_HPPA_GCC.mk b/solenv/gbuild/platform/LINUX_HPPA_GCC.mk new file mode 100644 index 000000000..c1a1ceeee --- /dev/null +++ b/solenv/gbuild/platform/LINUX_HPPA_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_IA64_GCC.mk b/solenv/gbuild/platform/LINUX_IA64_GCC.mk new file mode 100644 index 000000000..c1a1ceeee --- /dev/null +++ b/solenv/gbuild/platform/LINUX_IA64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_INTEL_GCC.mk b/solenv/gbuild/platform/LINUX_INTEL_GCC.mk new file mode 100644 index 000000000..146e95cf9 --- /dev/null +++ b/solenv/gbuild/platform/LINUX_INTEL_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS := -DX86 +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_M68K_GCC.mk b/solenv/gbuild/platform/LINUX_M68K_GCC.mk new file mode 100644 index 000000000..9e007101d --- /dev/null +++ b/solenv/gbuild/platform/LINUX_M68K_GCC.mk @@ -0,0 +1,15 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_POWERPC64_GCC.mk b/solenv/gbuild/platform/LINUX_POWERPC64_GCC.mk new file mode 100644 index 000000000..1880b3bad --- /dev/null +++ b/solenv/gbuild/platform/LINUX_POWERPC64_GCC.mk @@ -0,0 +1,15 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DPPC + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_POWERPC_GCC.mk b/solenv/gbuild/platform/LINUX_POWERPC_GCC.mk new file mode 100644 index 000000000..1880b3bad --- /dev/null +++ b/solenv/gbuild/platform/LINUX_POWERPC_GCC.mk @@ -0,0 +1,15 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_CPUDEFS += -DPPC + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_S390X_GCC.mk b/solenv/gbuild/platform/LINUX_S390X_GCC.mk new file mode 100644 index 000000000..c1a1ceeee --- /dev/null +++ b/solenv/gbuild/platform/LINUX_S390X_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_S390_GCC.mk b/solenv/gbuild/platform/LINUX_S390_GCC.mk new file mode 100644 index 000000000..c1a1ceeee --- /dev/null +++ b/solenv/gbuild/platform/LINUX_S390_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_SPARC64_GCC.mk b/solenv/gbuild/platform/LINUX_SPARC64_GCC.mk new file mode 100644 index 000000000..9e007101d --- /dev/null +++ b/solenv/gbuild/platform/LINUX_SPARC64_GCC.mk @@ -0,0 +1,15 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_SPARC_GCC.mk b/solenv/gbuild/platform/LINUX_SPARC_GCC.mk new file mode 100644 index 000000000..9e007101d --- /dev/null +++ b/solenv/gbuild/platform/LINUX_SPARC_GCC.mk @@ -0,0 +1,15 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk +gb_COMPILEROPTFLAGS := -Os + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/LINUX_X86_64_GCC.mk b/solenv/gbuild/platform/LINUX_X86_64_GCC.mk new file mode 100644 index 000000000..c1a1ceeee --- /dev/null +++ b/solenv/gbuild/platform/LINUX_X86_64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk or linux.mk + +include $(GBUILDDIR)/platform/linux.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/MACOSX_AARCH64_GCC.mk b/solenv/gbuild/platform/MACOSX_AARCH64_GCC.mk new file mode 100644 index 000000000..d8845ccbb --- /dev/null +++ b/solenv/gbuild/platform/MACOSX_AARCH64_GCC.mk @@ -0,0 +1,13 @@ +# -*- 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/. +# +#************************************************************************* + +include $(GBUILDDIR)/platform/macosx.mk + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/MACOSX_X86_64_GCC.mk b/solenv/gbuild/platform/MACOSX_X86_64_GCC.mk new file mode 100644 index 000000000..d8845ccbb --- /dev/null +++ b/solenv/gbuild/platform/MACOSX_X86_64_GCC.mk @@ -0,0 +1,13 @@ +# -*- 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/. +# +#************************************************************************* + +include $(GBUILDDIR)/platform/macosx.mk + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/NETBSD_INTEL_GCC.mk b/solenv/gbuild/platform/NETBSD_INTEL_GCC.mk new file mode 100644 index 000000000..feb527ba9 --- /dev/null +++ b/solenv/gbuild/platform/NETBSD_INTEL_GCC.mk @@ -0,0 +1,21 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk + +gb_CPUDEFS := -DX86 +gb_COMPILEROPTFLAGS := -O -g + +include $(GBUILDDIR)/platform/unxgcc.mk + +NB_ADD_LIBPATH := /usr/pkg/lib:/usr/X11R7/lib + +gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs:$(NB_ADD_LIBPATH) + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/NETBSD_X86_64_GCC.mk b/solenv/gbuild/platform/NETBSD_X86_64_GCC.mk new file mode 100644 index 000000000..fbbf7b428 --- /dev/null +++ b/solenv/gbuild/platform/NETBSD_X86_64_GCC.mk @@ -0,0 +1,20 @@ +# -*- 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/. +# + +#please make generic modifications to unxgcc.mk + +gb_COMPILEROPTFLAGS := -O -g + +include $(GBUILDDIR)/platform/unxgcc.mk + +NB_ADD_LIBPATH := /usr/pkg/lib:/usr/X11R7/lib + +gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs:$(NB_ADD_LIBPATH) + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk b/solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk new file mode 100644 index 000000000..50d803d29 --- /dev/null +++ b/solenv/gbuild/platform/OPENBSD_INTEL_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +gb_CPUDEFS := -DX86 +gb_STDLIBS := $(PTHREAD_LIBS) + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk b/solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk new file mode 100644 index 000000000..15908054d --- /dev/null +++ b/solenv/gbuild/platform/OPENBSD_X86_64_GCC.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/. +# + +#please make generic modifications to unxgcc.mk + +gb_STDLIBS := $(PTHREAD_LIBS) + +include $(GBUILDDIR)/platform/unxgcc.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/SOLARIS_INTEL_GCC.mk b/solenv/gbuild/platform/SOLARIS_INTEL_GCC.mk new file mode 100644 index 000000000..7f31c8a8a --- /dev/null +++ b/solenv/gbuild/platform/SOLARIS_INTEL_GCC.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/. +# +#************************************************************************* + +include $(GBUILDDIR)/platform/solaris.mk + + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/SOLARIS_SPARC_GCC.mk b/solenv/gbuild/platform/SOLARIS_SPARC_GCC.mk new file mode 100644 index 000000000..25b383489 --- /dev/null +++ b/solenv/gbuild/platform/SOLARIS_SPARC_GCC.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/. +# +#************************************************************************* + +gb_CPUDEFS := -D__sparcv8plus + +include $(GBUILDDIR)/platform/solaris.mk + + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/WNT_AARCH64_MSC.mk b/solenv/gbuild/platform/WNT_AARCH64_MSC.mk new file mode 100644 index 000000000..c9cf93138 --- /dev/null +++ b/solenv/gbuild/platform/WNT_AARCH64_MSC.mk @@ -0,0 +1,26 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +gb_CPUDEFS := -D_ARM64_=1 + +include $(GBUILDDIR)/platform/com_MSC_defs.mk + +include $(GBUILDDIR)/platform/com_MSC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/WNT_INTEL_MSC.mk b/solenv/gbuild/platform/WNT_INTEL_MSC.mk new file mode 100644 index 000000000..690a7083a --- /dev/null +++ b/solenv/gbuild/platform/WNT_INTEL_MSC.mk @@ -0,0 +1,26 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +gb_CPUDEFS := -D_X86_=1 + +include $(GBUILDDIR)/platform/com_MSC_defs.mk + +include $(GBUILDDIR)/platform/com_MSC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/WNT_X86_64_MSC.mk b/solenv/gbuild/platform/WNT_X86_64_MSC.mk new file mode 100644 index 000000000..18eae3e74 --- /dev/null +++ b/solenv/gbuild/platform/WNT_X86_64_MSC.mk @@ -0,0 +1,26 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +gb_CPUDEFS := -D_AMD64_=1 + +include $(GBUILDDIR)/platform/com_MSC_defs.mk + +include $(GBUILDDIR)/platform/com_MSC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/android.mk b/solenv/gbuild/platform/android.mk new file mode 100644 index 000000000..fde207ecc --- /dev/null +++ b/solenv/gbuild/platform/android.mk @@ -0,0 +1,129 @@ +# -*- 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_STDLIBS := -static-libstdc++ + +endif + +# No unit testing can be run +gb_CppunitTest_CPPTESTPRECOMMAND := : + +# Re-define this from unxgcc.mk with some small but important +# changes. Just temporarily done this way, shm_get promised to +# eventually enable this to be done this in some more elegant and less +# redundant fashion. + +gb_LinkTarget_LDFLAGS += \ + -Wl,-z,defs \ + -Wl,--as-needed \ + -Wl,--no-add-needed + +define gb_LinkTarget__command_dynamiclink +$(call gb_Helper_abbreviate_dirs,\ + $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \ + -shared \ + $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ + $(subst \d,$$,$(RPATH)) \ + $(T_USE_LD) $(T_LDFLAGS) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \ + -Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \ + $(T_LIBS) \ + $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \ + -o $(1)) +endef + +ifeq ($(DISABLE_DYNLOADING),TRUE) + +# Library class + +gb_Library_DEFS := +gb_Library_SYSPRE := lib +gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ +gb_Library_PLAINEXT := .a +gb_Library_DLLEXT := .a +gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT) + +gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_PLAINEXT) +gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) + +endif + +# Prefix UNO library filenames with "lib" +gb_Library_FILENAMES := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \ + + +ifeq ($(DISABLE_DYNLOADING),TRUE) + +gb_Library_FILENAMES += \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \ + +gb_Library_LAYER := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):OOO) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \ + +define gb_Library_Library_platform +$(call gb_LinkTarget_get_target,$(2)) : LAYER := $(call gb_Library_get_layer,$(1)) + +endef + +# CppunitTest class + +gb_CppunitTest_get_filename = libtest_$(1).a + +# No use for Cppunit targets now for Android (which would be just +# static archives), they are just a waste of disk space. +define gb_LinkTarget__command +$(call gb_Output_announce,$(2),$(true),LNK,4) + $(call gb_Trace_StartRange,$(2),LNK) +$(if $(filter CppunitTest,$(TARGETTYPE)), \ + touch $(1), \ + $(call gb_LinkTarget__command_staticlink,$(1))) + $(call gb_Trace_EndRange,$(2),LNK) +endef + +endif + +# No DT_RPATH or DT_RUNPATH support in the Bionic dynamic linker so +# don't bother generating such. + +define gb_Library_get_rpath +endef + +define gb_Executable_get_rpath +endef + +gb_LinkTarget_LDFLAGS := $(subst -Wl$(COMMA)-rpath-link$(COMMA)$(SYSBASE)/lib:$(SYSBASE)/usr/lib,,$(gb_LinkTarget_LDFLAGS)) + +gb_Library__set_soversion_script_platform = + + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk new file mode 100644 index 000000000..d34464030 --- /dev/null +++ b/solenv/gbuild/platform/com_GCC_class.mk @@ -0,0 +1,255 @@ +# -*- 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 ($(gb_FULLDEPS),$(true)) +ifneq (,$(CCACHE_HARDLINK)) +# cannot move hardlink over itself, so create dep file directly, even if that +# might leave a broken file behind in case the build is interrupted forcefully +define gb_cxx_dep_generation_options +-MMD -MT $(1) -MP -MF $(2) +endef +define gb_cxx_dep_copy +endef +else +define gb_cxx_dep_generation_options +-MMD -MT $(1) -MP -MF $(2)_ +endef +define gb_cxx_dep_copy +&& mv $(1)_ $(1) +endef +endif +else +define gb_cxx_dep_generation_options +endef +define gb_cxx_dep_copy +endef +endif + +# AsmObject class + +gb_AsmObject_get_source = $(1)/$(2).s + +# $(call gb_AsmObject__command,object,relative-source,source,dep-file) +define gb_AsmObject__command +$(call gb_Output_announce,$(2),$(true),ASM,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \ + $(gb_CC) \ + -x assembler-with-cpp \ + $(T_LTOFLAGS) \ + $(gb_AFLAGS) \ + $(if $(HAVE_ASM_END_BRANCH_INS_SUPPORT),-DEND_BRANCH_INS_SUPPORT) \ + -c $(3) \ + -o $(1)) \ + $(INCLUDE) && \ + echo "$(1) : $(3)" > $(4) +endef + +# CObject class + +# $(call gb_CObject__compiler,source,compiler) +define gb_CObject__compiler + $(if $(filter %.c %.m,$(1)), \ + $(if $(2), $(2), $(gb_CC)), \ + $(if $(2), $(2), $(gb_CXX))) +endef + +# When gb_LinkTarget_use_clang is used, filter out GCC flags that Clang doesn't know. +# $(call gb_CObject__filter_out_clang_cflags,cflags) +define gb_CObject__filter_out_clang_cflags + $(filter-out $(gb_FilterOutClangCFLAGS),$(1)) +endef + +# $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,compiler) +define gb_CObject__command_pattern +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \ + $(gb_COMPILER_SETUP) \ + $(if $(5),$(gb_COMPILER_PLUGINS_SETUP)) \ + $(call gb_CObject__compiler,$(3),$(6)) \ + $(DEFS) \ + $(T_LTOFLAGS) \ + $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \ + $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \ + $(if $(5),$(gb_COMPILER_PLUGINS)) \ + $(if $(COMPILER_TEST),-fsyntax-only -ferror-limit=0 -Xclang -verify) \ + $(if $(6), $(call gb_CObject__filter_out_clang_cflags,$(2)),$(2)) \ + $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \ + $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \ + -c $(3) \ + -o $(1) \ + $(if $(COMPILER_TEST),,$(call gb_cxx_dep_generation_options,$(1),$(4))) \ + $(INCLUDE) \ + $(PCHFLAGS) \ + $(if $(COMPILER_TEST),,$(call gb_cxx_dep_copy,$(4))) \ + ) +endef + +# PrecompiledHeader class + +ifeq ($(COM_IS_CLANG),TRUE) +gb_PrecompiledHeader_get_enableflags = -include-pch $(call gb_PrecompiledHeader_get_target,$(1),$(2)) +gb_PrecompiledHeader_EXT := .pch +# Workaround: Apple Clang version 12.0.5 sometimes tries to compile instead of generating PCH +# when used just with -c c++-header, so help it by being explicit. +gb_PrecompiledHeader_emit_pch := -Xclang -emit-pch +else +gb_PrecompiledHeader_get_enableflags = \ +-include $(dir $(call gb_PrecompiledHeader_get_target,$(1),$(2)))$(notdir $(subst .gch,,$(call gb_PrecompiledHeader_get_target,$(1),$(2)))) +gb_PrecompiledHeader_EXT := .gch +gb_PrecompiledHeader_emit_pch := +endif + +gb_PrecompiledHeader_extra_pch_cxxflags += $(PCH_INSTANTIATE_TEMPLATES) + +# Clang supports building extra object file where it puts code that would be shared by all users of the PCH. +# Unlike with MSVC it is built as a separate step. The relevant options are used only when generating the PCH +# and when creating the PCH's object file, normal compilations using the PCH do not need extra options. +gb_PrecompiledHeader_pch_with_obj += $(BUILDING_PCH_WITH_OBJ) +gb_PrecompiledHeader_extra_pch_cxxflags += $(BUILDING_PCH_WITH_OBJ) +ifneq ($(BUILDING_PCH_WITH_OBJ),) +# If using Clang's PCH extra object, we may need to strip unused sections, otherwise inline and template functions +# emitted in that object may in some cases cause unresolved references to private symbols in other libraries. +gb_LinkTarget_LDFLAGS += $(LD_GC_SECTIONS) +gb_PrecompiledHeader_pch_with_obj += -ffunction-sections -fdata-sections +# Enable generating more shared code and debuginfo in the PCH object file. +gb_PrecompiledHeader_extra_pch_cxxflags += $(PCH_DEBUGINFO) +ifeq ($(ENABLE_OPTIMIZED),) +# -fmodules-codegen appears to be worth it only if not optimizing, otherwise optimizing all the functions emitted +# in the PCH object file may take way too long, especially given that many of those may get thrown away +gb_PrecompiledHeader_extra_pch_cxxflags += $(PCH_CODEGEN) +endif +endif + +# This is for MSVC's object file built directly as a side-effect of building the PCH. +gb_PrecompiledHeader_get_objectfile = + +# $(call gb_PrecompiledHeader__command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler) +define gb_PrecompiledHeader__command +$(call gb_Output_announce,$(2),$(true),PCH,1) + $(call gb_Trace_StartRange,$(2),PCH) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(6))) && \ + cd $(BUILDDIR)/ && \ + CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \ + $(if $(7),$(7),$(gb_CXX)) \ + -x c++-header $(gb_PrecompiledHeader_emit_pch) \ + $(if $(7), $(call gb_CObject__filter_out_clang_cflags,$(4)),$(4)) \ + $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \ + $(gb_COMPILERDEPFLAGS) \ + $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \ + $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \ + $(gb_NO_PCH_TIMESTAMP) \ + $(gb_PrecompiledHeader_extra_pch_cxxflags) \ + $(5) \ + $(call gb_cxx_dep_generation_options,$(1),$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(6))) \ + -c $(patsubst %.cxx,%.hxx,$(3)) \ + -o$(1) \ + $(call gb_cxx_dep_copy,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(6))) \ + ) + $(call gb_Trace_EndRange,$(2),PCH) +endef + +ifeq ($(COM_IS_CLANG),TRUE) +# Clang has -fno-pch-timestamp, just checksum the file for CCACHE_PCH_EXTSUM +# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler) +define gb_PrecompiledHeader__sum_command + $(SHA256SUM) $(1) >$(1).sum +endef +else +# GCC does not generate the same .gch for the same input, so checksum the (preprocessed) input +# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler) +define gb_PrecompiledHeader__sum_command +$(call gb_Helper_abbreviate_dirs,\ + CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \ + $(if $(7),$(7),$(gb_CXX)) \ + -x c++-header \ + $(4) \ + $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \ + $(gb_COMPILERDEPFLAGS) \ + $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \ + $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \ + $(gb_NO_PCH_TIMESTAMP) \ + $(5) \ + -E $(patsubst %.cxx,%.hxx,$(3)) \ + -o- \ + | $(SHA256SUM) >$(1).sum \ + ) +endef +endif + +# not needed +gb_PrecompiledHeader__create_reuse_files = +gb_PrecompiledHeader__copy_reuse_files = + +# YaccTarget class + +define gb_YaccTarget__command +$(call gb_Output_announce,$(2),$(true),YAC,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(3)) && \ + $(BISON) $(T_YACCFLAGS) -v --defines=$(4) -o $(5) $(1) && touch $(3) ) + +endef + +# CppunitTest class + +ifeq ($(strip $(DEBUGCPPUNIT)),TRUE) +ifeq ($(strip $(CPPUNITTRACE)),) +CPPUNITTRACE := gdb --args +endif +ifeq ($(filter gdb,$(CPPUNITTRACE)),) +$(error For DEBUGCPPUNIT=TRUE, CPPUNITTRACE must be a command that runs gdb) +endif +gb_CppunitTest_DEBUGCPPUNIT := -nx --batch --command=$(SRCDIR)/solenv/bin/gdbtrycatchtrace-stdout +endif + +# ExternalProject class + +gb_ExternalProject_use_autoconf := +gb_ExternalProject_use_nmake := + +# StaticLibrary class + +gb_StaticLibrary_get_filename = lib$(1).a +gb_StaticLibrary_PLAINEXT := .a +gb_StaticLibrary_StaticLibrary_platform := + +gb_LinkTarget_get_linksearchpath_for_layer = \ + -L$(WORKDIR)/LinkTarget/StaticLibrary \ + -L$(call gb_Library_get_sdk_link_dir) \ + $(foreach layer,\ + $(subst +, ,$(patsubst $(1):%.,%,\ + $(filter $(1):%.,$(gb_LinkTarget_LAYER_LINKPATHS)))),\ + $(patsubst $(layer):%,-L%,\ + $(filter $(layer):%,$(gb_Library_LAYER_DIRS)))) + + +gb_ICU_PRECOMMAND := $(call gb_Helper_extend_ld_path,$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib) + +# UIConfig class + +# macOS sort(1) cannot read a response file +define gb_UIConfig__command +$(call gb_Helper_abbreviate_dirs,\ + $(SORT) -u $(UI_IMAGELISTS) /dev/null > $@ \ +) + +endef + +define gb_UIConfig__gla11y_command +$(call gb_Helper_abbreviate_dirs,\ + $(gb_UIConfig_LXML_PATH) $(if $(SYSTEM_LIBXML)$(SYSTEM_LIBXSLT),,$(gb_Helper_set_ld_path)) \ + $(call gb_ExternalExecutable_get_command,python) \ + $(gb_UIConfig_gla11y_SCRIPT) $(gb_UIConfig_gla11y_PARAMETERS) -o $@ $(UIFILES) +) + +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 new file mode 100644 index 000000000..bdf1684eb --- /dev/null +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -0,0 +1,335 @@ +# -*- 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_AWK := awk + +gb_CLASSPATHSEP := : +gb_LICENSE := LICENSE +gb_README = README_$(1) + +# use CC/CXX if they are nondefaults +ifneq ($(origin CC),default) +gb_CC := $(CC) +gb_GCCP := $(CC) +else +gb_CC := gcc +gb_GCCP := gcc +endif + +ifneq ($(origin CXX),default) +gb_CXX := $(CXX) +else +gb_CXX := g++ +endif + +ifneq ($(origin AR),default) +gb_AR := $(AR) +else +gb_AR := $(shell $(CC) -print-prog-name=ar) +endif + +# shell setup (env.vars) for the compiler +gb_COMPILER_SETUP := + +ifeq ($(strip $(gb_COMPILEROPTFLAGS)),) +gb_COMPILEROPTFLAGS := -O2 +endif + +gb_AFLAGS := $(AFLAGS) + +gb_COMPILERDEFS := \ + -DBOOST_ERROR_CODE_HEADER_ONLY \ + -DBOOST_SYSTEM_NO_DEPRECATED \ + -DCPPU_ENV=$(CPPU_ENV) \ + $(if $(filter EMSCRIPTEN,$(OS)),-U_FORTIFY_SOURCE) \ + +# enable debug STL +ifeq ($(gb_ENABLE_DBGUTIL),$(true)) +ifneq ($(HAVE_LIBSTDCPP),) +gb_COMPILERDEFS_STDLIB_DEBUG = -D_GLIBCXX_DEBUG +else +ifneq ($(LIBCPP_DEBUG),) +gb_COMPILERDEFS_STDLIB_DEBUG = $(LIBCPP_DEBUG) +endif +endif +gb_COMPILERDEFS += $(gb_COMPILERDEFS_STDLIB_DEBUG) +endif + +gb_CFLAGS_COMMON := \ + -Wall \ + -Wendif-labels \ + -Wextra \ + -Wstrict-prototypes \ + -Wundef \ + -Wunreachable-code \ + $(if $(or $(and $(COM_IS_CLANG),$(or $(findstring icecc,$(CC)),$(findstring icecc,$(CCACHE_PREFIX)))),$(findstring sccache,$(CC))),,-Wunused-macros) \ + $(if $(COM_IS_CLANG),-Wembedded-directive) \ + -finput-charset=UTF-8 \ + -fmessage-length=0 \ + -fno-common \ + -pipe \ + $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) \ + +gb_CXXFLAGS_COMMON := \ + -Wall \ + -Wno-missing-braces \ + -Wnon-virtual-dtor \ + -Wendif-labels \ + -Wextra \ + -Wundef \ + -Wunreachable-code \ + -Wshadow \ + $(if $(or $(and $(COM_IS_CLANG),$(or $(findstring icecc,$(CXX)),$(findstring icecc,$(CCACHE_PREFIX)))),$(findstring sccache,$(CXX))),,-Wunused-macros) \ + $(if $(COM_IS_CLANG),-Wembedded-directive) \ + -finput-charset=UTF-8 \ + -fmessage-length=0 \ + -fno-common \ + -pipe \ + $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) \ + +ifeq ($(HAVE_WDEPRECATED_COPY_DTOR),TRUE) +gb_CXXFLAGS_COMMON += -Wdeprecated-copy-dtor +endif + +gb_CXXFLAGS_DISABLE_WARNINGS = -w + +ifeq ($(HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED),TRUE) +gb_CXXFLAGS_COMMON += -Wno-maybe-uninitialized +endif + +ifeq ($(HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW),TRUE) +gb_CXXFLAGS_COMMON += -Wno-stringop-overflow +endif + +gb_CXXFLAGS_Wundef = -Wno-undef + +gb_CXXFLAGS_include := -include$(gb_SPACE) + +ifeq ($(strip $(gb_GCOV)),YES) +gb_CFLAGS_COMMON += -fprofile-arcs -ftest-coverage +gb_CXXFLAGS_COMMON += -fprofile-arcs -ftest-coverage +gb_LinkTarget_LDFLAGS += -fprofile-arcs -lgcov +gb_COMPILEROPTFLAGS := -O0 +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 += \ + -Wimplicit-fallthrough \ + -Wunused-exception-parameter \ + -Wrange-loop-analysis +else +gb_CFLAGS_COMMON += \ + -Wduplicated-cond \ + -Wlogical-op \ + -Wshift-overflow=2 +gb_CXXFLAGS_COMMON += \ + -Wduplicated-cond \ + -Wlogical-op \ + -Wshift-overflow=2 \ + -Wunused-const-variable=1 +endif + +# GCC 8 -Wcast-function-type (included in -Wextra) unhelpfully even warns on reinterpret_cast +# between incompatible function types: +ifeq ($(shell expr '$(GCC_VERSION)' '>=' 800),1) +gb_CXXFLAGS_COMMON += \ + -Wno-cast-function-type +endif + +# If CC or CXX already include -fvisibility=hidden, don't duplicate it +ifeq (,$(filter -fvisibility=hidden,$(CC))) +gb_VISIBILITY_FLAGS := -fvisibility=hidden +endif +gb_VISIBILITY_FLAGS_CXX := -fvisibility-inlines-hidden +gb_CXXFLAGS_COMMON += $(gb_VISIBILITY_FLAGS_CXX) + +gb_LinkTarget_LDFLAGS += $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) + +ifneq ($(gb_ENABLE_PCH),) +ifeq ($(COM_IS_CLANG),TRUE) +# Clang by default includes in the PCH timestamps of the files it was +# generated from, which would make the PCH be a "new" file for ccache +# even if the file has not actually changed. Disabling the timestamp +# prevents this at the cost of risking using an outdated PCH (which +# should be unlikely, given that gbuild has dependencies set up +# for our includes and system includes are unlikely to change). +gb_NO_PCH_TIMESTAMP := -Xclang -fno-pch-timestamp +else +gb_CFLAGS_COMMON += -fpch-preprocess -Winvalid-pch +gb_CXXFLAGS_COMMON += -fpch-preprocess -Winvalid-pch +gb_NO_PCH_TIMESTAMP := +endif +endif + +gb_CFLAGS_WERROR = $(if $(ENABLE_WERROR),-Werror) + +# This is the default in non-C++11 mode +ifeq ($(COM_IS_CLANG),TRUE) +gb_CXX03FLAGS := -std=gnu++98 -Werror=c++11-extensions -Wno-c++11-long-long \ + -Wno-deprecated-declarations +else +gb_CXX03FLAGS := -std=gnu++98 -Wno-long-long \ + -Wno-variadic-macros -Wno-non-virtual-dtor -Wno-deprecated-declarations +endif + +# On Windows MSVC only supports C90 so force gnu89 (especially in clang) to +# to catch potential gnu89/C90 incompatibilities locally. +gb_CFLAGS_COMMON += -std=gnu89 + +ifeq ($(ENABLE_LTO),TRUE) +ifeq ($(COM_IS_CLANG),TRUE) +gb_LTOFLAGS := -flto=thin +ifeq (,$(index,iOS MACOSX,$(OS))) +gb_LTOPLUGINFLAGS := --plugin $(if $(LD_PLUGIN),$(LD_PLUGIN),LLVMgold.so) +endif +else +# use parallelism based on make's job handling +gb_LTOFLAGS := -flto=jobserver -fuse-linker-plugin -O2 +# clang does not support -flto=<number> +gb_CLANG_LTOFLAGS := -flto=thin +endif +endif + +gb_LinkTarget_EXCEPTIONFLAGS := \ + -DEXCEPTIONS_ON \ + -fexceptions + +ifeq ($(gb_ENABLE_DBGUTIL),$(false)) +# Clang doesn't have this option +ifeq ($(HAVE_GCC_FNO_ENFORCE_EH_SPECS),TRUE) +gb_LinkTarget_EXCEPTIONFLAGS += \ + -fno-enforce-eh-specs +gb_FilterOutClangCFLAGS += -fno-enforce-eh-specs +endif +endif + +gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS) + +# We turn on and off this one depending on whether icecream and/or ccache are used, +# and changing cxxflags cause PCH rebuilds, so e.g. a plain temporary 'CCACHE_DISABLE=1' +# would cause a rebuild. Ignore the flag there, it's irrelevant for PCH use anyway. +gb_PrecompiledHeader_ignore_flags_for_flags_file := -Wunused-macros + +# optimization level +gb_COMPILERNOOPTFLAGS := -O0 -fstrict-aliasing -fstrict-overflow +gb_COMPILERDEBUGOPTFLAGS := -Og + +ifeq ($(OS),ANDROID) +gb_DEBUGINFO_FLAGS=-glldb +# Clang does not know -ggdb2 or some other options +else ifeq ($(HAVE_GCC_GGDB2),TRUE) +gb_DEBUGINFO_FLAGS=-ggdb2 +else +gb_DEBUGINFO_FLAGS=-g2 +endif +gb_LINKER_DEBUGINFO_FLAGS= + +ifeq ($(HAVE_EXTERNAL_DWARF),TRUE) +gb_DEBUGINFO_FLAGS+=-gsplit-dwarf +# GCC 11 defaults to -gdwarf-5, which GDB 10 doesn't support in split debug info +ifeq ($(COM_IS_CLANG),) +gb_DEBUGINFO_FLAGS+=-gdwarf-4 +endif +endif + +ifeq ($(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR),TRUE) +gb_DEBUGINFO_FLAGS+=-Xclang -debug-info-kind=constructor +endif + +ifeq ($(ENABLE_GDB_INDEX),TRUE) +gb_LINKER_DEBUGINFO_FLAGS += -Wl,--gdb-index +gb_DEBUGINFO_FLAGS += -ggnu-pubnames +endif + +gb_LinkTarget_INCLUDE :=\ + $(SOLARINC) \ + -I$(BUILDDIR)/config_$(gb_Side) \ + +ifeq ($(COM_IS_CLANG),TRUE) +gb_COMPILER_TEST_FLAGS := -Xclang -plugin-arg-loplugin -Xclang --unit-test-mode +ifeq ($(COMPILER_PLUGIN_TOOL),) +gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/clang/plugin.so -Xclang -add-plugin -Xclang loplugin +ifneq ($(COMPILER_PLUGIN_WARNINGS_ONLY),) +gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang \ + --warnings-only='$(COMPILER_PLUGIN_WARNINGS_ONLY)' +endif +else +gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/clang/plugin.so -Xclang -plugin -Xclang loplugin $(foreach plugin,$(COMPILER_PLUGIN_TOOL), -Xclang -plugin-arg-loplugin -Xclang $(plugin)) +ifneq ($(UPDATE_FILES),) +gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --scope=$(UPDATE_FILES) +endif +endif +ifeq ($(COMPILER_PLUGINS_DEBUG),TRUE) +gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --debug +endif +# set CCACHE_CPP2=1 to prevent clang generating spurious warnings +gb_COMPILER_SETUP += CCACHE_CPP2=1 +gb_COMPILER_PLUGINS_SETUP := ICECC_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox CCACHE_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox SCCACHE_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox +gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := \ + -Xclang -plugin-arg-loplugin -Xclang --warnings-as-errors +else +# Set CCACHE_CPP2 to prevent GCC -Werror=implicit-fallthrough= when ccache strips comments from C +# code (which still needs /*fallthrough*/-style comments to silence that warning): +ifeq ($(ENABLE_WERROR),TRUE) +gb_COMPILER_SETUP += CCACHE_CPP2=1 +endif +gb_COMPILER_TEST_FLAGS := +gb_COMPILER_PLUGINS := +gb_COMPILER_PLUGINS_SETUP := +gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := +endif + +# Executable class + +gb_Executable_EXT_for_build := + +# Helper class + +ifeq ($(OS_FOR_BUILD),MACOSX) +gb_Helper_LIBRARY_PATH_VAR := DYLD_LIBRARY_PATH +else ifeq ($(OS_FOR_BUILD),AIX) +gb_Helper_LIBRARY_PATH_VAR := LIBPATH +else ifeq ($(OS_FOR_BUILD),WNT) +# In theory possible if cross-compiling to some Unix from Windows, +# in practice strongly discouraged to even try that +gb_Helper_LIBRARY_PATH_VAR := PATH +else ifeq ($(OS_FOR_BUILD),HAIKU) +gb_Helper_LIBRARY_PATH_VAR := LIBRARY_PATH +else +gb_Helper_LIBRARY_PATH_VAR := LD_LIBRARY_PATH +endif + +gb_Helper_set_ld_path := $(gb_Helper_LIBRARY_PATH_VAR)=$${$(gb_Helper_LIBRARY_PATH_VAR):+$$$(gb_Helper_LIBRARY_PATH_VAR):}"$(INSTROOT_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER_FOR_BUILD):$(INSTROOT_FOR_BUILD)/$(LIBO_LIB_FOLDER_FOR_BUILD)" + +# $(1): list of : separated directory pathnames to append to the ld path +define gb_Helper_extend_ld_path +$(gb_Helper_set_ld_path):$(1) +endef + +# Convert path to file URL. +define gb_Helper_make_url +file://$(strip $(1)) +endef + +gb_Helper_get_rcfile = $(1)rc + +ifneq ($(gb_ENABLE_PCH),) +# Enable use of .sum files for PCHs. +gb_COMPILER_SETUP += CCACHE_PCH_EXTSUM=1 +endif + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk new file mode 100644 index 000000000..06d21ecd4 --- /dev/null +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -0,0 +1,742 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +# Convert path to file URL. +define gb_Helper_make_url +file:///$(strip $(1)) +endef + +# YaccTarget class + +define gb_YaccTarget__command +$(call gb_Output_announce,$(2),$(true),YAC,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(3)) && \ + $(BISON) $(T_YACCFLAGS) --defines=$(4) -o $(5) $(1) && touch $(3) ) + +endef + +# CObject class + +# $(call gb_CObject__compiler,flags,source,compiler) +define gb_CObject__compiler + $(if $(filter YES,$(LIBRARY_X64)), $(CXX_X64_BINARY), \ + $(if $(filter YES,$(PE_X86)), $(CXX_X86_BINARY), \ + $(if $(filter %.c,$(2)), \ + $(if $(3), $(3), $(gb_CC)), \ + $(if $(filter -clr,$(1)), \ + $(MSVC_CXX) -I$(SRCDIR)/solenv/clang-cl, \ + $(if $(3), $(3), $(gb_CXX)))))) +endef + +# Avoid annoying warning D9025 about overriding command-line arguments. +gb_Helper_remove_overridden_flags = \ + $(filter-out -W4 -w -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2 -Od -O2 -Zc:inline -Zc:inline- \ + -Zc:dllexportInlines -Zc:dllexportInlines- -EHs -EHa -DNOMINMAX -UNOMINMAX -D_X86_=1 -U_X86_ \ + -D_AMD64_=1 -U_AMD64_,$(1)) \ + $(lastword $(filter -W4 -w,$(1))) \ + $(lastword $(filter -Od -O2,$(1))) \ + $(lastword $(filter -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2,$(1))) \ + $(lastword $(filter -EHs -EHa,$(1))) \ + $(lastword $(filter -DNOMINMAX -UNOMINMAX,$(1))) \ + $(lastword $(filter -D_X86_=1 -U_X86_,$(1))) \ + $(lastword $(filter -D_AMD64_=1 -U_AMD64_,$(1))) \ + $(lastword $(filter -Zc:inline -Zc:inline-,$(1))) \ + $(lastword $(filter -Zc:dllexportInlines -Zc:dllexportInlines-,$(1))) + +# $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,compiler) +define gb_CObject__command_pattern +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && \ + unset INCLUDE && \ + $(if $(and $(gb_COMPILERDEPFLAGS),$(T_USE_CLANG)), export SHOWINCLUDES_PREFIX="${LO_CLANG_SHOWINCLUDES_PREFIX}" &&) \ + $(gb_COMPILER_SETUP) \ + $(call gb_CObject__compiler,$(2),$(3),$(6)) \ + $(call gb_Helper_remove_overridden_flags, \ + $(DEFS) \ + $(if $(filter YES,$(LIBRARY_X64)), ,$(gb_LTOFLAGS)) \ + $(2) $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \ + $(if $(EXTERNAL_CODE), \ + $(if $(filter -clr,$(2)),,$(if $(COM_IS_CLANG),-Wno-undef)), \ + $(gb_DEFS_INTERNAL)) \ + $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \ + $(if $(filter -clr,$(2)),,$(if $(5),$(gb_COMPILER_PLUGINS))) \ + $(if $(COMPILER_TEST),-fsyntax-only -ferror-limit=0 -Xclang -verify) \ + $(PCHFLAGS) \ + $(if $(COMPILER_TEST),,$(gb_COMPILERDEPFLAGS)) \ + $(if $(filter YES,$(LIBRARY_X64)), -U_X86_ -D_AMD64_,) \ + $(if $(filter YES,$(PE_X86)), -D_X86_ -U_AMD64_,)) \ + $(INCLUDE) \ + -Fd$(PDBFILE) \ + -c $(3) \ + -Fo$(1)) \ + $(if $(COMPILER_TEST),,$(call gb_create_deps,$(4),$(1),$(3))) +endef + +# PrecompiledHeader class + +gb_PrecompiledHeader_get_enableflags = \ + -Yu$(SRCDIR)/$(3).hxx \ + -FI$(SRCDIR)/$(3).hxx \ + -Fp$(call gb_PrecompiledHeader_get_target,$(1),$(2)) \ + $(gb_PCHWARNINGS) + +gb_PrecompiledHeader_EXT := .pch + +# MSVC PCH needs extra .obj created during the creation of the PCH file +gb_PrecompiledHeader_get_objectfile = $(1).obj + +# $(call gb_PrecompiledHeader__command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler) +define gb_PrecompiledHeader__command +$(call gb_Output_announce,$(2),$(true),PCH,1) + $(call gb_Trace_StartRange,$(2),PCH) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(6))) && \ + unset INCLUDE && \ + $(if $(and $(gb_COMPILERDEPFLAGS),$(T_USE_CLANG)), export SHOWINCLUDES_PREFIX="${LO_CLANG_SHOWINCLUDES_PREFIX}" &&) \ + CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \ + $(call gb_CObject__compiler,$(4),$(3),$(7)) \ + $(call gb_Helper_remove_overridden_flags, \ + $(4) $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \ + -Fd$(PDBFILE) \ + $(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \ + $(if $(filter YES,$(LIBRARY_X64)), ,$(gb_LTOFLAGS)) \ + $(gb_COMPILERDEPFLAGS) \ + $(gb_NO_PCH_TIMESTAMP) \ + $(5) \ + -c $(3) \ + -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -I$(dir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) \ + $(call gb_create_deps,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(6)),$(1),$(3)) + $(call gb_Trace_EndRange,$(2),PCH) +endef + +ifeq ($(COM_IS_CLANG),TRUE) +# Clang has -fno-pch-timestamp, just checksum the file for CCACHE_PCH_EXTSUM +# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler) +define gb_PrecompiledHeader__sum_command + $(SHA256SUM) $(1) >$(1).sum +endef +else +# MSVC does not generate the same .pch for the same input, so checksum the (preprocessed) input +# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler) +define gb_PrecompiledHeader__sum_command +$(call gb_Helper_abbreviate_dirs,\ + unset INCLUDE && \ + CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \ + $(call gb_CObject__compiler,$(4),$(3),$(7)) \ + $(call gb_Helper_remove_overridden_flags, \ + $(4)$(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \ + $(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \ + $(gb_LTOFLAGS) \ + $(5) \ + -E $(3) \ + 2>&1 | $(SHA256SUM) >$(1).sum \ + ) +endef +endif + +# When building a PCH, MSVC also creates a .pdb file with debug info. So for reuse +# add the .pdb to the PCH's files and then use the .pdb also for linktargets that reuse the PCH. +# call gb_PrecompiledHeader__create_reuse_files,linktarget,pchtarget,linktargetmakefilename +define gb_PrecompiledHeader__create_reuse_files +rm -f $(call gb_PrecompiledHeader_get_target,$(2),$(3)).pdb; \ +if test -f $(call gb_LinkTarget_get_pdbfile_in,$(1)); then \ + cp $(call gb_LinkTarget_get_pdbfile_in,$(1)) $(call gb_PrecompiledHeader_get_target,$(2),$(3)).pdb; \ +fi +endef + +# call gb_PrecompiledHeader__copy_reuse_files,linktarget,pchtarget,linktargetmakefilename +define gb_PrecompiledHeader__copy_reuse_files +rm -f $(call gb_LinkTarget_get_pdbfile_in,$(1)); \ +if test -f $(call gb_PrecompiledHeader_get_target,$(2),$(3)).pdb; then \ + cp $(call gb_PrecompiledHeader_get_target,$(2),$(3)).pdb $(call gb_LinkTarget_get_pdbfile_in,$(1)); \ +fi +endef + +# AsmObject class +ifeq ($(CPUNAME),AARCH64) +gb_AsmObject_get_source = $(1)/$(2).S + +# Code needs a preprocessor step .S -> .asm -> .o +define gb_AsmObject__command +$(call gb_Output_announce,$(2),$(true),ASM,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && \ + "$(CC)" -nologo -EP -D_M_ARM64 $(SOLARINC) $(3) > $(subst .o,.asm,$(1)) && \ + "$(ML_EXE)" $(gb_AFLAGS) -g -errorReport:prompt -o $(1) $(subst .o,.asm,$(1)), \ + ) && \ + echo "$(1) : $(3)" > $(4) +endef + +else # !AARCH64 +gb_AsmObject_get_source = $(1)/$(2).asm + +define gb_AsmObject__command +$(call gb_Output_announce,$(2),$(true),ASM,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && \ + "$(ML_EXE)" \ + $(if $(filter X86_64,$(CPUNAME)),, /safeseh) \ + /c /Cp $(gb_AFLAGS) -D$(COM) /Fo$(1) $(3)) && \ + echo "$(1) : $(3)" > $(4) +endef + +endif + +# LinkTarget class + +gb_LinkTarget_CFLAGS := $(gb_CFLAGS) +gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) +gb_LinkTarget_CXXCLRFLAGS := $(gb_CXXCLRFLAGS) + +gb_LinkTarget_INCLUDE :=\ + $(SOLARINC) \ + $(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \ + -I$(BUILDDIR)/config_$(gb_Side) \ + +# We must name the .pdb like libname.pdb, not libname.\(dll\|exe\|pyd\).pdb, +# otherwise WinDbg does not find it. +define gb_LinkTarget__get_pdb_filename +$(patsubst %.dll,%.pdb,$(patsubst %.exe,%.pdb,$(patsubst %.bin,%.bin.pdb,$(patsubst %.pyd,%.pdb,$(1))))) +endef + +gb_LinkTarget_get_pdbfile_in = \ + $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).objects.pdb + +gb_LinkTarget_get_pdbfile_out = \ + $(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) + +gb_LinkTarget_get_ilkfile = \ + $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).ilk + +gb_LinkTarget_get_manifestfile = \ + $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).manifest + +gb_LinkTarget_get_linksearchpath_for_layer = \ + -LIBPATH:$(WORKDIR)/LinkTarget/StaticLibrary \ + -LIBPATH:$(INSTDIR)/$(SDKDIRNAME)/lib \ + $(if $(filter OXT,$(1)),\ + -LIBPATH:$(WORKDIR)/LinkTarget/ExtensionLibrary, \ + -LIBPATH:$(WORKDIR)/LinkTarget/Library) + +# avoid fatal error LNK1170 for Library_merged +define gb_LinkTarget_MergedResponseFile +cat $${RESPONSEFILE} | sed 's/ /\n/g' | grep -v '^$$' > $${RESPONSEFILE}.1 && \ +mv $${RESPONSEFILE}.1 $${RESPONSEFILE} && +endef + +gb_MSC_SUBSYSTEM_VERSION=$(COMMA)$(if $(filter AARCH64,$(CPUNAME)),6.02,6.01) + +# the sort on the libraries is used to filter out duplicates to keep commandline +# length in check - otherwise the dupes easily hit the limit when linking mergedlib +define gb_LinkTarget__command +$(call gb_Output_announce,$(2),$(true),LNK,4) + $(call gb_Trace_StartRange,$(2),LNK) +$(call gb_Helper_abbreviate_dirs,\ + rm -f $(1) && \ + RESPONSEFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),100, \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \ + $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \ + $(PCHOBJS) $(NATIVERES)) && \ + $(if $(filter $(call gb_Library__get_workdir_linktargetname,merged),$(2)),$(call gb_LinkTarget_MergedResponseFile)) \ + unset INCLUDE && \ + $(gb_LINK) \ + $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ + $(if $(filter StaticLibrary,$(TARGETTYPE)),-LIB) \ + $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \ + $(if $(T_SYMBOLS),$(if $(filter Executable Library CppunitTest,$(TARGETTYPE)),$(gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO)),) \ + $(if $(filter YES,$(TARGETGUI)), -SUBSYSTEM:WINDOWS$(gb_MSC_SUBSYSTEM_VERSION), -SUBSYSTEM:CONSOLE$(gb_MSC_SUBSYSTEM_VERSION)) \ + $(if $(filter YES,$(LIBRARY_X64)), -MACHINE:X64) \ + $(if $(filter YES,$(PE_X86)), -MACHINE:X86) \ + $(if $(filter YES,$(LIBRARY_X64)), \ + -LIBPATH:$(COMPATH)/lib/x64 \ + -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x64 \ + -LIBPATH:$(UCRTSDKDIR)lib/$(UCRTVERSION)/ucrt/x64 \ + $(if $(filter 80 81 10,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/$(WINDOWS_SDK_LIB_SUBDIR)/um/x64)) \ + $(if $(filter YES,$(PE_X86)), \ + -LIBPATH:$(COMPATH)/lib/x86 \ + -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x86 \ + -LIBPATH:$(UCRTSDKDIR)lib/$(UCRTVERSION)/ucrt/x86 \ + $(if $(filter 80 81 10,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/$(WINDOWS_SDK_LIB_SUBDIR)/um/x86)) \ + $(T_USE_LD) $(T_LDFLAGS) \ + $(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),/NATVIS:$(SRCDIR)/solenv/vs/LibreOffice.natvis) \ + @$${RESPONSEFILE} \ + $(foreach lib,$(sort $(LINKED_LIBS)),$(call gb_Library_get_ilibfilename,$(lib))) \ + $(foreach lib,$(sort $(LINKED_STATIC_LIBS)),$(call gb_StaticLibrary_get_filename,$(lib))) \ + $(if $(filter-out StaticLibrary,$(TARGETTYPE)),\ + $(sort $(T_LIBS)) user32.lib \ + -manifestfile:$(WORKDIR)/LinkTarget/$(2).manifest \ + -pdb:$(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(2))) \ + $(if $(ILIBTARGET),-out:$(1) -implib:$(ILIBTARGET),-out:$(1)) \ + | LC_ALL=C $(GBUILDDIR)/platform/filter-creatingLibrary.awk; RC=$${PIPESTATUS[0]}; rm $${RESPONSEFILE} \ + $(if $(filter Library,$(TARGETTYPE)),; if [ ! -f $(ILIBTARGET) ]; then rm -f $(1); exit 42; fi) \ + $(if $(filter Library,$(TARGETTYPE)),&& if [ -f $(WORKDIR)/LinkTarget/$(2).manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest $(WORKDIR)/LinkTarget/$(2).manifest $(SRCDIR)/solenv/gbuild/platform/win_compatibility.manifest -outputresource:$(1)\;2 && touch -r $(1) $(WORKDIR)/LinkTarget/$(2).manifest $(ILIBTARGET); fi) \ + $(if $(filter Executable,$(TARGETTYPE)),&& if [ -f $(WORKDIR)/LinkTarget/$(2).manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest $(WORKDIR)/LinkTarget/$(2).manifest $(SRCDIR)/solenv/gbuild/platform/win_compatibility.manifest -outputresource:$(1)\;1 && touch -r $(1) $(WORKDIR)/LinkTarget/$(2).manifest; fi) \ + $(if $(filter Executable,$(TARGETTYPE)),&& mt.exe $(MTFLAGS) -nologo -manifest $(SRCDIR)/solenv/gbuild/platform/DeclareDPIAware.manifest -updateresource:$(1)\;1 ) \ + $(if $(filter Library,$(TARGETTYPE)),&& \ + echo $(notdir $(1)) > $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(gb_DUMPBIN) \ + -exports $(ILIBTARGET) \ + >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp,$(WORKDIR)/LinkTarget/$(2).exports,$(1))) \ + ; \ + $(call gb_Trace_EndRange,$(2),LNK) $(if $(gb_TRACE),;) \ + exit $$RC) +endef + +define gb_MSVCRT_subst +$(if $(MSVC_USE_DEBUG_RUNTIME),$(subst msvcrt,msvcrtd,$(subst msvcprt,msvcprtd,$(subst libcmt,libcmtd,$(subst libvcruntime,libvcruntimed,$(subst libucrt,libucrtd,$(subst libcpmt,libcpmtd,$(subst msvcmrt,msvcmrtd,$(1)))))))),$(1)) +endef + +define gb_LinkTarget_use_system_win32_libs +$(call gb_LinkTarget_add_libs,$(1),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib)) +$(if $(call gb_LinkTarget__is_merged,$(1)),\ + $(call gb_LinkTarget_add_libs,$(call gb_Library_get_linktarget,merged),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib))) +endef + +# Flags common for PE executables (EXEs and DLLs). +# Enable incremental only when debugging to speed up relinking. +gb_Windows_PE_TARGETTYPEFLAGS := \ + -release \ + -opt:noref \ + $(if $(filter 0,$(gb_DEBUGLEVEL)), -incremental:no) \ + $(if $(filter NO,$(LIBRARY_X64)), -safeseh) \ + -nxcompat \ + -dynamicbase \ + -manifest + +# link.exe in -LIB mode doesn't understand -debug, use it only for EXEs and DLLs +ifeq ($(gb_ENABLE_DBGUTIL),$(true)) +# fastlink is faster but pdb files reference .obj files +gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO := -debug:fastlink +else +gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO := -debug +endif + +ifeq ($(ENABLE_LTO),TRUE) +gb_Windows_PE_TARGETTYPEFLAGS += -LTCG +endif + +# Library class + + +gb_Library_DEFS := -D_DLL +gb_Library_TARGETTYPEFLAGS := \ + -DLL \ + $(gb_Windows_PE_TARGETTYPEFLAGS) + +gb_Library_get_rpath := + +gb_Library_SYSPRE := i +gb_Library_PLAINEXT := .lib +gb_Library_PLAINEXT_FOR_BUILD := .lib + +gb_Library_LAYER := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PLAINLIBS_SHLXTHDL),$(lib):SHLXTHDL) \ + +gb_Library_ILIBFILENAMES :=\ + $(foreach lib,$(gb_Library_KNOWNLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + +gb_Library_DLLEXT := .dll +gb_Library_UDK_MAJORVER := 3 +gb_Library_RTEXT := MSC$(gb_Library_DLLEXT) +gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_DLLEXT) +gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT) +gb_Library_UNOVEREXT := $(gb_Library_UDK_MAJORVER)$(gb_Library_DLLEXT) +gb_Library_RTVEREXT := $(gb_Library_UDK_MAJORVER)$(gb_Library_RTEXT) + +gb_Library_FILENAMES :=\ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(lib)$(gb_Library_DLLEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_SHLXTHDL),$(lib):$(lib)$(gb_Library_DLLEXT)) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \ + +# An assembly is a special kind of library for CLI +define gb_Library_Assembly +$(call gb_Library_Library,$(1)) +$(call gb_Library_get_linktarget_target,$(1)) : NATIVERES := + +endef + +define gb_Library_Library_platform +$(call gb_LinkTarget_set_ilibtarget,$(2),$(3)) + +$(call gb_LinkTarget_add_auxtargets,$(2),\ + $(patsubst %.lib,%.exp,$(3)) \ + $(call gb_LinkTarget_get_manifestfile,$(2)) \ + $(call gb_LinkTarget_get_pdbfile_in,$(2)) \ + $(call gb_LinkTarget_get_pdbfile_out,$(2)) \ + $(call gb_LinkTarget_get_ilkfile,$(2)) \ +) + +$(call gb_Library_add_default_nativeres,$(1),$(1)/default) + +$(call gb_LinkTarget_get_target,$(2)) \ +$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2)) + +endef + +define gb_Library_add_default_nativeres +$(call gb_WinResTarget_WinResTarget_init,$(2)) +$(call gb_WinResTarget_set_rcfile,$(2),include/default) +$(call gb_WinResTarget_add_defs,$(2),\ + -DVERVARIANT="$(LIBO_VERSION_PATCH)" \ + -DRES_APP_VENDOR="$(OOO_VENDOR)" \ + -DORG_NAME="$(call gb_Library_get_filename,$(1))"\ + -DINTERNAL_NAME="$(subst $(gb_Library_DLLEXT),,$(call gb_Library_get_filename,$(1)))" \ + -DADDITIONAL_VERINFO1="" \ + -DADDITIONAL_VERINFO2="" \ + -DADDITIONAL_VERINFO3="" \ +) +$(call gb_Library_add_nativeres,$(1),$(2)) +$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(2)) + +endef + +define gb_Executable_add_default_nativeres +$(call gb_WinResTarget_WinResTarget_init,$(1)/default) +$(call gb_WinResTarget_set_rcfile,$(1)/default,include/default) +$(call gb_WinResTarget_add_defs,$(1)/default,\ + -DVERVARIANT="$(LIBO_VERSION_PATCH)" \ + -DRES_APP_VENDOR="$(OOO_VENDOR)" \ + -DORG_NAME="$(call gb_Executable_get_filename,$(1))"\ + -DINTERNAL_NAME="$(subst $(gb_Executable_EXT),,$(call gb_Executable_get_filename,$(1)))" \ + -DADDITIONAL_VERINFO1="$(if $(2),VALUE \"FileDescription\"$(COMMA) \"$(2)\\0\")" \ + -DADDITIONAL_VERINFO2="" \ + -DADDITIONAL_VERINFO3="" \ +) +$(call gb_Executable_add_nativeres,$(1),$(1)/default) +$(call gb_Executable_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/default) + +endef + +define gb_LinkTarget_add_nativeres +$(call gb_LinkTarget_get_target,$(1)) : $(call gb_WinResTarget_get_target,$(2)) +$(call gb_LinkTarget_get_target,$(1)) : NATIVERES += $(call gb_WinResTarget_get_target,$(2)) + +endef + +define gb_LinkTarget_set_nativeres +$(call gb_LinkTarget_get_target,$(1)) : $(call gb_WinResTarget_get_target,$(2)) +$(call gb_LinkTarget_get_target,$(1)) : NATIVERES := $(call gb_WinResTarget_get_target,$(2)) + +endef + +define gb_Library_get_ilibfilename +$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_ILIBFILENAMES))) +endef + +gb_Library_get_sdk_link_dir = $(INSTDIR)/$(SDKDIRNAME)/lib + +gb_Library_get_sdk_link_lib = $(gb_Library_get_ilib_target) + +# StaticLibrary class + +gb_StaticLibrary_get_filename = $(1).lib +gb_StaticLibrary_PLAINEXT := .lib + +define gb_StaticLibrary_StaticLibrary_platform +$(call gb_LinkTarget_get_target,$(2)) \ +$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2)) + +$(call gb_LinkTarget_add_auxtargets,$(2),\ + $(call gb_LinkTarget_get_pdbfile_in,$(2)) \ +) + +endef + +# Executable class + +gb_Executable_EXT := .exe +gb_Executable_EXT_for_build := .exe +gb_Executable_TARGETTYPEFLAGS := $(gb_Windows_PE_TARGETTYPEFLAGS) + +gb_Executable_get_rpath := + +# surprisingly some executables have exports so link.exe creates import lib +define gb_Executable_Executable_platform +$(call gb_LinkTarget_set_ilibtarget,$(2),$(3)) + +$(call gb_LinkTarget_add_auxtargets,$(2),\ + $(patsubst %.lib,%.exp,$(3)) \ + $(call gb_LinkTarget_get_pdbfile_out,$(2)) \ + $(call gb_LinkTarget_get_pdbfile_in,$(2)) \ + $(call gb_LinkTarget_get_manifestfile,$(2)) \ +) + +$(call gb_LinkTarget_get_target,$(2)) \ +$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE := $(call gb_LinkTarget_get_pdbfile_in,$(2)) + +endef + +# CppunitTest class + +gb_CppunitTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-WNT.sh +gb_CppunitTest_PYTHONDEPS := $(call gb_Package_get_target,python3) +gb_CppunitTest_DEFS := -D_DLL +gb_CppunitTest_CPPTESTPRECOMMAND := $(call gb_Helper_prepend_ld_path,$(shell cygpath -u $(gb_Library_DLLDIR)):$(shell cygpath -u $(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll,ReleaseDll))) +gb_CppunitTest_get_filename = test_$(1).dll +gb_CppunitTest_get_ilibfilename = itest_$(1).lib + +define gb_CppunitTest_CppunitTest_platform +$(call gb_LinkTarget_set_ilibtarget,$(2),$(3)) + +$(call gb_LinkTarget_add_auxtargets,$(2),\ + $(patsubst %.lib,%.exp,$(3)) \ + $(3) \ + $(call gb_LinkTarget_get_manifestfile,$(2)) \ + $(call gb_LinkTarget_get_pdbfile_out,$(2)) \ + $(call gb_LinkTarget_get_pdbfile_in,$(2)) \ + $(call gb_LinkTarget_get_ilkfile,$(2)) \ +) + +$(call gb_LinkTarget_get_target,$(2)) \ +$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2)) + +endef + +# JunitTest class + +ifneq ($(OOO_TEST_SOFFICE),) +gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE) +else +ifneq ($(gb_JunitTest_DEBUGRUN),) +gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER) +else +gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice +endif +endif + + +define gb_JunitTest_JunitTest_platform +$(call gb_JunitTest_get_target,$(1)) : DEFS := \ + -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \ + -Dorg.openoffice.test.arg.env=PATH="$$$$PATH" \ + -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1))) + -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \ + +endef + + +define gb_Module_DEBUGRUNCOMMAND +printf "\nAttach the debugger to soffice.bin\n\n" +OFFICESCRIPT=`mktemp` && \ +printf "$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.exe" > $${OFFICESCRIPT} && \ +printf " --norestore --nologo '--accept=pipe,name=$(USER);urp;'\n" >> $${OFFICESCRIPT} && \ +$(SHELL) $${OFFICESCRIPT} && \ +rm $${OFFICESCRIPT} +endef + + + + +# PythonTest class + +gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) +gb_PythonTest_DEPS = $(call gb_Package_get_target,python3) $(call gb_Executable_get_target,python) + +ifeq ($(strip $(CPPUNITTRACE)),TRUE) +override CPPUNITTRACE := '$(DEVENV)' /debugexe +endif + +# WinResTarget class + +gb_WinResTarget_POSTFIX :=.res + +define gb_WinResTarget__command +$(call gb_Output_announce,$(2),$(true),RC ,1) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) && \ + $(gb_RC) \ + $(DEFS) $(FLAGS) \ + $(INCLUDE) \ + -Fo$(1) \ + $(RCFILE) ) +endef + +$(eval $(call gb_Helper_make_dep_targets,\ + WinResTarget \ +)) + +ifeq ($(gb_FULLDEPS),$(true)) +# FIXME this is used before TargetLocations is read? +gb_WinResTarget__command_target = $(WORKDIR_FOR_BUILD)/LinkTarget/Executable/makedepend.exe +define gb_WinResTarget__command_dep +$(call gb_Output_announce,RC:$(2),$(true),DEP,1) + $(call gb_Trace_StartRange,RC:$(2),DEP) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) && \ + $(call gb_Executable_get_target_for_build,makedepend) \ + $(INCLUDE) \ + $(DEFS) \ + $(RCFILE) \ + -o .res \ + -p $(dir $(3)) \ + -f $(1)) + $(call gb_Trace_EndRange,RC:$(2),DEP) +endef +else +gb_WinResTarget__command_target = +gb_WinResTarget__command_dep = +endif + +# InstallModuleTarget class + +define gb_InstallModuleTarget_InstallModuleTarget_platform +$(call gb_InstallModuleTarget_add_defs,$(1),\ + $(gb_CPUDEFS) \ + $(gb_OSDEFS) \ + -DCOMID=MSC \ +) + +endef + +# ExternalProject class + +# Use the gcc wrappers for an autoconf based project +# +# gb_ExternalProject_register_targets project state_target +define gb_ExternalProject_use_autoconf +$(call gb_ExternalProject_get_preparation_target,$(1)) : $(call gb_Executable_get_runtime_dependencies,gcc-wrapper) \ + $(call gb_Executable_get_runtime_dependencies,g++-wrapper) +$(call gb_ExternalProject_get_state_target,$(1),$(2)): WRAPPERS := $(gb_AUTOCONF_WRAPPERS) +endef + +# Set INCLUDE and LIB variables and unset MAKE/MAKEFLAGS when using nmake +# +# gb_ExternalProject_use_nmake project state_target +define gb_ExternalProject_use_nmake +$(call gb_ExternalProject_get_state_target,$(1),$(2)): NMAKE := $(gb_NMAKE_VARS) +endef + +# if ccache is enabled, then split it and use lastword as REAL_FOO +# /opt/lo/bin/ccache /cygdrive/c/PROGRA~2/MICROS~2.0/VC/bin/cl.exe + +gb_AUTOCONF_WRAPPERS = \ + REAL_CC="$(shell cygpath -w $(filter-out -%,$(CC)))" \ + REAL_CC_FLAGS="$(filter -%,$(CC))" \ + CC="$(call gb_Executable_get_target_for_build,gcc-wrapper)" \ + REAL_CXX="$(shell cygpath -w $(filter-out -%,$(CXX)))" \ + REAL_CXX_FLAGS="$(filter -%,$(CXX))" \ + CXX="$(call gb_Executable_get_target_for_build,g++-wrapper)" \ + LD="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo" + +gb_ExternalProject_INCLUDE := \ + $(subst -I,,$(subst $(WHITESPACE),;,$(SOLARINC))) + +gb_NMAKE_VARS = \ + CC="$(shell cygpath -w $(filter-out -%,$(CC))) $(filter -%,$(CC))" \ + INCLUDE="$(gb_ExternalProject_INCLUDE)" \ + LIB="$(ILIB)" \ + MAKEFLAGS= \ + MAKE= + +# InstallScript class + +gb_InstallScript_EXT := .inf + +# CliAssemblyTarget class + +gb_CliAssemblyTarget_POLICYEXT := $(gb_Library_DLLEXT) +gb_CliAssemblyTarget_get_dll = $(call gb_Library__get_dir_for_layer,NONE)/$(1)$(gb_CliAssemblyTarget_POLICYEXT) + +# Extension class + +gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/license.txt + +# UnpackedTarget class + +gb_UnpackedTarget_TARFILE_LOCATION := $(shell cygpath -u $(TARFILE_LOCATION)) + +# UnoApiHeadersTarget class + +ifeq ($(DISABLE_DYNLOADING),TRUE) +gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) +else +gb_UnoApiHeadersTarget_select_variant = $(2) +endif + +# UIConfig class + +# use responsefile because cui has too many files for command line +define gb_UIConfig__command +$(call gb_Helper_abbreviate_dirs,\ + RESPONSEFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),100,$(if $(UI_IMAGELISTS),$(strip $(UI_IMAGELISTS)),/dev/null)) \ + && tr " " "\000" < $$RESPONSEFILE | tr -d "\r\n" > $$RESPONSEFILE.0 \ + && $(SORT) -u --files0-from=$$RESPONSEFILE.0 > $@ \ + && rm $$RESPONSEFILE $$RESPONSEFILE.0 \ +) + +endef + +# use file list file because swriter has too many files for command line +define gb_UIConfig__gla11y_command +$(call gb_ExternalExecutale__check_registration,python) +$(call gb_Helper_abbreviate_dirs,\ + FILES=$(call gb_var2file,$(shell $(gb_MKTEMP)),100,$(UIFILES)) && \ + $(gb_UIConfig_LXML_PATH) $(if $(SYSTEM_LIBXML)$(SYSTEM_LIBXSLT),,$(gb_Helper_set_ld_path)) \ + $(call gb_ExternalExecutable_get_command,python) \ + $(gb_UIConfig_gla11y_SCRIPT) $(gb_UIConfig_gla11y_PARAMETERS) -o $@ -L $$FILES && \ + rm $$FILES +) + +endef + +# UIMenubarTarget class + +define gb_UIMenubarTarget__command +$(call gb_Output_announce,$(2),$(true),UIM,1) +$(call gb_Trace_StartRange,$(2),UIM) +cp $(3) $(1) +$(call gb_Trace_EndRange,$(2),UIM) + +endef + +gb_UIMenubarTarget_UIMenubarTarget_platform := + +# Python +gb_Python_HOME := $(INSTDIR_FOR_BUILD)/program/python-core-$(PYTHON_VERSION) +gb_Python_PRECOMMAND := PATH="$(shell cygpath -w $(INSTDIR_FOR_BUILD)/program)" PYTHONHOME="$(gb_Python_HOME)" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(gb_Python_HOME)/lib;$(gb_Python_HOME)/lib/lib-dynload:$(INSTDIR_FOR_BUILD)/program" +gb_Python_INSTALLED_EXECUTABLE := $(INSTROOT_FOR_BUILD)/$(LIBO_BIN_FOLDER)/python.exe + +gb_ICU_PRECOMMAND := PATH="$(shell cygpath -w $(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)" + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk new file mode 100644 index 000000000..364c0011f --- /dev/null +++ b/solenv/gbuild/platform/com_MSC_defs.mk @@ -0,0 +1,352 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +# set tmpdir to some mixed case path, suitable for native tools +gb_TMPDIR:=$(if $(TMPDIR),$(shell cygpath -m $(TMPDIR)),$(shell cygpath -m /tmp)) + +# please make generic Windows modifications to windows.mk +include $(GBUILDDIR)/platform/windows.mk + +gb_CC := cl +gb_CXX := cl +gb_LINK := link +gb_DUMPBIN := dumpbin +gb_AWK := awk +gb_CLASSPATHSEP := ; +gb_RC := rc + +# use CC/CXX if they are nondefaults +ifneq ($(origin CC),default) +gb_CC := $(CC) +gb_GCCP := $(CC) +endif +ifneq ($(origin CXX),default) +gb_CXX := $(CXX) +endif + +# _SCL_SECURE_NO_WARNINGS avoids deprecation warnings for STL algorithms +# like std::copy, std::transform (when MSVC_USE_DEBUG_RUNTIME is enabled) + +gb_COMPILERDEFS := \ + -DBOOST_ERROR_CODE_HEADER_ONLY \ + -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE \ + -DBOOST_SYSTEM_NO_DEPRECATED \ + -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING \ + -D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING \ + -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING \ + -D_CRT_NON_CONFORMING_SWPRINTFS \ + -D_CRT_NONSTDC_NO_DEPRECATE \ + -D_CRT_SECURE_NO_DEPRECATE \ + -D_SCL_SECURE_NO_WARNINGS \ + -D_MT \ + -D_DLL \ + -DCPPU_ENV=$(CPPU_ENV) \ + +ifeq ($(CPUNAME),INTEL) +gb_COMPILERDEFS += \ + -DBOOST_MEM_FN_ENABLE_CDECL \ + +endif + +gb_RCDEFS := \ + $(gb_WIN_VERSION_DEFS) \ + +gb_RCFLAGS := + +gb_AFLAGS := $(AFLAGS) + +# Do we really need to disable this many warnings? It seems to me that +# many of these warnings are for constructs that we have been actively +# cleaning away from the code, to avoid warnings when building with +# gcc or Clang and -Wall -Werror. + +# C4127: conditional expression is constant + +# C4201: nonstandard extension used : nameless struct/union + +# C4244: nonstandard extension used : formal parameter 'identifier' +# was previously defined as a type + +# C4250: 'class1' : inherits 'class2::member' via dominance + +# C4251: 'identifier' : class 'type' needs to have dll-interface to be +# used by clients of class 'type2' + +# C4267: conversion from 'size_t' to 'type', possible loss of data + +# C4275: non-DLL-interface classkey 'identifier' used as base for +# DLL-interface classkey 'identifier' + +# C4505: 'function' : unreferenced local function has been removed + +# C4611: interaction between 'function' and C++ object destruction is +# non-portable + +# C4702: unreachable code + +# C4706: assignment within conditional expression + +gb_CFLAGS := \ + -utf-8 \ + -Gd \ + -GR \ + -Gs \ + -GS \ + $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD) \ + -nologo \ + -W4 \ + -wd4244 \ + -wd4505 \ + -bigobj \ + +gb_CXXFLAGS_DISABLE_WARNINGS = -w + +ifneq ($(COM_IS_CLANG),TRUE) + +# clang-cl doesn't support -Wv:18 for now +gb_CFLAGS += \ + -Wv:18 \ + +endif + +gb_CXXFLAGS := \ + -utf-8 \ + $(CXXFLAGS_CXX11) \ + -Gd \ + -GR \ + -Gs \ + -GS \ + -Gy \ + $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD) \ + -nologo \ + -W4 \ + -wd4127 \ + -wd4201 \ + -wd4244 \ + -wd4250 \ + -wd4251 \ + -wd4267 \ + -wd4275 \ + -wd4505 \ + -wd4611 \ + -wd4706 \ + -bigobj \ + +ifneq ($(COM_IS_CLANG),TRUE) +gb_CXXFLAGS += -Zc:inline +gb_CXXFLAGS_ZCINLINE_OFF := -Zc:inline- +endif + +ifeq ($(CPUNAME),INTEL) + +gb_CXXFLAGS += \ + -Zm500 \ + +gb_CFLAGS += \ + -Zm500 \ + +endif + +ifeq ($(HAVE_DLLEXPORTINLINES),TRUE) +gb_CXXFLAGS += -Zc:dllexportInlines- +endif + +gb_CXXFLAGS_include := -FI +ifeq ($(COM_IS_CLANG),TRUE) +gb_CXXFLAGS_no_pch_warnings := -Wno-clang-cl-pch +endif + +ifneq ($(COM_IS_CLANG),TRUE) + +# clang-cl doesn't support -Wv:18 for now +# Work around MSVC 2017 C4702 compiler bug with release builds +# http://document-foundation-mail-archive.969070.n3.nabble.com/Windows-32-bit-build-failure-unreachable-code-tp4243848.html +# http://document-foundation-mail-archive.969070.n3.nabble.com/64-bit-Windows-build-failure-after-MSVC-Update-tp4246816.html +gb_CXXFLAGS += \ + -Wv:18 \ + $(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4702) \ + +endif + +# rc.exe does not support -nologo in 6.1.6723.1 that is in the Windows SDK 6.0A +gb_RCFLAGS += -nologo + +# C4005: 'identifier' : macro redefinition + +gb_PCHWARNINGS = \ + -we4650 \ + -we4651 \ + -we4652 \ + -we4653 \ + -we4005 \ + +gb_STDLIBS := \ + advapi32.lib \ + +gb_CFLAGS_WERROR = $(if $(ENABLE_WERROR),-WX) + +# there does not seem to be a way to force C++03 with MSVC, nor with clang-cl against MSVC system +# headers +gb_CXX03FLAGS := + +gb_LinkTarget_EXCEPTIONFLAGS := \ + -DEXCEPTIONS_ON \ + -EHs \ + +gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS) + +ifneq ($(gb_ENABLE_PCH),) +ifeq ($(COM_IS_CLANG),TRUE) +# the same as in com_GCC_defs.mk +gb_NO_PCH_TIMESTAMP := -Xclang -fno-pch-timestamp +endif +endif + +gb_LinkTarget_LDFLAGS := \ + $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-nologo,) \ + $(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \ + +# Prevent warning spamming +# Happens because of the way we link our unit tests with our libraries. +# LNK4049: locally defined symbol +gb_LinkTarget_LDFLAGS += \ + /ignore:4217 /ignore:4049 + + +ifeq ($(ENABLE_Z7_DEBUG),) +gb_DEBUGINFO_FLAGS := \ + -FS \ + -Zi \ + +else +# ccache does not work with -Zi +gb_DEBUGINFO_FLAGS := \ + -Z7 \ + +endif + +# See gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO +gb_LINKER_DEBUGINFO_FLAGS := + +gb_COMPILEROPTFLAGS := -O2 -Oy- +gb_COMPILERNOOPTFLAGS := -Od +gb_COMPILERDEBUGOPTFLAGS := + +ifeq ($(gb_FULLDEPS),$(true)) +gb_COMPILERDEPFLAGS := -showIncludes +define gb_create_deps +| LC_ALL=C $(GBUILDDIR)/platform/filter-showIncludes.awk -vdepfile=$(1) -vobjectfile=$(2) -vsourcefile=$(3); exit $${PIPESTATUS[0]} +endef +else +gb_COMPILERDEPFLAGS := +define gb_create_deps +| LC_ALL=C $(GBUILDDIR)/platform/filter-sourceName.awk; exit $${PIPESTATUS[0]} +endef +endif + +gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL) + +# When compiling for CLR, disable "warning C4339: use of undefined type detected +# in CLR meta-data - use of this type may lead to a runtime exception": +gb_CXXCLRFLAGS := \ + $(if $(COM_IS_CLANG), \ + $(patsubst -std=%,-std:c++17 -Zc:__cplusplus,$(gb_CXXFLAGS)), \ + $(gb_CXXFLAGS)) \ + $(gb_LinkTarget_EXCEPTIONFLAGS) \ + -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \ + -EHa \ + -clr \ + -wd4339 \ + -Wv:18 \ + -wd4267 \ + -Zc:twoPhase- \ + +ifeq ($(COM_IS_CLANG),TRUE) + +gb_CFLAGS += \ + -Wendif-labels \ + -Wshadow \ + -Wstrict-prototypes \ + -Wundef \ + -Wunused-macros \ + +gb_CXXFLAGS += \ + -Wendif-labels \ + -Wimplicit-fallthrough \ + -Wno-missing-braces \ + -Wnon-virtual-dtor \ + -Woverloaded-virtual \ + -Wshadow \ + -Wundef \ + -Wunused-macros \ + +endif + +ifeq ($(COM_IS_CLANG),TRUE) +gb_COMPILER_TEST_FLAGS := -Xclang -plugin-arg-loplugin -Xclang --unit-test-mode +ifeq ($(COMPILER_PLUGIN_TOOL),) +gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/clang/plugin.dll -Xclang -add-plugin -Xclang loplugin +ifneq ($(COMPILER_PLUGIN_WARNINGS_ONLY),) +gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang \ + --warnings-only='$(COMPILER_PLUGIN_WARNINGS_ONLY)' +endif +else +gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/clang/plugin.dll -Xclang -plugin -Xclang loplugin $(foreach plugin,$(COMPILER_PLUGIN_TOOL), -Xclang -plugin-arg-loplugin -Xclang $(plugin)) +ifneq ($(UPDATE_FILES),) +gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --scope=$(UPDATE_FILES) +endif +endif +ifeq ($(COMPILER_PLUGINS_DEBUG),TRUE) +gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --debug +endif +gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := \ + -Xclang -plugin-arg-loplugin -Xclang --warnings-as-errors +else +gb_COMPILER_TEST_FLAGS := +gb_COMPILER_PLUGINS := +gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := +endif + +# Helper class + +gb_Helper_set_ld_path := PATH="$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_BIN_FOLDER)):$$PATH" + +define gb_Helper_prepend_ld_path +PATH="$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_BIN_FOLDER)):$(1):$$PATH" +endef + +# $(1): one directory pathname to append to the ld path +define gb_Helper_extend_ld_path +$(gb_Helper_set_ld_path)':$(shell cygpath -u $(1))' +endef + +# common macros to build GPG related libraries +# we explicitly have to replace cygwin with mingw32 for the host, but the build must stay cygwin, or cmd.exe processes will be spawned +gb_WIN_GPG_WINDRES_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64) +gb_WIN_GPG_platform_switches := --build=$(BUILD_PLATFORM) --host=$(subst cygwin,mingw32,$(HOST_PLATFORM)) +gb_WIN_GPG_cross_setup_exports = export REAL_BUILD_CC="$(filter-out -%,$(CC_FOR_BUILD))" REAL_BUILD_CC_FLAGS="$(filter -%,$(CC_FOR_BUILD))" \ + && export CC_FOR_BUILD="$(call gb_Executable_get_target_for_build,gcc-wrapper) --wrapper-env-prefix=REAL_BUILD_ $(SOLARINC) -L$(subst ;, -L,$(ILIB_FOR_BUILD))" \ + && export RC='windres -O COFF --target=$(gb_WIN_GPG_WINDRES_target) --preprocessor=$(call gb_Executable_get_target_for_build,cpp) --preprocessor-arg=-+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)' + +ifneq ($(gb_ENABLE_PCH),) +# Enable use of .sum files for PCHs. +gb_COMPILER_SETUP += CCACHE_PCH_EXTSUM=1 +endif + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/filter-creatingLibrary.awk b/solenv/gbuild/platform/filter-creatingLibrary.awk new file mode 100755 index 000000000..231609feb --- /dev/null +++ b/solenv/gbuild/platform/filter-creatingLibrary.awk @@ -0,0 +1,46 @@ +#!/usr/bin/gawk -f +# -*- 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/. +# + +# Filter out the "Creating library" message printed by link.exe, +# as there is no way to disable it. + +BEGIN { + creatinglibrary_prefix = ENVIRON["CREATINGLIBRARY_PREFIX"]; + generatingcode_message = ENVIRON["GENERATINGCODE_MESSAGE"]; + finishedgeneratingcode_message = ENVIRON["FINISHEDGENERATINGCODE_MESSAGE"]; + if (!creatinglibrary_prefix) { + creatinglibrary_prefix = "\\.lib.*\\.exp" + } + if (!generatingcode_message) { + generatingcode_message = "Generating code" + } + if (!finishedgeneratingcode_message) { + finishedgeneratingcode_message = "Finished generating code" + } + firstline = 1 +} + +{ + if (firstline && match($0, creatinglibrary_prefix)) { + # ignore + } else if (match($0, generatingcode_message)) { + # ignore + } else if (match($0, finishedgeneratingcode_message)) { + # ignore + } else { + # because MSVC stupidly prints errors on stdout, it's + # necessary to forward everything that isn't matched by the pattern + # so users get to see them. + print $0 > "/dev/stderr" + } + firstline = 0 +} + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/filter-showIncludes.awk b/solenv/gbuild/platform/filter-showIncludes.awk new file mode 100755 index 000000000..9f5cabd10 --- /dev/null +++ b/solenv/gbuild/platform/filter-showIncludes.awk @@ -0,0 +1,99 @@ +#!/usr/bin/gawk -f +# -*- 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/. +# + +# Create dependency information from the output of cl.exe's showInclude. It +# needs additional information - the output name to which to write, objfile +# that depends on the includes, and the original file name. +# For best results all arguments should be absolute paths. +# +# It also consolidates the file names to a canonical form, and filters out +# duplicates. +# +# based on filter-showInclude.pl by Jan Holesovsky <kendy@suse.cz> + +BEGIN { + if (!depfile || !objectfile || !sourcefile) { + print "usage: filter-showIncludes.awk -vdepfile=depfile.d " \ + "-vobjectfile=objfile.o -vsourcefile=source.cxx" > "/dev/stderr" + exit 1 + } + tempfile = depfile ".tmp" + print objectfile " : \\\n " sourcefile " \\" > tempfile + + showincludes_prefix = ENVIRON["SHOWINCLUDES_PREFIX"]; + if (!showincludes_prefix) { + showincludes_prefix = "Note: including file:" + } + + # to match especially drive letters in allowlist case insensitive + IGNORECASE = 1 + allowlist = \ + "^(" ENVIRON["SRCDIR"] "|" ENVIRON["BUILDDIR"] ")" + firstline = 1 +} + +{ + sub(/\r$/, "") + sub(/^ */, "") + if (index($0, showincludes_prefix) == 1) { + $0 = substr($0, length(showincludes_prefix) + 1) + sub(/^ */, "") + + # The output from MSVC may contain a carriage return character at the + # end of filenames, in which case the translation unit will depend on a + # non-existing header, resulting in constant rebuild of all files, + # prevent that. + sub(/
/, "") + + gsub(/\\/, "/") + gsub(/ /, "\\ ") + if ($0 ~ allowlist) { # filter out system headers + if (!($0 in incfiles)) { + incfiles[$0] + print " " $0 " \\" > tempfile + } + } + } else { + # because MSVC stupidly prints errors on stdout, it's + # necessary to forward everything that isn't matched by the pattern + # so users get to see them. + if (firstline) { # ignore the line that just prints name of sourcefile + firstline = 0 + } else { + print $0 > "/dev/stderr" + } + } +} + +END { + if (!tempfile) { + exit 1 + } + print "" > tempfile + + # fdo#40099 if header.h does not exist, it will simply be considered out of + # date and any targets that use it as a prerequisite will be updated, + # which avoid misery when the header is deliberately deleted and removed + # as an include + # see http://www.makelinux.net/make3/make3-CHP-8-SECT-3 + for (file in incfiles) { + print file " :\n" > tempfile + } + + close(tempfile) + movecmd = "mv " tempfile " " depfile + ret = system(movecmd) + if (ret) { + print "ERROR: " movecmd " FAILED with status " ret > "/dev/stderr" + exit ret + } +} + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/filter-sourceName.awk b/solenv/gbuild/platform/filter-sourceName.awk new file mode 100755 index 000000000..d55e2707d --- /dev/null +++ b/solenv/gbuild/platform/filter-sourceName.awk @@ -0,0 +1,32 @@ +#!/usr/bin/gawk -f +# -*- 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/. +# + +# Filter out the "sourcefile.cxx" message printed by cl.exe, +# as there is no way to disable it. This file is used +# in place of filter-showIncludes.awk (which does the same) +# when --disable-dependency-tracking is used. + +BEGIN { + firstline = 1 +} + +{ + if (firstline) { + # ignore + } else { + # because MSVC stupidly prints errors on stdout, it's + # necessary to forward everything that isn't matched by the pattern + # so users get to see them. + print $0 > "/dev/stderr" + } + firstline = 0 +} + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/iOS.mk b/solenv/gbuild/platform/iOS.mk new file mode 100644 index 000000000..15f1ce4ef --- /dev/null +++ b/solenv/gbuild/platform/iOS.mk @@ -0,0 +1,269 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +ifeq ($(CC),) +$(error You must set CC in the environment. See README.cross for example.) +endif +ifeq ($(CXX),) +$(error You must set CXX in the environment. See README.cross for example.) +endif + +gb_COMPILEROPTFLAGS := -O2 + +include $(GBUILDDIR)/platform/com_GCC_defs.mk + +# Use standard lldb debugger +gb_DEBUGINFO_FLAGS=-g +gb_LINKER_DEBUGINFO_FLAGS= + +# Darwin mktemp -t expects a prefix, not a pattern +gb_MKTEMP := /usr/bin/mktemp -t gbuild. + +gb_OSDEFS := \ + -DIOS \ + -D_PTHREADS \ + -DUNIX \ + -DUNX \ + -D_REENTRANT \ + -DNO_PTHREAD_PRIORITY \ + $(LFS_CFLAGS) \ + +gb_CFLAGS := \ + $(gb_CFLAGS_COMMON) \ + -Wshadow \ + -fno-strict-aliasing \ + +gb_CXXFLAGS := \ + $(gb_CXXFLAGS_COMMON) \ + -Wno-ctor-dtor-privacy \ + -fno-strict-aliasing \ + -fsigned-char \ + $(CXXFLAGS_CXX11) \ + +# These are to get the compiler to switch to Objective-C++ or Objective-C mode +gb_OBJCXXFLAGS := -x objective-c++ +gb_OBJCFLAGS := -x objective-c + +gb_COMPILERDEFS += \ + -DBOOST_DETAIL_NO_CONTAINER_FWD + +# LinkTarget class + +gb_LinkTarget_CFLAGS := $(gb_CFLAGS) +gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) +gb_LinkTarget_OBJCXXFLAGS := $(gb_CXXFLAGS) $(gb_OBJCXXFLAGS) +gb_LinkTarget_OBJCFLAGS := $(gb_CFLAGS) $(gb_OBJCFLAGS) + +define gb_LinkTarget__get_liblinkflags +$(patsubst lib%.a,-l%,$(foreach lib,$(1),$(call gb_Library_get_filename,$(lib)))) +endef + +define gb_LinkTarget__get_layer +$(if $(filter Executable,$(1)),\ + $$(call gb_Executable_get_layer,$(2)),\ + $$(call gb_Library_get_layer,$(2))) +endef + +# To not export anything: -Wl$(COMMA)-exported_symbols_list$(COMMA)/dev/null +# But for some reason that slows down ld significantly. + +define gb_LinkTarget__command_dynamiclink + $(if $(filter Library CppunitTest,$(TARGETTYPE)),@echo No dynamic libraries should be built for iOS && exit 1, \ + $(if $(CXXOBJECTS)$(OBJCXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \ + $(gb_Executable_TARGETTYPEFLAGS) \ + $(subst \d,$$,$(RPATH)) \ + $(T_USE_LD) $(T_LDFLAGS) \ + -dead_strip \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \ + $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \ + $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ + $(call gb_LinkTarget__get_liblinkflags,$(LINKED_LIBS)) \ + $(shell $(SRCDIR)/bin/lo-all-static-libs) \ + $(T_LIBS) \ + -o $(1)) +endef + +# parameters: 1-linktarget 2-cobjects 3-cxxobjects +define gb_LinkTarget__command_staticlink +$(call gb_Helper_abbreviate_dirs,\ + rm -f $(1) && \ + $(gb_AR) -rsu $(1) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \ + $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ + $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null)) +endef + +define gb_LinkTarget__command +$(call gb_Output_announce,$(2),$(true),LNK,4) + $(call gb_Trace_StartRange,$(2),LNK) +$(if $(filter Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1),$(2))) +$(if $(filter CppunitTest Library StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1))) + $(call gb_Trace_EndRange,$(2),LNK) +endef + +define gb_LinkTarget_use_system_darwin_frameworks +$(call gb_LinkTarget_add_libs,$(1),$(foreach fw,$(2),-framework $(fw))) +$(if $(call gb_LinkTarget__is_merged,$(1)),\ + $(call gb_LinkTarget_add_libs,$(call gb_Library_get_linktarget,merged),$(foreach fw,$(2),-framework $(fw)))) +endef + + +# Library class + +gb_Library_DEFS := +gb_Library_SYSPRE := lib +gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ +gb_Library_PLAINEXT := .a +gb_Library_PLAINEXT_FOR_BUILD := .dylib +gb_Library_DLLEXT := .a +gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT) + +gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_PLAINEXT) +gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) + +gb_Library_FILENAMES := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \ + + +gb_Library_LAYER := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):OOO) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \ + +define gb_Library_Library_platform +$(call gb_LinkTarget_get_target,$(2)) : LAYER := $(call gb_Library_get_layer,$(1)) + +endef + +gb_Library__set_soversion_script_platform = + +gb_Library_get_sdk_link_dir = $(WORKDIR)/LinkTarget/Library + +# Executable class + +gb_Executable_EXT := +gb_Executable_TARGETTYPEFLAGS := + +gb_Executable_LAYER := \ + $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ + $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ + $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ + $(foreach exe,$(gb_Executable_NONE),$(exe):NONE) \ + + +define gb_Executable_Executable_platform +$(call gb_LinkTarget_get_target,$(2)) : LAYER := $(call gb_Executable_get_layer,$(1)) + +endef + + +# CppunitTest class + +gb_CppunitTest_CPPTESTPRECOMMAND := : +gb_CppunitTest_get_filename = libtest_(1).a +gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename) + +define gb_CppunitTest_CppunitTest_platform +$(call gb_LinkTarget_get_target,$(2)) : LAYER := NONE + +endef + +# InstallModuleTarget class + +define gb_InstallModuleTarget_InstallModuleTarget_platform +$(call gb_InstallModuleTarget_add_defs,$(1),\ + $(gb_CPUDEFS) \ + $(gb_OSDEFS) \ + -DCOMID=gcc3 \ + -D_gcc3 \ +) + +endef + +# InstallScript class + +gb_InstallScript_EXT := .ins + +# CliAssemblyTarget class + +gb_CliAssemblyTarget_POLICYEXT := +gb_CliAssemblyTarget_get_dll := + +# Extension class + +gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/LICENSE + +# UnpackedTarget class + +gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION) + +# UnoApiHeadersTarget class + +ifeq ($(DISABLE_DYNLOADING),TRUE) +gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) +else +gb_UnoApiHeadersTarget_select_variant = $(2) +endif + +# UIMenubarTarget class + +define gb_UIMenubarTarget__command +$(call gb_Output_announce,$(2),$(true),UIM,1) +$(call gb_Trace_StartRange,$(2),UIM) +cp $(3) $(1) +$(call gb_Trace_EndRange,$(2),UIM) + +endef + +gb_UIMenubarTarget_UIMenubarTarget_platform := + +# Python +gb_PYTHON_PRECOMMAND := + +include $(GBUILDDIR)/platform/com_GCC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/iOS_AARCH64_GCC.mk b/solenv/gbuild/platform/iOS_AARCH64_GCC.mk new file mode 100644 index 000000000..0d03fa027 --- /dev/null +++ b/solenv/gbuild/platform/iOS_AARCH64_GCC.mk @@ -0,0 +1,22 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +gb_CPUDEFS := -DARM64 + +include $(GBUILDDIR)/platform/iOS.mk diff --git a/solenv/gbuild/platform/iOS_X86_64_GCC.mk b/solenv/gbuild/platform/iOS_X86_64_GCC.mk new file mode 100644 index 000000000..008f54f2e --- /dev/null +++ b/solenv/gbuild/platform/iOS_X86_64_GCC.mk @@ -0,0 +1,22 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +gb_CPUDEFS := -DX86_64 + +include $(GBUILDDIR)/platform/iOS.mk diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk new file mode 100644 index 000000000..8fc7d38e3 --- /dev/null +++ b/solenv/gbuild/platform/linux.mk @@ -0,0 +1,24 @@ +# -*- 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__LinkTarget_LDFLAGS_zdefs := -Wl,-z,defs +ifeq ($(COM_IS_CLANG),TRUE) +ifneq ($(filter -fsanitize=%,$(CC) $(LDFLAGS)),) +gb__LinkTarget_LDFLAGS_zdefs := +endif +endif +gb_LinkTarget_LDFLAGS += $(gb__LinkTarget_LDFLAGS_zdefs) + +include $(GBUILDDIR)/platform/unxgcc.mk + +ifneq ($(ATOMIC_LIB),) +gb_STDLIBS_CXX := $(ATOMIC_LIB) +endif + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk new file mode 100644 index 000000000..5c072cba4 --- /dev/null +++ b/solenv/gbuild/platform/macosx.mk @@ -0,0 +1,381 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +gb_SDKDIR := $(MACOSX_SDK_PATH) + +include $(GBUILDDIR)/platform/com_GCC_defs.mk + +# Darwin mktemp -t expects a prefix, not a pattern +gb_MKTEMP ?= /usr/bin/mktemp -t gbuild + +gb_OSDEFS := \ + -D$(OS) \ + -D_PTHREADS \ + -DUNIX \ + -DUNX \ + -D_REENTRANT \ + -DNO_PTHREAD_PRIORITY \ + -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) \ + -DMAC_OS_X_VERSION_MAX_ALLOWED=$(MAC_OS_X_VERSION_MIN_REQUIRED) \ + $(LFS_CFLAGS) \ + + +gb_CFLAGS := \ + $(gb_CFLAGS_COMMON) \ + -fPIC \ + -fno-strict-aliasing \ + -Wshadow + +gb_CXXFLAGS := \ + $(gb_CXXFLAGS_COMMON) \ + -fPIC \ + -Woverloaded-virtual \ + -Wshadow \ + -Wno-ctor-dtor-privacy \ + -fno-strict-aliasing \ + -fsigned-char \ + $(CXXFLAGS_CXX11) + + #-fsigned-char \ might be removed? + +# these are to get g++ to switch to Objective-C++ mode +# (see toolkit module for a case where it is necessary to do it this way) +gb_OBJCXXFLAGS := -x objective-c++ -fobjc-exceptions + +gb_OBJCFLAGS := -x objective-c -fobjc-exceptions + +# LinkTarget class + +define gb_LinkTarget__get_rpath_for_layer +$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS))) +endef + +gb_LinkTarget__RPATHS := \ + URELIB:@__________________________________________________URELIB/ \ + UREBIN: \ + OOO:@__________________________________________________OOO/ \ + SDKBIN: \ + OXT: \ + NONE:@__________________________________________________NONE/ \ + +# $(call gb_LinkTarget__get_installname,libfilename,layerprefix) +define gb_LinkTarget__get_installname +$(if $(2),-install_name '$(2)$(1)') +endef + +gb_LinkTarget_CFLAGS := $(gb_CFLAGS) +gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) +gb_LinkTarget_OBJCXXFLAGS := $(gb_CXXFLAGS) $(gb_OBJCXXFLAGS) +gb_LinkTarget_OBJCFLAGS := $(gb_CFLAGS) $(gb_OBJCFLAGS) + +define gb_LinkTarget__get_layer +$(if $(filter Executable,$(1)),\ + $$(call gb_Executable_get_layer,$(2)),\ + $$(call gb_Library_get_layer,$(2))) +endef + +# We cannot sign executables early since Mojave/Catalina would treat them as +# restricted binary and ignore any DYLD_LIBRARY_PATH setting - So all +# signing is handled by the solenv/bin/macosx-codesign-app-bundle script. +# And the soffice executable needs to be signed last in +# macosx-codesign-app-bundle, as codesign would fail complaining that other +# parts of the app have not yet been signed: + +define gb_LinkTarget__command_dynamiclink +$(call gb_Helper_abbreviate_dirs,\ + FILELIST=$(call gb_var2file,$(shell $(gb_MKTEMP)),100, \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \ + $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist)))) && \ + cat $${FILELIST} | tr "[:space:]" "\n" | grep -v '^$$' > $${FILELIST}.1 && \ + mv $${FILELIST}.1 $${FILELIST} && \ + $(if $(CXXOBJECTS)$(OBJCXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \ + $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \ + $(if $(filter Bundle,$(TARGETTYPE)),$(gb_Bundle_TARGETTYPEFLAGS)) \ + $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ + $(subst \d,$$,$(RPATH)) \ + $(T_USE_LD) $(T_LDFLAGS) \ + $(patsubst lib%.dylib,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \ + -Wl$(COMMA)-filelist$(COMMA)$${FILELIST} \ + $(T_LIBS) \ + $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ + -o $(1) && \ + rm -f $${FILELIST} && \ + $(if $(SOVERSIONSCRIPT),ln -sf $(1) $(ILIBTARGET),:) && \ + $(if $(filter Executable,$(TARGETTYPE)), \ + $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl app $(LAYER) $(1) &&) \ + $(if $(filter Library Bundle CppunitTest,$(TARGETTYPE)),\ + $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl $(LAYER) $(1) &&) \ + $(if $(filter Library,$(TARGETTYPE)),\ + otool -l $(1) | grep -A 5 LC_ID_DYLIB \ + > $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(NM) -g -P $(1) | cut -d' ' -f1-2 | grep -v U$$ \ + >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \ + $(WORKDIR)/LinkTarget/$(2).exports,$(1)) &&) \ + :) +endef + +# parameters: 1-linktarget 2-cobjects 3-cxxobjects +define gb_LinkTarget__command_staticlink +$(call gb_Helper_abbreviate_dirs,\ + rm -f $(1) && \ + $(gb_AR) -rsu $(1) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \ + $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_target,$(object))) \ + $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \ + $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null)) +endef + +define gb_LinkTarget__command +$(call gb_Output_announce,$(2),$(true),LNK,4) + $(call gb_Trace_StartRange,$(2),LNK) +$(if $(filter Library Bundle CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1),$(2))) +$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1))) + $(call gb_Trace_EndRange,$(2),LNK) +endef + +define gb_LinkTarget_use_system_darwin_frameworks +$(call gb_LinkTarget_add_libs,$(1),$(foreach fw,$(2),-framework $(fw))) +$(if $(call gb_LinkTarget__is_merged,$(1)),\ + $(call gb_LinkTarget_add_libs,$(call gb_Library_get_linktarget,merged),$(foreach fw,$(2),-framework $(fw)))) +endef + + +# Library class + +gb_Library_DEFS := +gb_Library_TARGETTYPEFLAGS := -dynamiclib -single_module +gb_Bundle_TARGETTYPEFLAGS := -bundle +gb_Library_UDK_MAJORVER := 3 +gb_Library_SYSPRE := lib +gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ +gb_Library_PLAINEXT := .dylib +gb_Library_PLAINEXT_FOR_BUILD := .dylib +gb_Library_DLLEXT := .dylib +gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT) + +gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_PLAINEXT) +gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) + +gb_Library_FILENAMES := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT).$(gb_Library_UDK_MAJORVER)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT).$(gb_Library_UDK_MAJORVER)) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \ + + +gb_Library_LAYER := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \ + +define gb_Library_get_rpath +$(call gb_LinkTarget__get_installname,$(call gb_Library_get_filename,$(1)),$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))) +endef + +define gb_Library_Library_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1)) +$(call gb_LinkTarget_get_target,$(2)) : LAYER := $(call gb_Library_get_layer,$(1)) + +endef + +gb_Library__set_soversion_script_platform = $(gb_Library__set_soversion_script) + +gb_Library_get_sdk_link_dir = $(WORKDIR)/LinkTarget/Library + +gb_Library_get_sdk_link_lib = $(gb_Library_get_versionlink_target) + +# bundle is a special kind of library that exists only on Darwin/OSX +# set the TARGETTYPE to Bundle, and clear install_name(RPATH) +define gb_Library_Bundle +$(call gb_Library_Library,$(1)) +$(call gb_LinkTarget_set_targettype,$(call gb_Library_get_linktarget,$(1)),Bundle) +$(call gb_Library_get_linktarget_target,$(1)) : RPATH := +endef + +# Executable class + +gb_Executable_EXT := +gb_Executable_TARGETTYPEFLAGS := -bind_at_load + +gb_Executable_LAYER := \ + $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ + $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ + $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ + $(foreach exe,$(gb_Executable_NONE),$(exe):NONE) \ + + +gb_Executable_get_rpath := + +define gb_Executable_Executable_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := +$(call gb_LinkTarget_get_target,$(2)) : LAYER := $(call gb_Executable_get_layer,$(1)) + +endef + + +# CppunitTest class + +gb_CppunitTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-MACOSX.sh +gb_CppunitTest_PYTHONDEPS := $(call gb_Library_get_target,pyuno_wrapper) $(if $(SYSTEM_PYTHON),,$(call gb_GeneratedPackage_get_target,python3)) +gb_CppunitTest_CPPTESTPRECOMMAND := \ + $(call gb_Helper_extend_ld_path,$(gb_Library_DLLDIR):$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs) +gb_CppunitTest_get_filename = libtest_$(1).dylib +gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename) +gb_CppunitTest_malloc_check := -o "env MallocScribble=1" -o "env MallocPreScribble=1" + +define gb_CppunitTest_CppunitTest_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := +$(call gb_LinkTarget_get_target,$(2)) : LAYER := NONE + +endef + +# JunitTest class + +ifneq ($(OOO_TEST_SOFFICE),) +gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE) +else +ifneq ($(gb_JunitTest_DEBUGRUN),) +gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER) +else +gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice +endif +endif + +define gb_JunitTest_JunitTest_platform +$(call gb_JunitTest_get_target,$(1)) : DEFS := \ + -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \ + -Dorg.openoffice.test.arg.env=DYLD_LIBRARY_PATH"$$$${DYLD_LIBRARY_PATH+=$$$$DYLD_LIBRARY_PATH}" \ + -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1))) \ + -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \ + +endef + +# PythonTest class + +gb_PythonTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-MACOSX.sh +gb_PythonTest_DEPS := $(call gb_GeneratedPackage_get_target,python3) $(call gb_Package_get_target,python_shell) +gb_PythonTest_PRECOMMAND := $(gb_Helper_LIBRARY_PATH_VAR)=$${$(gb_Helper_LIBRARY_PATH_VAR):+$$$(gb_Helper_LIBRARY_PATH_VAR):}$(INSTROOT)/$(LIBO_URE_LIB_FOLDER) +ifneq ($(LIBO_LIB_FOLDER),$(LIBO_URE_LIB_FOLDER)) +gb_PythonTest_PRECOMMAND := $(gb_PythonTest_PRECOMMAND):$(INSTROOT)/$(LIBO_LIB_FOLDER) +endif +gb_PythonTest_PRECOMMAND := $(gb_PythonTest_PRECOMMAND):$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs + +# UITest class + +gb_UITest_DEPS := $(call gb_GeneratedPackage_get_target,python3) + +# Module class + +define gb_Module_DEBUGRUNCOMMAND +lldb -f $(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice -- --norestore --nologo \ + '"--accept=pipe,name=$(USER)\;urp"' +endef + +# InstallModuleTarget class + +define gb_InstallModuleTarget_InstallModuleTarget_platform +$(call gb_InstallModuleTarget_add_defs,$(1),\ + $(gb_CPUDEFS) \ + $(gb_OSDEFS) \ + -DCOMID=gcc3 \ + -D_gcc3 \ +) + +endef + +# InstallScript class + +gb_InstallScript_EXT := .ins + +# CliAssemblyTarget class + +gb_CliAssemblyTarget_POLICYEXT := +gb_CliAssemblyTarget_get_dll := + +# Extension class + +gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/Resources/LICENSE + +# UnpackedTarget class + +gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION) + +# UnoApiHeadersTarget class + +ifeq ($(DISABLE_DYNLOADING),TRUE) +gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) +else +gb_UnoApiHeadersTarget_select_variant = $(2) +endif + +# UIMenubarTarget class + +define gb_UIMenubarTarget__command +$(call gb_Output_announce,$(2),$(true),UIM,1) +$(call gb_Trace_StartRange,$(2),UIM) +$(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $(1) $(UI_MENUBAR_XSLT) $(3) +$(call gb_Trace_EndRange,$(2),UIM) + +endef + +define gb_UIMenubarTarget_UIMenubarTarget_platform +$(call gb_UIMenubarTarget_get_target,$(1)) : UI_MENUBAR_XSLT := $(SRCDIR)/solenv/bin/macosx_menubar_modification.xsl +$(call gb_UIMenubarTarget_get_target,$(1)) : $(SRCDIR)/solenv/bin/macosx_menubar_modification.xsl +$(call gb_UIMenubarTarget_get_target,$(1)) :| $(call gb_ExternalExecutable_get_dependencies,xsltproc) + +endef + +# Python +gb_Python_PRECOMMAND := PYTHONPATH="$$PYPATH" +gb_Python_INSTALLED_EXECUTABLE := $(INSTROOT)/$(LIBO_LIB_FOLDER)/LibreOfficePython.framework/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython +# this is passed to gdb as executable when running tests +gb_Python_INSTALLED_EXECUTABLE_GDB := $(gb_Python_INSTALLED_EXECUTABLE) + +include $(GBUILDDIR)/platform/com_GCC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk new file mode 100644 index 000000000..9d18cd913 --- /dev/null +++ b/solenv/gbuild/platform/solaris.mk @@ -0,0 +1,357 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +include $(GBUILDDIR)/platform/com_GCC_defs.mk + +gb_MKTEMP := mktemp -t gbuild.XXXXXX + +ifneq ($(origin AR),default) +gb_AR := $(AR) +endif + +# do not define SOLARIS - use #ifdef __sun instead +# -D$(OS) \ + +gb_OSDEFS := \ + -DSYSV \ + -DSUN \ + -DSUN4 \ + -D_REENTRANT \ + -D_POSIX_PTHREAD_SEMANTICS \ + -D_PTHREADS \ + -DUNIX \ + -DUNX \ + $(PTHREAD_CFLAGS) \ + $(LFS_CFLAGS) \ + +gb_CFLAGS := \ + $(gb_CFLAGS_COMMON) \ + -fPIC \ + -Wshadow \ + +gb_CXXFLAGS := \ + $(gb_CXXFLAGS_COMMON) \ + -fPIC \ + -Wshadow \ + -Woverloaded-virtual \ + $(CXXFLAGS_CXX11) \ + +ifneq ($(strip $(SYSBASE)),) +gb_CXXFLAGS += --sysroot=$(SYSBASE) +gb_CFLAGS += --sysroot=$(SYSBASE) +gb_LinkTarget_LDFLAGS += \ + -Wl,--sysroot=$(SYSBASE) +endif + +gb_LinkTarget_LDFLAGS += \ + -L$(SYSBASE)/lib \ + -L$(SYSBASE)/usr/lib \ + -Wl,-B,direct \ + -Wl,-z,defs \ + -Wl,-z,combreloc \ + +ifeq ($(HAVE_LD_HASH_STYLE),TRUE) +gb_LinkTarget_LDFLAGS += \ + -Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \ + +endif + +ifneq ($(HAVE_LD_BSYMBOLIC_FUNCTIONS),) +gb_LinkTarget_LDFLAGS += -Wl,-Bsymbolic-functions +endif + +# sun ld doesn't understand -O1 optimize flag +gb_LINKEROPTFLAGS := +gb_LINKERSTRIPDEBUGFLAGS := -Wl,-zredlocsym -Wl,-znoldynsym + +# LinkTarget class + +define gb_LinkTarget__get_rpath_for_layer +$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS))) +endef + +gb_LinkTarget__RPATHS := \ + URELIB:\dORIGIN \ + UREBIN:\dORIGIN \ + OOO:\dORIGIN \ + SDKBIN:\dORIGIN/../../program \ + OXT: \ + NONE:\dORIGIN/../Library \ + +gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) +gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CFLAGS_WERROR) + +# note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 +# we want to use @$(extraobjectlist) in the long run +# link with C compiler if there are no C++ files (pyuno_wrapper depends on this) +define gb_LinkTarget__command_dynamiclink +$(call gb_Helper_abbreviate_dirs,\ + $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \ + $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ + $(T_LTOFLAGS) \ + $(if $(SOVERSIONSCRIPT),-Wl$(COMMA)-soname=$(notdir $(1)) \ + ) \ + $(subst \d,$$,$(RPATH)) \ + $(T_USE_LD) $(T_LDFLAGS) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \ + -Wl$(COMMA)--start-group \ + $(foreach lib,$(LINKED_STATIC_LIBS),\ + $(call gb_StaticLibrary_get_target,$(lib))) \ + $(T_LIBS) \ + -Wl$(COMMA)--end-group \ + -Wl$(COMMA)-zrecord \ + $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \ + -o $(1) \ + $(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET))) + $(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\ + $(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \ + $(NM) --dynamic --extern-only --defined-only --format=posix $(1) \ + | cut -d' ' -f1-2 \ + >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \ + $(WORKDIR)/LinkTarget/$(2).exports,$(1)))) +endef + +define gb_LinkTarget__command_staticlink +$(call gb_Helper_abbreviate_dirs,\ + rm -f $(1) && \ + $(gb_AR) $(gb_LTOPLUGINFLAGS) -rsu $(1) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ + $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null)) +endef + +define gb_LinkTarget__command +$(call gb_Output_announce,$(2),$(true),LNK,4) + $(call gb_Trace_StartRange,$(2),LNK) +$(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1),$(2))) +$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1))) + $(call gb_Trace_EndRange,$(2),LNK) +endef + + +# Library class + +gb_Library_DEFS := +gb_Library_TARGETTYPEFLAGS := -shared -Wl,-M/usr/lib/ld/map.noexstk -mimpure-text +gb_Library_UDK_MAJORVER := 3 +gb_Library_SYSPRE := lib +gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ +gb_Library_PLAINEXT := .so +gb_Library_DLLEXT := .so +gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT) + +gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_PLAINEXT) +gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) + +gb_STDLIBS := \ + -lm \ + -lnsl \ + -lsocket \ + +gb_Library_FILENAMES := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT).$(gb_Library_UDK_MAJORVER)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT).$(gb_Library_UDK_MAJORVER)) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \ + + +gb_Library_LAYER := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \ + +define gb_Library__get_rpath +$(if $(1),$(strip -Wl,-z,origin '-Wl,-rpath,$(1)' -L$(INSTDIR)/program)) +endef + +define gb_Library_get_rpath +$(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))) +endef + +define gb_Library_Library_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1)) + +endef + +gb_Library__set_soversion_script_platform = $(gb_Library__set_soversion_script) + +gb_Library_get_sdk_link_dir = $(INSTDIR)/$(SDKDIRNAME)/lib + +gb_Library_get_sdk_link_lib = $(gb_Library_get_versionlink_target) + +# Executable class + +gb_Executable_EXT := + +gb_Executable_LAYER := \ + $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ + $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ + $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ + $(foreach exe,$(gb_Executable_NONE),$(exe):NONE) \ + + +define gb_Executable__get_rpath +$(strip -Wl,-z,origin $(if $(1),'-Wl$(COMMA)-rpath$(COMMA)$(1)') -L$(INSTDIR)/program) +endef + +define gb_Executable_get_rpath +$(call gb_Executable__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))) +endef + +define gb_Executable_Executable_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1)) + +endef + + +# CppunitTest class + +gb_CppunitTest_CPPTESTPRECOMMAND := \ + $(call gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs) +gb_CppunitTest_get_filename = libtest_$(1).so +gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename) + +define gb_CppunitTest_CppunitTest_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE)) + +endef + +define gb_CppunitTest_postprocess +$(SRCDIR)/solenv/bin/gdb-core-bt.sh $(1) $(2) $(3) +endef + +# JunitTest class + +ifneq ($(OOO_TEST_SOFFICE),) +gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE) +else +ifneq ($(gb_JunitTest_DEBUGRUN),) +gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER) +else +gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice +endif +endif + +define gb_JunitTest_JunitTest_platform +$(call gb_JunitTest_get_target,$(1)) : DEFS := \ + -Dorg.openoffice.test.arg.env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \ + -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1))) \ + -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \ + -Dorg.openoffice.test.arg.postprocesscommand=$(SRCDIR)/solenv/bin/gdb-core-bt.sh \ + -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \ + +endef + +# PythonTest class + +gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) + +# Module class + +define gb_Module_DEBUGRUNCOMMAND +OFFICESCRIPT=`mktemp` && \ +printf ". $(INSTROOT)/program/ooenv\\n" > $${OFFICESCRIPT} && \ +printf "gdb --tui $(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.bin" >> $${OFFICESCRIPT} && \ +printf " -ex \"set args --norestore --nologo '--accept=pipe,name=$(USER);urp;' \"" >> $${OFFICESCRIPT} && \ +printf " -ex \"r\"\\n" >> $${OFFICESCRIPT} && \ +$(SHELL) $${OFFICESCRIPT} && \ +rm $${OFFICESCRIPT} +endef + +# InstallModuleTarget class + +define gb_InstallModuleTarget_InstallModuleTarget_platform +$(call gb_InstallModuleTarget_add_defs,$(1),\ + $(gb_CPUDEFS) \ + $(gb_OSDEFS) \ + -DCOMID=gcc3 \ + -D_gcc3 \ +) + +endef + +# InstallScript class + +gb_InstallScript_EXT := .ins + +# CliAssemblyTarget class + +gb_CliAssemblyTarget_POLICYEXT := +gb_CliAssemblyTarget_get_dll := + +# Extension class + +gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/LICENSE + +# UnpackedTarget class + +gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION) + +# UnoApiHeadersTarget class + +ifeq ($(DISABLE_DYNLOADING),TRUE) +gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) +else +gb_UnoApiHeadersTarget_select_variant = $(2) +endif + +# UIMenubarTarget class + +define gb_UIMenubarTarget__command +$(call gb_Output_announce,$(2),$(true),UIM,1) +$(call gb_Trace_StartRange,$(2),UIM) +cp $(3) $(1) +$(call gb_Trace_EndRange,$(2),UIM) + +endef + +gb_UIMenubarTarget_UIMenubarTarget_platform := + +# Python +gb_Python_PRECOMMAND := PYTHONHOME="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib:$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload:$(INSTDIR)/program" +gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(INSTROOT)/program/python +# this is passed to gdb as executable when running tests +gb_Python_INSTALLED_EXECUTABLE_GDB := $(INSTROOT)/program/python.bin + +include $(GBUILDDIR)/platform/com_GCC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/unittest-failed-MACOSX.sh b/solenv/gbuild/platform/unittest-failed-MACOSX.sh new file mode 100755 index 000000000..049da92b4 --- /dev/null +++ b/solenv/gbuild/platform/unittest-failed-MACOSX.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# -*- Mode: sh; 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +cat << EOF + +Error: a unit test failed, please do one of: +make $1Test_$2 CPPUNITTRACE="lldb --" # for interactive debugging on macOS +make $1Test_$2 VALGRIND=memcheck # for memory checking + +You can limit the execution to just one particular test by: + +EOF + +case $1 in + Python) + cat << EOF +make $1Test_$2 PYTHON_TEST_NAME="testXYZ" ...above mentioned params... + +EOF + ;; + *) + cat << EOF +make $1Test_$2 CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params... + +EOF + ;; +esac + +exit 1 + +# vim: set et sw=4: diff --git a/solenv/gbuild/platform/unittest-failed-WNT.sh b/solenv/gbuild/platform/unittest-failed-WNT.sh new file mode 100755 index 000000000..5ace1f0d1 --- /dev/null +++ b/solenv/gbuild/platform/unittest-failed-WNT.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# -*- Mode: sh; 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +cat << EOF + +Error: a unit test failed, please do one of: +make $1Test_$2 CPPUNITTRACE=TRUE # which is a shortcut for the following line +make $1Test_$2 CPPUNITTRACE="'$DEVENV' /debugexe" # for interactive debugging in Visual Studio +make $1Test_$2 CPPUNITTRACE="drmemory -free_max_frames 20" # for memory checking (install Dr.Memory first, and put it to your PATH) + +You can limit the execution to just one particular test by: + +EOF + +case $1 in + Python) + cat << EOF +make $1Test_$2 PYTHON_TEST_NAME="testXYZ" ...above mentioned params... + +EOF + ;; + *) + cat << EOF +make $1Test_$2 CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params... + +EOF + ;; +esac + +exit 1 + +# vim: set et sw=4: diff --git a/solenv/gbuild/platform/unittest-failed-default.sh b/solenv/gbuild/platform/unittest-failed-default.sh new file mode 100755 index 000000000..1e742fd7f --- /dev/null +++ b/solenv/gbuild/platform/unittest-failed-default.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# -*- Mode: sh; 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +cat << EOF + +Error: a unit test failed, please do one of: + +make $1Test_$2 CPPUNITTRACE="gdb --args" + # for interactive debugging on Linux +make $1Test_$2 VALGRIND=memcheck + # for memory checking +make $1Test_$2 DEBUGCPPUNIT=TRUE + # for exception catching + +You can limit the execution to just one particular test by: + +EOF + +case $1 in + Python) + cat << EOF +make PYTHON_TEST_NAME="testXYZ" ...above mentioned params... + +EOF + ;; + *) + cat << EOF +make CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params... + +EOF + ;; +esac + +exit 1 + +# vim: set et sw=4: diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk new file mode 100644 index 000000000..94fd8a019 --- /dev/null +++ b/solenv/gbuild/platform/unxgcc.mk @@ -0,0 +1,427 @@ +# -*- 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +# to block heavy exception handling that try to acquire the solarmutex +export LO_LEAN_EXCEPTION=1 + +include $(GBUILDDIR)/platform/com_GCC_defs.mk + +gb_MKTEMP := mktemp -t gbuild.XXXXXX + +ifneq ($(origin AR),default) +gb_AR := $(AR) +endif + +gb_OSDEFS := \ + -D$(OS) \ + -D_PTHREADS \ + -DUNIX \ + -DUNX \ + $(PTHREAD_CFLAGS) \ + $(LFS_CFLAGS) \ + +gb_CFLAGS := \ + $(gb_CFLAGS_COMMON) \ + -fPIC \ + -Wshadow \ + +# At least libstdc++ needs -pthread when including various C++ headers like <thread>, see +# <https://gcc.gnu.org/onlinedocs/gcc-8.3.0/libstdc++/manual/manual/using.html +# #manual.intro.using.flags>: +ifneq ($(HAVE_LIBSTDCPP),) +gb_CXX_LINKFLAGS := -pthread +endif +# libc++ needs it too +ifneq ($(HAVE_LIBCPP),) +gb_CXX_LINKFLAGS := -pthread +endif + +gb_CXXFLAGS := \ + $(gb_CXXFLAGS_COMMON) \ + -fPIC \ + -Wshadow \ + -Woverloaded-virtual \ + $(CXXFLAGS_CXX11) \ + $(gb_CXX_LINKFLAGS) \ + + +ifneq ($(strip $(SYSBASE)),) +gb_CXXFLAGS += --sysroot=$(SYSBASE) +gb_CFLAGS += --sysroot=$(SYSBASE) +gb_LinkTarget_LDFLAGS += \ + -Wl,--sysroot=$(SYSBASE) +endif + +ifeq (,$(DISABLE_DYNLOADING)) +gb_LinkTarget_LDFLAGS += \ + -Wl,-rpath-link,$(SYSBASE)/lib:$(SYSBASE)/usr/lib \ + -Wl,-z,combreloc \ + +endif + +ifeq ($(HAVE_LD_HASH_STYLE),TRUE) +gb_LinkTarget_LDFLAGS += \ + -Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \ + +endif + +ifneq ($(HAVE_LD_BSYMBOLIC_FUNCTIONS),) +gb_LinkTarget_LDFLAGS += -Wl,-Bsymbolic-functions +endif + +gb_LINKEROPTFLAGS := -Wl,-O1 +gb_LINKERSTRIPDEBUGFLAGS := -Wl,-S + +# LinkTarget class + +define gb_LinkTarget__get_rpath_for_layer +$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS))) +endef + +gb_LinkTarget__RPATHS := \ + URELIB:\dORIGIN \ + UREBIN:\dORIGIN \ + OOO:\dORIGIN \ + SDKBIN:\dORIGIN/../../program \ + OXT: \ + NONE:\dORIGIN/../Library \ + +gb_LinkTarget_CFLAGS := $(gb_CFLAGS) +gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) + +gb_LinkTarget__cmd_lockfile = $(if $(LOCKFILE),$(LOCKFILE),$(call gb_Executable_get_command,lockfile)) +gb_LinkTarget__Lock := $(WORKDIR)/LinkTarget/link.lock + +# No newline or space before endef! +define gb_LinkTarget__WantLock +$(if $(strip $(and \ + $(call gb_CondExeLockfile,$(true)), \ + $(filter-out Executable/lockfile,$(1)), \ + $(if $(filter FUZZERS,$(BUILD_TYPE)),,$(DISABLE_DYNLOADING)), \ + $(filter CppunitTest Executable,$(TARGETTYPE)) \ + )),$(true)) +endef + +# In theory would need to track, if any of the linked objects is C++ code, so for the static build we assume yes :-( +gb_LinkTarget__NeedsCxxLinker = $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)$(DISABLE_DYNLOADING)),$(true)) + +# note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 +# we want to use @$(extraobjectlist) in the long run +# link with C compiler if there are no C++ files (pyuno_wrapper depends on this) +# But always link with C++ compiler e.g. under -fsanitize=undefined, as sal uses +# __ubsan_handle_dynamic_type_cache_miss_abort and __ubsan_vptr_type_cache from +# libclang_rt.ubsan_cxx-x86_64.a, and oosplash links against sal but itself only +# contains .c sources: +define gb_LinkTarget__command_dynamiclink +$(if $(call gb_LinkTarget__WantLock,$2), \ + echo "$(call gb_Output_announce_str,$(2): wait for lock at $$(date -u),$(true),LNK,5)" ; \ + $(gb_LinkTarget__cmd_lockfile) -r -1 $(gb_LinkTarget__Lock) ; \ + echo "$(call gb_Output_announce_str,$(2): got link lock at $$(date -u),$(true),LNK,5)" ; \ +) ++$(call gb_Helper_abbreviate_dirs,\ + $(if $(call gb_LinkTarget__NeedsCxxLinker),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \ + $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ + $(T_LTOFLAGS) \ + $(if $(SOVERSIONSCRIPT),-Wl$(COMMA)--soname=$(notdir $(1)) \ + -Wl$(COMMA)--version-script=$(SOVERSIONSCRIPT)) \ + $(subst \d,$$,$(RPATH)) \ + $(T_USE_LD) $(T_LDFLAGS) $(foreach pre_js,$(T_PREJS), --pre-js $(pre_js)) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \ + $(if $(filter TRUE,$(DISABLE_DYNLOADING)), \ + -Wl$(COMMA)--start-group \ + $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \ + $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ + $(patsubst $(gb_LinkTarget__syslib),%,$(T_LIBS)) \ + $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \ + -Wl$(COMMA)--end-group \ + , \ + -Wl$(COMMA)--start-group \ + $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ + $(T_LIBS) \ + $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \ + -Wl$(COMMA)--end-group \ + -Wl$(COMMA)--no-as-needed \ + $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \ + ) \ + -o $(1) \ + $(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)) \ + $(if $(call gb_LinkTarget__WantLock,$(2)),; RC=$$? ; rm -f $(gb_LinkTarget__Lock); if test $$RC -ne 0; then exit $$RC; fi)) + +$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\ + $(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \ + $(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \ + | cut -d' ' -f1-2 >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \ + $(WORKDIR)/LinkTarget/$(2).exports,$(1)))) +$(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter EMSCRIPTEN,$(OS)),$(filter TRUE,$(ENABLE_QT5))), \ + cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) ; \ + sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)) ; \ + ln -sf $(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data $(dir $(1))/soffice.data ; \ + ln -sf $(call gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.metadata $(dir $(1))/soffice.data.js.metadata ; \ +) +endef + +define gb_LinkTarget__command_staticlink +$(call gb_Helper_abbreviate_dirs,\ + rm -f $(1) && \ + $(gb_AR) $(gb_LTOPLUGINFLAGS) -rsu $(1) \ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ + $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ + $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null)) +endef + +define gb_LinkTarget__command +$(call gb_Output_announce,$(2),$(true),LNK,4) + $(call gb_Trace_StartRange,$(2),LNK) +$(if $(filter CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1),$(2))) +$(if $(filter Library,$(TARGETTYPE)),$(if $(filter TRUE,$(DISABLE_DYNLOADING)),$(call gb_LinkTarget__command_staticlink,$(1)),$(call gb_LinkTarget__command_dynamiclink,$(1),$(2)))) +$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1))) + $(call gb_Trace_EndRange,$(2),LNK) +endef + + +# Library class + +gb_Library_DEFS := +gb_Library_SYSPRE := lib +gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ + +ifeq ($(DISABLE_DYNLOADING),TRUE) + +gb_Library_PLAINEXT := .a +gb_Library_PLAINEXT_FOR_BUILD := .so +gb_Library_DLLEXT := .a + +else + +gb_Library_TARGETTYPEFLAGS := -shared -Wl,-z,noexecstack +gb_Library_UDK_MAJORVER := 3 +gb_Library_PLAINEXT := .so +gb_Library_PLAINEXT_FOR_BUILD := .so +gb_Library_DLLEXT := .so + +endif + +gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT) + +gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_PLAINEXT) +gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) + +gb_Library_FILENAMES := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \ + +ifeq ($(DISABLE_DYNLOADING),TRUE) + +gb_Library_FILENAMES += \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \ + +else + +gb_Library_FILENAMES += \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT).$(gb_Library_UDK_MAJORVER)) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT).$(gb_Library_UDK_MAJORVER)) \ + +endif + +gb_Library_LAYER := \ + $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ + $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \ + $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \ + $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \ + $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \ + +define gb_Library__get_rpath +$(if $(1),$(strip -Wl,-z,origin '-Wl,-rpath,$(1)' -Wl,-rpath-link,$(INSTDIR)/program)) +endef + +define gb_Library_get_rpath +$(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))) +endef + +define gb_Library_Library_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1)) + +endef + +gb_Library__set_soversion_script_platform = $(gb_Library__set_soversion_script) + +gb_Library_get_sdk_link_dir = $(INSTDIR)/$(SDKDIRNAME)/lib + +gb_Library_get_sdk_link_lib = $(gb_Library_get_versionlink_target) + +# Executable class + +gb_Executable_EXT := + +gb_Executable_LAYER := \ + $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ + $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ + $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ + $(foreach exe,$(gb_Executable_NONE),$(exe):NONE) \ + + +define gb_Executable__get_rpath +$(strip -Wl,-z,origin $(if $(1),'-Wl$(COMMA)-rpath$(COMMA)$(1)') -Wl,-rpath-link,$(INSTDIR)/program) +endef + +define gb_Executable_get_rpath +$(call gb_Executable__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))) +endef + +define gb_Executable_Executable_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1)) + +endef + + +# CppunitTest class + +gb_CppunitTest_CPPTESTPRECOMMAND := \ + $(call gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs) +gb_CppunitTest_get_filename = libtest_$(1).so +gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename) +gb_CppunitTest_malloc_check := -ex 'set environment MALLOC_CHECK_=2; set environment MALLOC_PERTURB_=153' + +define gb_CppunitTest_CppunitTest_platform +$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE)) + +endef + +define gb_CppunitTest_postprocess +$(SRCDIR)/solenv/bin/gdb-core-bt.sh $(1) $(2) $(3) +endef + +# JunitTest class + +ifneq ($(OOO_TEST_SOFFICE),) +gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE) +else +ifneq ($(gb_JunitTest_DEBUGRUN),) +gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER) +else +gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice +endif +endif + +define gb_JunitTest_JunitTest_platform +$(call gb_JunitTest_get_target,$(1)) : DEFS := \ + -Dorg.openoffice.test.arg.env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \ + -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1))) \ + -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \ + -Dorg.openoffice.test.arg.postprocesscommand=$(SRCDIR)/solenv/bin/gdb-core-bt.sh \ + -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \ + +endef + +# PythonTest class + +gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) + +# Module class + +define gb_Module_DEBUGRUNCOMMAND +OFFICESCRIPT=`mktemp` && \ +printf 'if [ -e $(INSTROOT)/program/ooenv ]; then . $(INSTROOT)/program/ooenv; fi\n' > $${OFFICESCRIPT} && \ +printf "PYTHONWARNINGS=default gdb $(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.bin" >> $${OFFICESCRIPT} && \ +printf " -ex \"set args --norestore --nologo '--accept=pipe,name=$(USER);urp;' %s\"" \ + "$(subst ","\\\"",$(value gb_DBGARGS))" >> $${OFFICESCRIPT} && \ +$(SHELL) $${OFFICESCRIPT} && \ +rm $${OFFICESCRIPT} +endef + +# InstallModuleTarget class + +define gb_InstallModuleTarget_InstallModuleTarget_platform +$(call gb_InstallModuleTarget_add_defs,$(1),\ + $(gb_CPUDEFS) \ + $(gb_OSDEFS) \ + -DCOMID=gcc3 \ + -D_gcc3 \ +) + +endef + +# InstallScript class + +gb_InstallScript_EXT := .ins + +# CliAssemblyTarget class + +gb_CliAssemblyTarget_POLICYEXT := +gb_CliAssemblyTarget_get_dll := + +# Extension class + +gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/LICENSE + +# UnpackedTarget class + +gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION) + +# UnoApiHeadersTarget class + +ifeq ($(DISABLE_DYNLOADING),TRUE) +gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) +else +gb_UnoApiHeadersTarget_select_variant = $(2) +endif + +# UIMenubarTarget class + +define gb_UIMenubarTarget__command +$(call gb_Output_announce,$(2),$(true),UIM,1) +$(call gb_Trace_StartRange,$(2),UIM) +cp $(3) $(1) +$(call gb_Trace_EndRange,$(2),UIM) + +endef + +gb_UIMenubarTarget_UIMenubarTarget_platform := + +# Python +gb_Python_PRECOMMAND := PYTHONHOME="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib:$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload" +gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(INSTROOT)/program/python +# this is passed to gdb as executable when running tests +gb_Python_INSTALLED_EXECUTABLE_GDB := $(INSTROOT)/program/python.bin + +include $(GBUILDDIR)/platform/com_GCC_class.mk + +# vim: set noet sw=4: diff --git a/solenv/gbuild/platform/win_compatibility.manifest b/solenv/gbuild/platform/win_compatibility.manifest new file mode 100644 index 000000000..709f6f3c7 --- /dev/null +++ b/solenv/gbuild/platform/win_compatibility.manifest @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <!-- Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + </application> + </compatibility> +</assembly> diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk new file mode 100644 index 000000000..57f906ad1 --- /dev/null +++ b/solenv/gbuild/platform/windows.mk @@ -0,0 +1,60 @@ +# -*- 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/. +# + +# to block heavy exception handling that try to acquire the solarmutex +export LO_LEAN_EXCEPTION=1 + +gb_LICENSE := license.txt +gb_README = readme_$(1).txt + +gb_Helper_get_rcfile = $(1).ini + +gb_Helper_LIBRARY_PATH_VAR := PATH + +gb_MKTEMP := mktemp --tmpdir=$(gb_TMPDIR) gbuild.XXXXXX + +# define _WIN32_WINNT and WINVER will be derived from it in sdkddkver.h +# current baseline is Windows 7 (NT 6.1) +# for _WIN32_IE, if _WIN32_WINNT >= 0x0600 the derived value from +# sdkddkver.h is sufficient +gb_WIN_VERSION_DEFS := \ + -D_WIN32_WINNT=0x0601 \ + -DWIN32 \ + -DWNT \ + +gb_OSDEFS := \ + $(gb_WIN_VERSION_DEFS) \ + -DNOMINMAX \ + $(LFS_CFLAGS) \ + +gb_Executable_LAYER := \ + $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ + $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ + $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ + $(foreach exe,$(gb_Executable_NONE),$(exe):NONE) \ + +# empty to avoid --warn-undefined-functions +gb_Library__set_soversion_script_platform = + +# default platform and configuration values used by msbuild +gb_MSBUILD_CONFIG := $(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) +gb_MSBUILD_PLATFORM := $(strip \ + $(if $(filter INTEL,$(CPUNAME)),Win32) \ + $(if $(filter X86_64,$(CPUNAME)),x64) \ + $(if $(filter AARCH64,$(CPUNAME)),ARM64) \ + ) +gb_MSBUILD_CONFIG_AND_PLATFORM := \ + /p:Configuration=$(gb_MSBUILD_CONFIG) \ + /p:Platform=$(gb_MSBUILD_PLATFORM) + +gb_CONFIGURE_PLATFORMS := \ + $(if $(and $(filter i686-pc-cygwin,$(HOST_PLATFORM)),$(filter x86_64-pc-cygwin,$(BUILD_PLATFORM))), \ + --build=$(HOST_PLATFORM),--build=$(BUILD_PLATFORM)) --host=$(HOST_PLATFORM) + +# vim:set noexpandtab: |