You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2023/10/02 01:42:33 UTC
[openoffice] branch trunk updated: For gbuild, when linking a binary on Windows produces a .manifest file, embed this manifest into the binary like dmake did.
This is an automated email from the ASF dual-hosted git repository.
damjan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new 104751b68f For gbuild, when linking a binary on Windows produces a .manifest file, embed this manifest into the binary like dmake did.
104751b68f is described below
commit 104751b68faf29eef4f137251f7b9ecd22ed8074
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Sun Oct 1 09:48:00 2023 +0200
For gbuild, when linking a binary on Windows produces a .manifest file,
embed this manifest into the binary like dmake did.
Unfortunately our old version of LINK.EXE doesn't have the /MANIFEST:EMBED
option, so the manifest has to be be embedded by calling MT.EXE in a
separate step.
Also, stop delivering the .manifest files to ${OUTDIR} now.
Patch by: me
Fixes: #127731 - AOO fails to open ODBC manager
---
main/solenv/gbuild/platform/windows.mk | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/main/solenv/gbuild/platform/windows.mk b/main/solenv/gbuild/platform/windows.mk
index 1957e904f1..ad75301570 100644
--- a/main/solenv/gbuild/platform/windows.mk
+++ b/main/solenv/gbuild/platform/windows.mk
@@ -37,6 +37,7 @@ endif
gb_CC := cl
gb_CXX := cl
gb_LINK := link
+gb_MT := mt
gb_AWK := awk
gb_CLASSPATHSEP := ;
gb_RC := rc
@@ -453,6 +454,8 @@ gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb
+# Runs the linker command to generate the binary.
+# If a .manifest file is generated, embeds it into the binary.
define gb_LinkTarget__command
$(call gb_Output_announce,$(2),$(true),LNK,4)
$(call gb_Helper_abbreviate_dirs_native,\
@@ -477,7 +480,14 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(patsubst %,%.lib,$(EXTERNAL_LIBS)) \
$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \
$(LIBS) \
- $(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \
+ $(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); \
+ RC=$$?; \
+ if [ -f $(if $(DLLTARGET),$(DLLTARGET),$(1)).manifest ]; then \
+ $(gb_MT) \
+ -manifest $(if $(DLLTARGET),$(DLLTARGET),$(1)).manifest \
+ -outputresource:$(if $(DLLTARGET),$(DLLTARGET),$(1)); \
+ fi; \
+ rm $${RESPONSEFILE} \
$(if $(DLLTARGET),; if [ ! -f $(DLLTARGET) ]; then rm -f $(1) && false; fi) ; exit $$RC)
endef
@@ -682,7 +692,6 @@ $(call gb_LinkTarget_set_auxtargets,$(2),\
$(call gb_Executable_get_target,$(1)) \
$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS := $(call gb_Executable_get_target,$(1)).manifest
-$(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)).manifest,$(call gb_LinkTarget_get_target,$(2)).manifest,$(1))
$(call gb_LinkTarget_get_target,$(2)) \
$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))