Skip to contentSkip to conversation

pakcage/libasio: new package

PATCH New aduskett at gmail.com 2 participants 2 messages Nov 30, 2019 – Dec 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pakcage/libasio: new package

From: Adam Duskett <[email protected]>

Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.

This is a standalone library that does not require Boost.

Tested with test-pkg -a on Debian8:
44 builds, 10 skipped, 0 build failed, 0 legal-info failed

---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/libasio/0001-fix-uclibc-eventfd.patch | 51 +++++++++++++++++++
 ...-static-linking-with-openssl-support.patch | 30 +++++++++++
 package/libasio/Config.in                     | 23 +++++++++
 package/libasio/libasio.hash                  |  3 ++
 package/libasio/libasio.mk                    | 25 +++++++++
 7 files changed, 134 insertions(+)
 create mode 100644 package/libasio/0001-fix-uclibc-eventfd.patch
 create mode 100644 package/libasio/0002-fix-static-linking-with-openssl-support.patch
 create mode 100644 package/libasio/Config.in
 create mode 100644 package/libasio/libasio.hash
 create mode 100644 package/libasio/libasio.mk
DEVELOPERS +1 -0
index 16e8510b0a..aa16a1a1ee 100644
@@ -41,6 +41,7 @@ F:	package/gstreamer1/gst1-vaapi/
 F:	package/imx-usb-loader/
 F:	package/janus-gateway/
 F:	package/json-for-modern-cpp/
+F:	package/libasio/
 F:	package/libcpprestsdk/
 F:	package/libressl/
 F:	package/libselinux/
package/Config.in +1 -0
index 37861387e8..d577f9cec8 100644
@@ -1738,6 +1738,7 @@ menu "Other"
 	source "package/jemalloc/Config.in"
 	source "package/lapack/Config.in"
 	source "package/libargtable2/Config.in"
+	source "package/libasio/Config.in"
 	source "package/libatomic_ops/Config.in"
 	source "package/libavl/Config.in"
 	source "package/libb64/Config.in"
package/libasio/0001-fix-uclibc-eventfd.patch new file +51 -0

51 lines not on this page · raw message

package/libasio/0002-fix-static-linking-with-openssl-support.patch new file +30 -0
new file mode 100644
index 0000000000..e450212938
@@ -0,0 +1,30 @@
+From 70f76fdcd127d1bd59b43f46267a21949c552026 Mon Sep 17 00:00:00 2001
+From: Adam Duskett <[email protected]>
+Date: Sat, 30 Nov 2019 14:17:10 -0800
+Subject: [PATCH] fix static linking with openssl support
+
+Dynamic builds of libcrypto would also include libz, but during static builds
+this is not true. Always specifying -lz fixes building against static builds of
+openssl.
+
+Signed-off-by: Adam Duskett <[email protected]>
+---
+ asio/configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/asio/configure.ac b/asio/configure.ac
+index 2e20b84..ca74108 100644
+--- a/asio/configure.ac
++++ b/asio/configure.ac
+@@ -60,7 +60,7 @@ AC_CHECK_HEADER([openssl/ssl.h],,
+ ],[])
+ 
+ if test x$OPENSSL_FOUND != xno; then
+-  LIBS="$LIBS -lssl -lcrypto"
++  LIBS="$LIBS -lssl -lcrypto -lz"
+ fi
+ 
+ AM_CONDITIONAL(HAVE_OPENSSL,test x$OPENSSL_FOUND != xno)
+-- 
+2.23.0
+
package/libasio/Config.in new file +23 -0
new file mode 100644
index 0000000000..8689018d8a
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_LIBASIO
+	bool "libasio"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_USE_WCHAR
+	depends on BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # exception_ptr
+	help
+	  Asio is a cross-platform C++ library for network and low-level
+	  I/O programming that provides developers with a consistent
+	  asynchronous model using a modern C++ approach.
+
+	  This is a standalone library that does not require Boost.
+
+	  https://github.com/chriskohlhoff/asio
+
+comment "libasio needs a toolchain w/ C++, dynamic library, wchar"
+	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
+
+comment "libasio needs exception_ptr"
+	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
package/libasio/libasio.hash new file +3 -0
new file mode 100644
index 0000000000..4ceb4984ca
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 bdb01a649c24d73ca4a836662e7af442d935313ed6deef6b07f17f3bc5f78d7a	libasio-asio-1-14-0.tar.gz
+sha256 c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566	asio/LICENSE_1_0.txt
package/libasio/libasio.mk new file +25 -0
new file mode 100644
index 0000000000..776388b288
@@ -0,0 +1,25 @@
+################################################################################
+#
+# libasio
+#
+################################################################################
+
+LIBASIO_VERSION = asio-1-14-0
+LIBASIO_SITE = $(call github,chriskohlhoff,asio,$(LIBASIO_VERSION))
+LIBASIO_SUBDIR = asio
+LIBASIO_AUTORECONF = YES
+# Headers only
+LIBASIO_INSTALL_TARGET = NO
+LIBASIO_INSTALL_STAGING = YES
+LIBASIO_LICENSE = BSL-1.0
+LIBASIO_LICENSE_FILES = asio/LICENSE_1_0.txt
+LIBASIO_CONF_OPTS = --without-boost
+
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+LIBASIO_DEPENDENCIES += openssl
+LIBASIO_CONF_OPTS += --with-openssl
+else
+LIBASIO_CONF_OPTS += --without-openssl
+endif
+
+$(eval $(autotools-package))
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 pakcage/libasio: new package

Hello Adam,

Minor nit: pakcage -> package in the commit title. See below for more comments.

Quoted 20 lines · On Sat, 30 Nov 2019 15:29:31 -0800 aduskett at gmail.com wrote:
package/libasio/0002-fix-static-linking-with-openssl-support.patch new file +14 -0
new file mode 100644
index 0000000000..e450212938
@@ -0,0 +1,30 @@
+From 70f76fdcd127d1bd59b43f46267a21949c552026 Mon Sep 17 00:00:00 2001
+From: Adam Duskett <[email protected]>
+Date: Sat, 30 Nov 2019 14:17:10 -0800
+Subject: [PATCH] fix static linking with openssl support
+
+Dynamic builds of libcrypto would also include libz, but during static builds
+this is not true. Always specifying -lz fixes building against static builds of
+openssl.
+
+Signed-off-by: Adam Duskett <[email protected]>
+---
+ asio/configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/libasio/0002-fix-static-linking-with-openssl-support.patch line 24

Quoted 10 lines
package/libasio/0002-fix-static-linking-with-openssl-support.patch new file +10 -0
+diff --git a/asio/configure.ac b/asio/configure.ac
+index 2e20b84..ca74108 100644
+--- a/asio/configure.ac
++++ b/asio/configure.ac
+@@ -60,7 +60,7 @@ AC_CHECK_HEADER([openssl/ssl.h],,
+ ],[])
+ 
+ if test x$OPENSSL_FOUND != xno; then
+-  LIBS="$LIBS -lssl -lcrypto"
++  LIBS="$LIBS -lssl -lcrypto -lz"

It is a bit sad that this is forced in all builds. We generally handle this either by using pkg-config in the .ac file (best) or alternatively, by using pkg-config in the .mk file, and passing the appropriate LIBS option in <pkg>_CONF_ENV.

However, this library is a header-only library, so it doesn't really need to link with OpenSSL or bother with static linking issues. Only the examples/tests need that.

So I'd say that a better solution is a patch that adds --disable-examples/--disable-tests options, and then uses them.

package/libasio/Config.in line 6

Quoted 12 lines
package/libasio/Config.in new file +6 -0
new file mode 100644
index 0000000000..8689018d8a
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_LIBASIO
+	bool "libasio"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_USE_WCHAR
+	depends on BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS

Could you explain this dependency? Indeed, this dependency is already part of BR2_TOOLCHAIN_HAS_GCC_BUG_64735.

Thanks!

Thomas

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