wide-dhcpv6: Compile for for uClibc-0.9.31.

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.)


git-svn-id: svn://svn.openwrt.org/openwrt/packages@23802 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
mb 2010-11-02 21:19:58 +00:00
parent 901e5202ad
commit b89365116f
2 changed files with 59 additions and 0 deletions

View 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

View File

@ -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_ */