Hello,
We 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.
Changes included:
* Makefile: Add the STATIC_CURL_LIBS to targets where needed * Shared.mak: Define STATIC_CURL_LIBS empty by default * git-compat-util.h, usage.c: The symbol "error" is conflicting, so it is renamed in order to resolve this conflict.
Best regards, Gergely
diff --git i/Makefile w/Makefile index 8aa489f3b6..3db62216da 100644 --- i/Makefile +++ w/Makefile @@ -2981,14 +2981,14 @@ git-%$X: %.o GIT-LDFLAGS $(GITLIBS) git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ - $(IMAP_SEND_LDFLAGS) $(LIBS) + $(IMAP_SEND_LDFLAGS) $(LIBS) $(STATIC_CURL_LIBS) git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ - $(CURL_LIBCURL) $(LIBS) + $(CURL_LIBCURL) $(LIBS) $(STATIC_CURL_LIBS) git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ - $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS) + $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS) $(STATIC_CURL_LIBS) $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY) $(QUIET_LNCP)$(RM) $@ && \ @@ -2998,7 +2998,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ - $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS) + $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS) $(STATIC_CURL_LIBS) scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \ diff --git i/git-compat-util.h w/git-compat-util.h index bebcf9f698..d8ee12a4f8 100644 --- i/git-compat-util.h +++ w/git-compat-util.h @@ -424,7 +424,7 @@ NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2))); NORETURN void die_errno(const char *err, ...) __attribute__((format (printf, 1, 2))); int die_message(const char *err, ...) __attribute__((format (printf, 1, 2))); int die_message_errno(const char *err, ...) __attribute__((format (printf, 1, 2))); -int error(const char *err, ...) __attribute__((format (printf, 1, 2))); +int git_error(const char *err, ...) __attribute__((format (printf, 1, 2))); int error_errno(const char *err, ...) __attribute__((format (printf, 1, 2))); void warning(const char *err, ...) __attribute__((format (printf, 1, 2))); void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2))); @@ -457,7 +457,7 @@ static inline int const_error(void) { return -1; } -#define error(...) (error(__VA_ARGS__), const_error()) +#define error(...) (git_error(__VA_ARGS__), const_error()) #define error_errno(...) (error_errno(__VA_ARGS__), const_error()) #endif diff --git i/shared.mak w/shared.mak index 0e7492076e..2794e51a4c 100644 --- i/shared.mak +++ w/shared.mak @@ -130,3 +130,5 @@ GIT_USER_AGENT="$(GIT_USER_AGENT)" \ GIT_VERSION="$(GIT_VERSION_OVERRIDE)" \ $(SHELL_PATH) "$(1)/GIT-VERSION-GEN" "$(1)" "$(2)" "$(3)" endef + +STATIC_CURL_LIBS?= diff --git i/usage.c w/usage.c index 527edb1e79..472f764e6c 100644 --- i/usage.c +++ w/usage.c @@ -287,8 +287,7 @@ int error_errno(const char *fmt, ...) return -1; } -#undef error -int error(const char *err, ...) +int git_error(const char *err, ...) { va_list params;