From 22efecc44666d3ed9050ac4a6895b94f35c3510b Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 28 Nov 2020 01:08:19 +0000
Subject: net-libs/liblockfile: fix Darwin makefile

* Don't install directly into $(ROOT) (!).
  Instead install into $(DESTDIR), which will, among other benefits,
  allow Portage to detect collisions.

  (noticed when tried to install twice and a symlink failed!)

* Respect AR

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Sam James <sam@gentoo.org>
---
 net-libs/liblockfile/files/Makefile.Darwin.in | 29 ++++++++++++++++++---------
 1 file changed, 19 insertions(+), 10 deletions(-)

(limited to 'net-libs/liblockfile')

diff --git a/net-libs/liblockfile/files/Makefile.Darwin.in b/net-libs/liblockfile/files/Makefile.Darwin.in
index 936d48a2d1d0..f466f9ca50e7 100644
--- a/net-libs/liblockfile/files/Makefile.Darwin.in
+++ b/net-libs/liblockfile/files/Makefile.Darwin.in
@@ -10,6 +10,7 @@ NVER	= 0.1
 
 CFLAGS		= @CFLAGS@ -I.
 LDFLAGS		= @LDFLAGS@
+AR		= @AR@
 CC		= @CC@
 
 prefix		= @prefix@
@@ -30,7 +31,7 @@ shared:		liblockfile.dylib dotlockfile
 nfslib:		nfslock.$(VER).dylib
 
 liblockfile.a:	lockfile.o
-		ar rv liblockfile.a lockfile.o
+		$(AR) rv liblockfile.a lockfile.o
 
 liblockfile.dylib: liblockfile.a
 		$(CC) $(LDFLAGS) -fPIC -dynamiclib -install_name @libdir@/liblockfile.1.0.dylib \
@@ -51,25 +52,33 @@ xlockfile.o:	lockfile.c
 		$(CC) $(CFLAGS) -DLOCKPROG=\"$(bindir)/dotlockfile\" -c lockfile.c -o xlockfile.o
 
 install_static:	static install_common
-		install -m 644 liblockfile.a $(ROOT)$(libdir)
+		install -d $(DESTDIR)$(libdir)
+		install -m 644 liblockfile.a $(DESTDIR)$(libdir)
 
 install_shared:	shared install_common
+		install -d $(DESTDIR)$(libdir)
 		install -m 755 liblockfile.dylib \
-			$(ROOT)$(libdir)/liblockfile.$(VER).dylib
-		ln -s liblockfile.$(VER).dylib $(ROOT)$(libdir)/liblockfile.dylib
+			$(DESTDIR)$(libdir)/liblockfile.$(VER).dylib
+		ln -s liblockfile.$(VER).dylib $(DESTDIR)$(libdir)/liblockfile.dylib
 
 install_common:
-		install -m 644 lockfile.h maillock.h $(ROOT)$(includedir)
+		install -d $(DESTDIR)$(includedir)
+		install -d $(DESTDIR)$(bindir)
+		install -m 644 lockfile.h maillock.h $(DESTDIR)$(includedir)
 		if [ "$(MAILGROUP)" != "" ]; then\
-		  install -g $(MAILGROUP) -m 2755 dotlockfile $(ROOT)$(bindir);\
+		  install  -g $(MAILGROUP) -m 2755 dotlockfile $(DESTDIR)$(bindir);\
 		else \
-		  install -g root -m 755 dotlockfile $(ROOT)$(bindir); \
+		  install  -g root -m 755 dotlockfile $(DESTDIR)$(bindir); \
 		fi
-		install -m 644 *.1 $(ROOT)$(mandir)/man1
-		install -m 644 *.3 $(ROOT)$(mandir)/man3
+		install -d $(DESTDIR)$(mandir)
+		install -d $(DESTDIR)$(mandir)/man1
+		install -d $(DESTDIR)$(mandir)/man3
+		install -m 644 *.1 $(DESTDIR)$(mandir)/man1
+		install -m 644 *.3 $(DESTDIR)$(mandir)/man3
 
 install_nfslib:	nfslib
-		install -m 755 nfslock.$(VER).dylib $(ROOT)$(nfslockdir)
+		install -d $(DESTDIR)$(nfslockdir)
+		install -m 755 nfslock.$(VER).dylib $(DESTDIR)$(nfslockdir)
 
 clean:
 		rm -f *.a *.o *.dylib dotlockfile
-- 
cgit v1.2.3-65-gdbad