0002-Add-PREFIX-to-host-paths.patch 7.2 KB

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