Skip to contentSkip to conversation

ipvsadm: allow to redefine AR (libipvs)

PATCH In review Sergey V. Lobanov 2 participants 2 messages Feb 4, 2022 – Feb 20, 2022 IPVS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipvsadm: allow to redefine AR (libipvs)

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

---
 libipvs/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
libipvs/Makefile +2 -1
index f845c8b..7e02d4d 100644
@@ -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 $@ $^
Signature · 1 line
2.32.0 (Apple Git-132)
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 8 lines · Sergey V. Lobanov

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

Looks good to me, thanks!

Quoted 26 lines
---
 libipvs/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
libipvs/Makefile +2 -1
index f845c8b..7e02d4d 100644
@@ -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 $@ $^
Signature · 1 line
2.32.0 (Apple Git-132)

Regards

--
Julian Anastasov <[email protected]>