policycoreutils: add a HLL compiler to convert policy packages (.pp) to CIL

Reads in a policy package file via stdin or via filename, and writes out
the equivilent CIL to stdout or to an output file, depending on the
parameters passed in.

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
Steve Lawrence 2014-01-24 16:25:06 -05:00
parent 2ff279e21e
commit 893851c0a1
5 changed files with 3544 additions and 1 deletions

View File

@ -14,3 +14,4 @@ sestatus/sestatus
setfiles/restorecon
setfiles/setfiles
setsebool/setsebool
hll/pp/pp

View File

@ -1,4 +1,4 @@
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
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 /usr/include/sys/inotify.h 2>/dev/null)

View File

@ -0,0 +1,8 @@
SUBDIRS = pp
all install relabel clean indent:
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
test:

View File

@ -0,0 +1,35 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
INCLUDEDIR ?= $(PREFIX)/include
SBINDIR ?= $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
LIBDIR ?= $(PREFIX)/lib
LIBEXECDIR ?= $(PREFIX)/libexec
HLLDIR ?= $(LIBEXECDIR)/selinux/hll
CFLAGS ?= -Werror -Wall -W
override CFLAGS += -I$(INCLUDEDIR)
LDLIBS = $(LIBDIR)/libsepol.a -L$(LIBDIR)
PP_SRCS = $(wildcard *.c)
PP_OBJS = $(patsubst %.c,%.o,$(PP_SRCS))
all: pp
pp: $(PP_OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^
install: all
-mkdir -p $(HLLDIR)
install -m 755 pp $(HLLDIR)
relabel:
clean:
-rm -f pp $(PP_OBJS)
indent:
../../scripts/Lindent $(wildcard *.[ch])

3499
policycoreutils/hll/pp/pp.c Normal file

File diff suppressed because it is too large Load Diff