tdf#130857 qt weld: Hide widget marked for deletion
[LibreOffice.git] / odk / build-examples_common.mk
blob9f608e5d196a37468c6b76677024b62c4ebf8d5e
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # System-provided shells on macOS are known to unset DYLD_LIBRARY_PATH, so we need some sort of hack
11 # to provided the invocation of make below with a shell that preserves DYLD_LIBRARY_PATH. Until
12 # macOS 10.14, what apparently worked is to use a copy of /bin/sh in some temp dir. However, with
13 # macOS 10.15, that hack appears to no longer work, the only known workaround is to use e.g. bash
14 # built from upstream source and pass it into the toplevel make invocation as SHELL=... command line
15 # argument (which is also needed when building external/firebird and needing to preserve a global
16 # DYLD_LIBRARY_PATH, see comment 17 at
17 # <https://bugs.documentfoundation.org/show_bug.cgi?id=101789#c17> "FIREBIRD 3 - fails to build on
18 # OSX 10.11.6 with clang"). When building on macOS <= 10.14 and not passing SHELL=... on the
19 # command line, MACOSX_SHELL_HACK will kick in and do the "use a copy of /bin/sh" workaround. When
20 # passing in a self-built SHELL=... (which is necessary now on macOS >= 10.15), the
21 # MACOSX_SHELL_HACK will not kick in, but the below invocation of make will automatically inherit
22 # SHELL from the currently running invocation of make. (At least with GNU Make 4.2.1, the origin of
23 # a default SHELL setting is, somewhat unintuitively, reported as "file" rather than "default". To
24 # avoid surprises, use an explicit check for an origin of "command line" here.)
25 MACOSX_SHELL_HACK := $(and $(filter MACOSX,$(OS)),$(filter-out command line,$(origin SHELL)))
27 define odk_build-examples_test
29 $(eval $(call gb_CustomTarget_CustomTarget,$(1)))
31 $(call gb_CustomTarget_get_target,$(1)): \
32 $(gb_CustomTarget_workdir)/$(1)/setsdkenv
33 ifneq ($(gb_SUPPRESS_TESTS),)
34 @true
35 else
36 $$(call gb_Output_announce,$(subst $(WORKDIR)/,,$(1)),$(true),CHK,1)
37 rm -fr $(gb_CustomTarget_workdir)/$(1)/{out,user}
38 $(if $(MACOSX_SHELL_HACK), \
39 ODK_BUILD_SHELL=$$$$($(gb_MKTEMP)) && \
40 cp /bin/sh "$$$$ODK_BUILD_SHELL" && \
41 chmod 0700 "$$$$ODK_BUILD_SHELL" &&) \
42 (saved_library_path=$$$${$(gb_Helper_LIBRARY_PATH_VAR)} && . $$< \
43 $(if $(filter MACOSX,$(OS)),, \
44 && $(gb_Helper_LIBRARY_PATH_VAR)=$$$$saved_library_path) \
45 && export \
46 UserInstallation=$(call gb_Helper_make_url,$(gb_CustomTarget_workdir)/$(1)/user) \
47 $(foreach my_dir,$(2), \
48 && (cd $(INSTDIR)/$(SDKDIRNAME)/examples/$(my_dir) \
49 && printf 'yes\n' | LANGUAGE= LC_ALL=C make -j1 \
50 CC="$(CXX) $(gb_CXX03FLAGS)" LINK="$(CXX)" LIB="$(CXX)" \
51 $(if $(MACOSX_SHELL_HACK), SHELL="$$$$ODK_BUILD_SHELL", ))) \
52 $(if $(MACOSX_SHELL_HACK),&& rm -f "$$$$ODK_BUILD_SHELL")) \
53 >$(gb_CustomTarget_workdir)/$(1)/log 2>&1 \
54 || (RET=$$$$? \
55 $(if $(MACOSX_SHELL_HACK), && rm -f "$$$$ODK_BUILD_SHELL" , ) \
56 && cat $(gb_CustomTarget_workdir)/$(1)/log \
57 && exit $$$$RET)
58 endif
60 $(gb_CustomTarget_workdir)/$(1)/setsdkenv: \
61 $(SRCDIR)/odk/config/setsdkenv_unix.sh.in \
62 $(BUILDDIR)/config_$(gb_Side).mk | \
63 $(gb_CustomTarget_workdir)/$(1)/.dir
64 $$(call gb_Output_announce,$(subst $(WORKDIR)/,,$(1)),$(true),SED,1)
65 sed -e 's!@OO_SDK_NAME@!sdk!' \
66 -e 's!@OO_SDK_HOME@!$(INSTDIR)/$(SDKDIRNAME)!' \
67 -e 's!@OFFICE_HOME@!$(INSTROOTBASE)!' -e 's!@OO_SDK_MAKE_HOME@!!' \
68 -e 's!@OO_SDK_ZIP_HOME@!!' -e 's!@OO_SDK_CAT_HOME@!!' \
69 -e 's!@OO_SDK_SED_HOME@!!' -e 's!@OO_SDK_CPP_HOME@!!' \
70 -e 's!@OO_SDK_DOTNET_ROOT@!$(DOTNET_ROOT)!' \
71 -e 's!@OO_SDK_JAVA_HOME@!$(JAVA_HOME)!' \
72 -e 's!@OO_SDK_OUTPUT_DIR@!$(gb_CustomTarget_workdir)/$(1)/out!' \
73 -e 's!@SDK_AUTO_DEPLOYMENT@!YES!' $$< > $$@
75 .PHONY: $(call gb_CustomTarget_get_target,$(1))
77 endef
79 # vim: set noet sw=4 ts=4: