diff mbox series

libselinux: LABEL_BACKEND_ANDROID add option to enable it

Message ID 8651564.oA283WntVp@odin
State Accepted
Headers show
Series libselinux: LABEL_BACKEND_ANDROID add option to enable it | expand

Commit Message

Björn Bidar Oct. 20, 2020, 12:21 p.m. UTC
Add option to just enable the android label backend without disabling
anything else.

Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
---
 libselinux/Makefile     | 3 ++-
 libselinux/src/Makefile | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Björn Bidar Oct. 31, 2020, 12:42 a.m. UTC | #1
Add option to just enable the android label backend without disabling
anything else eg. using ANDROID_HOST. Enable by default when using 
ANDROID_HOST.

Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
---
 libselinux/Makefile     | 3 ++-
 libselinux/src/Makefile | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libselinux/Makefile b/libselinux/Makefile
index cb5872b7..ac16c15e 100644
--- a/libselinux/Makefile
+++ b/libselinux/Makefile
@@ -4,6 +4,7 @@ PKG_CONFIG ?= pkg-config
 DISABLE_SETRANS ?= n
 DISABLE_RPM ?= n
 ANDROID_HOST ?= n
+LABEL_BACKEND_ANDROID ?= n
 ifeq ($(ANDROID_HOST),y)
 	override DISABLE_SETRANS=y
 	override DISABLE_BOOL=y
@@ -20,7 +21,7 @@ endif
 ifeq ($(DISABLE_X11),y)
 	DISABLE_FLAGS+= -DNO_X_BACKEND
 endif
-export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST DISABLE_X11
+export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST DISABLE_X11 
LABEL_BACKEND_ANDROID
 
 USE_PCRE2 ?= n
 ifeq ($(USE_PCRE2),y)
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index be0b6eec..52c40f01 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -122,8 +122,12 @@ SRCS= callbacks.c freecon.c label.c label_file.c \
 	label_backends_android.c regex.c label_support.c \
 	matchpathcon.c setrans_client.c sha1.c booleans.c
 else
-DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
+LABEL_BACKEND_ANDROID=y
+endif
+
+ifneq ($(LABEL_BACKEND_ANDROIDT),y)
 SRCS:= $(filter-out label_backends_android.c, $(SRCS))
+DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
 endif
 
 ifeq ($(DISABLE_X11),y)
William Roberts Oct. 31, 2020, 1:57 p.m. UTC | #2
On Fri, Oct 30, 2020 at 7:45 PM Björn Bidar <bjorn.bidar@jolla.com> wrote:
>
> Add option to just enable the android label backend without disabling
> anything else eg. using ANDROID_HOST. Enable by default when using
> ANDROID_HOST.
>
> Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
> ---
>  libselinux/Makefile     | 3 ++-
>  libselinux/src/Makefile | 6 +++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/Makefile b/libselinux/Makefile
> index cb5872b7..ac16c15e 100644
> --- a/libselinux/Makefile
> +++ b/libselinux/Makefile
> @@ -4,6 +4,7 @@ PKG_CONFIG ?= pkg-config
>  DISABLE_SETRANS ?= n
>  DISABLE_RPM ?= n
>  ANDROID_HOST ?= n
> +LABEL_BACKEND_ANDROID ?= n
>  ifeq ($(ANDROID_HOST),y)
>         override DISABLE_SETRANS=y
>         override DISABLE_BOOL=y
> @@ -20,7 +21,7 @@ endif
>  ifeq ($(DISABLE_X11),y)
>         DISABLE_FLAGS+= -DNO_X_BACKEND
>  endif
> -export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST DISABLE_X11
> +export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST DISABLE_X11
> LABEL_BACKEND_ANDROID
>
>  USE_PCRE2 ?= n
>  ifeq ($(USE_PCRE2),y)
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index be0b6eec..52c40f01 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -122,8 +122,12 @@ SRCS= callbacks.c freecon.c label.c label_file.c \
>         label_backends_android.c regex.c label_support.c \
>         matchpathcon.c setrans_client.c sha1.c booleans.c
>  else
> -DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
> +LABEL_BACKEND_ANDROID=y
> +endif
> +
> +ifneq ($(LABEL_BACKEND_ANDROIDT),y)
>  SRCS:= $(filter-out label_backends_android.c, $(SRCS))
> +DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
>  endif
>
>  ifeq ($(DISABLE_X11),y)
> --
> 2.29.1
>

Why would I want this, is there a specific use case for this one?
diff mbox series

Patch

diff --git a/libselinux/Makefile b/libselinux/Makefile
index 6a43b243..17226758 100644
--- a/libselinux/Makefile
+++ b/libselinux/Makefile
@@ -4,6 +4,7 @@  PKG_CONFIG ?= pkg-config
 DISABLE_SETRANS ?= n
 DISABLE_RPM ?= n
 ANDROID_HOST ?= n
+LABEL_BACKEND_ANDROID ?= n
 ifeq ($(ANDROID_HOST),y)
 	override DISABLE_SETRANS=y
 	override DISABLE_BOOL=y
@@ -17,7 +18,7 @@  endif
 ifeq ($(DISABLE_BOOL),y)
 	DISABLE_FLAGS+= -DDISABLE_BOOL
 endif
-export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST
+export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST 
LABEL_BACKEND_ANDROID
 
 USE_PCRE2 ?= n
 ifeq ($(USE_PCRE2),y)
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 190016e2..2f7c0401 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -122,8 +122,12 @@  SRCS= callbacks.c freecon.c label.c label_file.c \
 	label_backends_android.c regex.c label_support.c \
 	matchpathcon.c setrans_client.c sha1.c booleans.c
 else
-DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
+LABEL_BACKEND_ANDROID=y
+endif
+
+ifneq ($(LABEL_BACKEND_ANDROIDT),y)
 SRCS:= $(filter-out label_backends_android.c, $(SRCS))
+DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
 endif
 
 SWIGRUBY = swig -Wall -ruby -o $(SWIGRUBYCOUT) -outdir ./ $(DISABLE_FLAGS)