Browse Source

avrdude: fix musl compatibility

 - Build with -D_GNU_SOURCE to expose "loff_t" required for libelf.h
 - Include sys/types.h before usb.h to provide missing u_int*_t types

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Jo-Philipp Wich 9 years ago
parent
commit
d028771f28
2 changed files with 64 additions and 1 deletions
  1. 4
    1
      utils/avrdude/Makefile
  2. 60
    0
      utils/avrdude/patches/100-musl-compat.patch

+ 4
- 1
utils/avrdude/Makefile View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=avrdude
11 11
 PKG_VERSION:=6.1
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 15
 PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/avrdude
@@ -40,6 +40,9 @@ CONFIGURE_ARGS+= \
40 40
 	--disable-doc \
41 41
 	--disable-parport \
42 42
 
43
+TARGET_CFLAGS+= \
44
+	-D_GNU_SOURCE \
45
+
43 46
 define Package/avrdude/conffiles
44 47
 /etc/avrdude.conf
45 48
 endef

+ 60
- 0
utils/avrdude/patches/100-musl-compat.patch View File

@@ -0,0 +1,60 @@
1
+--- a/dfu.h
2
++++ b/dfu.h
3
+@@ -25,6 +25,7 @@
4
+ 
5
+ #ifdef HAVE_LIBUSB
6
+ #if defined(HAVE_USB_H)
7
++#  include <sys/types.h>
8
+ #  include <usb.h>
9
+ #elif defined(HAVE_LUSB0_USB_H)
10
+ #  include <lusb0_usb.h>
11
+--- a/pickit2.c
12
++++ b/pickit2.c
13
+@@ -50,6 +50,7 @@
14
+ #include <string.h>
15
+ #include <inttypes.h>
16
+ #include <unistd.h>
17
++#include <sys/types.h>
18
+ 
19
+ #include "avrdude.h"
20
+ #include "avr.h"
21
+--- a/ser_avrdoper.c
22
++++ b/ser_avrdoper.c
23
+@@ -248,6 +248,7 @@ static int usbGetReport(union filedescri
24
+ /* ------------------------------------------------------------------------ */
25
+ 
26
+ #if defined(HAVE_USB_H)
27
++#  include <sys/types.h>
28
+ #  include <usb.h>
29
+ #elif defined(HAVE_LUSB0_USB_H)
30
+ #  include <lusb0_usb.h>
31
+--- a/usbtiny.c
32
++++ b/usbtiny.c
33
+@@ -41,6 +41,7 @@
34
+ 
35
+ #if defined(HAVE_LIBUSB)      // we use LIBUSB to talk to the board
36
+ #if defined(HAVE_USB_H)
37
++#  include <sys/types.h>
38
+ #  include <usb.h>
39
+ #elif defined(HAVE_LUSB0_USB_H)
40
+ #  include <lusb0_usb.h>
41
+--- a/usbasp.c
42
++++ b/usbasp.c
43
+@@ -54,6 +54,7 @@
44
+ # endif
45
+ #else
46
+ # if defined(HAVE_USB_H)
47
++#  include <sys/types.h>
48
+ #  include <usb.h>
49
+ # elif defined(HAVE_LUSB0_USB_H)
50
+ #  include <lusb0_usb.h>
51
+--- a/usb_libusb.c
52
++++ b/usb_libusb.c
53
+@@ -36,6 +36,7 @@
54
+ #include <sys/time.h>
55
+ 
56
+ #if defined(HAVE_USB_H)
57
++#  include <sys/types.h>
58
+ #  include <usb.h>
59
+ #elif defined(HAVE_LUSB0_USB_H)
60
+ #  include <lusb0_usb.h>