Skip to contentSkip to conversation

libselinux: add ANDROID_HOST=y build option

PATCH Superseded [email protected] 3 participants 17 messages Sep 26, 2016 – Sep 27, 2016 SELinux security module

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libselinux: add ANDROID_HOST=y build option

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +7 -1
index 5a8d42c..50ae009 100644
@@ -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)
libselinux/src/Makefile +34 -16

79 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 19 lines · On Mon, Sep 26, 2016 at 1:53 PM, <[email protected]> wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +0 -0
index 5a8d42c..50ae009 100644

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 6 lines
libselinux/Makefile +3 -0
@@ -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 \

argghhh .. missing too much, drop DISABLE_RPM... copy+paste+edit fail. Ill let v2 sit for a day, and aggregate other
feedback for v3. Sorry for the noise.

<snip>

#2 lore raw
Quoted 15 lines · William Roberts
Quoted 14 lines · On Mon, Sep 26, 2016 at 1:53 PM, <[email protected]> wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
Quoted 15 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 11 lines
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

argghhh .. missing too much, drop DISABLE_RPM... copy+paste+edit fail. Ill let v2 sit for a day, and aggregate other
feedback for v3. Sorry for the noise.

Sorry, why can't you override DISABLE_RPM=y?

#3 lore raw
Quoted 32 lines · Stephen Smalley
Quoted 15 lines · William Roberts
Quoted 14 lines · On Mon, Sep 26, 2016 at 1:53 PM, <[email protected]> wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
Quoted 15 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 11 lines
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

argghhh .. missing too much, drop DISABLE_RPM... copy+paste+edit fail. Ill let v2 sit for a day, and aggregate other
feedback for v3. Sorry for the noise.

Quoted 2 lines

Sorry, why can't you override DISABLE_RPM=y?

It's superfluous because it;s not used in the source files built for ANDROID_HOST, and
it doesn't match the build recipe for Android. So if the goal would be to provide a quick
flag to test the build against, it wouldn't meet that requirement.

#4 lore raw
In reply to [email protected]
Quoted 7 lines · On 09/26/2016 04:53 PM, [email protected] wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

Quoted 12 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +0 -0
index 5a8d42c..50ae009 100644

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 9 lines
libselinux/Makefile +6 -0
@@ -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

Don't you actually want to also pick up utils/sefcontext_compile? That is built and used on the build host. And I'm not sure why we'd drop the other SUBDIRS.

Quoted 42 lines
libselinux/Makefile +1 -1
 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)
libselinux/src/Makefile +12 -1
index 36e42b8..d841ef7 100644
@@ -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) $@

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 115

Quoted 10 lines
libselinux/src/Makefile +10 -0
+
+$(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 $@ $<

Did these truly need to move? I don't see why.

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 125

Quoted 10 lines
libselinux/src/Makefile +9 -0
+
+# 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)

Is this worthwhile/necessary? The point of the build option IIUC is just to allow upstream testing that the Android build host version will still build, it shouldn't matter if there are extras.

Quoted 31 lines
libselinux/src/Makefile +0 -14
 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) $<
 

libselinux/src/Makefile distclean: clean · line 199

Quoted 7 lines
libselinux/src/Makefile +3 -1
@@ -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

Why is this needed?

BTW, this option can be dangerous. Don't build with it and then do a make install later without doing a make clean - you'll brick your Linux system ;(

#5 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 7 lines · On 09/26/2016 04:53 PM, [email protected] wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but considering that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 18 lines
Quoted 18 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +2 -0
index 5a8d42c..50ae009 100644
@@ -10,6 +10,12 @@ ifeq ($(EMBEDDED),y)
      override DISABLE_RPM=y
      override DISABLE_BOOL=y
 endif
+ifeq ($(ANDROID_HOST),y)
+     override DISABLE_SETRANS=y
Quoted 8 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 4 lines
libselinux/Makefile +4 -0
+     EMFLAGS+= -DDISABLE_RPM -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \
+             -DBUILD_HOST
+     SUBDIRS = src
+endif

Don't you actually want to also pick up utils/sefcontext_compile? That is built and used on the build host. And I'm not sure why we'd drop the other SUBDIRS.

You'll start running into linking issues if things that use libselinux, use something not
in the build host IIRC. Perhaps, if that is the issue, we just limit it to sefcontext_compile.

Quoted 40 lines
Quoted 40 lines
libselinux/Makefile +1 -1
 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)
libselinux/src/Makefile +9 -1
index 36e42b8..d841ef7 100644
@@ -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)
 
Quoted 15 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 115

Quoted 13 lines
libselinux/src/Makefile +13 -0
+$(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 $@ $<

Did these truly need to move? I don't see why.

this prevents us from having multiple definitions of the recipes or multiple if's on ANDROID_HOST=y.
Both flavors need these wildcard targets.

Quoted 15 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 125

Quoted 11 lines
libselinux/src/Makefile +9 -0
+
+# 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)

Is this worthwhile/necessary? The point of the build option IIUC is just to allow upstream testing that the Android build host version will still build, it shouldn't matter if there are extras.

Those things die on linking... so I didn't want to submit something where Make returns not 0.

Quoted 35 lines
Quoted 35 lines
libselinux/src/Makefile +0 -14
 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]))
 
Quoted 6 lines

libselinux/src/Makefile distclean: clean · line 199

Quoted 4 lines
libselinux/src/Makefile +3 -1
-.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

Why is this needed?

The targets for %.o and %.lo are used on all build targets, the rest is committed on ANDROID_HOST=y.
So for the stuff that is separated out, we have a .PHONY for it. For the things the define in common,
notably ALL, we have a shared .PHONY for them.

Quoted 4 lines

BTW, this option can be dangerous. Don't build with it and then do a make install later without doing a make clean - you'll brick your Linux system ;(

That is true, but isn't that the point of SE Linux :-P. Kidding aside, perhaps we
could create a guard file that's checked on install, if its there, you need to run make clean first.

#6 lore raw
Quoted 10 lines · William Roberts
Quoted 9 lines · Stephen Smalley
Quoted 7 lines · On 09/26/2016 04:53 PM, [email protected] wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Quoted 8 lines
Quoted 2 lines

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but considering that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Ok, fair point. Actually EMBEDDED=y is broken and no one is using it AFAIK so we should probably kill it at some point separately.

Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +2 -0
index 5a8d42c..50ae009 100644
@@ -10,6 +10,12 @@ ifeq ($(EMBEDDED),y)
      override DISABLE_RPM=y
      override DISABLE_BOOL=y
 endif
+ifeq ($(ANDROID_HOST),y)
+     override DISABLE_SETRANS=y
Quoted 8 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 4 lines
libselinux/Makefile +4 -0
+     EMFLAGS+= -DDISABLE_RPM -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \
+             -DBUILD_HOST
+     SUBDIRS = src
+endif

Don't you actually want to also pick up utils/sefcontext_compile? That is built and used on the build host. And I'm not sure why we'd drop the other SUBDIRS.

Quoted 4 lines

You'll start running into linking issues if things that use libselinux, use something not
in the build host IIRC. Perhaps, if that is the issue, we just limit it to sefcontext_compile.

Sure, the utils/Makefile can remove entries the same way it already does for DISABLE_*.

Quoted 57 lines
Quoted 41 lines
Quoted 41 lines
libselinux/Makefile +1 -1
 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)
libselinux/src/Makefile +9 -1
index 36e42b8..d841ef7 100644
@@ -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)
 
Quoted 15 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 115

Quoted 13 lines
libselinux/src/Makefile +13 -0
+$(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 $@ $<

Did these truly need to move? I don't see why.

Quoted 3 lines

this prevents us from having multiple definitions of the recipes or multiple if's on ANDROID_HOST=y.
Both flavors need these wildcard targets.

If I undo all of these changes, make ANDROID_HOST=y clean all works just
fine. So does make install. You don't need any of this conditional
logic in the Makefile, and it just makes it harder to read and maintain.

Quoted 78 lines
Quoted 16 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 125

Quoted 12 lines
libselinux/src/Makefile +9 -0
+
+# 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)

Is this worthwhile/necessary? The point of the build option IIUC is just to allow upstream testing that the Android build host version will still build, it shouldn't matter if there are extras.

Those things die on linking... so I didn't want to submit something where Make returns not 0.

Quoted 35 lines
Quoted 35 lines
libselinux/src/Makefile +0 -14
 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]))
 
Quoted 6 lines

libselinux/src/Makefile distclean: clean · line 199

Quoted 4 lines
libselinux/src/Makefile +3 -1
-.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

Why is this needed?

The targets for %.o and %.lo are used on all build targets, the rest is committed on ANDROID_HOST=y.
So for the stuff that is separated out, we have a .PHONY for it. For the things the define in common,
notably ALL, we have a shared .PHONY for them.

Quoted 4 lines

BTW, this option can be dangerous. Don't build with it and then do a make install later without doing a make clean - you'll brick your Linux system ;(

That is true, but isn't that the point of SE Linux :-P. Kidding aside, perhaps we
could create a guard file that's checked on install, if its there, you need to run make clean first.

#7 lore raw
Quoted 3 lines · Stephen Smalley
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines · On 09/26/2016 04:53 PM, [email protected] wrote:
Quoted 5 lines

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 15 lines
Quoted 4 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Ok, fair point. Actually EMBEDDED=y is broken and no one is using it AFAIK so we should probably kill it at some point separately.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 17 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif
Quoted 8 lines
Quoted 3 lines

Don't you actually want to also pick up utils/sefcontext_compile? That is built and used on the build host. And I'm not sure why we'd drop the other SUBDIRS.

You'll start running into linking issues if things that use libselinux, use something not
in the build host IIRC. Perhaps, if that is the issue, we just limit it to sefcontext_compile.

Sure, the utils/Makefile can remove entries the same way it already does for DISABLE_*.

Quoted 2 lines
Quoted 2 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

libselinux/Makefile endif · line 31

Quoted 9 lines
libselinux/Makefile +1 -1
 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

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
libselinux/Makefile +0 -0
 USE_PCRE2 ?= n
 ifeq ($(USE_PCRE2),y)
libselinux/src/Makefile +0 -0
index 36e42b8..d841ef7 100644

libselinux/src/Makefile endif · line 52

Quoted 6 lines
libselinux/src/Makefile +3 -0
@@ -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 \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

libselinux/src/Makefile endif · line 54

Quoted 2 lines
libselinux/src/Makefile +2 -0
+                     matchpathcon.c setrans_client.c sha1.c
+     override CFLAGS += -DNO_MEDIA_BACKEND -DNO_DB_BACKEND

-DNO_X_BACKEND \

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

libselinux/src/Makefile endif

Quoted 3 lines
libselinux/src/Makefile +3 -0
+                     -DBUILD_HOST
+else
+     SRCS= $(filter-out $(UNUSED_SRCS) $(GENERATED) audit2why.c,

$(sort $(wildcard *.c)))

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

libselinux/src/Makefile endif

Quoted 4 lines
libselinux/src/Makefile +1 -1
+endif
 
 GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) selinuxswig_python_exception.i
-SRCS= $(filter-out $(UNUSED_SRCS) $(GENERATED) audit2why.c, $(sort

$(wildcard *.c)))

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir

Quoted 4 lines
libselinux/src/Makefile +0 -0
 MAX_STACK_SIZE=32768
 
@@ -92,6 +100,28 @@ SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir

./ $(EMFLAGS)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS)

Quoted 9 lines
libselinux/src/Makefile +6 -0
 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

Quoted 14 lines
Quoted 10 lines
Quoted 9 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 115

Quoted 7 lines
libselinux/src/Makefile +7 -0
+     ln -sf $@ $(TARGET)
+
+%.o:  %.c policy.h
+     $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
+
+%.lo:  %.c policy.h
+     $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<

Did these truly need to move? I don't see why.

Quoted 3 lines

this prevents us from having multiple definitions of the recipes or multiple if's on ANDROID_HOST=y.
Both flavors need these wildcard targets.

Quoted 8 lines

If I undo all of these changes, make ANDROID_HOST=y clean all works just
fine. So does make install. You don't need any of this conditional
logic in the Makefile, and it just makes it harder to read and maintain.

Quoted 4 lines
Quoted 4 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir · line 116

Quoted 4 lines
libselinux/src/Makefile +2 -0
+
+# ANDROID_HOST Build option only builds the shared and static

versions of

Quoted 18 lines
Quoted 18 lines
Quoted 4 lines
Quoted 4 lines
libselinux/src/Makefile +4 -0
+# libselinux.
+ifeq ($(ANDROID_HOST),y)
+
+all: $(LIBA) $(LIBSO)
Quoted 8 lines

libselinux/src/Makefile SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(EMFLAGS) · line 125

Quoted 4 lines
libselinux/src/Makefile +3 -0
+
+else
+
 all: $(LIBA) $(LIBSO) $(LIBPC)

Is this worthwhile/necessary? The point of the build option IIUC is just to allow upstream testing that the Android build host version will still build, it shouldn't matter if there are extras.

Those things die on linking... so I didn't want to submit something where Make returns not 0.

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

libselinux/src/Makefile $(SWIGSO): $(SWIGLOBJ) · line 141

Quoted 4 lines

pywrap: all $(SWIGFILES) $(AUDIT2WHYSO)

libselinux/src/Makefile +0 -0
@@ -110,14 +140,6 @@ $(SWIGSO): $(SWIGLOBJ)
 $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
      $(CC) $(CFLAGS) -shared -o $@ $^ -L. -lselinux $(LDFLAGS)

-L$(LIBDIR)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

libselinux/src/Makefile $(SWIGSO): $(SWIGLOBJ)

Quoted 7 lines
libselinux/src/Makefile +0 -6
-$(LIBA): $(OBJS)
-     $(AR) rcs $@ $^
-     $(RANLIB) $@
-
-$(LIBSO): $(LOBJS)
-     $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl

$(LDFLAGS) -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

libselinux/src/Makefile $(SWIGSO): $(SWIGLOBJ)

Quoted 4 lines
libselinux/src/Makefile +0 -2
-     ln -sf $@ $(TARGET)
-
 $(LIBPC): $(LIBPC).in ../VERSION
      sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):;

s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

libselinux/src/Makefile $(AUDIT2WHYLOBJ): audit2why.c · line 153

Quoted 4 lines
libselinux/src/Makefile +0 -0
@@ -130,12 +152,6 @@ $(AUDIT2WHYLOBJ): audit2why.c
 $(AUDIT2WHYSO): $(AUDIT2WHYLOBJ)
      $(CC) $(CFLAGS) -shared -o $@ $^ -L. $(LDFLAGS) -lselinux

$(LIBDIR)/libsepol.a -L$(LIBDIR)

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
libselinux/src/Makefile +0 -6
-%.o:  %.c policy.h
-     $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
-
-%.lo:  %.c policy.h
-     $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
-
 $(SWIGCOUT): $(SWIGIF)
      $(SWIG) $<
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

libselinux/src/Makefile distclean: clean · line 195

Quoted 3 lines
libselinux/src/Makefile +0 -0
@@ -178,4 +194,6 @@ distclean: clean
 indent:
      ../../scripts/Lindent $(filter-out $(GENERATED),$(wildcard

*.[ch]))

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

libselinux/src/Makefile distclean: clean · line 180

Quoted 2 lines
libselinux/src/Makefile +0 -1
-.PHONY: all clean pywrap rubywrap swigify install install-pywrap

install-rubywrap distclean

Quoted 1 line
Quoted 1 line
Quoted 1 line

libselinux/src/Makefile distclean: clean · line 196

Quoted 1 line
libselinux/src/Makefile +1 -0
+.PHONY: clean pywrap rubywrap swigify install install-pywrap

install-rubywrap distclean

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines

libselinux/src/Makefile distclean: clean · line 199

Quoted 2 lines
libselinux/src/Makefile +2 -0
+endif
+.PHONY: all

Why is this needed?

The targets for %.o and %.lo are used on all build targets, the rest is committed on ANDROID_HOST=y.
So for the stuff that is separated out, we have a .PHONY for it. For the things the define in common,
notably ALL, we have a shared .PHONY for them.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

BTW, this option can be dangerous. Don't build with it and then do a make install later without doing a make clean - you'll brick your Linux system ;(

That is true, but isn't that the point of SE Linux :-P. Kidding aside, perhaps we
could create a guard file that's checked on install, if its there, you

need to

Quoted 2 lines
Quoted 2 lines

run make clean first.

OK good to know, I ran into issues, but it might have been fore I had the rest of it sorted out.

#8 lore raw
In reply to Stephen Smalley

<snip>

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

Don't you actually want to also pick up utils/sefcontext_compile? That is built and used on the build host. And I'm not sure why we'd drop the other SUBDIRS.

You'll start running into linking issues if things that use libselinux, use something not
in the build host IIRC. Perhaps, if that is the issue, we just limit it to sefcontext_compile.

Sure, the utils/Makefile can remove entries the same way it already does for DISABLE_*.

Well actually, that means every-time their is a new file added, the Makefile needs to be modified,
I was trying to avoid that. Also, the remove list is super long, so it looks pretty unwieldy.

<snip>

#9 lore raw
Quoted 10 lines · William Roberts

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Don't you actually want to also pick up utils/sefcontext_compile? That is built and used on the build host. And I'm not sure why we'd drop the other SUBDIRS.

You'll start running into linking issues if things that use libselinux, use something not
in the build host IIRC. Perhaps, if that is the issue, we just limit it to sefcontext_compile.

Quoted 7 lines
Quoted 2 lines

Sure, the utils/Makefile can remove entries the same way it already does for DISABLE_*.

Well actually, that means every-time their is a new file added, the Makefile needs to be modified,
I was trying to avoid that. Also, the remove list is super long, so it looks pretty unwieldy.

Yes, you can just override TARGETS instead.

#10 lore raw
In reply to William Roberts
Quoted 27 lines · William Roberts
Quoted 11 lines · Stephen Smalley
Quoted 7 lines · On 09/26/2016 04:53 PM, [email protected] wrote:

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but considering that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 8 lines
Quoted 8 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 17 deletions(-)
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
libselinux/Makefile +0 -0
index 5a8d42c..50ae009 100644
@@ -10,6 +10,12 @@ ifeq ($(EMBEDDED),y)
      override DISABLE_RPM=y
Quoted 8 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 8 lines
libselinux/Makefile +6 -0
      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

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

#11 lore raw
Quoted 3 lines · Stephen Smalley
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines · On 09/26/2016 04:53 PM, [email protected] wrote:
Quoted 5 lines

From: William Roberts <[email protected]>

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 11 lines
Quoted 11 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 6 lines
Quoted 6 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

You mean all the ANDROID _HOST stuff? I didn't want to depart from what's there, that seemed to be the spot for disabling things.

#12 lore raw
Quoted 53 lines · William Roberts
Quoted 3 lines · On Sep 27, 2016 10:00, "Stephen Smalley" <[email protected]…
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]

Quoted 1 line · <mailto:[email protected]>> wrote:
Quoted 1 line
Quoted 1 line

On 09/26/2016 04:53 PM, [email protected]

Quoted 1 line · <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: William Roberts <[email protected]

<mailto:[email protected]>>

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 8 lines
Quoted 8 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]>>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif
Quoted 5 lines
Quoted 2 lines

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

You mean all the ANDROID _HOST stuff? I didn't want to depart from what's there, that seemed to be the spot for disabling things.

You don't use the -DNO_*_BACKEND or -DBUILD_HOST flags anywhere except in src/Makefile, so you don't need to set them here.

#13 lore raw
Quoted 54 lines · Stephen Smalley
Quoted 53 lines · William Roberts
Quoted 3 lines · On Sep 27, 2016 10:00, "Stephen Smalley" <[email protected]…
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]

Quoted 1 line · <mailto:[email protected]>> wrote:
Quoted 1 line
Quoted 1 line

On 09/26/2016 04:53 PM, [email protected]

Quoted 1 line · <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: William Roberts <[email protected]

<mailto:[email protected]>>

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 8 lines
Quoted 8 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]>>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

You mean all the ANDROID _HOST stuff? I didn't want to depart from what's there, that seemed to be the spot for disabling things.

You don't use the -DNO_*_BACKEND or -DBUILD_HOST flags anywhere except in src/Makefile, so you don't need to set them here.

The same could be said about DISABLE_SETRANS

#14 lore raw
Quoted 58 lines · William Roberts
Quoted 57 lines · Stephen Smalley
Quoted 56 lines · William Roberts
Quoted 3 lines · On Sep 27, 2016 10:00, "Stephen Smalley" <[email protected]…
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]

Quoted 1 line · <mailto:[email protected]>> wrote:
Quoted 1 line
Quoted 1 line

On 09/26/2016 04:53 PM, [email protected]

Quoted 1 line · <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: William Roberts <[email protected]

<mailto:[email protected]>>

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 8 lines
Quoted 8 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]>>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

You mean all the ANDROID _HOST stuff? I didn't want to depart from what's there, that seemed to be the spot for disabling things.

You don't use the -DNO_*_BACKEND or -DBUILD_HOST flags anywhere except in src/Makefile, so you don't need to set them here.

The same could be said about DISABLE_SETRANS

It isn't set in both Makefiles. Pick one.

#15 lore raw
Quoted 62 lines · Stephen Smalley
Quoted 61 lines · William Roberts
Quoted 60 lines · Stephen Smalley
Quoted 58 lines · William Roberts
Quoted 3 lines · On Sep 27, 2016 10:00, "Stephen Smalley" <[email protected]…
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]

Quoted 1 line · <mailto:[email protected]>> wrote:
Quoted 1 line
Quoted 1 line

On 09/26/2016 04:53 PM, [email protected]

Quoted 1 line · <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: William Roberts <[email protected]

<mailto:[email protected]>>

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 8 lines
Quoted 8 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]>>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 18

Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

You mean all the ANDROID _HOST stuff? I didn't want to depart from what's there, that seemed to be the spot for disabling things.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

You don't use the -DNO_*_BACKEND or -DBUILD_HOST flags anywhere except in src/Makefile, so you don't need to set them here.

The same could be said about DISABLE_SETRANS

It isn't set in both Makefiles. Pick one.

Its not set in both, did you mean referenced/used? In fact I don't even set the default n, which I should be doing.

#16 lore raw
Quoted 67 lines · William Roberts
Quoted 66 lines · Stephen Smalley
Quoted 65 lines · William Roberts
Quoted 63 lines · Stephen Smalley
Quoted 53 lines · William Roberts
Quoted 3 lines · On Sep 27, 2016 10:00, "Stephen Smalley" <[email protected]…
Quoted 1 line · William Roberts

On Tue, Sep 27, 2016 at 7:11 AM, Stephen Smalley <[email protected]

Quoted 1 line · <mailto:[email protected]>> wrote:
Quoted 1 line
Quoted 1 line

On 09/26/2016 04:53 PM, [email protected]

Quoted 1 line · <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: William Roberts <[email protected]

<mailto:[email protected]>>

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

To build the selinux host configuration, specify
ANDROID_HOST=y on the Make command line.

eg)
make ANDROID_HOST=y

Seems oddly named, neither corresponding to the #define it enables (BUILD_HOST) nor to the target platform.

We could change this to BUILD_HOST=y to enable all of it, but

considering

Quoted 8 lines
Quoted 8 lines

that this build is specific for Android, I thought the naming to be more appropriate.

Additionally, EMBEDDED doesn't flip anything called EMBEDDED as well.

Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]>>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
---
 libselinux/Makefile     |  8 +++++++-
 libselinux/src/Makefile | 50

+++++++++++++++++++++++++++++++++----------------

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

libselinux/Makefile ifeq ($(EMBEDDED),y) · line 15

Quoted 13 lines
 2 files changed, 41 insertions(+), 17 deletions(-)
libselinux/Makefile +3 -0
index 5a8d42c..50ae009 100644
@@ -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 \

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
libselinux/Makefile +3 -0
+             -DBUILD_HOST
+     SUBDIRS = src
+endif
Quoted 5 lines
Quoted 2 lines

Also, this is redundant; you can handle it entirely within libselinux/src/Makefile without anything here.

You mean all the ANDROID _HOST stuff? I didn't want to depart from what's there, that seemed to be the spot for disabling things.

You don't use the -DNO_*_BACKEND or -DBUILD_HOST flags anywhere except in src/Makefile, so you don't need to set them here.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The same could be said about DISABLE_SETRANS

It isn't set in both Makefiles. Pick one.

Its not set in both, did you mean referenced/used? In fact I don't even set the default n, which I should be doing.

You set -DNO_*_BACKEND and -DBUILD_HOST in both Makefiles if ANDROID_HOST=y.