[source] busybox: add musl compatible nslookup replacement
LEDE Commits
lede-commits at lists.infradead.org
Tue Apr 11 17:59:47 PDT 2017
Hi Jo,
On 04/10/2017 04:20 AM, LEDE Commits wrote:
> +---
> + Makefile.flags | 6 +
> + networking/nslookup_lede.c | 869 +++++++++++++++++++++++++++++++++++++++++++++
> + 2 files changed, 875 insertions(+)
> + create mode 100644 networking/nslookup_lede.c
> +
> +diff --git a/Makefile.flags b/Makefile.flags
> +index 65021de..096ab77 100644
> +--- a/Makefile.flags
> ++++ b/Makefile.flags
> +@@ -134,6 +134,12 @@ else
> + LDLIBS += m
> + endif
> +
> ++# nslookup_lede might need the resolv library
> ++RESOLV_AVAILABLE := $(shell echo 'int main(void){res_init();return 0;}' >resolvtest.c; $(CC) $(CFLAGS) -include resolv.h -lresolv -o /dev/null resolvtest.c >/dev/null 2>&1 && echo "y"; rm resolvtest.c)
> ++ifeq ($(RESOLV_AVAILABLE),y)
> ++LDLIBS += resolv
> ++endif
This is not working with external toolchains that require TARGET_LDFLAGS
(and possibly TARGET_CPPFLAGS) to be specified. How about the following:
diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index be4b967a47d4..c87243b93c1f 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -85,6 +85,12 @@ ifdef CONFIG_BUSYBOX_CONFIG_PAM
LDLIBS += pam pam_misc pthread
endif
+ifdef CONFIG_BUSYBOX_DEFAULT_NSLOOKUP_LEDE
+ ifeq ($(CONFIG_USE_GLIBC),y)
+ LDLIBS += resolv
+ endif
+endif
+
define Build/Compile
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
This is already a LEDE specific patch, so it we can use existing
knowledge about the toolchain we have in the Makefile, what do you
think? I verified the patch with an external glibc toolchain, aarch64
musl and armvirt glibc to make sure it was working correctly.
Thanks!
--
Florian
More information about the lede-commits
mailing list