From b89365116fcf728c7d4d093cc774329ef34df05b Mon Sep 17 00:00:00 2001 From: mb Date: Tue, 2 Nov 2010 21:19:58 +0000 Subject: [PATCH] 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 --- ipv6/wide-dhcpv6/Makefile | 3 ++ .../patches/002-fix-dprintf-clash.patch | 56 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch diff --git a/ipv6/wide-dhcpv6/Makefile b/ipv6/wide-dhcpv6/Makefile index 42bc0a5d1..ac5234b45 100644 --- a/ipv6/wide-dhcpv6/Makefile +++ b/ipv6/wide-dhcpv6/Makefile @@ -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 index 000000000..a1efcae10 --- /dev/null +++ b/ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch @@ -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 ++#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_ */ -- 2.11.0