Skip to contentSkip to conversation

package/git: Fix static compilation

PATCH Superseded Remi Pommarel 3 participants 11 messages Oct 26, 2015 – Oct 28, 2015

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover package/git: Fix static compilation

Hi,

This patch series fixes git package static compilation. This fixes missing library dependency coming from static library undefined symbols as well as backport of submitted and accepted git patches.

Thanks
Remi

Remi Pommarel (3):
package/git: Add needed library for static compilation package/git: Add git patch for static compilation package/git: Used curl-config program for target

 .../0001-Makefile-link-libcurl-before-zlib.patch   |  62 ++++++++++
 ...kefile-make-curl-config-path-configurable.patch | 131 +++++++++++++++++++++
 ...configure.ac-detect-ssl-need-with-libcurl.patch |  85 +++++++++++++
 package/git/git.mk                                 |  17 ++-
 4 files changed, 293 insertions(+), 2 deletions(-)
 create mode 100644 package/git/0001-Makefile-link-libcurl-before-zlib.patch
 create mode 100644 package/git/0002-Makefile-make-curl-config-path-configurable.patch
 create mode 100644 package/git/0003-configure.ac-detect-ssl-need-with-libcurl.patch
Signature · 1 line
2.0.1
#1 lore raw

PATCH 1/3 package/git: Add needed library for static compilation

Add missing ssl, zlib and gettext library for static compilation support.

A statically compiled libcurl need to be linked with some libraries to get all its undefined symbols resolved. Indeed when libcurl supports openssl it needs -lssl to satisfy all its dependencies, the same goes for gettext and zlib symbols.

---
 package/git/git.mk | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
package/git/git.mk +13 -2
index 2bd6a01..942f29f 100644
@@ -14,7 +14,7 @@ GIT_DEPENDENCIES = zlib host-gettext
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 GIT_DEPENDENCIES += openssl
 GIT_CONF_OPTS += --with-openssl
-GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lz)
+GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lssl -lcrypto)
 else
 GIT_CONF_OPTS += --without-openssl
 endif
@@ -55,9 +55,20 @@ else
 GIT_CONF_OPTS += --without-tcltk
 endif
 
+ifeq ($(BR2_PACKAGE_GETTEXT),y)
+GIT_DEPENDENCIES += gettext
+GIT_CONF_ENV += ac_cv_lib_c_gettext=no
+endif
+
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+GIT_DEPENDENCIES += zlib
+GIT_CONF_ENV_LIBS += -lz
+endif
+
+
 # assume yes for these tests, configure will bail out otherwise
 # saying error: cannot run test program while cross compiling
-GIT_CONF_ENV = \
+GIT_CONF_ENV += \
 	ac_cv_fread_reads_directories=yes \
 	ac_cv_snprintf_returns_bogus=yes LIBS='$(GIT_CONF_ENV_LIBS)'
 
Signature · 1 line
2.0.1
#2 lore raw

PATCH 1/3 package/git: Add needed library for static compilation

Hi Remi,

Quoted 17 lines · Remi Pommarel

Add missing ssl, zlib and gettext library for static compilation support.

A statically compiled libcurl need to be linked with some libraries to get all its undefined symbols resolved. Indeed when libcurl supports openssl it needs -lssl to satisfy all its dependencies, the same goes for gettext and zlib symbols.

---
 package/git/git.mk | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
package/git/git.mk +0 -0
index 2bd6a01..942f29f 100644

package/git/git.mk GIT_DEPENDENCIES = zlib host-gettext · line 17

Quoted 5 lines
package/git/git.mk +1 -1
@@ -14,7 +14,7 @@ GIT_DEPENDENCIES = zlib host-gettext
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 GIT_DEPENDENCIES += openssl
 GIT_CONF_OPTS += --with-openssl
-GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lz)
+GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lssl -lcrypto)

zlib is always selected. You should not remove it.

Also, since you seem to fix the libcurl issue in later patches is this still needed at all?

package/git/git.mk else · line 61

Quoted 11 lines
package/git/git.mk +4 -0
 else
 GIT_CONF_OPTS += --without-openssl
 endif
@@ -55,9 +55,20 @@ else
 GIT_CONF_OPTS += --without-tcltk
 endif
 
+ifeq ($(BR2_PACKAGE_GETTEXT),y)
+GIT_DEPENDENCIES += gettext
+GIT_CONF_ENV += ac_cv_lib_c_gettext=no
+endif

Are you sure this fixes a static build issue? If not, please make a separate patch for this part.

package/git/git.mk else · line 66

Quoted 4 lines
package/git/git.mk +4 -0
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+GIT_DEPENDENCIES += zlib
+GIT_CONF_ENV_LIBS += -lz
+endif

This part should not be needed. zlib is already in GIT_DEPENDENCIES (above), -lz should be in GIT_CONF_ENV_LIBS for static build, and BR2_PACKAGE_ZLIB is always selected.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#3 lore raw

PATCH 1/3 package/git: Add needed library for static compilation

Hi Baruch,

Quoted 15 lines · Baruch Siach

Hi Remi,

Quoted 12 lines · Remi Pommarel

Add missing ssl, zlib and gettext library for static compilation support.

A statically compiled libcurl need to be linked with some libraries to get all its undefined symbols resolved. Indeed when libcurl supports openssl it needs -lssl to satisfy all its dependencies, the same goes for gettext and zlib symbols.

---
 package/git/git.mk | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
Quoted 12 lines

package/git/git.mk GIT_DEPENDENCIES = zlib host-gettext · line 17

Quoted 10 lines
package/git/git.mk +1 -1
index 2bd6a01..942f29f 100644
@@ -14,7 +14,7 @@ GIT_DEPENDENCIES = zlib host-gettext
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 GIT_DEPENDENCIES += openssl
 GIT_CONF_OPTS += --with-openssl
-GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lz)
+GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lssl -lcrypto)

zlib is always selected. You should not remove it.

Ok will do, thanks.

Quoted 4 lines

Also, since you seem to fix the libcurl issue in later patches is this still needed at all?

There are two places the additional libraries are needed. In the Makefile in order to compile git binaries, the patches fix the issue here. And in the configure when it compile test application to probe for features, unfortunatly configure still need LIBS varibale to be set.

Quoted 7 lines
Quoted 7 lines
package/git/git.mk +0 -0
 else
 GIT_CONF_OPTS += --without-openssl
 endif
@@ -55,9 +55,20 @@ else
 GIT_CONF_OPTS += --without-tcltk
 endif
 
Quoted 8 lines

package/git/git.mk else · line 61

Quoted 4 lines
package/git/git.mk +4 -0
+ifeq ($(BR2_PACKAGE_GETTEXT),y)
+GIT_DEPENDENCIES += gettext
+GIT_CONF_ENV += ac_cv_lib_c_gettext=no
+endif

Are you sure this fixes a static build issue? If not, please make a separate patch for this part.

When statically compiled with gettext support libcurl need to be linked with libintl, using ac_cv_lib_c_gettext does the job. So for me its static linking related.

Quoted 9 lines

package/git/git.mk else · line 66

Quoted 4 lines
package/git/git.mk +4 -0
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+GIT_DEPENDENCIES += zlib
+GIT_CONF_ENV_LIBS += -lz
+endif

This part should not be needed. zlib is already in GIT_DEPENDENCIES (above), -lz should be in GIT_CONF_ENV_LIBS for static build, and BR2_PACKAGE_ZLIB is always selected.

Ok will remove this bit.

Thanks

Signature · 1 line
R?mi
#4 lore raw

PATCH 1/3 package/git: Add needed library for static compilation

Hi Remi,

Quoted 30 lines · Remi Pommarel
Quoted 13 lines · Baruch Siach
Quoted 12 lines · Remi Pommarel

Add missing ssl, zlib and gettext library for static compilation support.

A statically compiled libcurl need to be linked with some libraries to get all its undefined symbols resolved. Indeed when libcurl supports openssl it needs -lssl to satisfy all its dependencies, the same goes for gettext and zlib symbols.

---
 package/git/git.mk | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
Quoted 12 lines

package/git/git.mk GIT_DEPENDENCIES = zlib host-gettext · line 17

Quoted 10 lines
package/git/git.mk +1 -1
index 2bd6a01..942f29f 100644
@@ -14,7 +14,7 @@ GIT_DEPENDENCIES = zlib host-gettext
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 GIT_DEPENDENCIES += openssl
 GIT_CONF_OPTS += --with-openssl
-GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lz)
+GIT_CONF_ENV_LIBS += $(if $(BR2_STATIC_LIBS),-lssl -lcrypto)

zlib is always selected. You should not remove it.

Ok will do, thanks.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Also, since you seem to fix the libcurl issue in later patches is this still needed at all?

There are two places the additional libraries are needed. In the Makefile in order to compile git binaries, the patches fix the issue here. And in the configure when it compile test application to probe for features, unfortunatly configure still need LIBS varibale to be set.

Please add this information to the commit log.

Quoted 11 lines
Quoted 7 lines

package/git/git.mk else · line 61

Quoted 4 lines
package/git/git.mk +4 -0
+ifeq ($(BR2_PACKAGE_GETTEXT),y)
+GIT_DEPENDENCIES += gettext
+GIT_CONF_ENV += ac_cv_lib_c_gettext=no
+endif

Are you sure this fixes a static build issue? If not, please make a separate patch for this part.

When statically compiled with gettext support libcurl need to be linked with libintl, using ac_cv_lib_c_gettext does the job. So for me its static linking related.

So this is only needed when libcurl is enabled?

Please add this information as well to the commit log, and add a comment in the code.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#5 lore raw

PATCH 2/3 package/git: Add git patch for static compilation

In reply to Remi Pommarel

Use submitted git patches that fix static compilation:
- The first patch fix library link order
- The second patch adds -lssl when needed with libcurl

---
 .../0001-Makefile-link-libcurl-before-zlib.patch   | 62 ++++++++++++++++
 ...configure.ac-detect-ssl-need-with-libcurl.patch | 85 ++++++++++++++++++++++
 2 files changed, 147 insertions(+)
 create mode 100644 package/git/0001-Makefile-link-libcurl-before-zlib.patch
 create mode 100644 package/git/0003-configure.ac-detect-ssl-need-with-libcurl.patch
package/git/0001-Makefile-link-libcurl-before-zlib.patch new file +62 -0
new file mode 100644
index 0000000..8b6786e
@@ -0,0 +1,62 @@
+From 9eaa78b0b037964da85d6a15f0128639f2118a53 Mon Sep 17 00:00:00 2001
+From: Remi Pommarel <[email protected]>
+Date: Wed, 21 Oct 2015 19:01:13 +0200
+Subject: [PATCH 1/3] Makefile: link libcurl before zlib
+
+For static linking especially library order while linking is important. For
+example, libcurl wants symbols from zlib when building http-push, http-fetch
+and remote-curl. So for these programs libcurl has to be linked before zlib.
+
+Signed-off-by: Remi Pommarel <[email protected]>
+Reviewed-by: Jonathan Nieder <[email protected]>
+Signed-off-by: Junio C Hamano <[email protected]>
+---
+ Makefile | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ce0cfe2..9787385 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1029,7 +1029,7 @@ ifdef HAVE_ALLOCA_H
+ endif
+ 
+ IMAP_SEND_BUILDDEPS =
+-IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
++IMAP_SEND_LDFLAGS =
+ 
+ ifdef NO_CURL
+ 	BASIC_CFLAGS += -DNO_CURL
+@@ -1086,6 +1086,7 @@ else
+ 		endif
+ 	endif
+ endif
++IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
+ 
+ ifdef ZLIB_PATH
+ 	BASIC_CFLAGS += -I$(ZLIB_PATH)/include
+@@ -1971,10 +1972,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
+ 
+ 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,$^) \
+-		$(LIBS) $(CURL_LIBCURL)
++		$(CURL_LIBCURL) $(LIBS)
+ git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
+ 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
+-		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
++		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
+ 
+ git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
+ 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
+@@ -1988,7 +1989,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,$^) \
+-		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
++		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
+ 
+ $(LIB_FILE): $(LIB_OBJS)
+ 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^
+-- 
+2.0.1
+
package/git/0003-configure.ac-detect-ssl-need-with-libcurl.patch new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
2.0.1
#6 lore raw

PATCH 2/3 package/git: Add git patch for static compilation

On 26-10-15 22:12, Remi Pommarel wrote:
[snip]

Quoted 21 lines
package/git/0003-configure.ac-detect-ssl-need-with-libcurl.patch new file +15 -0
new file mode 100644
index 0000000..e8dc367
@@ -0,0 +1,85 @@
+From 7e91e8d73a757801c0604a03fd2f0fa8003e4ac0 Mon Sep 17 00:00:00 2001
+From: Remi Pommarel <[email protected]>
+Date: Thu, 24 Sep 2015 21:14:00 +0200
+Subject: [PATCH 3/3] configure.ac: detect ssl need with libcurl
+
+When libcurl has been statically compiled with openssl support they both
+need to be linked in everytime libcurl is used.
+
+During configuration this can be detected by looking for Curl_ssl_init
+function symbol in libcurl, which will only be present if libcurl has been
+compiled statically built with openssl.
+
+configure.ac checks for Curl_ssl_init function in libcurl and if such function
+exists; it sets NEEDS_SSL_WITH_CURL that is used by the Makefile to include
+-lssl alongside with -lcurl.

package/git/0003-configure.ac-detect-ssl-need-with-libcurl.patch line 25

Quoted 10 lines
package/git/0003-configure.ac-detect-ssl-need-with-libcurl.patch new file +10 -0
+
+Signed-off-by: Remi Pommarel <[email protected]>
+Signed-off-by: Junio C Hamano <[email protected]>
+---
+ configure.ac | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff -rup a/configure b/configure
+--- a/configure 2015-10-26 20:33:23.829904205 +0100
++++ b/configure 2015-10-26 20:33:40.429904052 +0100

We prefer the original patch to configure.ac and adding GIT_AUTORECONF = YES

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#7 lore raw

PATCH 3/3 package/git: Used curl-config program for target

In reply to Remi Pommarel

Fix cross compilation by using curl-config script for target instead of the one from host.

---
 ...kefile-make-curl-config-path-configurable.patch | 131 +++++++++++++++++++++
 package/git/git.mk                                 |   2 +
 2 files changed, 133 insertions(+)
 create mode 100644 package/git/0002-Makefile-make-curl-config-path-configurable.patch
package/git/0002-Makefile-make-curl-config-path-configurable.patch new file +131 -0
new file mode 100644
index 0000000..54911e3
@@ -0,0 +1,131 @@
+From f89158760d5f02ba59f644799abd921e6be22f13 Mon Sep 17 00:00:00 2001
+From: Remi Pommarel <[email protected]>
+Date: Wed, 21 Oct 2015 19:10:46 +0200
+Subject: [PATCH 2/3] Makefile: make curl-config path configurable
+
+There are situations, e.g. during cross compilation, where curl-config
+program is not present in the PATH.
+
+Make the makefile use a configurable curl-config program passed through
+CURL_CONFIG variable which can be set through config.mak.
+
+Also make this variable tunable through use of autoconf/configure. Configure
+will set CURL_CONFIG variable in config.mak.autogen to whatever value has been
+passed to ac_cv_prog_CURL_CONFIG.
+
+Signed-off-by: Remi Pommarel <[email protected]>
+Reviewed-by: Jonathan Nieder <[email protected]>
+Signed-off-by: Junio C Hamano <[email protected]>
+---
+ Makefile     |  8 ++++++--
+ configure.ac | 13 +++++++++++++
+ 2 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9787385..64d17d0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -39,6 +39,9 @@ all::
+ # Define CURLDIR=/foo/bar if your curl header and library files are in
+ # /foo/bar/include and /foo/bar/lib directories.
+ #
++# Define CURL_CONFIG to curl's configuration program that prints information
++# about the library (e.g., its version number).  The default is 'curl-config'.
++#
+ # Define NO_EXPAT if you do not have expat installed.  git-http-push is
+ # not built, and you cannot push using http:// and https:// transports (dumb).
+ #
+@@ -425,6 +428,7 @@ TCL_PATH = tclsh
+ TCLTK_PATH = wish
+ XGETTEXT = xgettext
+ MSGFMT = msgfmt
++CURL_CONFIG = curl-config
+ PTHREAD_LIBS = -lpthread
+ PTHREAD_CFLAGS =
+ GCOV = gcov
+@@ -1059,13 +1063,13 @@ else
+ 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
+ 	PROGRAM_OBJS += http-fetch.o
+ 	PROGRAMS += $(REMOTE_CURL_NAMES)
+-	curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
++	curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+ 	ifeq "$(curl_check)" "070908"
+ 		ifndef NO_EXPAT
+ 			PROGRAM_OBJS += http-push.o
+ 		endif
+ 	endif
+-	curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
++	curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+ 	ifeq "$(curl_check)" "072200"
+ 		USE_CURL_FOR_IMAP_SEND = YesPlease
+ 	endif
+diff -rup a/configure b/configure
+--- a/configure     2015-10-26 20:33:23.829904205 +0100
++++ b/configure 2015-10-26 20:33:40.429904052 +0100
+@@ -624,6 +624,7 @@ ac_includes_default="\
+
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
++CURL_CONFIG
+ ASCIIDOC
+ TCLTK_PATH
+ DIFF
+@@ -5230,6 +5281,55 @@ fi
+
+ config_appended_defs="$config_appended_defs${newline}NO_CURL=${NO_CURL}"
+
++if test -z "$NO_CURL"; then
++
++# Extract the first word of "curl-config", so it can be a program name with args.
++set dummy curl-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_CURL_CONFIG+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$CURL_CONFIG"; then
++  ac_cv_prog_CURL_CONFIG="$CURL_CONFIG" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_CURL_CONFIG="curl-config"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  test -z "$ac_cv_prog_CURL_CONFIG" && ac_cv_prog_CURL_CONFIG="no"
++fi
++fi
++CURL_CONFIG=$ac_cv_prog_CURL_CONFIG
++if test -n "$CURL_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL_CONFIG" >&5
++$as_echo "$CURL_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++
++if test $CURL_CONFIG != no; then
++
++config_appended_defs="$config_appended_defs${newline}CURL_CONFIG=${CURL_CONFIG}"
++fi
++
++fi
++
++
+ #
+ # Define NO_EXPAT if you do not have expat installed.  git-http-push is
+ # not built, and you cannot push using http:// and https:// transports.
+-- 
+2.0.1
+
package/git/git.mk +2 -0
index 942f29f..e049cf4 100644
@@ -29,6 +29,8 @@ endif
 ifeq ($(BR2_PACKAGE_CURL),y)
 GIT_DEPENDENCIES += libcurl
 GIT_CONF_OPTS += --with-curl
+GIT_CONF_ENV +=	\
+	ac_cv_prog_curl_config=$(STAGING_DIR)/usr/bin/$(LIBCURL_CONFIG_SCRIPTS)
 else
 GIT_CONF_OPTS += --without-curl
 endif
Signature · 1 line
2.0.1
#8 lore raw

PATCH 3/3 package/git: Used curl-config program for target

Quoted 4 lines · Remi Pommarel

Fix cross compilation by using curl-config script for target instead of the one from host.

Again, please patch configure.ac instead of configure. Otherwise, looks good to
me. Though I didn't immediately understand why it wasn't necessary to add CURL_CONFIG to config.mak.in

Regards,
Arnout

Quoted 157 lines
---
 ...kefile-make-curl-config-path-configurable.patch | 131 +++++++++++++++++++++
 package/git/git.mk                                 |   2 +
 2 files changed, 133 insertions(+)
 create mode 100644 package/git/0002-Makefile-make-curl-config-path-configurable.patch
package/git/0002-Makefile-make-curl-config-path-configurable.patch new file +131 -0
new file mode 100644
index 0000000..54911e3
@@ -0,0 +1,131 @@
+From f89158760d5f02ba59f644799abd921e6be22f13 Mon Sep 17 00:00:00 2001
+From: Remi Pommarel <[email protected]>
+Date: Wed, 21 Oct 2015 19:10:46 +0200
+Subject: [PATCH 2/3] Makefile: make curl-config path configurable
+
+There are situations, e.g. during cross compilation, where curl-config
+program is not present in the PATH.
+
+Make the makefile use a configurable curl-config program passed through
+CURL_CONFIG variable which can be set through config.mak.
+
+Also make this variable tunable through use of autoconf/configure. Configure
+will set CURL_CONFIG variable in config.mak.autogen to whatever value has been
+passed to ac_cv_prog_CURL_CONFIG.
+
+Signed-off-by: Remi Pommarel <[email protected]>
+Reviewed-by: Jonathan Nieder <[email protected]>
+Signed-off-by: Junio C Hamano <[email protected]>
+---
+ Makefile     |  8 ++++++--
+ configure.ac | 13 +++++++++++++
+ 2 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9787385..64d17d0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -39,6 +39,9 @@ all::
+ # Define CURLDIR=/foo/bar if your curl header and library files are in
+ # /foo/bar/include and /foo/bar/lib directories.
+ #
++# Define CURL_CONFIG to curl's configuration program that prints information
++# about the library (e.g., its version number).  The default is 'curl-config'.
++#
+ # Define NO_EXPAT if you do not have expat installed.  git-http-push is
+ # not built, and you cannot push using http:// and https:// transports (dumb).
+ #
+@@ -425,6 +428,7 @@ TCL_PATH = tclsh
+ TCLTK_PATH = wish
+ XGETTEXT = xgettext
+ MSGFMT = msgfmt
++CURL_CONFIG = curl-config
+ PTHREAD_LIBS = -lpthread
+ PTHREAD_CFLAGS =
+ GCOV = gcov
+@@ -1059,13 +1063,13 @@ else
+ 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
+ 	PROGRAM_OBJS += http-fetch.o
+ 	PROGRAMS += $(REMOTE_CURL_NAMES)
+-	curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
++	curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+ 	ifeq "$(curl_check)" "070908"
+ 		ifndef NO_EXPAT
+ 			PROGRAM_OBJS += http-push.o
+ 		endif
+ 	endif
+-	curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
++	curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+ 	ifeq "$(curl_check)" "072200"
+ 		USE_CURL_FOR_IMAP_SEND = YesPlease
+ 	endif
+diff -rup a/configure b/configure
+--- a/configure     2015-10-26 20:33:23.829904205 +0100
++++ b/configure 2015-10-26 20:33:40.429904052 +0100
+@@ -624,6 +624,7 @@ ac_includes_default="\
+
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
++CURL_CONFIG
+ ASCIIDOC
+ TCLTK_PATH
+ DIFF
+@@ -5230,6 +5281,55 @@ fi
+
+ config_appended_defs="$config_appended_defs${newline}NO_CURL=${NO_CURL}"
+
++if test -z "$NO_CURL"; then
++
++# Extract the first word of "curl-config", so it can be a program name with args.
++set dummy curl-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_CURL_CONFIG+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$CURL_CONFIG"; then
++  ac_cv_prog_CURL_CONFIG="$CURL_CONFIG" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_CURL_CONFIG="curl-config"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  test -z "$ac_cv_prog_CURL_CONFIG" && ac_cv_prog_CURL_CONFIG="no"
++fi
++fi
++CURL_CONFIG=$ac_cv_prog_CURL_CONFIG
++if test -n "$CURL_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL_CONFIG" >&5
++$as_echo "$CURL_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++
++if test $CURL_CONFIG != no; then
++
++config_appended_defs="$config_appended_defs${newline}CURL_CONFIG=${CURL_CONFIG}"
++fi
++
++fi
++
++
+ #
+ # Define NO_EXPAT if you do not have expat installed.  git-http-push is
+ # not built, and you cannot push using http:// and https:// transports.
+-- 
+2.0.1
+
package/git/git.mk +2 -0
index 942f29f..e049cf4 100644
@@ -29,6 +29,8 @@ endif
 ifeq ($(BR2_PACKAGE_CURL),y)
 GIT_DEPENDENCIES += libcurl
 GIT_CONF_OPTS += --with-curl
+GIT_CONF_ENV +=	\
+	ac_cv_prog_curl_config=$(STAGING_DIR)/usr/bin/$(LIBCURL_CONFIG_SCRIPTS)
 else
 GIT_CONF_OPTS += --without-curl
 endif
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#9 lore raw

PATCH 3/3 package/git: Used curl-config program for target

Quoted 9 lines · Arnout Vandecappelle
Quoted 4 lines · Remi Pommarel

Fix cross compilation by using curl-config script for target instead of the one from host.

Again, please patch configure.ac instead of configure. Otherwise, looks good to
me. Though I didn't immediately understand why it wasn't necessary to add CURL_CONFIG to config.mak.in

Ok I will use configure.ac patch instead. Git can be configured using two ways, either using configure or using config.mak.in. I could have set CURL_CONFIG in config.mak.in also but using the two methods at the same time is redundant.

Thanks

Signature · 1 line
R?mi
#10 lore raw

PATCH 3/3 package/git: Used curl-config program for target

Quoted 7 lines · Remi Pommarel
Quoted 6 lines · Arnout Vandecappelle
Quoted 4 lines · Remi Pommarel

Fix cross compilation by using curl-config script for target instead of the one from host.

Quoted 8 lines
Quoted 3 lines

Again, please patch configure.ac instead of configure. Otherwise, looks good to
me. Though I didn't immediately understand why it wasn't necessary to add CURL_CONFIG to config.mak.in

Ok I will use configure.ac patch instead. Git can be configured using two ways, either using configure or using config.mak.in. I could have set CURL_CONFIG in config.mak.in also but using the two methods at the same time is redundant.

Er, I'm pretty sure that configure will convert config.mak.in into
config.mak.autogen. But it will append all the GIT_CONFIG_SUBST variables, which is not usual autotools idiom, that's why I was confused.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF