policycoreutils: honour LINGUAS variable
Subsystems (2)
PATCH 1/7 policycoreutils: honour LINGUAS variable
If the user has the $LINGUAS environment variable set, only translations for those languages should be installed to the system.
The gettext manual [1] says:
"Internationalized packages have usually many ll.po files. Unless translations are disabled, all those available are installed together with the package. However, the environment variable LINGUAS may be set, prior to configuration, to limit the installed set. LINGUAS should then contain a space separated list of two-letter codes, stating which languages are allowed."
[1]: https://www.gnu.org/software/gettext/manual/html_node/Installers.html#Installers
--- policycoreutils/po/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
policycoreutils/po/Makefile +10 -2
@@ -20,8 +20,16 @@ MSGMERGE_FLAGS = -q XGETTEXT = xgettext --default-domain=$(NLSPACKAGE) MSGFMT = msgfmt -# What do we need to do -POFILES = $(wildcard *.po) +# All possible linguas +PO_LINGUAS := $(sort $(patsubst %.po,%,$(wildcard *.po))) + +# Only the files matching what the user has set in LINGUAS +USER_LINGUAS := $(filter $(patsubst %,%%,$(LINGUAS)),$(PO_LINGUAS)) + +# if no valid LINGUAS, build all languages +USE_LINGUAS := $(if $(USER_LINGUAS),$(USER_LINGUAS),$(PO_LINGUAS)) + +POFILES = $(patsubst %,%.po,$(USE_LINGUAS)) MOFILES = $(patsubst %.po,%.mo,$(POFILES)) POTFILES = \ ../run_init/open_init_pty.c \
Signature · 1 line
2.10.2
PATCH 2/7 libselinux: get pcre CFLAGS/LDFLAGS from pkg-config
Gentoo-Bug: https://bugs.gentoo.org/500674
--- libselinux/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
libselinux/Makefile +5 -3
@@ -1,5 +1,6 @@ SUBDIRS = src include utils man +PKG_CONFIG ?= pkg-config DISABLE_SETRANS ?= n DISABLE_RPM ?= n ANDROID_HOST ?= n
@@ -20,10 +21,11 @@ export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y) - PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 - PCRE_LDFLAGS := -lpcre2-8 + PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8) + PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre2-8) else - PCRE_LDFLAGS := -lpcre + PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre) + PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre) endif export PCRE_CFLAGS PCRE_LDFLAGS
Signature · 1 line
2.10.2
PATCH 3/7 libselinux: PCRE_LDFLAGS is actually LDLIBS
In reply to Jason ZamanQuoted 1 line
From Make's manual:
LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker, ‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable instead.
LDLIBS
Library flags or names given to compilers when they are supposed to invoke the linker, ‘ld’. Non-library linker flags, such as -L, should go in the LDFLAGS variable.
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
--- libselinux/Makefile | 6 +++--- libselinux/src/Makefile | 6 +++--- libselinux/utils/Makefile | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
libselinux/Makefile +3 -3
@@ -22,12 +22,12 @@ export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y) PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8) - PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre2-8) + PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre2-8) else PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre) - PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre) + PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre) endif -export PCRE_CFLAGS PCRE_LDFLAGS +export PCRE_CFLAGS PCRE_LDLIBS OS := $(shell uname) export OS
libselinux/src/Makefile +3 -3
@@ -91,7 +91,7 @@ override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup LD_SONAME_FLAGS=-install_name,$(LIBSO) endif -PCRE_LDFLAGS ?= -lpcre +PCRE_LDLIBS ?= -lpcre override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
@@ -143,8 +143,8 @@ $(LIBA): $(OBJS) $(RANLIB) $@ $(LIBSO): $(LOBJS) - $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS) - ln -sf $@ $(TARGET) + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(PCRE_LDLIBS) -ldl -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS) + ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
libselinux/utils/Makefile +2 -2
@@ -46,7 +46,7 @@ endif override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) LDLIBS += -L../src -lselinux -L$(LIBDIR) -PCRE_LDFLAGS ?= -lpcre +PCRE_LDLIBS ?= -lpcre ifeq ($(ANDROID_HOST),y) TARGETS=sefcontext_compile
@@ -54,7 +54,7 @@ else TARGETS=$(patsubst %.c,%,$(wildcard *.c)) endif -sefcontext_compile: LDLIBS += $(PCRE_LDFLAGS) ../src/libselinux.a -lsepol +sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a -lsepol sefcontext_compile: sefcontext_compile.o ../src/regex.o
Signature · 1 line
2.10.2
PATCH 4/7 Makefiles: drop -L/-I to system paths
In reply to Jason ZamanThe toolchain automatically handles them and they break cross compiling.
LDFLAGS should also come before object files, some flags (eg, -Wl,as-needed) can break things if they are in the wrong place)
Gentoo-Bug: https://bugs.gentoo.org/500674
--- checkpolicy/Makefile | 2 +- checkpolicy/test/Makefile | 1 - libselinux/src/Makefile | 10 +++++----- libselinux/utils/Makefile | 5 +++-- libsemanage/src/Makefile | 8 ++++---- libsemanage/tests/Makefile | 8 ++++---- libsepol/utils/Makefile | 4 ++-- mcstrans/src/Makefile | 4 ++-- mcstrans/utils/Makefile | 4 ++-- policycoreutils/hll/pp/Makefile | 3 +-- policycoreutils/load_policy/Makefile | 4 ++-- policycoreutils/newrole/Makefile | 4 ++-- policycoreutils/run_init/Makefile | 4 ++-- policycoreutils/secon/Makefile | 4 ++-- policycoreutils/semodule/Makefile | 3 +-- policycoreutils/sestatus/Makefile | 4 ++-- policycoreutils/setfiles/Makefile | 3 +-- policycoreutils/setsebool/Makefile | 3 +-- python/audit2allow/Makefile | 1 - python/sepolicy/Makefile | 2 +- restorecond/Makefile | 2 +- sandbox/Makefile | 4 ++-- secilc/Makefile | 8 ++++---- semodule-utils/semodule_deps/Makefile | 1 - semodule-utils/semodule_expand/Makefile | 3 +-- semodule-utils/semodule_link/Makefile | 3 +-- semodule-utils/semodule_package/Makefile | 3 +-- 27 files changed, 48 insertions(+), 57 deletions(-)
checkpolicy/Makefile +1 -1
@@ -14,7 +14,7 @@ YACC = bison -y CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing -override CFLAGS += -I. -I${INCLUDEDIR} +override CFLAGS += -I. CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \ policy_define.o
checkpolicy/test/Makefile +0 -1
@@ -8,7 +8,6 @@ INCLUDEDIR ?= $(PREFIX)/include LIBSEPOLA ?= $(LIBDIR)/libsepol.a CFLAGS ?= -g -Wall -W -Werror -O2 -pipe -override CFLAGS += -I$(INCLUDEDIR) all: dispol dismod
libselinux/src/Makefile +5 -5
@@ -93,7 +93,7 @@ endif PCRE_LDLIBS ?= -lpcre -override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) +override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) SWIG_CFLAGS += -Wno-error -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter \ -Wno-shadow -Wno-uninitialized -Wno-missing-prototypes -Wno-missing-declarations
@@ -133,17 +133,17 @@ $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT) $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $< $(SWIGSO): $(SWIGLOBJ) - $(CC) $(CFLAGS) -shared -o $@ $< -L. -lselinux $(LDFLAGS) $(PYLIBS) -L$(LIBDIR) + $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $< -lselinux $(PYLIBS) $(SWIGRUBYSO): $(SWIGRUBYLOBJ) - $(CC) $(CFLAGS) -shared -o $@ $^ -L. -lselinux $(LDFLAGS) $(RUBYLIBS) -L$(LIBDIR) + $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS) $(LIBA): $(OBJS) $(AR) rcs $@ $^ $(RANLIB) $@ $(LIBSO): $(LOBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(PCRE_LDLIBS) -ldl -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(PCRE_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS) ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION
@@ -156,7 +156,7 @@ $(AUDIT2WHYLOBJ): audit2why.c $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $< $(AUDIT2WHYSO): $(AUDIT2WHYLOBJ) $(LIBSEPOLA) - $(CC) $(CFLAGS) -shared -o $@ $^ -L. $(LDFLAGS) -lselinux $(PYLIBS) -L$(LIBDIR) + $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(PYLIBS) %.o: %.c policy.h $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
libselinux/utils/Makefile +3 -2
@@ -44,8 +44,9 @@ override CFLAGS += -I/opt/local/include -I../../libsepol/include override LDFLAGS += -L../../libsepol/src -undefined dynamic_lookup endif -override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) -LDLIBS += -L../src -lselinux -L$(LIBDIR) +override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) +LDFLAGS += -L../src +LDLIBS += -lselinux PCRE_LDLIBS ?= -lpcre ifeq ($(ANDROID_HOST),y)
libsemanage/src/Makefile +4 -4
@@ -61,7 +61,7 @@ CFLAGS ?= -Werror -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format- SWIG_CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable -Wno-shadow \ -Wno-unused-parameter -override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE +override CFLAGS += -I../include -D_GNU_SOURCE RANLIB ?= ranlib SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./
@@ -81,17 +81,17 @@ $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT) $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $< $(SWIGSO): $(SWIGLOBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lsemanage $(PYLIBS) -L$(LIBDIR) + $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $< -lsemanage $(PYLIBS) $(SWIGRUBYSO): $(SWIGRUBYLOBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lsemanage $(RUBYLIBS) -L$(LIBDIR) + $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lsemanage $(RUBYLIBS) $(LIBA): $(OBJS) $(AR) rcs $@ $^ $(RANLIB) $@ $(LIBSO): $(LOBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -laudit -lselinux -lbz2 -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -laudit -lselinux -lbz2 -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION
libsemanage/tests/Makefile +4 -4
@@ -5,20 +5,20 @@ LIBDIR ?= $(PREFIX)/lib SOURCES = $(wildcard *.c) # Add the required external object files here: -LIBS = ../src/libsemanage.a -L$(LIBDIR) -lselinux -lsepol +LIBS = ../src/libsemanage.a -lselinux -lsepol ########################################################################### EXECUTABLE = libsemanage-tests CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter -INCLUDE = -I../src -I../include -I$(PREFIX)/include -LDFLAGS += -lcunit -lbz2 -laudit +INCLUDE = -I../src -I../include +LDLIBS += -lcunit -lbz2 -laudit OBJECTS = $(SOURCES:.c=.o) all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) ../src/libsemanage.a - $(CC) $(OBJECTS) $(LIBS) $(LDFLAGS) -o $@ + $(CC) $(OBJECTS) $(LIBS) $(LDFLAGS) -o $@ $(LDLIBS) %.o: %.c $(CC) $(CFLAGS) $(INCLUDE) -c $*.c -o $*.o
libsepol/utils/Makefile +2 -2
@@ -3,8 +3,8 @@ PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin CFLAGS ?= -Wall -Werror -override CFLAGS += -I../include -LDLIBS += -L../src -lsepol +LDFLAGS += -L../src +LDLIBS += -lsepol TARGETS=$(patsubst %.c,%,$(wildcard *.c))
mcstrans/src/Makefile +2 -2
@@ -10,12 +10,12 @@ PROG_OBJS= $(patsubst %.c,%.o,$(PROG_SRC)) PROG=mcstransd INITSCRIPT=mcstrans CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -override CFLAGS += -I$(PREFIX)/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 all: $(PROG) $(PROG): $(PROG_OBJS) - $(CC) $(LDFLAGS) -pie -o $@ $^ -lselinux -lcap -lpcre $(LIBDIR)/libsepol.a -L$(LIBDIR) + $(CC) $(LDFLAGS) -pie -o $@ $^ -lselinux -lcap -lpcre $(LIBDIR)/libsepol.a %.o: %.c $(CC) $(CFLAGS) -fPIE -c -o $@ $<
mcstrans/utils/Makefile +2 -2
@@ -5,8 +5,8 @@ BINDIR ?= $(PREFIX)/sbin LIBSEPOLA ?= $(LIBDIR)/libsepol.a CFLAGS ?= -Wall -override CFLAGS += -I../src -I$(PREFIX)/include -D_GNU_SOURCE -LDLIBS += -L$(LIBDIR) -lselinux -lpcre +override CFLAGS += -I../src -D_GNU_SOURCE +LDLIBS += -lselinux -lpcre TARGETS=$(patsubst %.c,%,$(wildcard *.c))
policycoreutils/hll/pp/Makefile +1 -2
@@ -8,8 +8,7 @@ LIBEXECDIR ?= $(PREFIX)/libexec HLLDIR ?= $(LIBEXECDIR)/selinux/hll CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) -LDLIBS = -lsepol -L$(LIBDIR) +LDLIBS = -lsepol PP_SRCS = $(wildcard *.c) PP_OBJS = $(patsubst %.c,%.o,$(PP_SRCS))
policycoreutils/load_policy/Makefile +2 -2
@@ -6,8 +6,8 @@ MANDIR ?= $(PREFIX)/share/man LOCALEDIR ?= /usr/share/locale CFLAGS ?= -Werror -Wall -W -override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" -LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib +override CFLAGS += $(LDFLAGS) -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" +LDLIBS += -lsepol -lselinux TARGETS=$(patsubst %.c,%,$(wildcard *.c))
policycoreutils/newrole/Makefile +2 -2
@@ -22,8 +22,8 @@ VERSION = $(shell cat ../VERSION) CFLAGS ?= -Werror -Wall -W EXTRA_OBJS = -override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" -LDLIBS += -lselinux -L$(PREFIX)/lib +override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" +LDLIBS += -lselinux ifeq ($(PAMH), /usr/include/security/pam_appl.h) override CFLAGS += -DUSE_PAM EXTRA_OBJS += hashtab.o
policycoreutils/run_init/Makefile +2 -2
@@ -9,8 +9,8 @@ PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null) AUDITH = $(shell ls /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 +override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" +LDLIBS += -lselinux ifeq ($(PAMH), /usr/include/security/pam_appl.h) override CFLAGS += -DUSE_PAM LDLIBS += -lpam -lpam_misc
policycoreutils/secon/Makefile +2 -2
@@ -8,8 +8,8 @@ LIBDIR ?= $(PREFIX)/lib WARNS=-Werror -W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal VERSION = $(shell cat ../VERSION) CFLAGS ?= $(WARNS) -O1 -override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(INCLUDEDIR) -LDLIBS = -lselinux -L$(LIBDIR) +override CFLAGS += -DVERSION=\"$(VERSION)\" +LDLIBS = -lselinux all: secon
policycoreutils/semodule/Makefile +1 -2
@@ -6,8 +6,7 @@ MANDIR = $(PREFIX)/share/man LIBDIR ?= $(PREFIX)/lib CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) -LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR) +LDLIBS = -lsepol -lselinux -lsemanage SEMODULE_OBJS = semodule.o all: semodule genhomedircon
policycoreutils/sestatus/Makefile +2 -2
@@ -6,8 +6,8 @@ ETCDIR ?= $(DESTDIR)/etc LIBDIR ?= $(PREFIX)/lib CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -LDLIBS = -lselinux -L$(LIBDIR) +override CFLAGS += -D_FILE_OFFSET_BITS=64 +LDLIBS = -lselinux all: sestatus
policycoreutils/setfiles/Makefile +1 -2
@@ -8,8 +8,7 @@ AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }') CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -LDLIBS = -lselinux -lsepol -L$(LIBDIR) +LDLIBS = -lselinux -lsepol ifeq ($(AUDITH), /usr/include/libaudit.h) override CFLAGS += -DUSE_AUDIT
policycoreutils/setsebool/Makefile +1 -2
@@ -7,8 +7,7 @@ LIBDIR ?= $(PREFIX)/lib BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) -LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR) +LDLIBS = -lsepol -lselinux -lsemanage SETSEBOOL_OBJS = setsebool.o BASHCOMPLETIONS=setsebool-bash-completion.sh
python/audit2allow/Makefile +0 -1
@@ -10,7 +10,6 @@ INCLUDEDIR ?= $(PREFIX)/include LIBSEPOLA ?= $(LIBDIR)/libsepol.a CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) all: audit2why sepolgen-ifgen-attr-helper
python/sepolicy/Makefile +1 -1
@@ -12,7 +12,7 @@ LOCALEDIR ?= /usr/share/locale BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions SHAREDIR ?= $(PREFIX)/share/sandbox CFLAGS ?= -Wall -Werror -Wextra -W -override CFLAGS += -I$(PREFIX)/include -DPACKAGE="policycoreutils" -DSHARED -shared +override CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared BASHCOMPLETIONS=sepolicy-bash-completion.sh
restorecond/Makefile +1 -1
@@ -17,7 +17,7 @@ DBUSFLAGS = -DHAVE_DBUS $(shell $(PKG_CONFIG) --cflags dbus-glib-1) DBUSLIB = $(shell $(PKG_CONFIG) --libs dbus-glib-1) CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include $(DBUSFLAGS) +override CFLAGS += $(DBUSFLAGS) USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y)
sandbox/Makefile +2 -2
@@ -9,8 +9,8 @@ SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man LOCALEDIR ?= /usr/share/locale SHAREDIR ?= $(PREFIX)/share/sandbox -override CFLAGS += -I$(PREFIX)/include -DPACKAGE="\"policycoreutils\"" -Wall -Werror -Wextra -W -LDLIBS += -lselinux -lcap-ng -L$(LIBDIR) +override CFLAGS += -DPACKAGE="\"policycoreutils\"" -Wall -Werror -Wextra -W +LDLIBS += -lselinux -lcap-ng SEUNSHARE_OBJS = seunshare.o all: sandbox seunshare sandboxX.sh start
secilc/Makefile +4 -4
@@ -4,7 +4,7 @@ MANDIR ?= $(PREFIX)/share/man LIBDIR ?= $(PREFIX)/lib INCLUDEDIR ?= $(PREFIX)/include -LDLIBS = -lsepol -L$(LIBDIR) +LDLIBS = -lsepol SECILC = secilc SECILC_SRCS := secilc.c
@@ -20,18 +20,18 @@ XMLTO = xmlto CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused -override CFLAGS += -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 all: $(SECILC) $(SECIL2CONF) man $(SECILC): $(SECILC_OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) test: $(SECILC) ./$(SECILC) test/policy.cil $(SECIL2CONF): $(SECIL2CONF_OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) man: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE)
semodule-utils/semodule_deps/Makefile +0 -1
@@ -7,7 +7,6 @@ MANDIR ?= $(PREFIX)/share/man LIBSEPOLA ?= $(LIBDIR)/libsepol.a CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) all: semodule_deps
semodule-utils/semodule_expand/Makefile +1 -2
@@ -6,8 +6,7 @@ LIBDIR ?= $(PREFIX)/lib MANDIR ?= $(PREFIX)/share/man CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) -LDLIBS = -lsepol -L$(LIBDIR) +LDLIBS = -lsepol all: semodule_expand
semodule-utils/semodule_link/Makefile +1 -2
@@ -6,8 +6,7 @@ MANDIR ?= $(PREFIX)/share/man LIBDIR ?= $(PREFIX)/lib CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) -LDLIBS = -lsepol -L$(LIBDIR) +LDLIBS = -lsepol all: semodule_link
semodule-utils/semodule_package/Makefile +1 -2
@@ -6,8 +6,7 @@ LIBDIR ?= $(PREFIX)/lib MANDIR ?= $(PREFIX)/share/man CFLAGS ?= -Werror -Wall -W -override CFLAGS += -I$(INCLUDEDIR) -LDLIBS = -lsepol -L$(LIBDIR) +LDLIBS = -lsepol all: semodule_package semodule_unpackage
Signature · 1 line
2.10.2
PATCH 5/7 restorecond: get pcre cflags/libs from pkg-config
In reply to Jason Zaman--- restorecond/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
restorecond/Makefile +6 -3
@@ -21,12 +21,15 @@ override CFLAGS += $(DBUSFLAGS) USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y) - PCRE_LDFLAGS := -lpcre2-8 + PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8) + PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre2-8) else - PCRE_LDFLAGS := -lpcre + PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre) + PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre) endif +export PCRE_CFLAGS PCRE_LDLIBS -LDLIBS += -lselinux $(PCRE_LDFLAGS) $(DBUSLIB) -L$(LIBDIR) +LDLIBS += -lselinux $(PCRE_LDLIBS) $(DBUSLIB) all: restorecond
Signature · 1 line
2.10.2
PATCH 6/7 Add includes for DESTDIR only in root Makefile
In reply to Jason Zaman--- Makefile | 7 +++++++ 1 file changed, 7 insertions(+)
Makefile +7 -0
@@ -8,6 +8,13 @@ ifeq ($(DEBUG),1) export LDFLAGS = -g endif +ifneq ($(DESTDIR),) + CFLAGS += -I$(DESTDIR)/usr/include + LDFLAGS += -L$(DESTDIR)/usr/lib + export CFLAGS + export LDFLAGS +endif + all install relabel clean test indent: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) $@) || exit 1; \
Signature · 1 line
2.10.2
PATCH 7/7 policycoreutils: make audit and pam support configurable
In reply to Jason Zaman--- policycoreutils/newrole/Makefile | 10 +++++----- policycoreutils/run_init/Makefile | 10 +++++----- policycoreutils/setfiles/Makefile | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-)
policycoreutils/newrole/Makefile +5 -5
@@ -4,8 +4,8 @@ BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man ETCDIR ?= $(DESTDIR)/etc LOCALEDIR = /usr/share/locale -PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null) -AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) +PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) +AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) # Enable capabilities to permit newrole to generate audit records. # This will make newrole a setuid root program. # The capabilities used are: CAP_AUDIT_WRITE.
@@ -24,7 +24,7 @@ CFLAGS ?= -Werror -Wall -W EXTRA_OBJS = override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" LDLIBS += -lselinux -ifeq ($(PAMH), /usr/include/security/pam_appl.h) +ifeq ($(PAMH), y) 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), y) 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), y) 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
policycoreutils/run_init/Makefile +5 -5
@@ -5,20 +5,20 @@ SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man ETCDIR ?= $(DESTDIR)/etc LOCALEDIR ?= /usr/share/locale -PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null) -AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) +PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) +AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) CFLAGS ?= -Werror -Wall -W override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" LDLIBS += -lselinux -ifeq ($(PAMH), /usr/include/security/pam_appl.h) +ifeq ($(PAMH), y) 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), y) 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), y) install -m 644 run_init.pamd $(ETCDIR)/pam.d/run_init endif
policycoreutils/setfiles/Makefile +2 -2
@@ -3,14 +3,14 @@ PREFIX ?= $(DESTDIR)/usr SBINDIR ?= $(DESTDIR)/sbin MANDIR = $(PREFIX)/share/man LIBDIR ?= $(PREFIX)/lib -AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) +AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }') CFLAGS ?= -g -Werror -Wall -W LDLIBS = -lselinux -lsepol -ifeq ($(AUDITH), /usr/include/libaudit.h) +ifeq ($(AUDITH), y) override CFLAGS += -DUSE_AUDIT LDLIBS += -laudit endif
Signature · 1 line
2.10.2
Re: [PATCH 7/7] policycoreutils: make audit and pam support configurable
Quoted 1 line · Jason Zaman
Signed-off-by Jason Zaman <[email protected]>
Thanks, all seven applied.
Quoted 113 lines
---
policycoreutils/newrole/Makefile | 10 +++++----- policycoreutils/run_init/Makefile | 10 +++++----- policycoreutils/setfiles/Makefile | 4 ++--3 files changed, 12 insertions(+), 12 deletions(-)policycoreutils/newrole/Makefile +0
-0@@ -4,8 +4,8 @@ BINDIR ?= $(PREFIX)/binMANDIR ?= $(PREFIX)/share/man
ETCDIR ?= $(DESTDIR)/etc
LOCALEDIR =/usr/share/localepolicycoreutils/newrole/Makefile +2
-2-PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null) -AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) +PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) +AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)# Enable capabilities to permit newrole to generate audit records. # This will make newrole a setuid root program.
# The capabilities used are:CAP_AUDIT_WRITE.policycoreutils/newrole/Makefile +0
-0@@ -24,7 +24,7 @@ CFLAGS ?= -Werror -Wall -WEXTRA_OBJS =
override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" LDLIBS += -lselinuxpolicycoreutils/newrole/Makefile +1
-1-ifeq ($(PAMH), /usr/include/security/pam_appl.h) +ifeq ($(PAMH), y)override CFLAGS += -DUSE_PAM
EXTRA_OBJS+= hashtab.o
LDLIBS += -lpam -lpam_miscpolicycoreutils/newrole/Makefile +0
-0@@ -32,7 +32,7 @@ elseoverride CFLAGS += -D_XOPEN_SOURCE=500
LDLIBS += -lcrypt
endifpolicycoreutils/newrole/Makefile +1
-1-ifeq ($(AUDITH), /usr/include/libaudit.h) +ifeq ($(AUDITH), y)override CFLAGS += -DUSE_AUDIT
LDLIBS += -laudit
endifpolicycoreutils/newrole/Makefile +0
-0@@ -66,7 +66,7 @@ install: alltest -d $(MANDIR)/man1 || install -m 755 -d $(MANDIR)/man1 install -m $(MODE) newrole $(BINDIR)
install -m 644 newrole.1 $(MANDIR)/man1/policycoreutils/newrole/Makefile +1
-1-ifeq ($(PAMH), /usr/include/security/pam_appl.h) +ifeq ($(PAMH), y)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/newrolepolicycoreutils/run_init/Makefile +0
-0@@ -5,20 +5,20 @@ SBINDIR ?= $(PREFIX)/sbinMANDIR ?= $(PREFIX)/share/man
ETCDIR ?= $(DESTDIR)/etc
LOCALEDIR ?=/usr/share/localepolicycoreutils/run_init/Makefile +2
-2-PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null) -AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) +PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) +AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
CFLAGS ?= -Werror -Wall -W
override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
LDLIBS += -lselinuxpolicycoreutils/run_init/Makefile +1
-1-ifeq ($(PAMH), /usr/include/security/pam_appl.h) +ifeq ($(PAMH), y)override CFLAGS += -DUSE_PAM
LDLIBS += -lpam -lpam_misc
else
override CFLAGS += -D_XOPEN_SOURCE=500
LDLIBS += -lcrypt
endifpolicycoreutils/run_init/Makefile +1
-1-ifeq ($(AUDITH), /usr/include/libaudit.h) +ifeq ($(AUDITH), y)override CFLAGS += -DUSE_AUDIT
LDLIBS += -laudit
endifpolicycoreutils/run_init/Makefile +0
-0@@ -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/
policycoreutils/run_init/Makefile +1
-1-ifeq ($(PAMH), /usr/include/security/pam_appl.h) +ifeq ($(PAMH), y)install -m 644 run_init.pamd $(ETCDIR)/pam.d/run_init endif
policycoreutils/setfiles/Makefile +0
-0@@ -3,14 +3,14 @@ PREFIX ?= $(DESTDIR)/usrSBINDIR ?= $(DESTDIR)/sbin
MANDIR = $(PREFIX)/share/man
LIBDIR ?= $(PREFIX)/libpolicycoreutils/setfiles/Makefile +1
-1-AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) +AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
ABORT_ON_ERRORS=$(shell grep "^\#defineABORT_ON_ERRORS"setfiles.c| awk -S '{ print $$3 }')
CFLAGS ?= -g -Werror -Wall -W
LDLIBS = -lselinux -lsepolpolicycoreutils/setfiles/Makefile +1
-1-ifeq ($(AUDITH), /usr/include/libaudit.h) +ifeq ($(AUDITH), y)override CFLAGS += -DUSE_AUDIT
LDLIBS += -laudit
endif