diff mbox series

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

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

Commit Message

Fabrice Fontaine April 14, 2019, 3:51 p.m. UTC
Fixes:
 - http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
 - Do not call autogen.sh, use AUTORECONF and apply the same tweaks
   than autogen.sh to remove de-ANSI-fication

 ...-pkg-config-to-find-openssl-dependen.patch | 35 +++++++++++++++++++
 package/ngircd/ngircd.mk                      | 23 ++++++++++--
 2 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100644 package/ngircd/0001-configure.ng-use-pkg-config-to-find-openssl-dependen.patch

Comments

Thomas Petazzoni April 15, 2019, 8:10 p.m. UTC | #1
On Sun, 14 Apr 2019 17:51:53 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fixes:
>  - http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

This was still causing the AC_CHECK_LIB error here, which was in fact
due to the use of PKG_CHECK_MODULES without having host-pkgconf in the
dependencies. With this, ngircd built fine, but unfortunately, there is
still an issue.

> +# We're patching configure.ng, but package cannot autoreconf with
> +# automake >= 1.12 because de-ANSI-fication has been removed so apply the same
> +# tweaks that are done by upstream in autogen.sh
> +define NGIRCD_REMOVE_DE_ANSI_FICATION
> +	sed -e "s|^__ng_PROTOTYPES__|AC_C_PROTOTYPES|g" \
> +		$(@D)/configure.ng > $(@D)/configure.ac
> +
> +	sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #ansi2knr|g" \

This ${SERIAL_TESTS}

> +		$(@D)/src/portab/Makefile.ng > $(@D)/src/portab/Makefile.am
> +	for i in ipaddr/Makefile ngircd/Makefile testsuite/Makefile tool/Makefile; do \
> +		sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #../portab/ansi2knr|g" \

and here, cause check-package to complain:

package/ngircd/ngircd.mk:23: use $() to delimit variables, not ${}
package/ngircd/ngircd.mk:26: use $() to delimit variables, not ${}

so we need to find a way to either silence those warnings, or work
around them. Perhaps we could simply include a patch ?

The tarball already has the configure.ac and Makefile.am generated,
they only need to be tweaked for de-ansi-fication, and a patch may be a
good alternative.

What do you think ?

Best regards,

Thomas
Arnout Vandecappelle April 15, 2019, 9:08 p.m. UTC | #2
On 15/04/2019 22:10, Thomas Petazzoni wrote:
> On Sun, 14 Apr 2019 17:51:53 +0200
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> 
>> Fixes:
>>  - http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22
>>
>> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> 
> This was still causing the AC_CHECK_LIB error here, which was in fact
> due to the use of PKG_CHECK_MODULES without having host-pkgconf in the
> dependencies. With this, ngircd built fine, but unfortunately, there is
> still an issue.
> 
>> +# We're patching configure.ng, but package cannot autoreconf with
>> +# automake >= 1.12 because de-ANSI-fication has been removed so apply the same
>> +# tweaks that are done by upstream in autogen.sh
>> +define NGIRCD_REMOVE_DE_ANSI_FICATION
>> +	sed -e "s|^__ng_PROTOTYPES__|AC_C_PROTOTYPES|g" \

 Pretty please, be consistent with sed delimiters:

$ git grep -h '\(SED\|sed\|-e\).*\bs[@!|,#+%^:]' -- \*.mk | \
  grep -o '\bs[@!|,#+%^:]' | sort | uniq -c
     23 s#
     56 s%
     60 s,
     50 s:
      2 s@
      3 s^
     11 s|

 So comma or percent please.


>> +		$(@D)/configure.ng > $(@D)/configure.ac
>> +
>> +	sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #ansi2knr|g" \
> 
> This ${SERIAL_TESTS}
> 
>> +		$(@D)/src/portab/Makefile.ng > $(@D)/src/portab/Makefile.am
>> +	for i in ipaddr/Makefile ngircd/Makefile testsuite/Makefile tool/Makefile; do \
>> +		sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #../portab/ansi2knr|g" \
> 
> and here, cause check-package to complain:
> 
> package/ngircd/ngircd.mk:23: use $() to delimit variables, not ${}
> package/ngircd/ngircd.mk:26: use $() to delimit variables, not ${}

 Huh? How could this ever have worked? make will replace the ${SERIAL_TESTS}
with the empty string, since the SERIAL_TESTS variable is not defined. Fabrice,
did you actually test this? Or maybe the SERIAL_TESTS is empty anyway?

 Anyway: $$ will fix the issue, both for make and for check-package.

 Regards,
 Arnout

> 
> so we need to find a way to either silence those warnings, or work
> around them. Perhaps we could simply include a patch ?
> 
> The tarball already has the configure.ac and Makefile.am generated,
> they only need to be tweaked for de-ansi-fication, and a patch may be a
> good alternative.
> 
> What do you think ?
> 
> Best regards,
> 
> Thomas
>
Thomas Petazzoni April 15, 2019, 9:14 p.m. UTC | #3
On Mon, 15 Apr 2019 23:08:00 +0200
Arnout Vandecappelle <arnout@mind.be> wrote:

> > package/ngircd/ngircd.mk:23: use $() to delimit variables, not ${}
> > package/ngircd/ngircd.mk:26: use $() to delimit variables, not ${}  
> 
>  Huh? How could this ever have worked? make will replace the ${SERIAL_TESTS}
> with the empty string, since the SERIAL_TESTS variable is not defined. Fabrice,
> did you actually test this? Or maybe the SERIAL_TESTS is empty anyway?

SERIAL_TESTS would be "serial-tests" in our case:

  https://github.com/ngircd/ngircd/blob/master/autogen.sh#L190

https://www.gnu.org/software/automake/manual/html_node/Serial-Test-Harness.html

I guess it's only used when you run "make check", so we don't really
care in the context of Buildroot.

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..582da563ac 100644
--- a/package/ngircd/ngircd.mk
+++ b/package/ngircd/ngircd.mk
@@ -9,6 +9,25 @@  NGIRCD_SOURCE = ngircd-$(NGIRCD_VERSION).tar.xz
 NGIRCD_SITE = https://arthur.barton.de/pub/ngircd
 NGIRCD_LICENSE = GPL-2.0+
 NGIRCD_LICENSE_FILES = COPYING
+# We're patching configure.ac
+NGIRCD_AUTORECONF = YES
+
+# We're patching configure.ng, but package cannot autoreconf with
+# automake >= 1.12 because de-ANSI-fication has been removed so apply the same
+# tweaks that are done by upstream in autogen.sh
+define NGIRCD_REMOVE_DE_ANSI_FICATION
+	sed -e "s|^__ng_PROTOTYPES__|AC_C_PROTOTYPES|g" \
+		$(@D)/configure.ng > $(@D)/configure.ac
+
+	sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #ansi2knr|g" \
+		$(@D)/src/portab/Makefile.ng > $(@D)/src/portab/Makefile.am
+	for i in ipaddr/Makefile ngircd/Makefile testsuite/Makefile tool/Makefile; do \
+		sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #../portab/ansi2knr|g" \
+			$(@D)/src/$$i.ng > $(@D)/src/$$i.am ; \
+	done
+endef
+
+NGIRCD_PRE_CONFIGURE_HOOKS += NGIRCD_REMOVE_DE_ANSI_FICATION
 
 ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
 NGIRCD_CONF_OPTS += --with-pam=$(STAGING_DIR)/usr
@@ -18,8 +37,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)