xref: /OK3568_Linux_fs/buildroot/package/cups/0003-Sanitize-the-installation-process.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From e35f809c435c224954a5c7bff3f5729c5b3bc0ba Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Thu, 21 Jan 2016 23:21:06 +0100
4Subject: [PATCH] Sanitize the installation process
5
6The installation process does two things that are not convenient when
7cross-compiling:
8
9 - It uses install's -s option to strip binaries, but this option uses
10   the host strip and not the cross strip, which fails at stripping
11   binaries. In addition, we do not necessarily want cups to strip its
12   binaries, we may want to keep the debugging symbols.
13
14 - It enforces ownership (user, group) which isn't possible since
15   "make install" isn't executed as root when cross-compiling.
16
17 - It installs many files and directories with permissions that
18   prevent overwriting those files/directories, which meant calling
19   "make install" twice was failing.
20
21[Olivier: tweak the patch for 2.2.4 release]
22
23Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
24Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
25---
26 Makedefs.in        | 12 ++++++------
27 conf/Makefile      |  6 +++---
28 notifier/Makefile  |  2 +-
29 scheduler/Makefile | 15 +++++++--------
30 4 files changed, 17 insertions(+), 18 deletions(-)
31
32diff --git a/Makedefs.in b/Makedefs.in
33index 3afef0a..3e4f1bd 100644
34--- a/Makedefs.in
35+++ b/Makedefs.in
36@@ -40,14 +40,14 @@ SHELL		=	/bin/sh
37 # Installation programs...
38 #
39
40-INSTALL_BIN	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
41-INSTALL_COMPDATA =	$(INSTALL) -c -m 444 @INSTALL_GZIP@
42+INSTALL_BIN	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m 755
43+INSTALL_COMPDATA =	$(INSTALL) -c -m 644 @INSTALL_GZIP@
44 INSTALL_CONFIG	=	$(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
45-INSTALL_DATA	=	$(INSTALL) -c -m 444
46+INSTALL_DATA	=	$(INSTALL) -c -m 644
47 INSTALL_DIR	=	$(INSTALL) -d
48-INSTALL_LIB	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
49-INSTALL_MAN	=	$(INSTALL) -c -m 444
50-INSTALL_SCRIPT	=	$(INSTALL) -c -m @CUPS_EXE_FILE_PERM@
51+INSTALL_LIB	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m 755
52+INSTALL_MAN	=	$(INSTALL) -c -m 644
53+INSTALL_SCRIPT	=	$(INSTALL) -c -m 755
54
55 #
56 # Default user, group, and system groups for the scheduler...
57diff --git a/conf/Makefile b/conf/Makefile
58index 933d7d9..6ac5e19 100644
59--- a/conf/Makefile
60+++ b/conf/Makefile
61@@ -72,11 +72,11 @@ install:	all install-data install-headers install-libs install-exec
62 install-data:
63 	for file in $(KEEP); do \
64 		if test -r $(SERVERROOT)/$$file ; then \
65-			$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
66+			$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
67 		else \
68-			$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
69+			$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
70 		fi ; \
71-		$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.default; \
72+		$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.default; \
73 	done
74 	$(INSTALL_DIR) -m 755 $(DATADIR)/mime
75 	for file in $(REPLACE); do \
76diff --git a/notifier/Makefile b/notifier/Makefile
77index 3206dd0..c34a4d7 100644
78--- a/notifier/Makefile
79+++ b/notifier/Makefile
80@@ -62,7 +62,7 @@ install:	all install-data install-headers install-libs install-exec
81 #
82
83 install-data:
84-	$(INSTALL_DIR) -m 775 -g $(CUPS_GROUP) $(CACHEDIR)/rss
85+	$(INSTALL_DIR) -m 775 $(CACHEDIR)/rss
86
87
88 #
89diff --git a/scheduler/Makefile b/scheduler/Makefile
90index 251f017..25f2f5f 100644
91--- a/scheduler/Makefile
92+++ b/scheduler/Makefile
93@@ -146,28 +146,27 @@ install-data:
94 	echo Creating $(SERVERBIN)/driver...
95 	$(INSTALL_DIR) -m 755 $(SERVERBIN)/driver
96 	echo Creating $(SERVERROOT)...
97-	$(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)
98+	$(INSTALL_DIR) -m 755 $(SERVERROOT)
99 	echo Creating $(SERVERROOT)/ppd...
100-	$(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/ppd
101+	$(INSTALL_DIR) -m 755 $(SERVERROOT)/ppd
102 	if test "x`uname`" != xDarwin; then \
103 		echo Creating $(SERVERROOT)/ssl...; \
104-		$(INSTALL_DIR) -m 700 -g $(CUPS_GROUP) $(SERVERROOT)/ssl; \
105+		$(INSTALL_DIR) -m 700 $(SERVERROOT)/ssl; \
106 	fi
107 	if test "$(STATEDIR)" != "$(SERVERROOT)"; then \
108 		echo Creating $(STATEDIR)...; \
109 		$(INSTALL_DIR) -m 755 $(STATEDIR); \
110 	fi
111 	echo Creating $(STATEDIR)/certs...
112-	$(INSTALL_DIR) -m 511 -o $(CUPS_USER) -g $(CUPS_PRIMARY_SYSTEM_GROUP) \
113-		$(STATEDIR)/certs
114+	$(INSTALL_DIR) -m 711 $(STATEDIR)/certs
115 	echo Creating $(LOGDIR)...
116 	$(INSTALL_DIR) -m 755 $(LOGDIR)
117 	echo Creating $(REQUESTS)...
118-	$(INSTALL_DIR) -m 710 -g $(CUPS_GROUP) $(REQUESTS)
119+	$(INSTALL_DIR) -m 710 $(REQUESTS)
120 	echo Creating $(REQUESTS)/tmp...
121-	$(INSTALL_DIR) -m 1770 -g $(CUPS_GROUP) $(REQUESTS)/tmp
122+	$(INSTALL_DIR) -m 1770 $(REQUESTS)/tmp
123 	echo Creating $(CACHEDIR)...
124-	$(INSTALL_DIR) -m 770 -g $(CUPS_GROUP) $(CACHEDIR)
125+	$(INSTALL_DIR) -m 770 $(CACHEDIR)
126 	if test "x$(INITDIR)" != x; then \
127 		echo Installing init scripts...; \
128 		$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
129--
1302.6.4
131
132