net-tools: remove libintl static linking handling
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 3 Jul 2017 22:01:03 +0000 (00:01 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 4 Jul 2017 23:37:14 +0000 (01:37 +0200)
We no longer support building the full-blown libintl in static linking
scenarios, as it causes too many problems. Patch
0001-Makefile-fix-static-linking-issue-with-lintl.patch was added to
allow passing -lintl through LIBS, in a place that works for static
linking.

However, for dynamic linking, we can simply pass -lintl through the
existing LDFLAGS variable, as it was done prior to commit
38bfd129c64a9cfd82c4fa4c797afadf12a6ffaa ("package/net-tools: fix
static linking issue with lintl").

This commit does that and gets rid of the now useless patch.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/net-tools/0001-Makefile-fix-static-linking-issue-with-lintl.patch [deleted file]
package/net-tools/0001-iptunnel.c-do-not-include-netinet-ip.h.patch [new file with mode: 0644]
package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch [deleted file]
package/net-tools/net-tools.mk

diff --git a/package/net-tools/0001-Makefile-fix-static-linking-issue-with-lintl.patch b/package/net-tools/0001-Makefile-fix-static-linking-issue-with-lintl.patch
deleted file mode 100644 (file)
index a2d674e..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-From a2076079a409141704701ec17a205d89e5b24052 Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@gmail.com>
-Date: Sat, 28 May 2016 20:45:02 +0200
-Subject: [PATCH] Makefile: fix static linking issue with lintl
-
-When net-tools are build with uClibc-ng and statically linked,
-some tools like hostname and route needs to link with -lintl.
-
-Adding -lintl in LDFLAGS place the library before object files:
-arm-linux-gcc -O2 -g -Wall -fno-strict-aliasing   -static -lintl -Llib -o hostname hostname.o
-
-Add $(LIBS) after object files in the Makefile to place -lintl correctly.
-
-Fixes:
-http://autobuild.buildroot.net/results/134/1345b6d366125320b89512e7ce7f142f1a03acf8
-
-Ref:
-http://lists.busybox.net/pipermail/buildroot/2016-May/162216.html
-
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
----
- Makefile | 20 ++++++++++----------
- 1 file changed, 10 insertions(+), 10 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 171123d..a2baf79 100644
---- a/Makefile
-+++ b/Makefile
-@@ -158,37 +158,37 @@ subdirs: libdir
-               @for i in $(SUBDIRS:$(NET_LIB_PATH)/=); do $(MAKE) -C $$i || exit $$? ; done
- ifconfig:     $(NET_LIB) ifconfig.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(LIBS) $(NLIB)
- nameif:               $(NET_LIB) nameif.o
-               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB)
- hostname:     hostname.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(DNLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(LIBS) $(DNLIB)
- route:                $(NET_LIB) route.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(LIBS) $(NLIB)
- arp:          $(NET_LIB) arp.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(LIBS) $(NLIB)
- rarp:         $(NET_LIB) rarp.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(LIBS) $(NLIB)
- slattach:     $(NET_LIB) slattach.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(LIBS) $(NLIB)
- plipconfig:   $(NET_LIB) plipconfig.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(LIBS) $(NLIB)
- netstat:      $(NET_LIB) netstat.o statistics.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(NLIB) $(SELIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(LIBS) $(NLIB) $(SELIB)
- iptunnel:     $(NET_LIB) iptunnel.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(LIBS) $(NLIB)
- ipmaddr:      $(NET_LIB) ipmaddr.o
--              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(NLIB)
-+              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(LIBS) $(NLIB)
- mii-tool:     $(NET_LIB) mii-tool.o
-               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB)
--- 
-2.5.5
-
diff --git a/package/net-tools/0001-iptunnel.c-do-not-include-netinet-ip.h.patch b/package/net-tools/0001-iptunnel.c-do-not-include-netinet-ip.h.patch
new file mode 100644 (file)
index 0000000..a8658c4
--- /dev/null
@@ -0,0 +1,72 @@
+From eec38a200357b195efbb23bb645ab721c040f246 Mon Sep 17 00:00:00 2001
+From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+Date: Thu, 3 Nov 2016 12:59:39 +0000
+Subject: [PATCH] iptunnel.c: do not include netinet/ip.h
+
+This fixes a struct redefinition problem like this one:
+
+================================
+In file included from /usr/include/linux/if_tunnel.h:6:0,
+                 from iptunnel.c:34:
+/usr/include/linux/ip.h:85:8: error: redefinition of 'struct iphdr'
+ struct iphdr {
+        ^
+In file included from iptunnel.c:29:0:
+/usr/include/netinet/ip.h:45:8: note: originally defined here
+ struct iphdr
+        ^
+================================
+
+iptunnel.c includes netinet/ip.h which contains a definition of the
+iphdr struct.
+
+iptunnel.c also includes linux/if_tunnel.h which includes linux/ip.h
+which contains a definition of the iphdr struct.
+
+So, both netinet/ip.h and linux/ip.h define the iphdr struct, and both
+of them have been included directly or indirectly by iptunnel.c. Because
+of that the compilation fails due to a struct redefinition.
+
+The problem can be solved by just not including netinet/ip.h.
+
+However, some Linux headers included in certain toolchains may not have
+an updated linux/if_tunnel.h which includes linux/ip.h, so we need to
+include it unconditionally otherwise linux/if_tunnel.h will use the
+struct iphdr before being defined and the compilation will also fail in
+this way:
+
+================================
+In file included from iptunnel.c:33:0:
+/usr/include/linux/if_tunnel.h:37:16: error: field 'iph' has incomplete type
+  struct iphdr  iph;
+                  ^
+================================
+
+Upstream status: merge request sent
+https://sourceforge.net/p/net-tools/code/merge-requests/4/
+
+Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+---
+ iptunnel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/iptunnel.c b/iptunnel.c
+index 3fe1b84..e2ec2d8 100644
+--- a/iptunnel.c
++++ b/iptunnel.c
+@@ -26,11 +26,11 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <netinet/in.h>
+-#include <netinet/ip.h>
+ #include <arpa/inet.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
+ #include <linux/types.h>
++#include <linux/ip.h>
+ #include <linux/if_tunnel.h>
+
+ #include "config.h"
+-- 
+2.10.1
+
diff --git a/package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch b/package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch
deleted file mode 100644 (file)
index a8658c4..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-From eec38a200357b195efbb23bb645ab721c040f246 Mon Sep 17 00:00:00 2001
-From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
-Date: Thu, 3 Nov 2016 12:59:39 +0000
-Subject: [PATCH] iptunnel.c: do not include netinet/ip.h
-
-This fixes a struct redefinition problem like this one:
-
-================================
-In file included from /usr/include/linux/if_tunnel.h:6:0,
-                 from iptunnel.c:34:
-/usr/include/linux/ip.h:85:8: error: redefinition of 'struct iphdr'
- struct iphdr {
-        ^
-In file included from iptunnel.c:29:0:
-/usr/include/netinet/ip.h:45:8: note: originally defined here
- struct iphdr
-        ^
-================================
-
-iptunnel.c includes netinet/ip.h which contains a definition of the
-iphdr struct.
-
-iptunnel.c also includes linux/if_tunnel.h which includes linux/ip.h
-which contains a definition of the iphdr struct.
-
-So, both netinet/ip.h and linux/ip.h define the iphdr struct, and both
-of them have been included directly or indirectly by iptunnel.c. Because
-of that the compilation fails due to a struct redefinition.
-
-The problem can be solved by just not including netinet/ip.h.
-
-However, some Linux headers included in certain toolchains may not have
-an updated linux/if_tunnel.h which includes linux/ip.h, so we need to
-include it unconditionally otherwise linux/if_tunnel.h will use the
-struct iphdr before being defined and the compilation will also fail in
-this way:
-
-================================
-In file included from iptunnel.c:33:0:
-/usr/include/linux/if_tunnel.h:37:16: error: field 'iph' has incomplete type
-  struct iphdr  iph;
-                  ^
-================================
-
-Upstream status: merge request sent
-https://sourceforge.net/p/net-tools/code/merge-requests/4/
-
-Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
----
- iptunnel.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/iptunnel.c b/iptunnel.c
-index 3fe1b84..e2ec2d8 100644
---- a/iptunnel.c
-+++ b/iptunnel.c
-@@ -26,11 +26,11 @@
- #include <sys/socket.h>
- #include <sys/ioctl.h>
- #include <netinet/in.h>
--#include <netinet/ip.h>
- #include <arpa/inet.h>
- #include <net/if.h>
- #include <net/if_arp.h>
- #include <linux/types.h>
-+#include <linux/ip.h>
- #include <linux/if_tunnel.h>
-
- #include "config.h"
--- 
-2.10.1
-
index 57a3eb4dea1802f6011214523f790330ce3ed48f..bc87290d4fc0018e94ebbe04e0ec0b8e904acbff 100644 (file)
@@ -35,7 +35,7 @@ NET_TOOLS_POST_CONFIGURE_HOOKS += NET_TOOLS_ENABLE_I18N NET_TOOLS_ENABLE_IPV6
 
 define NET_TOOLS_BUILD_CMDS
        $(TARGET_CONFIGURE_OPTS) \
-               LIBS=$(TARGET_NLS_LIBS) \
+               LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)" \
                $(MAKE) -C $(@D)
 endef