1 From 7f99a727cdb8160d49bb0d0554fc88787980c971 Mon Sep 17 00:00:00 2001
2 From: Adam Duskett <Aduskett@gmail.com>
3 Date: Thu, 14 Jul 2016 13:16:03 -0400
4 Subject: [PATCH] Add PREFIX to host paths
6 Updates the remaining hardcoded host paths used in the build to be
7 prefixed with a PREFIX path to allow cross compilation.
9 Updated to work with version 2.5
11 Signed-off-by: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
12 Signed-off-by: Niranjan Reddy <niranjan.reddy@rockwellcollins.com>
13 Signed-off-by: Adam Duskett <AdamDuskett@outlook.com>
14 Signed-off-by: Adam Duskett <Aduskett@gmail.com>
16 policycoreutils/Makefile | 4 +++-
17 policycoreutils/audit2allow/Makefile | 2 +-
18 policycoreutils/load_policy/Makefile | 2 +-
19 policycoreutils/mcstrans/src/Makefile | 17 +++++++++--------
20 policycoreutils/newrole/Makefile | 8 ++++----
21 policycoreutils/run_init/Makefile | 8 ++++----
22 policycoreutils/sepolicy/Makefile | 2 +-
23 policycoreutils/setfiles/Makefile | 4 ++--
24 8 files changed, 25 insertions(+), 22 deletions(-)
26 diff --git a/Makefile b/Makefile
27 index 0634a2a..bd99b1c 100644
31 +PREFIX ?= $(DESTDIR)/usr
33 SUBDIRS = sepolicy setfiles semanage load_policy newrole run_init sandbox secon audit2allow sestatus semodule_package semodule semodule_link semodule_expand semodule_deps sepolgen-ifgen setsebool scripts po man gui hll
35 INOTIFYH = $(shell ls $(DESTDIR)/usr/include/sys/inotify.h 2>/dev/null)
37 -ifeq (${INOTIFYH}, /usr/include/sys/inotify.h)
38 +ifeq (${INOTIFYH}, $(PREFIX)/include/sys/inotify.h)
39 SUBDIRS += restorecond
42 diff --git a/audit2allow/Makefile b/audit2allow/Makefile
43 index 87d2502..d4108fe 100644
44 --- a/audit2allow/Makefile
45 +++ b/audit2allow/Makefile
46 @@ -5,7 +5,7 @@ PREFIX ?= $(DESTDIR)/usr
47 BINDIR ?= $(PREFIX)/bin
48 LIBDIR ?= $(PREFIX)/lib
49 MANDIR ?= $(PREFIX)/share/man
50 -LOCALEDIR ?= /usr/share/locale
51 +LOCALEDIR ?= $(PREFIX)/share/locale
55 diff --git a/load_policy/Makefile b/load_policy/Makefile
56 index 7c5bab0..5cd0bbb 100644
57 --- a/load_policy/Makefile
58 +++ b/load_policy/Makefile
59 @@ -3,7 +3,7 @@ PREFIX ?= $(DESTDIR)/usr
60 SBINDIR ?= $(DESTDIR)/sbin
61 USRSBINDIR ?= $(PREFIX)/sbin
62 MANDIR ?= $(PREFIX)/share/man
63 -LOCALEDIR ?= /usr/share/locale
64 +LOCALEDIR ?= $(PREFIX)/share/locale
66 CFLAGS ?= -Werror -Wall -W
67 override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
68 diff --git a/mcstrans/src/Makefile b/mcstrans/src/Makefile
69 index 907a1f1..6fda57e 100644
70 --- a/mcstrans/src/Makefile
71 +++ b/mcstrans/src/Makefile
73 ARCH = $(shell uname -i)
74 +# Installation directories.
75 +PREFIX ?= $(DESTDIR)/usr
76 +SBINDIR ?= $(DESTDIR)/sbin
77 +INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
78 +SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
80 ifeq "$(ARCH)" "x86_64"
81 # In case of 64 bit system, use these lines
83 + LIBDIR=$(PREFIX)/lib64
86 # In case of 32 bit system, use these lines
88 + LIBDIR=$(PREFIX)/lib
91 # In case of 32 bit system, use these lines
93 + LIBDIR=$(PREFIX)/lib
97 -# Installation directories.
98 -PREFIX ?= $(DESTDIR)/usr
99 -SBINDIR ?= $(DESTDIR)/sbin
100 -INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
101 -SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
103 PROG_SRC=mcstrans.c mcscolor.c mcstransd.c mls_level.c
104 PROG_OBJS= $(patsubst %.c,%.o,$(PROG_SRC))
105 diff --git a/newrole/Makefile b/newrole/Makefile
106 index f124a6a..b687a09 100644
107 --- a/newrole/Makefile
108 +++ b/newrole/Makefile
109 @@ -3,7 +3,7 @@ PREFIX ?= $(DESTDIR)/usr
110 BINDIR ?= $(PREFIX)/bin
111 MANDIR ?= $(PREFIX)/share/man
112 ETCDIR ?= $(DESTDIR)/etc
113 -LOCALEDIR = /usr/share/locale
114 +LOCALEDIR = $(PREFIX)/share/locale
115 PAMH = $(shell ls $(DESTDIR)/usr/include/security/pam_appl.h 2>/dev/null)
116 AUDITH = $(shell ls $(DESTDIR)/usr/include/libaudit.h 2>/dev/null)
117 # Enable capabilities to permit newrole to generate audit records.
118 @@ -24,7 +24,7 @@ CFLAGS ?= -Werror -Wall -W
120 override CFLAGS += -DVERSION=\"$(VERSION)\" $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
121 LDLIBS += -lselinux -L$(PREFIX)/lib
122 -ifeq ($(PAMH), /usr/include/security/pam_appl.h)
123 +ifeq ($(PAMH), $(PREFIX)/include/security/pam_appl.h)
124 override CFLAGS += -DUSE_PAM
125 EXTRA_OBJS += hashtab.o
126 LDLIBS += -lpam -lpam_misc
127 @@ -32,7 +32,7 @@ else
128 override CFLAGS += -D_XOPEN_SOURCE=500
131 -ifeq ($(AUDITH), /usr/include/libaudit.h)
132 +ifeq ($(AUDITH), $(PREFIX)/include/libaudit.h)
133 override CFLAGS += -DUSE_AUDIT
136 @@ -66,7 +66,7 @@ install: all
137 test -d $(MANDIR)/man1 || install -m 755 -d $(MANDIR)/man1
138 install -m $(MODE) newrole $(BINDIR)
139 install -m 644 newrole.1 $(MANDIR)/man1/
140 -ifeq ($(PAMH), /usr/include/security/pam_appl.h)
141 +ifeq ($(PAMH), $(PREFIX)/include/security/pam_appl.h)
142 test -d $(ETCDIR)/pam.d || install -m 755 -d $(ETCDIR)/pam.d
143 ifeq ($(LSPP_PRIV),y)
144 install -m 644 newrole-lspp.pamd $(ETCDIR)/pam.d/newrole
145 diff --git a/run_init/Makefile b/run_init/Makefile
146 index c81179b..ce0df9f 100644
147 --- a/run_init/Makefile
148 +++ b/run_init/Makefile
149 @@ -4,21 +4,21 @@ PREFIX ?= $(DESTDIR)/usr
150 SBINDIR ?= $(PREFIX)/sbin
151 MANDIR ?= $(PREFIX)/share/man
152 ETCDIR ?= $(DESTDIR)/etc
153 -LOCALEDIR ?= /usr/share/locale
154 +LOCALEDIR ?= $(PREFIX)/share/locale
155 PAMH = $(shell ls $(DESTDIR)/usr/include/security/pam_appl.h 2>/dev/null)
156 AUDITH = $(shell ls $(DESTDIR)/usr/include/libaudit.h 2>/dev/null)
158 CFLAGS ?= -Werror -Wall -W
159 override CFLAGS += -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
160 LDLIBS += -lselinux -L$(PREFIX)/lib
161 -ifeq ($(PAMH), /usr/include/security/pam_appl.h)
162 +ifeq ($(PAMH), $(PREFIX)/include/security/pam_appl.h)
163 override CFLAGS += -DUSE_PAM
164 LDLIBS += -lpam -lpam_misc
166 override CFLAGS += -D_XOPEN_SOURCE=500
169 -ifeq ($(AUDITH), /usr/include/libaudit.h)
170 +ifeq ($(AUDITH), $(PREFIX)/include/libaudit.h)
171 override CFLAGS += -DUSE_AUDIT
174 @@ -38,7 +38,7 @@ install: all
175 install -m 755 open_init_pty $(SBINDIR)
176 install -m 644 run_init.8 $(MANDIR)/man8/
177 install -m 644 open_init_pty.8 $(MANDIR)/man8/
178 -ifeq ($(PAMH), /usr/include/security/pam_appl.h)
179 +ifeq ($(PAMH), $(PREFIX)/include/security/pam_appl.h)
180 install -m 644 run_init.pamd $(ETCDIR)/pam.d/run_init
183 diff --git a/sepolicy/Makefile b/sepolicy/Makefile
184 index 6624373..a16f8de 100644
185 --- a/sepolicy/Makefile
186 +++ b/sepolicy/Makefile
187 @@ -8,7 +8,7 @@ BINDIR ?= $(PREFIX)/bin
188 SBINDIR ?= $(PREFIX)/sbin
189 DATADIR ?= $(PREFIX)/share
190 MANDIR ?= $(PREFIX)/share/man
191 -LOCALEDIR ?= /usr/share/locale
192 +LOCALEDIR ?= $(PREFIX)/share/locale
193 BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
194 SHAREDIR ?= $(PREFIX)/share/sandbox
195 CFLAGS ?= -Wall -Werror -Wextra -W
196 diff --git a/setfiles/Makefile b/setfiles/Makefile
197 index eb26ed0..3c6b80d 100644
198 --- a/setfiles/Makefile
199 +++ b/setfiles/Makefile
200 @@ -12,7 +12,7 @@ CFLAGS ?= -g -Werror -Wall -W
201 override CFLAGS += -I$(DESTDIR)/usr/include
202 LDLIBS = -lselinux -lsepol -L$(LIBDIR)
204 -ifeq ($(AUDITH), /usr/include/libaudit.h)
205 +ifeq ($(AUDITH), $(PREFIX)/include/libaudit.h)
206 override CFLAGS += -DUSE_AUDIT