git: 64080a2f32ba - main - sysutils/nut*: Correctly use libusb.so

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Mon, 09 May 2022 18:11:29 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=64080a2f32ba282291fec3f9b4c6d37c7594b723

commit 64080a2f32ba282291fec3f9b4c6d37c7594b723
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-05-09 17:10:33 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-05-09 17:49:29 +0000

    sysutils/nut*: Correctly use libusb.so
    
    FreeBSD has no libusb-1.0.so, even though pkgconf identifies it as such.
    The ABI is the same but the name is different.
    
    Reported by:    Paul Arakelyan <paul.arakelyan@gmail.com>
---
 sysutils/nut-devel/Makefile                              |  2 +-
 .../files/patch-tools_nut-scanner_nutscan-init.c         | 16 ++++++++++++++++
 sysutils/nut/Makefile                                    |  2 +-
 .../nut/files/patch-tools_nut-scanner_nutscan-init.c     | 16 ++++++++++++++++
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/sysutils/nut-devel/Makefile b/sysutils/nut-devel/Makefile
index 7aea1a1f7a28..d72db98f03a0 100644
--- a/sysutils/nut-devel/Makefile
+++ b/sysutils/nut-devel/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	nut
 PORTVERSION=	${NUT_COMMIT_DATE}
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	sysutils
 PKGNAMESUFFIX=	-devel
 # MASTER_SITES=	http://www.networkupstools.org/source/${PORTVERSION:R}/
diff --git a/sysutils/nut-devel/files/patch-tools_nut-scanner_nutscan-init.c b/sysutils/nut-devel/files/patch-tools_nut-scanner_nutscan-init.c
new file mode 100644
index 000000000000..bc341494ce73
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-tools_nut-scanner_nutscan-init.c
@@ -0,0 +1,16 @@
+diff --git tools/nut-scanner/nutscan-init.c.orig tools/nut-scanner/nutscan-init.c
+index 9ea3f5d..13f4e78 100644
+--- tools/nut-scanner/nutscan-init.c.orig
++++ tools/nut-scanner/nutscan-init.c
+@@ -133,7 +133,11 @@ void nutscan_init(void)
+ 	char *libname = NULL;
+ #ifdef WITH_USB
+  #if WITH_LIBUSB_1_0
++  #ifdef __FreeBSD__
++	libname = get_libname("libusb.so");
++  #else
+ 	libname = get_libname("libusb-1.0.so");
++  #endif
+  #else
+ 	libname = get_libname("libusb-0.1.so");
+ 	if (!libname) {
diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile
index fcb96c79ad9d..d91fe5efc9fc 100644
--- a/sysutils/nut/Makefile
+++ b/sysutils/nut/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	nut
 PORTVERSION=	2.8.0
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www.networkupstools.org/source/${PORTVERSION:R}/
 
diff --git a/sysutils/nut/files/patch-tools_nut-scanner_nutscan-init.c b/sysutils/nut/files/patch-tools_nut-scanner_nutscan-init.c
new file mode 100644
index 000000000000..bc341494ce73
--- /dev/null
+++ b/sysutils/nut/files/patch-tools_nut-scanner_nutscan-init.c
@@ -0,0 +1,16 @@
+diff --git tools/nut-scanner/nutscan-init.c.orig tools/nut-scanner/nutscan-init.c
+index 9ea3f5d..13f4e78 100644
+--- tools/nut-scanner/nutscan-init.c.orig
++++ tools/nut-scanner/nutscan-init.c
+@@ -133,7 +133,11 @@ void nutscan_init(void)
+ 	char *libname = NULL;
+ #ifdef WITH_USB
+  #if WITH_LIBUSB_1_0
++  #ifdef __FreeBSD__
++	libname = get_libname("libusb.so");
++  #else
+ 	libname = get_libname("libusb-1.0.so");
++  #endif
+  #else
+ 	libname = get_libname("libusb-0.1.so");
+ 	if (!libname) {