From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] libknet1: musl fix
Date: Thu, 05 Sep 2019 11:11:35 +0200 [thread overview]
Message-ID: <20190905091135.BKE2uTLCRDYvIOES9PKEpskuzDZhBIQ9vNHEHxofkqA@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-14215@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 466 bytes --]
There is an updated pull request by jirib against master on the void-packages repository
https://github.com/jirib/void-packages libknet1
https://github.com/void-linux/void-packages/pull/14215
libknet1: musl fix
Upstream provided musl fix, I took diff and applied to latest release, see https://github.com/kronosnet/kronosnet/commit/512e433b0b3d8bf14818dcb8c8eb7748d7e899be
A patch file from https://github.com/void-linux/void-packages/pull/14215.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libknet1-14215.patch --]
[-- Type: text/x-diff, Size: 11098 bytes --]
From cffffe58950cf7ce64dddd925a8748941fa60d8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20B=C4=9Blka?= <jirib79@gmail.com>
Date: Wed, 4 Sep 2019 23:59:15 +0200
Subject: [PATCH] libknet1: musl fix
---
srcpkgs/libknet1/patches/01_musl_fix.diff | 210 ++++++++++++++++++++++
srcpkgs/libknet1/template | 56 ++++--
srcpkgs/libnozzle1 | 1 +
srcpkgs/libnozzle1-devel | 1 +
4 files changed, 253 insertions(+), 15 deletions(-)
create mode 100644 srcpkgs/libknet1/patches/01_musl_fix.diff
create mode 120000 srcpkgs/libnozzle1
create mode 120000 srcpkgs/libnozzle1-devel
diff --git a/srcpkgs/libknet1/patches/01_musl_fix.diff b/srcpkgs/libknet1/patches/01_musl_fix.diff
new file mode 100644
index 00000000000..f636c79bb8d
--- /dev/null
+++ b/srcpkgs/libknet1/patches/01_musl_fix.diff
@@ -0,0 +1,210 @@
+https://github.com/kronosnet/kronosnet/commit/512e433b0b3d8bf14818dcb8c8eb7748d7e899be
+
+diff --git a/configure.ac b/configure.ac
+index 778b12a5..e430aeb8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -205,6 +205,10 @@ AC_SEARCH_LIBS([dlopen], [dl dld], , [AC_MSG_ERROR([dlopen not found])])
+ AC_SUBST([dl_LIBS], [$LIBS])
+ LIBS="$saved_LIBS"
+
++# Check RTLD_DI_ORIGIN (not decalred by musl. glibc has it as an enum so cannot use ifdef)
++AC_CHECK_DECL([RTLD_DI_ORIGIN], [AC_DEFINE([HAVE_RTLD_DI_ORIGIN], 1,
++ [define when RTLD_DI_ORIGIN is declared])], ,[[#include <dlfcn.h>]])
++
+ # OS detection
+
+ AC_MSG_CHECKING([for os in ${host_os}])
+diff --git a/libknet/common.c b/libknet/common.c
+index 00907c91..ed8ac899 100644
+--- a/libknet/common.c
++++ b/libknet/common.c
+@@ -12,6 +12,8 @@
+ #include <fcntl.h>
+ #include <dlfcn.h>
+ #include <errno.h>
++#include <libgen.h>
++#include <link.h>
+ #include <string.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+@@ -54,6 +56,30 @@ int _fdset_nonblock(int fd)
+ return 0;
+ }
+
++static int get_lib_dir(void *lib_handle, char dir[MAXPATHLEN])
++{
++ int res;
++#ifndef HAVE_RTLD_DI_ORIGIN
++ struct link_map *lm;
++ char l_name[MAXPATHLEN];
++#endif
++
++#ifdef HAVE_RTLD_DI_ORIGIN
++ res = dlinfo(lib_handle, RTLD_DI_ORIGIN, dir);
++#else
++ /*
++ * musl libc doesn't support RTLD_DI_ORIGIN
++ */
++ res = dlinfo(lib_handle, RTLD_DI_LINKMAP, &lm);
++ if (res == 0) {
++ snprintf(l_name, sizeof(l_name), "%s", lm->l_name);
++ snprintf(dir, MAXPATHLEN, "%s", dirname(l_name));
++ }
++#endif
++
++ return res;
++}
++
+ static void *open_lib(knet_handle_t knet_h, const char *libname, int extra_flags)
+ {
+ void *ret = NULL;
+@@ -81,7 +107,7 @@ static void *open_lib(knet_handle_t knet_h, const char *libname, int extra_flags
+ memset(dir, 0, sizeof(dir));
+ memset(link, 0, sizeof(link));
+ memset(path, 0, sizeof(path));
+- if (dlinfo(ret, RTLD_DI_ORIGIN, &dir) < 0) {
++ if (get_lib_dir(ret, dir) < 0) {
+ /*
+ * should we dlclose and return error?
+ */
+diff --git a/libknet/compat.c b/libknet/compat.c
+index e808f332..2e73c9fc 100644
+--- a/libknet/compat.c
++++ b/libknet/compat.c
+@@ -22,7 +22,7 @@
+ #include <sys/types.h>
+ #include <sys/event.h>
+ #include <sys/time.h>
+-#include <sys/errno.h>
++#include <errno.h>
+
+ static int32_t
+ _poll_to_filter_(int32_t event)
+diff --git a/libknet/crypto.c b/libknet/crypto.c
+index afa4f88c..2c4d5f5c 100644
+--- a/libknet/crypto.c
++++ b/libknet/crypto.c
+@@ -8,7 +8,7 @@
+
+ #include "config.h"
+
+-#include <sys/errno.h>
++#include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <pthread.h>
+diff --git a/libknet/handle.c b/libknet/handle.c
+index fcb129a7..6ecc91f7 100644
+--- a/libknet/handle.c
++++ b/libknet/handle.c
+@@ -456,9 +456,24 @@ static void _close_epolls(knet_handle_t knet_h)
+ static int _start_threads(knet_handle_t knet_h)
+ {
+ int savederrno = 0;
++ pthread_attr_t attr;
+
+ set_thread_status(knet_h, KNET_THREAD_PMTUD, KNET_THREAD_REGISTERED);
+- savederrno = pthread_create(&knet_h->pmtud_link_handler_thread, 0,
++
++ savederrno = pthread_attr_init(&attr);
++ if (savederrno) {
++ log_err(knet_h, KNET_SUB_HANDLE, "Unable to init pthread attributes: %s",
++ strerror(savederrno));
++ goto exit_fail;
++ }
++ savederrno = pthread_attr_setstacksize(&attr, KNET_THREAD_STACK_SIZE);
++ if (savederrno) {
++ log_err(knet_h, KNET_SUB_HANDLE, "Unable to set stack size attribute: %s",
++ strerror(savederrno));
++ goto exit_fail;
++ }
++
++ savederrno = pthread_create(&knet_h->pmtud_link_handler_thread, &attr,
+ _handle_pmtud_link_thread, (void *) knet_h);
+ if (savederrno) {
+ log_err(knet_h, KNET_SUB_HANDLE, "Unable to start pmtud link thread: %s",
+@@ -467,7 +482,7 @@ static int _start_threads(knet_handle_t knet_h)
+ }
+
+ set_thread_status(knet_h, KNET_THREAD_DST_LINK, KNET_THREAD_REGISTERED);
+- savederrno = pthread_create(&knet_h->dst_link_handler_thread, 0,
++ savederrno = pthread_create(&knet_h->dst_link_handler_thread, &attr,
+ _handle_dst_link_handler_thread, (void *) knet_h);
+ if (savederrno) {
+ log_err(knet_h, KNET_SUB_HANDLE, "Unable to start dst cache thread: %s",
+@@ -476,7 +491,7 @@ static int _start_threads(knet_handle_t knet_h)
+ }
+
+ set_thread_status(knet_h, KNET_THREAD_TX, KNET_THREAD_REGISTERED);
+- savederrno = pthread_create(&knet_h->send_to_links_thread, 0,
++ savederrno = pthread_create(&knet_h->send_to_links_thread, &attr,
+ _handle_send_to_links_thread, (void *) knet_h);
+ if (savederrno) {
+ log_err(knet_h, KNET_SUB_HANDLE, "Unable to start datafd to link thread: %s",
+@@ -485,7 +500,7 @@ static int _start_threads(knet_handle_t knet_h)
+ }
+
+ set_thread_status(knet_h, KNET_THREAD_RX, KNET_THREAD_REGISTERED);
+- savederrno = pthread_create(&knet_h->recv_from_links_thread, 0,
++ savederrno = pthread_create(&knet_h->recv_from_links_thread, &attr,
+ _handle_recv_from_links_thread, (void *) knet_h);
+ if (savederrno) {
+ log_err(knet_h, KNET_SUB_HANDLE, "Unable to start link to datafd thread: %s",
+@@ -494,7 +509,7 @@ static int _start_threads(knet_handle_t knet_h)
+ }
+
+ set_thread_status(knet_h, KNET_THREAD_HB, KNET_THREAD_REGISTERED);
+- savederrno = pthread_create(&knet_h->heartbt_thread, 0,
++ savederrno = pthread_create(&knet_h->heartbt_thread, &attr,
+ _handle_heartbt_thread, (void *) knet_h);
+ if (savederrno) {
+ log_err(knet_h, KNET_SUB_HANDLE, "Unable to start heartbeat thread: %s",
+@@ -502,6 +517,15 @@ static int _start_threads(knet_handle_t knet_h)
+ goto exit_fail;
+ }
+
++ savederrno = pthread_attr_destroy(&attr);
++ if (savederrno) {
++ log_err(knet_h, KNET_SUB_HANDLE, "Unable to destroy pthread attributes: %s",
++ strerror(savederrno));
++ /*
++ * Do not return error code. Error is not critical.
++ */
++ }
++
+ return 0;
+
+ exit_fail:
+diff --git a/libknet/internals.h b/libknet/internals.h
+index 3911b847..13530687 100644
+--- a/libknet/internals.h
++++ b/libknet/internals.h
+@@ -37,6 +37,14 @@
+
+ #define KNET_INTERNAL_DATA_CHANNEL KNET_DATAFD_MAX
+
++/*
++ * Size of threads stack. Value is choosen by experimenting, how much is needed
++ * to sucesfully finish test suite, and at the time of writing patch it was
++ * ~300KiB. To have some room for future enhancement it is increased
++ * by factor of 3 and rounded.
++ */
++#define KNET_THREAD_STACK_SIZE (1024 * 1024)
++
+ typedef void *knet_transport_link_t; /* per link transport handle */
+ typedef void *knet_transport_t; /* per knet_h transport handle */
+ struct knet_transport_ops; /* Forward because of circular dependancy */
+diff --git a/libknet/onwire.c b/libknet/onwire.c
+index 143ac4b7..e3fd293b 100644
+--- a/libknet/onwire.c
++++ b/libknet/onwire.c
+@@ -8,7 +8,7 @@
+
+ #include "config.h"
+
+-#include <sys/errno.h>
++#include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+
diff --git a/srcpkgs/libknet1/template b/srcpkgs/libknet1/template
index 95cd2b8bef2..ea87c510409 100644
--- a/srcpkgs/libknet1/template
+++ b/srcpkgs/libknet1/template
@@ -1,16 +1,15 @@
# Template file for 'libknet1'
-# only library and development files now, if interested in kronosnetd update!
+# only libraries and development files now, if interested in kronosnetd update!
pkgname=libknet1
version=1.11
-revision=1
+revision=2
wrksrc=kronosnet-${version}
build_style=gnu-configure
-configure_args="--disable-crypto-nss --disable-dependency-tracking
- --disable-libknet-sctp --disable-libnozzle --disable-kronosnetd --disable-poc
- --disable-static"
-hostmakedepends="doxygen libxml2-devel pkg-config libqb-devel"
-makedepends="bzip2-devel liblz4-devel liblzma-devel libqb-devel libressl-devel
- libxml2-devel libzstd-devel lzo-devel zlib-devel"
+configure_args="--disable-dependency-tracking --disable-libknet-sctp
+ --disable-kronosnetd --disable-poc --disable-static"
+hostmakedepends="automake doxygen libtool libxml2-devel pkg-config libqb-devel"
+makedepends="bzip2-devel liblz4-devel liblzma-devel libnl3-devel libqb-devel
+ libressl-devel libxml2-devel libzstd-devel lzo-devel nss-devel zlib-devel"
short_desc="Kronosnet core switching implementation (libraries)"
maintainer="Jiří Bělka <jirib79@gmail.com>"
license="GPL-2.0-or-later, LGPL-2.1-only"
@@ -18,9 +17,16 @@ homepage="https://www.kronosnet.org"
distfiles="https://kronosnet.org/releases/kronosnet-${version}.tar.bz2"
checksum=c2ee20a9b5b0791ed5379b38b0b51d549603933925a839f045455553f03e6114
-if [ "$XBPS_TARGET_LIBC" = musl ]; then
- broken="Uses dlinfo RTLD_DI_ORIGIN and other runtime issues"
-fi
+#if [ "$XBPS_TARGET_LIBC" = musl ]; then
+# broken="Uses dlinfo RTLD_DI_ORIGIN and other runtime issues"
+#fi
+
+patch_args='-Np1'
+
+pre_configure() {
+# aclocal --install -Im4
+ autoreconf -fi
+}
post_install() {
rm -rf ${DESTDIR}/usr/share/doc/kronosnet
@@ -31,9 +37,29 @@ libknet1-devel_package() {
depends="libknet1>=${version}_${revision}"
short_desc="Kronosnet core switching implementation (development files)"
pkg_install() {
- vmove usr/include
- vmove "usr/lib/*.so"
- vmove "usr/lib/pkgconfig"
- vmove usr/share/man/man3
+ vmove usr/include/libknet.h
+ vmove usr/lib/libknet.so
+ vmove usr/lib/pkgconfig/libknet.pc
+ vmove "usr/share/man/man3/knet*"
+ }
+}
+
+libnozzle1_package() {
+ short_desc="Userland wrapper around kernel tap devices"
+ pkg_install() {
+ vdoc README
+ vmove "usr/include/libnozzle.so.*"
+ }
+}
+
+
+libnozzle1-devel_package() {
+ depends="libnozzle1>=${version}_${revision}"
+ short_desc="Userland wrapper around kernel tap devices (development files)"
+ pkg_install() {
+ vmove usr/include/libnozzle.h
+ vmove usr/lib/libnozzle.so
+ vmove usr/lib/pkgconfig/libnozzle.pc
+ vmove "usr/share/man/man3/nozzle*"
}
}
diff --git a/srcpkgs/libnozzle1 b/srcpkgs/libnozzle1
new file mode 120000
index 00000000000..0dca2d60545
--- /dev/null
+++ b/srcpkgs/libnozzle1
@@ -0,0 +1 @@
+libknet1
\ No newline at end of file
diff --git a/srcpkgs/libnozzle1-devel b/srcpkgs/libnozzle1-devel
new file mode 120000
index 00000000000..0dca2d60545
--- /dev/null
+++ b/srcpkgs/libnozzle1-devel
@@ -0,0 +1 @@
+libknet1
\ No newline at end of file
next prev parent reply other threads:[~2019-09-05 9:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 22:01 [PR PATCH] " voidlinux-github
2019-09-04 22:31 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-04 22:31 ` voidlinux-github
2019-09-04 23:05 ` voidlinux-github
2019-09-04 23:05 ` voidlinux-github
2019-09-04 23:37 ` voidlinux-github
2019-09-04 23:37 ` voidlinux-github
2019-09-05 9:11 ` voidlinux-github
2019-09-05 9:11 ` voidlinux-github [this message]
2019-09-05 10:26 ` voidlinux-github
2019-09-05 10:26 ` voidlinux-github
2019-09-05 10:58 ` voidlinux-github
2019-09-05 10:58 ` voidlinux-github
2019-09-05 11:26 ` voidlinux-github
2019-09-05 12:11 ` voidlinux-github
2019-09-05 17:42 ` [PR PATCH] [Merged]: " voidlinux-github
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190905091135.BKE2uTLCRDYvIOES9PKEpskuzDZhBIQ9vNHEHxofkqA@z \
--to=voidlinux-github@inbox.vuxu.org \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).