xref: /OK3568_Linux_fs/buildroot/package/liblockfile/0001-Makefile.in-fix-cross-compilation.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 7535d990645d867a6e491d16cd2548ea7e54958e Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Mon, 5 Apr 2021 16:21:32 +0200
4Subject: [PATCH] Makefile.in: fix cross-compilation
5
6- Use DESTDIR to install each files instead of prepending prefix with it
7  as this will result in dotlockfile being wrongly install in $(bindir)
8- Use -f when creating symlink to avoid an error if link already exists
9- Do not install files with root group as this will break
10  cross-compilation
11
12Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
13[Upstream status: https://github.com/miquels/liblockfile/pull/11]
14---
15 Makefile.in | 36 ++++++++++++++++++------------------
16 1 file changed, 18 insertions(+), 18 deletions(-)
17
18diff --git a/Makefile.in b/Makefile.in
19index 9c74b35..5ce8153 100644
20--- a/Makefile.in
21+++ b/Makefile.in
22@@ -10,7 +10,7 @@ CFLAGS		= @CFLAGS@ -I.
23 LDFLAGS		= @LDFLAGS@
24 CC		= @CC@
25
26-prefix		= $(DESTDIR)@prefix@
27+prefix		= @prefix@
28 exec_prefix	= @exec_prefix@
29 bindir		= @bindir@
30 libdir		= @libdir@
31@@ -60,34 +60,34 @@ dlockfile.o:	lockfile.c
32 			-c lockfile.c -o dlockfile.o
33
34 install_static:	static install_common
35-		install -d -m 755 -g root -p $(libdir)
36-		install -m 644 liblockfile.a $(libdir)
37+		install -d -m 755 -p $(DESTDIR)$(libdir)
38+		install -m 644 liblockfile.a $(DESTDIR)$(libdir)
39
40 install_shared:	shared install_static install_common
41-		install -d -m 755 -g root -p $(libdir)
42+		install -d -m 755 -p $(DESTDIR)$(libdir)
43 		install -m 755 liblockfile.so \
44-			$(libdir)/liblockfile.so.$(SOVER)
45-		ln -s liblockfile.so.$(SOVER) $(libdir)/liblockfile.so.$(MAJOR)
46-		ln -s liblockfile.so.$(SOVER) $(libdir)/liblockfile.so
47+			$(DESTDIR)$(libdir)/liblockfile.so.$(SOVER)
48+		ln -sf liblockfile.so.$(SOVER) $(DESTDIR)$(libdir)/liblockfile.so.$(MAJOR)
49+		ln -sf liblockfile.so.$(SOVER) $(DESTDIR)$(libdir)/liblockfile.so
50 		if test "$(DESTDIR)" = ""; then @LDCONFIG@; fi
51
52 install_common:
53-		install -d -m 755 -g root -p $(includedir)
54-		install -d -m 755 -g root -p $(bindir)
55-		install -d -m 755 -g root -p $(mandir)/man1
56-		install -d -m 755 -g root -p $(mandir)/man3
57-		install -m 644 lockfile.h maillock.h $(includedir)
58+		install -d -m 755 -p $(DESTDIR)$(includedir)
59+		install -d -m 755 -p $(DESTDIR)$(bindir)
60+		install -d -m 755 -p $(DESTDIR)$(mandir)/man1
61+		install -d -m 755 -p $(DESTDIR)$(mandir)/man3
62+		install -m 644 lockfile.h maillock.h $(DESTDIR)$(includedir)
63 		if [ "$(MAILGROUP)" != "" ]; then\
64-		  install -g $(MAILGROUP) -m 2755 dotlockfile $(bindir);\
65+		  install -g $(MAILGROUP) -m 2755 dotlockfile $(DESTDIR)$(bindir);\
66 		else \
67-		  install -g root -m 755 dotlockfile $(bindir); \
68+		  install -m 755 dotlockfile $(DESTDIR)$(bindir); \
69 		fi
70-		install -m 644 *.1 $(mandir)/man1
71-		install -m 644 *.3 $(mandir)/man3
72+		install -m 644 *.1 $(DESTDIR)$(mandir)/man1
73+		install -m 644 *.3 $(DESTDIR)$(mandir)/man3
74
75 install_nfslib:	nfslib
76-		install -d -m 755 -g root -p $(nfslockdir)
77-		install -m 755 nfslock.so.$(NFSVER) $(nfslockdir)
78+		install -d -m 755 -p $(DESTDIR)$(nfslockdir)
79+		install -m 755 nfslock.so.$(NFSVER) $(DESTDIR)$(nfslockdir)
80 		if test "$(DESTDIR)" = ""; then @LDCONFIG@; fi
81
82 test:		test-stamp
83