ipvsadm: fix build on macos
authorSergey V. Lobanov <sergey@lobanov.in>
Fri, 4 Feb 2022 22:18:27 +0000 (01:18 +0300)
committerRosen Penev <rosenp@gmail.com>
Sat, 12 Feb 2022 23:18:06 +0000 (15:18 -0800)
ipvsadm build fails on macos due to libipvs Makefiles uses system
`ar` that is not compatible with the objectes generated by OpenWrt
GCC Toolchain.

This commit adds patch to allow ar redefining
This commit modifes an old patch (removing CC=gcc is not required
due to it is redefinable)

Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
net/ipvsadm/Makefile
net/ipvsadm/patches/001-Makefile.patch
net/ipvsadm/patches/100_allow_to_redefine_ar_libipvs.patch [new file with mode: 0644]

index df064669fa4d52effc058de2519f799f71d05040..7780dd30393769fb28ffb891d3614e016ae01617 100644 (file)
@@ -13,7 +13,7 @@ PKG_VERSION:=1.31
 PKG_MAINTAINER:=Mauro Mozzarelli <mauro@ezplanet.org>, \
                Florian Eckert <fe@dev.tdt.de>
 PKG_LICENSE:=GPL-2.0-or-later
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/ipvsadm/
index e552cfcb31cc75d5bd2b752cf69cbdfa81f4342e..d5cf182865d18eb689b3401ac430e8cdee1a7bd5 100644 (file)
  
 --- a/libipvs/Makefile
 +++ b/libipvs/Makefile
-@@ -1,7 +1,6 @@
+@@ -1,7 +1,7 @@
  # Makefile for libipvs
  
--CC            = gcc
+ CC            = gcc
 -CFLAGS                = -Wall -Wunused -Wstrict-prototypes -g -fPIC
 +CFLAGS                += -Wall -Wunused -Wstrict-prototypes -g -fPIC
  ifneq (0,$(HAVE_NL))
diff --git a/net/ipvsadm/patches/100_allow_to_redefine_ar_libipvs.patch b/net/ipvsadm/patches/100_allow_to_redefine_ar_libipvs.patch
new file mode 100644 (file)
index 0000000..440193a
--- /dev/null
@@ -0,0 +1,43 @@
+From: http://archive.linuxvirtualserver.org/html/lvs-devel/2022-02/msg00000.html
+
+From: "Sergey V. Lobanov" <sergey@lobanov.in>
+To: lvs-devel@vger.kernel.org
+Cc: "Sergey V. Lobanov" <sergey@lobanov.in>
+Subject: [PATCH] ipvsadm: allow to redefine AR (libipvs)
+Date: Sat,  5 Feb 2022 00:52:15 +0300
+Message-Id: <20220204215215.94422-1-sergey@lobanov.in>
+X-Mailer: git-send-email 2.32.0 (Apple Git-132)
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+Return-Path: sergey@lobanov.in
+
+libipvs Makefile uses `ar` to build archive. On cross-compile
+cross-platfrom build it fails due system ar might be incompatible
+with the objects generated by $(CC). It happens if build ipvsadm
+on macos using GCC Toolchain (Linux target)
+
+This patch allows to redefine `ar` using AR var in libipvs Makefile
+
+Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
+---
+ libipvs/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/libipvs/Makefile
++++ b/libipvs/Makefile
+@@ -1,5 +1,6 @@
+ # Makefile for libipvs
++AR            = ar
+ CC            = gcc
+ CFLAGS                += -Wall -Wunused -Wstrict-prototypes -g -fPIC
+ ifneq (0,$(HAVE_NL))
+@@ -30,7 +31,7 @@ SHARED_LIB   = libipvs.so
+ all:          $(STATIC_LIB) $(SHARED_LIB)
+ $(STATIC_LIB):        libipvs.o ip_vs_nl_policy.o
+-              ar rv $@ $^
++              $(AR) rv $@ $^
+ $(SHARED_LIB):        libipvs.o ip_vs_nl_policy.o
+               $(CC) -shared -Wl,-soname,$@ -o $@ $^