git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] Embed an application manifest on MinGW

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 2, 2011, 16:27 UTC
Message-ID
<7vfwnsdwqf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1307010937-2894-1-git-send-email-cesarb@cesarb.net>

Does the output from $WINDRES define any external symbol the rest of the code can refer to? If so, you could throw resource.o into one of the .a file and make sure that the symbol is referred to from main(); perhaps the definition of main in compat/mingw.h can refer to it.

If you can do that, you wouldn't need any change to the Makefile other than the rule to build compat/win32/resource.o and conditionally add that object to LIB_OBJS, perhaps like this (obviously untested as I do not have access to windows boxes).

 Makefile |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index cbc3fce..0a18e56 100644
--- a/Makefile
+++ b/Makefile
@@ -320,6 +320,7 @@ XGETTEXT = xgettext
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov
+WINDRES = windres
 
 export TCL_PATH TCLTK_PATH
 
@@ -1169,6 +1170,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	NO_INET_PTON = YesPlease
 	NO_INET_NTOP = YesPlease
 	NO_POSIX_GOODIES = UnfortunatelyYes
+	LIB_OBJS += compat/win32/resource.o
 	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 	COMPAT_OBJS += compat/mingw.o compat/winansi.o \
@@ -1580,6 +1582,7 @@ ifndef V
 	QUIET_LNCP     = @echo '   ' LN/CP $@;
 	QUIET_XGETTEXT = @echo '   ' XGETTEXT $@;
 	QUIET_GCOV     = @echo '   ' GCOV $@;
+	QUIET_WINDRES  = @echo '   ' WINDRES $@;
 	QUIET_SUBDIR0  = +@subdir=
 	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 			 $(MAKE) $(PRINT_DIR) -C $$subdir
@@ -2022,6 +2025,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
+%.o: %.rc
+	$(QUIET_WINDRES)$(WINDRES) $< $@
+compat/win32/resource.o: compat/win32/git.manifest
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
 
Previous: Johannes SchindelinNext: Cesar Eduardo Barros
Message 3 of 4 in “Embed an application manifest on MinGW”
  1. Embed an application manifest on MinGWCesar Eduardo Barros, Jun 2, 2011
  2. Johannes SchindelinJun 2, 2011
  3. Junio C HamanoJun 2, 2011
  4. Cesar Eduardo BarrosJun 2, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.