iproute2: avoid unneeded compiles to speed building
authorTony Ambardar <itugrok@yahoo.com>
Sun, 18 Apr 2021 10:09:44 +0000 (03:09 -0700)
committerKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Thu, 22 Apr 2021 14:11:36 +0000 (15:11 +0100)
Skip building Makefile targets that aren't packaged: tipc, dcb, ifstat,
rtacct, lnstat, and man. Also, only compile targets needed for the current
build variant i.e. don't compile 'tc' when building an 'ip' variant and
vice versa.

These changes reduce typical build times by over 30%:
  $ make package/iproute2/clean && time make -j8 package/iproute2/compile
  (old)
  ...
  real    2m24.985s
  user    3m12.537s
  sys     0m26.677s

  (new)
  ...
  real    1m36.945s
  user    2m8.734s
  sys     0m20.046s

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
package/network/utils/iproute2/Makefile
package/network/utils/iproute2/patches/120-no_arpd.patch [deleted file]
package/network/utils/iproute2/patches/120-no_arpd_ifstat_rtacct_lnstat.patch [new file with mode: 0644]
package/network/utils/iproute2/patches/130-no_netem.patch [deleted file]
package/network/utils/iproute2/patches/130-no_netem_tipc_dcb_man.patch [new file with mode: 0644]
package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch [new file with mode: 0644]

index d7a7b3ed0f7f0380fc14e17fa3a1cbbb41791ef6..54165636c7c2ad0627eae41047d0394ef76f0103 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iproute2
 PKG_VERSION:=5.11.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
@@ -153,6 +153,7 @@ MAKE_FLAGS += \
        KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
        SHARED_LIBS=$(SHARED_LIBS) \
        IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
+       BUILD_VARIANT=$(BUILD_VARIANT) \
        LIBBPF_FORCE=$(LIBBPF_FORCE) \
        HAVE_ELF=$(HAVE_ELF) \
        HAVE_MNL=$(HAVE_MNL) \
diff --git a/package/network/utils/iproute2/patches/120-no_arpd.patch b/package/network/utils/iproute2/patches/120-no_arpd.patch
deleted file mode 100644 (file)
index 7723981..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/misc/Makefile
-+++ b/misc/Makefile
-@@ -6,9 +6,9 @@ TARGETS=ss nstat ifstat rtacct lnstat
- include ../config.mk
--ifeq ($(HAVE_BERKELEY_DB),y)
--      TARGETS += arpd
--endif
-+#ifeq ($(HAVE_BERKELEY_DB),y)
-+#     TARGETS += arpd
-+#endif
- all: $(TARGETS)
diff --git a/package/network/utils/iproute2/patches/120-no_arpd_ifstat_rtacct_lnstat.patch b/package/network/utils/iproute2/patches/120-no_arpd_ifstat_rtacct_lnstat.patch
new file mode 100644 (file)
index 0000000..bb6a8d0
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/misc/Makefile
++++ b/misc/Makefile
+@@ -2,13 +2,13 @@
+ SSOBJ=ss.o ssfilter_check.o ssfilter.tab.o
+ LNSTATOBJ=lnstat.o lnstat_util.o
+-TARGETS=ss nstat ifstat rtacct lnstat
++TARGETS=ss nstat
+ include ../config.mk
+-ifeq ($(HAVE_BERKELEY_DB),y)
+-      TARGETS += arpd
+-endif
++#ifeq ($(HAVE_BERKELEY_DB),y)
++#     TARGETS += arpd
++#endif
+ all: $(TARGETS)
diff --git a/package/network/utils/iproute2/patches/130-no_netem.patch b/package/network/utils/iproute2/patches/130-no_netem.patch
deleted file mode 100644 (file)
index 7d2fa03..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -55,7 +55,7 @@ WFLAGS += -Wmissing-declarations -Wold-s
- CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
- YACCFLAGS = -d -t -v
--SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man
-+SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma dcb man
- LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
- LDLIBS += $(LIBNETLINK)
diff --git a/package/network/utils/iproute2/patches/130-no_netem_tipc_dcb_man.patch b/package/network/utils/iproute2/patches/130-no_netem_tipc_dcb_man.patch
new file mode 100644 (file)
index 0000000..e3faee0
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -55,7 +55,7 @@ WFLAGS += -Wmissing-declarations -Wold-s
+ CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
+ YACCFLAGS = -d -t -v
+-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man
++SUBDIRS=lib ip tc bridge misc genl devlink rdma
+ LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
+ LDLIBS += $(LIBNETLINK)
diff --git a/package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch b/package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch
new file mode 100644 (file)
index 0000000..1341866
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/ip/Makefile
++++ b/ip/Makefile
+@@ -26,7 +26,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI
+ ALLOBJ=$(IPOBJ) $(RTMONOBJ)
+ SCRIPTS=ifcfg rtpr routel routef
+-TARGETS=ip rtmon
++TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon
+ all: $(TARGETS) $(SCRIPTS)
+--- a/tc/Makefile
++++ b/tc/Makefile
+@@ -141,7 +141,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
+       $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
+-all: tc $(TCSO)
++all: $(findstring tc,$(BUILD_VARIANT)) $(TCSO)
+ tc: $(TCOBJ) $(LIBNETLINK) libtc.a
+       $(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@