commit:     5fed5ddcd0f58347c03970a507017b3eaeba6a52
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 10 04:17:19 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul 10 04:22:40 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5fed5ddc

net-wireless/wireless-tools: fix musl build

Closes: https://bugs.gentoo.org/958314
Thanks-to: Samuel Blythe <metroidhunter9000 <AT> proton.me>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/wireless-tools-29-musl.patch             | 20 +++++++
 .../wireless-tools-30_pre9-r2.ebuild               | 63 ++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/net-wireless/wireless-tools/files/wireless-tools-29-musl.patch 
b/net-wireless/wireless-tools/files/wireless-tools-29-musl.patch
new file mode 100644
index 000000000000..4af5628225f9
--- /dev/null
+++ b/net-wireless/wireless-tools/files/wireless-tools-29-musl.patch
@@ -0,0 +1,20 @@
+https://bugs.gentoo.org/958314
+
+Fixes compilation error against musl-libc, like in 
https://github.com/md-raid-utilities/mdadm/issues/12#issuecomment-2119880626
+
+Patch by Samuel Blythe <[email protected]>
+--- a/ifrename.c
++++ b/ifrename.c
+@@ -52,6 +52,12 @@
+ 
+ #include "iwlib.h"            /* Wireless Tools library */
+ 
++/* Ensure GNU basename behavior for musl libc */
++#ifndef __GLIBC__
++#define basename(path) \
++       (strrchr((path),'/') ? strrchr((path),'/')+1 : (path))
++#endif
++
+ // This would be cool, unfortunately...
+ //#include <linux/ethtool.h>  /* Ethtool stuff -> struct ethtool_drvinfo */
+ 

diff --git a/net-wireless/wireless-tools/wireless-tools-30_pre9-r2.ebuild 
b/net-wireless/wireless-tools/wireless-tools-30_pre9-r2.ebuild
new file mode 100644
index 000000000000..53d69334c7ce
--- /dev/null
+++ b/net-wireless/wireless-tools/wireless-tools-30_pre9-r2.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+# The following works with both pre-releases and releases
+MY_P=${PN/-/_}.${PV/_/.}
+S="${WORKDIR}/${MY_P/\.pre*/}"
+
+DESCRIPTION="A collection of tools to configure IEEE 802.11 wireless LAN cards"
+HOMEPAGE="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html";
+SRC_URI="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/${MY_P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+IUSE="multicall"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-29-asneeded.patch
+       "${FILESDIR}"/${PN}-29-musl.patch
+)
+
+src_prepare() {
+       default
+
+       sed -i \
+               -e "s:^\(CC\) = gcc:\1 = $(tc-getCC):" \
+               -e "s:^\(AR\) = ar:\1 = $(tc-getAR):" \
+               -e "s:^\(RANLIB\) = ranlib:\1 = $(tc-getRANLIB):" \
+               -e "s:^\(CFLAGS=-Os\):#\1:" \
+               -e "s:\(@\$(LDCONFIG).*\):#\1:" \
+               -e "s:^\(INSTALL_MAN= \$(PREFIX)\)/man:\1/usr/share/man:" \
+               -e "s:^\(INSTALL_LIB= \$(PREFIX)\)/lib:\1/$(get_libdir)/:" \
+               -e "s:^\(INSTALL_INC= \$(PREFIX)\)/include:\1/usr/include:" \
+               -e "s:^\(BUILD_STATIC = y\):#\1:" \
+               -e '/\$(CC)/s:-Wl,-s\>::' \
+               "${S}"/Makefile || die
+}
+
+src_compile() {
+       emake
+
+       use multicall && emake iwmulticall
+}
+
+src_install() {
+       emake PREFIX="${ED}" install
+
+       if use multicall; then
+               # 'make install-iwmulticall' will overwrite some of the tools
+               # with symlinks - this is intentional (brix)
+               emake PREFIX="${ED}" install-iwmulticall
+       fi
+
+       has cs ${LINGUAS-cs} || rm -rf "${ED}"/usr/share/man/cs
+       has fr ${LINGUAS-fr} || rm -rf 
"${ED}"/usr/share/man/fr.{ISO8859-1,UTF-8}
+
+       dodoc CHANGELOG.h HOTPLUG-UDEV.txt IFRENAME-VS-XXX.txt PCMCIA.txt README
+       has fr ${LINGUAS-fr} && dodoc README.fr
+}

Reply via email to