Skip to contentSkip to conversation

package/apcupsd: pass additional libusb libs for static build

PATCH New James Hilliard 2 participants 3 messages Apr 28, 2020 – Apr 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/apcupsd: pass additional libusb libs for static build

By default apcupsd only passes libs for libusb-compat, this is not sufficient for static builds which also require libusb libs.

Fixes:
http://autobuild.buildroot.net/results/747/7472fec82983f5b9c2f92578b2b20b746a8d20ae/build-end.log

---
 package/apcupsd/apcupsd.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/apcupsd/apcupsd.mk +4 -1
index ff9cc9242f..a0fda19cf3 100644
@@ -10,8 +10,11 @@ APCUPSD_LICENSE = GPL-2.0
 APCUPSD_LICENSE_FILES = COPYING
 APCUPSD_CONF_OPTS = --disable-test
 
-ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
+ifneq ($(BR2_PACKAGE_APCUPSD_MODBUS_USB)$(BR2_PACKAGE_APCUPSD_USB),)
 APCUPSD_CONF_ENV = ac_cv_path_usbcfg=$(STAGING_DIR)/usr/bin/libusb-config
+ifeq ($(BR2_STATIC_LIBS),y)
+APCUPSD_CONF_ENV += LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libusb`"
+endif
 endif
 
 ifeq ($(BR2_PACKAGE_APCUPSD_APCSMART),y)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/apcupsd: pass additional libusb libs for static build

Quoted 16 lines · On Tue, 28 Apr 2020 03:31:39 -0600 James Hilliard <[email protected]>…

By default apcupsd only passes libs for libusb-compat, this is not sufficient for static builds which also require libusb libs.

Fixes:
http://autobuild.buildroot.net/results/747/7472fec82983f5b9c2f92578b2b20b746a8d20ae/build-end.log

---
 package/apcupsd/apcupsd.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/apcupsd/apcupsd.mk +0 -0
index ff9cc9242f..a0fda19cf3 100644

package/apcupsd/apcupsd.mk APCUPSD_LICENSE = GPL-2.0 · line 16

Quoted 8 lines
package/apcupsd/apcupsd.mk +3 -1
@@ -10,8 +10,11 @@ APCUPSD_LICENSE = GPL-2.0
 APCUPSD_LICENSE_FILES = COPYING
 APCUPSD_CONF_OPTS = --disable-test
 
-ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
+ifneq ($(BR2_PACKAGE_APCUPSD_MODBUS_USB)$(BR2_PACKAGE_APCUPSD_USB),)
 APCUPSD_CONF_ENV = ac_cv_path_usbcfg=$(STAGING_DIR)/usr/bin/libusb-config
+ifeq ($(BR2_STATIC_LIBS),y)
+APCUPSD_CONF_ENV += LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libusb`"

You're using pkg-config here, but the package didn't had any dependency on host-pkgconf, so I've added that, and applied.

However, could you tweak the upstream configure.in to directly use pkg-config to detect libusb ? It already uses pkg-config to detect another library. This would simplify things quite a bit.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/apcupsd: pass additional libusb libs for static build

Quoted 32 lines · Thomas Petazzoni
Quoted 16 lines · On Tue, 28 Apr 2020 03:31:39 -0600 James Hilliard <[email protected]>…

By default apcupsd only passes libs for libusb-compat, this is not sufficient for static builds which also require libusb libs.

Fixes:
http://autobuild.buildroot.net/results/747/7472fec82983f5b9c2f92578b2b20b746a8d20ae/build-end.log

---
 package/apcupsd/apcupsd.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/apcupsd/apcupsd.mk +0 -0
index ff9cc9242f..a0fda19cf3 100644

package/apcupsd/apcupsd.mk APCUPSD_LICENSE = GPL-2.0 · line 16

Quoted 8 lines
package/apcupsd/apcupsd.mk +3 -1
@@ -10,8 +10,11 @@ APCUPSD_LICENSE = GPL-2.0
 APCUPSD_LICENSE_FILES = COPYING
 APCUPSD_CONF_OPTS = --disable-test
 
-ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
+ifneq ($(BR2_PACKAGE_APCUPSD_MODBUS_USB)$(BR2_PACKAGE_APCUPSD_USB),)
 APCUPSD_CONF_ENV = ac_cv_path_usbcfg=$(STAGING_DIR)/usr/bin/libusb-config
+ifeq ($(BR2_STATIC_LIBS),y)
+APCUPSD_CONF_ENV += LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libusb`"

You're using pkg-config here, but the package didn't had any dependency on host-pkgconf, so I've added that, and applied.

Quoted 3 lines

However, could you tweak the upstream configure.in to directly use pkg-config to detect libusb ? It already uses pkg-config to detect another library. This would simplify things quite a bit.

I'll give it a shot, upstream doesn't seem to be super active though.

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com