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