diff mbox series

[1/1] package/ngircd: fix static build with openssl and atomic

Message ID 20190411214927.30188-1-fontaine.fabrice@gmail.com
State Superseded
Headers show
Series [1/1] package/ngircd: fix static build with openssl and atomic | expand

Commit Message

Fabrice Fontaine April 11, 2019, 9:49 p.m. UTC
Fixes:
 - http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...-pkg-config-to-find-openssl-dependen.patch | 35 +++++++++++++++++++
 package/ngircd/ngircd.mk                      | 13 +++++--
 2 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 package/ngircd/0001-configure.ng-use-pkg-config-to-find-openssl-dependen.patch

Comments

Thomas Petazzoni April 14, 2019, 1:28 p.m. UTC | #1
Hello Fabrice,

On Thu, 11 Apr 2019 23:49:27 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> +# We're patching configure.ng, but package cannot autoreconf with our version of
> +# autotools, so we have to do it manually instead of setting

Actually, it *can* autoreconf with our version of autotools: that's
what the ./autogen.sh script does, i.e it calls our autoconf/automake.

However, it does that after doing some patching on
configure.ng/Makefile.ng, depending on the detected version of
autoconf/automake.

> +# NGIRCD_AUTORECONF = YES
> +define NGIRCD_RUN_AUTOGEN
> +	cd $(@D) && PATH=$(BR_PATH) ./autogen.sh
> +endef
> +
> +NGIRCD_PRE_CONFIGURE_HOOKS += NGIRCD_RUN_AUTOGEN

You forgot to add host-autoconf and host-automake to the dependencies.
host-libtool doesn't seem to be needed.

However, even with that, it doesn't build properly here:

>>> ngircd 25 Patching libtool
>>> ngircd 25 Configuring
cd /home/thomas/projets/buildroot/output/build/ngircd-25 && PATH="/home/thomas/projets/buildroot/output/host/bin:/home/thomas/projets/buildroot/output/host/sbin:/home/thomas/sys/bin/:/usr/libexec/python3-sphinx:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/thomas/.rvm/bin:/home/thomas/sys/bin:/home/thomas/.gem/ruby/2.1.0/bin:/home/thomas/.rvm/bin:/home/thomas/projets/git-wrappers/:/home/thomas/.local/bin" ./autogen.sh
Searching for required tools ...
Detected automake 1.15.1 ...
 - Disabling de-ANSI-fication support.
 - Enforcing serial test harness.
Generating files using "autoconf" and "automake" ...
configure.ac:315: error: possibly undefined macro: AC_CHECK_LIB
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Error! Check your installation of GNU automake and autoconf!
make[1]: *** [package/pkg-generic.mk:230: /home/thomas/projets/buildroot/output/build/ngircd-25/.stamp_configured] Error 1

This is maybe because autoconf is not called with the right -I
arguments. See the AUTORECONF macro in package/autoconf/autoconf.mk.

If that's the case, perhaps it's easier to use <pkg>_AUTORECONF = YES,
and simply re-implement in ngircd.mk the two tweaks that ngircd
autogen.sh does ?

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/ngircd/0001-configure.ng-use-pkg-config-to-find-openssl-dependen.patch b/package/ngircd/0001-configure.ng-use-pkg-config-to-find-openssl-dependen.patch
new file mode 100644
index 0000000000..bf05f99dc4
--- /dev/null
+++ b/package/ngircd/0001-configure.ng-use-pkg-config-to-find-openssl-dependen.patch
@@ -0,0 +1,35 @@ 
+From 75f669b9a00a76f0abf35cce8b9f80711aff7600 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Thu, 11 Apr 2019 23:24:36 +0200
+Subject: [PATCH] configure.ng: use pkg-config to find openssl dependencies
+
+openssl can depends on lz or latomic so use pkg-config to find those
+dependencies and fallback to existing mechanism
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: https://github.com/ngircd/ngircd/pull/256]
+---
+ configure.ng | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ng b/configure.ng
+index 57ae8bb8..899d00f7 100644
+--- a/configure.ng
++++ b/configure.ng
+@@ -464,8 +464,11 @@ AC_ARG_WITH(openssl,
+ 				CPPFLAGS="-I$withval/include $CPPFLAGS"
+ 				LDFLAGS="-L$withval/lib $LDFLAGS"
+ 			fi
+-			AC_CHECK_LIB(crypto, BIO_s_mem)
+-			AC_CHECK_LIB(ssl, SSL_new)
++			PKG_CHECK_MODULES([OPENSSL], [libssl libcrypto],
++				[LIBS="$LIBS $OPENSSL_LIBS" CFLAGS="$CFLAGS $OPENSSL_CFLAGS"],
++				[AC_CHECK_LIB(crypto, BIO_s_mem)
++				AC_CHECK_LIB(ssl, SSL_new)]
++			)
+ 			AC_CHECK_FUNCS(SSL_new, x_ssl_openssl=yes,
+ 				AC_MSG_ERROR([Can't enable openssl])
+ 			)
+-- 
+2.20.1
+
diff --git a/package/ngircd/ngircd.mk b/package/ngircd/ngircd.mk
index 5fa86afdd5..bd8ac9dad4 100644
--- a/package/ngircd/ngircd.mk
+++ b/package/ngircd/ngircd.mk
@@ -10,6 +10,15 @@  NGIRCD_SITE = https://arthur.barton.de/pub/ngircd
 NGIRCD_LICENSE = GPL-2.0+
 NGIRCD_LICENSE_FILES = COPYING
 
+# We're patching configure.ng, but package cannot autoreconf with our version of
+# autotools, so we have to do it manually instead of setting
+# NGIRCD_AUTORECONF = YES
+define NGIRCD_RUN_AUTOGEN
+	cd $(@D) && PATH=$(BR_PATH) ./autogen.sh
+endef
+
+NGIRCD_PRE_CONFIGURE_HOOKS += NGIRCD_RUN_AUTOGEN
+
 ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
 NGIRCD_CONF_OPTS += --with-pam=$(STAGING_DIR)/usr
 NGIRCD_DEPENDENCIES += linux-pam
@@ -18,8 +27,8 @@  NGIRCD_CONF_OPTS += --without-pam
 endif
 
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
-NGIRCD_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr
-NGIRCD_DEPENDENCIES += openssl
+NGIRCD_CONF_OPTS += --with-openssl
+NGIRCD_DEPENDENCIES += host-pkgconf openssl
 else
 NGIRCD_CONF_OPTS += --without-openssl
 ifeq ($(BR2_PACKAGE_GNUTLS),y)