wide-dhcpv6: Compile for for uClibc-0.9.31.
authorMichael Büsch <mb@bu3sch.de>
Tue, 2 Nov 2010 21:19:58 +0000 (21:19 +0000)
committerMichael Büsch <mb@bu3sch.de>
Tue, 2 Nov 2010 21:19:58 +0000 (21:19 +0000)
We need -D_GNU_SOURCE. However, that also introduces a "dprintf" prototype, which clashes with our local dprintf. We use an ugly workaround. (Don't want to touch every caller of dprintf, because the patch would be huge.)

SVN-Revision: 23802

ipv6/wide-dhcpv6/Makefile
ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch [new file with mode: 0644]

index 42bc0a5d1aa5615b584bd2de626067295f5b2619..ac5234b45ee1d9c2ccbc96e20f6907048d6305af 100644 (file)
@@ -73,6 +73,8 @@ define Package/wide-dhcpv6-control/description
        This package installs the client and server control utility.
 endef
 
+TARGET_CFLAGS+=-D_GNU_SOURCE
+
 define Build/Configure
        $(call Build/Configure/Default,--with-localdbdir=/var)
 endef
@@ -80,6 +82,7 @@ endef
 define Build/Compile   
        $(MAKE) -C $(PKG_BUILD_DIR) \
                DESTDIR="$(PKG_INSTALL_DIR)" \
+               EXTRA_CFLAGS="-include debug.h" \
                all 
 endef
 
diff --git a/ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch b/ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch
new file mode 100644 (file)
index 0000000..a1efcae
--- /dev/null
@@ -0,0 +1,56 @@
+Index: wide-dhcpv6-20080615/common.c
+===================================================================
+--- wide-dhcpv6-20080615.orig/common.c 2010-11-02 22:07:03.161000001 +0100
++++ wide-dhcpv6-20080615/common.c      2010-11-02 22:07:19.532000002 +0100
+@@ -3207,7 +3207,7 @@
+ }
+ void
+-dprintf(int level, const char *fname, const char *fmt, ...)
++my_dprintf(int level, const char *fname, const char *fmt, ...)
+ {
+       va_list ap;
+       char logbuf[LINE_MAX];
+Index: wide-dhcpv6-20080615/Makefile.in
+===================================================================
+--- wide-dhcpv6-20080615.orig/Makefile.in      2010-11-02 22:07:03.151000001 +0100
++++ wide-dhcpv6-20080615/Makefile.in   2010-11-02 22:07:19.533000002 +0100
+@@ -37,7 +37,7 @@
+ group= @group@
+ CFLAGS=       @CFLAGS@ @DEFS@ -DSYSCONFDIR=\"${sysconfdir}\" \
+-      -DLOCALDBDIR=\"${localdbdir}\"
++      -DLOCALDBDIR=\"${localdbdir}\" $(EXTRA_CFLAGS)
+ LDFLAGS=@LDFLAGS@
+ LIBOBJS=@LIBOBJS@
+ LIBS= @LIBS@ @LEXLIB@
+Index: wide-dhcpv6-20080615/common.h
+===================================================================
+--- wide-dhcpv6-20080615.orig/common.h 2010-11-02 22:07:23.187000002 +0100
++++ wide-dhcpv6-20080615/common.h      2010-11-02 22:08:43.646001043 +0100
+@@ -155,7 +155,6 @@
+ extern int in6_addrscopebyif __P((struct in6_addr *, char *));
+ extern int in6_scope __P((struct in6_addr *));
+ extern void setloglevel __P((int));
+-extern void dprintf __P((int, const char *, const char *, ...));
+ extern int get_duid __P((char *, struct duid *));
+ extern void dhcp6_init_options __P((struct dhcp6_optinfo *));
+ extern void dhcp6_clear_options __P((struct dhcp6_optinfo *));
+Index: wide-dhcpv6-20080615/debug.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ wide-dhcpv6-20080615/debug.h       2010-11-02 22:14:58.354999418 +0100
+@@ -0,0 +1,13 @@
++#ifndef MY_DEBUG_H_
++#define MY_DEBUG_H_
++
++/* First include stdio.h, which may contain the prototype for the external dprintf.
++ * We do not want that. We redefine dprintf to our local implementation. */
++#include <stdio.h>
++#define dprintf my_dprintf
++#ifndef __P
++# define __P(x) x
++#endif
++extern void my_dprintf __P((int, const char *, const char *, ...));
++
++#endif /* MY_DEBUG_H_ */