{"thread":{"id":"64956","subject":"Patch: Enable static builds","startedAt":"2026-02-09T12:25:08Z","lastAt":"2026-02-09T12:25:08Z","messageCount":1,"participants":["Czuczy, Gergely"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"535521","messageId":"DB4PR02MB853530284728178B3731BA419265A@DB4PR02MB8535.eurprd02.prod.outlook.com","threadId":"64956","inReplyTo":null,"subject":"Patch: Enable static builds","fromName":"Czuczy, Gergely","fromEmail":"gergely.czuczy@sap.com","sentAt":"2026-02-09T12:25:05Z","receivedAt":"2026-02-09T12:25:08Z","isPatch":false,"sender":{"key":"gergely.czuczy@sap.com","avatar":null},"body":"Hello,\n\nWe are building git statically in a container, however this require a tiny adjustment, and I would like to submit our patch, allowing others to painlessly do the same. The attached patch applies clean to master and v.2.53.0.\n\nChanges included:\n\n  *   Makefile: Add the STATIC_CURL_LIBS to targets where needed\n  *   Shared.mak: Define STATIC_CURL_LIBS empty by default\n  *   git-compat-util.h, usage.c: The symbol \"error\" is conflicting, so it is renamed in order to resolve this conflict.\n\nBest regards,\nGergely\n\n\n\ndiff --git i/Makefile w/Makefile\nindex 8aa489f3b6..3db62216da 100644\n--- i/Makefile\n+++ w/Makefile\n@@ -2981,14 +2981,14 @@ git-%$X: %.o GIT-LDFLAGS $(GITLIBS)\n \n git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(IMAP_SEND_LDFLAGS) $(LIBS)\n+\t\t$(IMAP_SEND_LDFLAGS) $(LIBS) $(STATIC_CURL_LIBS)\n \n git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(CURL_LIBCURL) $(LIBS)\n+\t\t$(CURL_LIBCURL) $(LIBS) $(STATIC_CURL_LIBS)\n git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS) $(STATIC_CURL_LIBS)\n \n $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n \t$(QUIET_LNCP)$(RM) $@ && \\\n@@ -2998,7 +2998,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n \n $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS) $(STATIC_CURL_LIBS)\n \n scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \\\ndiff --git i/git-compat-util.h w/git-compat-util.h\nindex bebcf9f698..d8ee12a4f8 100644\n--- i/git-compat-util.h\n+++ w/git-compat-util.h\n@@ -424,7 +424,7 @@ NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));\n NORETURN void die_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));\n int die_message(const char *err, ...) __attribute__((format (printf, 1, 2)));\n int die_message_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));\n-int error(const char *err, ...) __attribute__((format (printf, 1, 2)));\n+int git_error(const char *err, ...) __attribute__((format (printf, 1, 2)));\n int error_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));\n void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));\n void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));\n@@ -457,7 +457,7 @@ static inline int const_error(void)\n {\n \treturn -1;\n }\n-#define error(...) (error(__VA_ARGS__), const_error())\n+#define error(...) (git_error(__VA_ARGS__), const_error())\n #define error_errno(...) (error_errno(__VA_ARGS__), const_error())\n #endif\n \ndiff --git i/shared.mak w/shared.mak\nindex 0e7492076e..2794e51a4c 100644\n--- i/shared.mak\n+++ w/shared.mak\n@@ -130,3 +130,5 @@ GIT_USER_AGENT=\"$(GIT_USER_AGENT)\" \\\n GIT_VERSION=\"$(GIT_VERSION_OVERRIDE)\" \\\n $(SHELL_PATH) \"$(1)/GIT-VERSION-GEN\" \"$(1)\" \"$(2)\" \"$(3)\"\n endef\n+\n+STATIC_CURL_LIBS?=\ndiff --git i/usage.c w/usage.c\nindex 527edb1e79..472f764e6c 100644\n--- i/usage.c\n+++ w/usage.c\n@@ -287,8 +287,7 @@ int error_errno(const char *fmt, ...)\n \treturn -1;\n }\n \n-#undef error\n-int error(const char *err, ...)\n+int git_error(const char *err, ...)\n {\n \tva_list params;\n \n"}]}