From: william.c.roberts@intel.com
To: selinux@tycho.nsa.gov, seandroid-list@tycho.nsa.gov, sds@tycho.nsa.gov
Subject: [PATCH v2] libselinux: add ANDROID_HOST=y build option
Date: Mon, 26 Sep 2016 13:53:09 -0700 [thread overview]
Message-ID: <1474923189-26431-1-git-send-email-william.c.roberts@intel.com> (raw)
From: William Roberts <william.c.roberts@intel.com>
To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.
eg)
make ANDROID_HOST=y
Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
libselinux/Makefile | 8 +++++++-
libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
2 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/libselinux/Makefile b/libselinux/Makefile
index 5a8d42c..50ae009 100644
--- a/libselinux/Makefile
+++ b/libselinux/Makefile
@@ -10,6 +10,12 @@ ifeq ($(EMBEDDED),y)
override DISABLE_RPM=y
override DISABLE_BOOL=y
endif
+ifeq ($(ANDROID_HOST),y)
+ override DISABLE_SETRANS=y
+ EMFLAGS+= -DDISABLE_RPM -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \
+ -DBUILD_HOST
+ SUBDIRS = src
+endif
ifeq ($(DISABLE_AVC),y)
EMFLAGS+= -DDISABLE_AVC
endif
@@ -22,7 +28,7 @@ endif
ifeq ($(DISABLE_SETRANS),y)
EMFLAGS+= -DDISABLE_SETRANS
endif
-export DISABLE_AVC DISABLE_SETRANS DISABLE_RPM DISABLE_BOOL EMFLAGS
+export DISABLE_AVC DISABLE_SETRANS DISABLE_RPM DISABLE_BOOL EMFLAGS ANDROID_HOST
USE_PCRE2 ?= n
ifeq ($(USE_PCRE2),y)
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 36e42b8..d841ef7 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -47,9 +47,17 @@ endif
ifeq ($(DISABLE_BOOL),y)
UNUSED_SRCS+=booleans.c
endif
+ifeq ($(ANDROID_HOST),y)
+ SRCS=callbacks.c freecon.c label.c label_file.c \
+ label_android_property.c regex.c label_support.c \
+ matchpathcon.c setrans_client.c sha1.c
+ override CFLAGS += -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \
+ -DBUILD_HOST
+else
+ SRCS= $(filter-out $(UNUSED_SRCS) $(GENERATED) audit2why.c, $(sort $(wildcard *.c)))
+endif
GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) selinuxswig_python_exception.i
-SRCS= $(filter-out $(UNUSED_SRCS) $(GENERATED) audit2why.c, $(sort $(wildcard *.c)))
MAX_STACK_SIZE=32768
@@ -92,6 +100,28 @@ SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS)
SWIGRUBY = swig -Wall -ruby -o $(SWIGRUBYCOUT) -outdir ./ $(EMFLAGS)
+$(LIBA): $(OBJS)
+ $(AR) rcs $@ $^
+ $(RANLIB) $@
+
+$(LIBSO): $(LOBJS)
+ $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
+ ln -sf $@ $(TARGET)
+
+%.o: %.c policy.h
+ $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
+
+%.lo: %.c policy.h
+ $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
+
+# ANDROID_HOST Build option only builds the shared and static versions of
+# libselinux.
+ifeq ($(ANDROID_HOST),y)
+
+all: $(LIBA) $(LIBSO)
+
+else
+
all: $(LIBA) $(LIBSO) $(LIBPC)
pywrap: all $(SWIGFILES) $(AUDIT2WHYSO)
@@ -110,14 +140,6 @@ $(SWIGSO): $(SWIGLOBJ)
$(SWIGRUBYSO): $(SWIGRUBYLOBJ)
$(CC) $(CFLAGS) -shared -o $@ $^ -L. -lselinux $(LDFLAGS) -L$(LIBDIR)
-$(LIBA): $(OBJS)
- $(AR) rcs $@ $^
- $(RANLIB) $@
-
-$(LIBSO): $(LOBJS)
- $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
- ln -sf $@ $(TARGET)
-
$(LIBPC): $(LIBPC).in ../VERSION
sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
@@ -130,12 +152,6 @@ $(AUDIT2WHYLOBJ): audit2why.c
$(AUDIT2WHYSO): $(AUDIT2WHYLOBJ)
$(CC) $(CFLAGS) -shared -o $@ $^ -L. $(LDFLAGS) -lselinux $(LIBDIR)/libsepol.a -L$(LIBDIR)
-%.o: %.c policy.h
- $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
-
-%.lo: %.c policy.h
- $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
-
$(SWIGCOUT): $(SWIGIF)
$(SWIG) $<
@@ -178,4 +194,6 @@ distclean: clean
indent:
../../scripts/Lindent $(filter-out $(GENERATED),$(wildcard *.[ch]))
-.PHONY: all clean pywrap rubywrap swigify install install-pywrap install-rubywrap distclean
+.PHONY: clean pywrap rubywrap swigify install install-pywrap install-rubywrap distclean
+endif
+.PHONY: all
--
1.9.1
next reply other threads:[~2016-09-26 20:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 20:53 william.c.roberts [this message]
2016-09-26 20:55 ` [PATCH v2] libselinux: add ANDROID_HOST=y build option William Roberts
2016-09-27 14:03 ` Stephen Smalley
2016-09-27 15:09 ` William Roberts
2016-09-27 14:11 ` Stephen Smalley
2016-09-27 15:08 ` William Roberts
2016-09-27 16:52 ` Stephen Smalley
2016-09-27 17:00 ` William Roberts
2016-09-27 19:13 ` William Roberts
2016-09-27 19:17 ` Stephen Smalley
2016-09-27 17:02 ` Stephen Smalley
2016-09-27 18:43 ` William Roberts
2016-09-27 18:51 ` Stephen Smalley
2016-09-27 19:03 ` William Roberts
2016-09-27 19:08 ` Stephen Smalley
2016-09-27 19:09 ` William Roberts
2016-09-27 19:15 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474923189-26431-1-git-send-email-william.c.roberts@intel.com \
--to=william.c.roberts@intel.com \
--cc=sds@tycho.nsa.gov \
--cc=seandroid-list@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.