Re: [OpenWrt-Devel] [PATCH] libusb-compat: fix build with musl

2015-06-18 Thread Jo-Philipp Wich
Hi Álvaro,

I see. The proper place to fix it is flashrom, it needs to include
sys/types.h before including libusb headers and its Makefile needs to
define -D_GNU_SOURCE or -std=gnu99


Regards,
Jow
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] libusb-compat: fix build with musl

2015-06-17 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com
---
 package/libs/libusb-compat/Makefile|   4 +-
 .../patches/001-fix-musl-stdint.patch  | 185 +
 2 files changed, 187 insertions(+), 2 deletions(-)
 create mode 100644 package/libs/libusb-compat/patches/001-fix-musl-stdint.patch

diff --git a/package/libs/libusb-compat/Makefile 
b/package/libs/libusb-compat/Makefile
index 561091f..c1cb587 100644
--- a/package/libs/libusb-compat/Makefile
+++ b/package/libs/libusb-compat/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2010-2014 OpenWrt.org
+# Copyright (C) 2010-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libusb-compat
 PKG_VERSION:=0.1.4
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=@SF/libusb
diff --git a/package/libs/libusb-compat/patches/001-fix-musl-stdint.patch 
b/package/libs/libusb-compat/patches/001-fix-musl-stdint.patch
new file mode 100644
index 000..333bc09
--- /dev/null
+++ b/package/libs/libusb-compat/patches/001-fix-musl-stdint.patch
@@ -0,0 +1,185 @@
+--- a/libusb/usb.h
 b/libusb/usb.h
+@@ -27,6 +27,7 @@
+ 
+ #include unistd.h
+ #include stdlib.h
++#include stdint.h
+ #include limits.h
+ 
+ #include dirent.h
+@@ -78,40 +79,40 @@
+ 
+ /* All standard descriptors have these 2 fields in common */
+ struct usb_descriptor_header {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
++  uint8_t  bLength;
++  uint8_t  bDescriptorType;
+ };
+ 
+ /* String descriptor */
+ struct usb_string_descriptor {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
+-  u_int16_t wData[1];
++  uint8_t  bLength;
++  uint8_t  bDescriptorType;
++  uint16_t wData[1];
+ };
+ 
+ /* HID descriptor */
+ struct usb_hid_descriptor {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
+-  u_int16_t bcdHID;
+-  u_int8_t  bCountryCode;
+-  u_int8_t  bNumDescriptors;
+-  /* u_int8_t  bReportDescriptorType; */
+-  /* u_int16_t wDescriptorLength; */
++  uint8_t  bLength;
++  uint8_t  bDescriptorType;
++  uint16_t bcdHID;
++  uint8_t  bCountryCode;
++  uint8_t  bNumDescriptors;
++  /* uint8_t  bReportDescriptorType; */
++  /* uint16_t wDescriptorLength; */
+   /* ... */
+ };
+ 
+ /* Endpoint descriptor */
+ #define USB_MAXENDPOINTS  32
+ struct usb_endpoint_descriptor {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
+-  u_int8_t  bEndpointAddress;
+-  u_int8_t  bmAttributes;
+-  u_int16_t wMaxPacketSize;
+-  u_int8_t  bInterval;
+-  u_int8_t  bRefresh;
+-  u_int8_t  bSynchAddress;
++  uint8_t  bLength;
++  uint8_t  bDescriptorType;
++  uint8_t  bEndpointAddress;
++  uint8_t  bmAttributes;
++  uint16_t wMaxPacketSize;
++  uint8_t  bInterval;
++  uint8_t  bRefresh;
++  uint8_t  bSynchAddress;
+ 
+   unsigned char *extra;   /* Extra descriptors */
+   int extralen;
+@@ -129,15 +130,15 @@ struct usb_endpoint_descriptor {
+ /* Interface descriptor */
+ #define USB_MAXINTERFACES 32
+ struct usb_interface_descriptor {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
+-  u_int8_t  bInterfaceNumber;
+-  u_int8_t  bAlternateSetting;
+-  u_int8_t  bNumEndpoints;
+-  u_int8_t  bInterfaceClass;
+-  u_int8_t  bInterfaceSubClass;
+-  u_int8_t  bInterfaceProtocol;
+-  u_int8_t  iInterface;
++  uint8_t  bLength;
++  uint8_t  bDescriptorType;
++  uint8_t  bInterfaceNumber;
++  uint8_t  bAlternateSetting;
++  uint8_t  bNumEndpoints;
++  uint8_t  bInterfaceClass;
++  uint8_t  bInterfaceSubClass;
++  uint8_t  bInterfaceProtocol;
++  uint8_t  iInterface;
+ 
+   struct usb_endpoint_descriptor *endpoint;
+ 
+@@ -155,14 +156,14 @@ struct usb_interface {
+ /* Configuration descriptor information.. */
+ #define USB_MAXCONFIG 8
+ struct usb_config_descriptor {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
+-  u_int16_t wTotalLength;
+-  u_int8_t  bNumInterfaces;
+-  u_int8_t  bConfigurationValue;
+-  u_int8_t  iConfiguration;
+-  u_int8_t  bmAttributes;
+-  u_int8_t  MaxPower;
++  uint8_t  bLength;
++  uint8_t  bDescriptorType;
++  uint16_t wTotalLength;
++  uint8_t  bNumInterfaces;
++  uint8_t  bConfigurationValue;
++  uint8_t  iConfiguration;
++  uint8_t  bmAttributes;
++  uint8_t  MaxPower;
+ 
+   struct usb_interface *interface;
+ 
+@@ -172,28 +173,28 @@ struct usb_config_descriptor {
+ 
+ /* Device descriptor */
+ struct usb_device_descriptor {
+-  u_int8_t  bLength;
+-  u_int8_t  bDescriptorType;
+-  u_int16_t bcdUSB;
+-  u_int8_t  bDeviceClass;
+-  u_int8_t  bDeviceSubClass;
+-  u_int8_t  bDeviceProtocol;
+-  u_int8_t  

Re: [OpenWrt-Devel] [PATCH] libusb-compat: fix build with musl

2015-06-17 Thread Álvaro Fernández Rojas
Hi Jow,

I didn't mean to use that commit description, but something like fix musl 
compatibility.
You're right, libusb-compat builds without issues, but when flashrom checks for 
libusb-compat it fails due to u_int*_t types:
http://buildbot.openwrt.org:8010/broken_packages/brcm63xx.smp/flashrom/compile.txt

Regards,
Álvaro.

El 17/06/2015 a las 22:29, Jo-Philipp Wich escribió:
 Hi Álvaro,
 
 hmm, I have no issues building it under musl here. The buildbots seems
 to report no errors either.
 
 Can you provide a diffconfig.sh output?
 
 Btw, you do not need to replace all types, u_int{8,16,32,64}_t is
 exposed by musl if you include sys/types.h *and* if _GNU_SOURCE is
 defined.
 
 ~ Jow
 
 
 
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] libusb-compat: fix build with musl

2015-06-17 Thread Jo-Philipp Wich
Hi Álvaro,

hmm, I have no issues building it under musl here. The buildbots seems
to report no errors either.

Can you provide a diffconfig.sh output?

Btw, you do not need to replace all types, u_int{8,16,32,64}_t is
exposed by musl if you include sys/types.h *and* if _GNU_SOURCE is
defined.

~ Jow



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel