Skip to contentSkip to conversation

package/ngircd: fix static build with openssl and atomic

PATCH New Fabrice Fontaine 3 participants 4 messages Apr 14, 2019 – Apr 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/ngircd: fix static build with openssl and atomic

Fixes:
- http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22

---
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
package/ngircd/0001-configure.ng-use-pkg-config-to-find-openssl-dependen.patch new file +35 -0
new file mode 100644
index 0000000000..bf05f99dc4
@@ -0,0 +1,35 @@
+From 75f669b9a00a76f0abf35cce8b9f80711aff7600 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+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 <[email protected]>
+[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
+
package/ngircd/ngircd.mk +21 -2
index 5fa86afdd5..582da563ac 100644
@@ -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)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 package/ngircd: fix static build with openssl and atomic

Quoted 4 lines · On Sun, 14 Apr 2019 17:51:53 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22

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.

package/ngircd/ngircd.mk NGIRCD_SOURCE = ngircd-$(NGIRCD_VERSION).tar.xz · line 22

Quoted 8 lines
package/ngircd/ngircd.mk +8 -0
+# 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}

package/ngircd/ngircd.mk NGIRCD_SOURCE = ngircd-$(NGIRCD_VERSION).tar.xz · line 25

Quoted 3 lines
package/ngircd/ngircd.mk +3 -0
+		$(@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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH v2 1/1 package/ngircd: fix static build with openssl and atomic

Quoted 13 lines · Thomas Petazzoni
Quoted 4 lines · On Sun, 14 Apr 2019 17:51:53 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/72345ebd144bed824329618e66721a98eba3be22

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.

Quoted 5 lines

package/ngircd/ngircd.mk NGIRCD_SOURCE = ngircd-$(NGIRCD_VERSION).tar.xz · line 19

Quoted 5 lines
package/ngircd/ngircd.mk +5 -0
+# 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.

Quoted 6 lines

package/ngircd/ngircd.mk NGIRCD_SOURCE = ngircd-$(NGIRCD_VERSION).tar.xz · line 22

Quoted 3 lines
package/ngircd/ngircd.mk +3 -0
+		$(@D)/configure.ng > $(@D)/configure.ac
+
+	sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} #ansi2knr|g" \

This ${SERIAL_TESTS}

Quoted 8 lines

package/ngircd/ngircd.mk NGIRCD_SOURCE = ngircd-$(NGIRCD_VERSION).tar.xz · line 25

Quoted 3 lines
package/ngircd/ngircd.mk +3 -0
+		$(@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

Quoted 14 lines

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

#3 lore raw

PATCH v2 1/1 package/ngircd: fix static build with openssl and atomic

Quoted 6 lines · On Mon, 15 Apr 2019 23:08:00 +0200 Arnout Vandecappelle <[email protected]> wrote:
Quoted 2 lines

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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com