net-misc/dibbler: Fix call to undeclared function pthread_kill

Closes: https://bugs.gentoo.org/897944
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/31240
Signed-off-by: Bernard Cafarelli <voyageur@gentoo.org>
This commit is contained in:
Brahmajit Das
2023-06-01 06:27:13 +00:00
committed by Bernard Cafarelli
parent e4fbab63c9
commit 2f0e774294
2 changed files with 140 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit flag-o-matic readme.gentoo-r1 systemd
DESCRIPTION="Portable DHCPv6 implementation (server, client and relay)"
HOMEPAGE="http://klub.com.pl/dhcpv6/"
SRC_URI="http://klub.com.pl/dhcpv6/dibbler/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~hppa ~mips ~x86"
IUSE="doc resolvconf"
RDEPEND="resolvconf? ( virtual/resolvconf )"
DEPEND="${RDEPEND}
doc? ( dev-texlive/texlive-latexextra )"
PATCHES=(
"${FILESDIR}"/${P}-fno-common.patch
"${FILESDIR}"/${P}-gnu-ism.patch
"${FILESDIR}"/${P}-clang-16-musl-fix.patch
)
DOC_CONTENTS="Make sure that you modify client.conf, server.conf and/or relay.conf
to suit your needs. They are stored in /etc/dibbler"
src_configure() {
# ODR violations, bug #861611
filter-lto
# Uses removed 'register' keyword
append-cxxflags -std=c++14
econf $(use_enable resolvconf)
}
src_compile() {
default
# devel documentation is broken and users should consult the online version
# http://klub.com.pl/dhcpv6/doxygen/
use doc && emake -C doc/ user
}
src_install() {
default
readme.gentoo_create_doc
dosbin dibbler-{client,relay,server}
doman doc/man/*.8
insinto /etc/dibbler
doins doc/examples/*.conf
keepdir /var/lib/dibbler
dodoc AUTHORS CHANGELOG RELNOTES TODO
use doc && dodoc doc/dibbler-user.pdf
doinitd "${FILESDIR}"/dibbler-{client,relay,server}
systemd_dounit "${FILESDIR}"/dibbler-client.service
}
pkg_postinst() {
readme.gentoo_print_elog
}

View File

@@ -0,0 +1,74 @@
From: Brahmajit Das <brahmajit.xyz@gmail.com>
Date: Wed, 31 May 2023 06:27:08 +0000
Subject: [PATCH] Fix build with clang 16
Especially on musl libc.
On musl libc with clang-16, the function pthread_kill can't be found, as its
only available if the FTM is enabled. Hence defining _GNU_SOURCE makes thie
function available.
Other than that this patch also renames the variable lock, to fix the following
error: ./Port-linux/dibbler-client.cpp:48:27: error: reference to 'lock' is
ambiguous. I'm exactly not sure what the errors are, but I'm guessing it's
related to CPP namespaces. Not sure either why its not reproducable under glibc
llvm.
Bug: https://bugs.gentoo.org/897944
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
--- a/Port-linux/dibbler-client.cpp
+++ b/Port-linux/dibbler-client.cpp
@@ -26,7 +26,7 @@ using namespace std;
#define IF_RECONNECTED_DETECTED -1
-extern pthread_mutex_t lock;
+extern pthread_mutex_t plock;
TDHCPClient* ptr = 0;
@@ -44,8 +44,8 @@ void signal_handler(int n) {
#ifdef MOD_CLNT_CONFIRM
void signal_handler_of_linkstate_change(int n) {
Log(Notice) << "Network switch off event detected. initiating CONFIRM." << LogEnd;
- pthread_mutex_lock(&lock);
- pthread_mutex_unlock(&lock);
+ pthread_mutex_lock(&plock);
+ pthread_mutex_unlock(&plock);
}
#endif
--- a/Port-linux/lowlevel-linux-link-state.c
+++ b/Port-linux/lowlevel-linux-link-state.c
@@ -10,6 +10,7 @@
#ifdef MOD_CLNT_CONFIRM
#define __USE_UNIX98
+#define _GNU_SOURCE
#include <stdio.h>
#include <signal.h>
@@ -34,7 +35,7 @@ volatile int * notifier = 0;
int isDone = 0;
pthread_t parent_id;
pthread_t ntid;
-pthread_mutex_t lock;
+pthread_mutex_t plock;
struct state {
int id;
@@ -86,9 +87,9 @@ void link_state_changed(int ifindex)
{
if (changed_links->cnt<16)
changed_links->ifindex[changed_links->cnt++] = ifindex;
- pthread_mutex_lock(&lock);
+ pthread_mutex_lock(&plock);
*notifier = 1; /* notify that change has occured */
- pthread_mutex_unlock(&lock);
+ pthread_mutex_unlock(&plock);
pthread_kill(parent_id,SIGUSR1);
} else
{
--
2.40.1