diff mbox

package/exim: fix static linking

Message ID 1401263274-12833-1-git-send-email-yann.morin.1998@free.fr
State Accepted
Commit bf22cea53fa2af48bde3010673d3babee1ae6873
Headers show

Commit Message

Yann E. MORIN May 28, 2014, 7:47 a.m. UTC
From: "Yann E. MORIN" <yann.morin.1998@free.fr>

When building static, we need to tell exim that it needs to link
statically (obviously), and that it should link against pthreads.

Yet, exim is still not happy with that, as it still wants to build
something (a version-related program) at install time, so we need
to replicate the ld flags at install time.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/exim/exim.mk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni May 28, 2014, 7:52 a.m. UTC | #1
Dear Yann E. MORIN,

On Wed, 28 May 2014 09:47:54 +0200, Yann E. MORIN wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> When building static, we need to tell exim that it needs to link
> statically (obviously), and that it should link against pthreads.
> 
> Yet, exim is still not happy with that, as it still wants to build
> something (a version-related program) at install time, so we need
> to replicate the ld flags at install time.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Reference to autobuilder failure, maybe? :-)

Thomas
Peter Korsgaard May 28, 2014, 7:59 a.m. UTC | #2
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > From: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > When building static, we need to tell exim that it needs to link
 > statically (obviously), and that it should link against pthreads.

 > Yet, exim is still not happy with that, as it still wants to build
 > something (a version-related program) at install time, so we need
 > to replicate the ld flags at install time.

Committed with the autobuilder link added, thanks.
diff mbox

Patch

diff --git a/package/exim/exim.mk b/package/exim/exim.mk
index ca9c8a7..b780b85 100644
--- a/package/exim/exim.mk
+++ b/package/exim/exim.mk
@@ -49,15 +49,22 @@  define EXIM_CONFIGURE_CMDS
 	$(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS))
 endef
 
+# exim needs a bit of love to build statically
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+EXIM_STATIC_FLAGS = LFLAGS="-pthread --static"
+endif
+
 # "The -j (parallel) flag must not be used with make"
 # (http://www.exim.org/exim-html-current/doc/html/spec_html/ch04.html)
 define EXIM_BUILD_CMDS
-	build=br $(MAKE1) -C $(@D)
+	build=br $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS)
 endef
 
+# Need to replicate the LFLAGS in install, as exim still wants to build
+# something when installing...
 define EXIM_INSTALL_TARGET_CMDS
 	DESTDIR=$(TARGET_DIR) INSTALL_ARG="-no_chown -no_symlink" build=br \
-	  $(MAKE1) -C $(@D) install
+	  $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) install
 	chmod u+s $(TARGET_DIR)/usr/sbin/exim
 endef