From 0d9f220a005c63079292a2122071ca7ac5d71970 Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Tue, 13 Mar 2018 15:35:48 +0100 Subject: [PATCH] checkpolicy-2.7-6 - build: follow standard semantics for DESTDIR and PREFIX --- checkpolicy-fedora.patch | 99 ++++++++++++++++++++++++++++++++++++++++ checkpolicy.spec | 11 +++-- 2 files changed, 106 insertions(+), 4 deletions(-) diff --git a/checkpolicy-fedora.patch b/checkpolicy-fedora.patch index 7916347..834c878 100644 --- a/checkpolicy-fedora.patch +++ b/checkpolicy-fedora.patch @@ -1,3 +1,69 @@ +diff --git checkpolicy-2.7/Makefile checkpolicy-2.7/Makefile +index 68e11f2..4c817cd 100644 +--- checkpolicy-2.7/Makefile ++++ checkpolicy-2.7/Makefile +@@ -1,12 +1,9 @@ + # + # Makefile for building the checkpolicy program + # +-PREFIX ?= $(DESTDIR)/usr ++PREFIX ?= /usr + BINDIR ?= $(PREFIX)/bin + MANDIR ?= $(PREFIX)/share/man +-LIBDIR ?= $(PREFIX)/lib +-INCLUDEDIR ?= $(PREFIX)/include +-LIBSEPOLA ?= $(LIBDIR)/libsepol.a + TARGETS = checkpolicy checkmodule + + LEX = flex +@@ -14,7 +11,12 @@ YACC = bison -y + + CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing + +-override CFLAGS += -I. ++# If no specific libsepol.a is specified, fall back on LDFLAGS search path ++# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there ++# is no need to define a value for LDLIBS_LIBSEPOLA ++ifeq ($(LIBSEPOLA),) ++ LDLIBS_LIBSEPOLA := -l:libsepol.a ++endif + + CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \ + policy_define.o +@@ -27,8 +29,10 @@ all: $(TARGETS) + $(MAKE) -C test + + checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA) ++ $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) + + checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA) ++ $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) + + %.o: %.c + $(CC) $(CFLAGS) -o $@ -c $< +@@ -46,15 +50,15 @@ lex.yy.c: policy_scan.l y.tab.c + $(LEX) policy_scan.l + + install: all +- -mkdir -p $(BINDIR) +- -mkdir -p $(MANDIR)/man8 +- install -m 755 $(TARGETS) $(BINDIR) +- install -m 644 checkpolicy.8 $(MANDIR)/man8 +- install -m 644 checkmodule.8 $(MANDIR)/man8 ++ -mkdir -p $(DESTDIR)$(BINDIR) ++ -mkdir -p $(DESTDIR)$(MANDIR)/man8 ++ install -m 755 $(TARGETS) $(DESTDIR)$(BINDIR) ++ install -m 644 checkpolicy.8 $(DESTDIR)$(MANDIR)/man8 ++ install -m 644 checkmodule.8 $(DESTDIR)$(MANDIR)/man8 + + relabel: install +- /sbin/restorecon $(BINDIR)/checkpolicy +- /sbin/restorecon $(BINDIR)/checkmodule ++ /sbin/restorecon $(DESTDIR)$(BINDIR)/checkpolicy ++ /sbin/restorecon $(DESTDIR)$(BINDIR)/checkmodule + + clean: + -rm -f $(TARGETS) $(CHECKPOLOBJS) $(CHECKMODOBJS) y.tab.c y.tab.h lex.yy.c diff --git checkpolicy-2.7/checkmodule.8 checkpolicy-2.7/checkmodule.8 index ee95882..cf76591 100644 --- checkpolicy-2.7/checkmodule.8 @@ -89,3 +155,36 @@ index 655c94b..60c07fe 100644 /* FLASK */ +diff --git checkpolicy-2.7/test/Makefile checkpolicy-2.7/test/Makefile +index 59fa446..89e7557 100644 +--- checkpolicy-2.7/test/Makefile ++++ checkpolicy-2.7/test/Makefile +@@ -1,19 +1,22 @@ + # + # Makefile for building the dispol program + # +-PREFIX ?= $(DESTDIR)/usr +-BINDIR ?= $(PREFIX)/bin +-LIBDIR ?= $(PREFIX)/lib +-INCLUDEDIR ?= $(PREFIX)/include +-LIBSEPOLA ?= $(LIBDIR)/libsepol.a +- + CFLAGS ?= -g -Wall -W -Werror -O2 -pipe + ++# If no specific libsepol.a is specified, fall back on LDFLAGS search path ++# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there ++# is no need to define a value for LDLIBS_LIBSEPOLA ++ifeq ($(LIBSEPOLA),) ++ LDLIBS_LIBSEPOLA := -l:libsepol.a ++endif ++ + all: dispol dismod + + dispol: dispol.o $(LIBSEPOLA) ++ $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) + + dismod: dismod.o $(LIBSEPOLA) ++ $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) + + clean: + -rm -f dispol dismod *.o diff --git a/checkpolicy.spec b/checkpolicy.spec index ed99f1b..b1f757f 100644 --- a/checkpolicy.spec +++ b/checkpolicy.spec @@ -1,16 +1,16 @@ -%define libselinuxver 2.7-6 -%define libsepolver 2.7-3 +%define libselinuxver 2.7-12 +%define libsepolver 2.7-5 Summary: SELinux policy compiler Name: checkpolicy Version: 2.7 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2 Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20170804/checkpolicy-2.7.tar.gz # download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh # run: # $ VERSION=2.7 ./make-fedora-selinux-patch.sh checkpolicy -# HEAD https://github.com/fedora-selinux/selinux/commit/4247fad665261169b430895f0ab10f56eb33dd10 +# HEAD https://github.com/fedora-selinux/selinux/commit/4e253a0231ca085df03b55c4c0490ad6a0e261eb Patch1: checkpolicy-fedora.patch Conflicts: selinux-policy-base < 3.13.1-138 BuildRequires: gcc @@ -56,6 +56,9 @@ install test/dispol ${RPM_BUILD_ROOT}%{_bindir}/sedispol %{_bindir}/sedispol %changelog +* Tue Mar 13 2018 Petr Lautrbach - 2.7-6 +- build: follow standard semantics for DESTDIR and PREFIX + * Thu Feb 22 2018 Florian Weimer - 2.7-5 - Use LDFLAGS from redhat-rpm-config