Skip to content

Commit

Permalink
sysutils/nut*: Correctly use libusb.so
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cschuber committed May 9, 2022
1 parent fa59329 commit 64080a2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sysutils/nut-devel/Makefile
Expand Up @@ -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}/
Expand Down
16 changes: 16 additions & 0 deletions 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) {
2 changes: 1 addition & 1 deletion sysutils/nut/Makefile
Expand Up @@ -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}/

Expand Down
16 changes: 16 additions & 0 deletions 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) {

0 comments on commit 64080a2

Please sign in to comment.