diff mbox

[3/4] libselinux: allow compiling python wrapper module for target

Message ID 20170202224505.22882-3-Adamduskett@outlook.com
State Accepted, archived
Headers show

Commit Message

Adam Duskett Feb. 2, 2017, 10:45 p.m. UTC
libselinux currently does not compile it's python wrapper module
for the target.  This is needed for audit2allow to function properly.

This patch allows for the python wrapper to be built.  The current
makefile will try to install the python wrapper to the host directory
unless the PYSITEDIR variable is set.  I wrapped the build of the
python wrapper in a check for AUDIT2ALLOW because of the extra python
dependency, as I am sure many users don't want to have to install
python if they don't have to.

Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
---
 package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Matt Weber March 27, 2017, 5:21 p.m. UTC | #1
Adam,

On Thu, Feb 2, 2017 at 4:45 PM, Adam Duskett <aduskett@gmail.com> wrote:
> libselinux currently does not compile it's python wrapper module
> for the target.  This is needed for audit2allow to function properly.
>
> This patch allows for the python wrapper to be built.  The current
> makefile will try to install the python wrapper to the host directory
> unless the PYSITEDIR variable is set.  I wrapped the build of the
> python wrapper in a check for AUDIT2ALLOW because of the extra python
> dependency, as I am sure many users don't want to have to install
> python if they don't have to.
>
> Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
> ---
>  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk
> index 44120c4..fba5d41 100644
> --- a/package/libselinux/libselinux.mk
> +++ b/package/libselinux/libselinux.mk
> @@ -30,6 +30,7 @@ endef
>  define LIBSELINUX_INSTALL_STAGING_CMDS
>         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
>                 $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
> +

<snip>

>         if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
>                 echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
> +

Any reason for the two newlines above?

>  endef
>
> +ifeq ($(BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW),y)
> +LIBSELINUX_DEPENDENCIES += host-swig
> +
> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> +LIBSELINUX_DEPENDENCIES += python3
> +LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)
> +LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
> +LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
> +else
> +LIBSELINUX_DEPENDENCIES += python
> +LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
> +LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
> +LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
> +endif
> +
> +LIBSELINUX_MAKE_OPTS += \
> +       PYINC="$(LIBSELINUX_PYINC)" \
> +       PYTHONLIBDIR="$(LIBSELINUX_PYTHONLIBDIR)" \
> +       PYLIBVER="$(LIBSELINUX_PYLIBVER)" \
> +       PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
> +       SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
> +
> +LIBSELINUX_BUILD_CMDS += $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) \
> +       $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) swigify pywrap
> +
> +LIBSELINUX_INSTALL_TARGET_CMDS += $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +       $(LIBSELINUX_MAKE_OPTS) install-pywrap
> +
> +endif
> +

I need to build and test this.  This was in the original libselinux
patchset and I believe we had issues in swig.

>  HOST_LIBSELINUX_DEPENDENCIES = \
>         host-libsepol host-pcre host-swig
>
> --
> 2.9.3
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Matt Weber March 27, 2017, 7:19 p.m. UTC | #2
Adam,

On Mon, Mar 27, 2017 at 12:21 PM, Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
> Adam,
>
> On Thu, Feb 2, 2017 at 4:45 PM, Adam Duskett <aduskett@gmail.com> wrote:
>> libselinux currently does not compile it's python wrapper module
>> for the target.  This is needed for audit2allow to function properly.
>>
>> This patch allows for the python wrapper to be built.  The current
>> makefile will try to install the python wrapper to the host directory
>> unless the PYSITEDIR variable is set.  I wrapped the build of the
>> python wrapper in a check for AUDIT2ALLOW because of the extra python
>> dependency, as I am sure many users don't want to have to install
>> python if they don't have to.
>>
>> Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
>> ---
>>  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
>>  1 file changed, 32 insertions(+)
>>
>> diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk
>> index 44120c4..fba5d41 100644
>> --- a/package/libselinux/libselinux.mk
>> +++ b/package/libselinux/libselinux.mk
>> @@ -30,6 +30,7 @@ endef
>>  define LIBSELINUX_INSTALL_STAGING_CMDS
>>         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
>>                 $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
>> +
>
> <snip>
>
>>         if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
>>                 echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
>> +
>
> Any reason for the two newlines above?
>
>>  endef
>>
>> +ifeq ($(BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW),y)
>> +LIBSELINUX_DEPENDENCIES += host-swig
>> +
>> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
>> +LIBSELINUX_DEPENDENCIES += python3
>> +LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)
>> +LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
>> +LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
>> +else
>> +LIBSELINUX_DEPENDENCIES += python
>> +LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
>> +LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
>> +LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
>> +endif
>> +
>> +LIBSELINUX_MAKE_OPTS += \
>> +       PYINC="$(LIBSELINUX_PYINC)" \
>> +       PYTHONLIBDIR="$(LIBSELINUX_PYTHONLIBDIR)" \
>> +       PYLIBVER="$(LIBSELINUX_PYLIBVER)" \
>> +       PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
>> +       SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
>> +
>> +LIBSELINUX_BUILD_CMDS += $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) \
>> +       $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) swigify pywrap
>> +
>> +LIBSELINUX_INSTALL_TARGET_CMDS += $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
>> +       $(LIBSELINUX_MAKE_OPTS) install-pywrap
>> +
>> +endif
>> +
>
> I need to build and test this.  This was in the original libselinux
> patchset and I believe we had issues in swig.
>

I did a build test but didn't have hardware available to execute.  I
did verify the libselinux installed correctly to staging and that the
swig related (selinux.py) item built/installed correctly
(target/usr/lib/python3.5/site-packages/selinux/).

Reviewed-by: Matt Weber <matthew.weber@rockwellcollins.com>
Matt Weber April 4, 2017, 2:09 a.m. UTC | #3
Adam,


On Mon, Mar 27, 2017 at 2:19 PM, Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
>
> Adam,
>
> On Mon, Mar 27, 2017 at 12:21 PM, Matthew Weber
> <matthew.weber@rockwellcollins.com> wrote:
> > Adam,
> >
> > On Thu, Feb 2, 2017 at 4:45 PM, Adam Duskett <aduskett@gmail.com> wrote:
> >> libselinux currently does not compile it's python wrapper module
> >> for the target.  This is needed for audit2allow to function properly.
> >>
> >> This patch allows for the python wrapper to be built.  The current
> >> makefile will try to install the python wrapper to the host directory
> >> unless the PYSITEDIR variable is set.  I wrapped the build of the
> >> python wrapper in a check for AUDIT2ALLOW because of the extra python
> >> dependency, as I am sure many users don't want to have to install
> >> python if they don't have to.
> >>
> >> Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
> >> ---
> >>  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
> >>  1 file changed, 32 insertions(+)
> >>
> >> diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk
> >> index 44120c4..fba5d41 100644
> >> --- a/package/libselinux/libselinux.mk
> >> +++ b/package/libselinux/libselinux.mk
> >> @@ -30,6 +30,7 @@ endef
> >>  define LIBSELINUX_INSTALL_STAGING_CMDS
> >>         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> >>                 $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
> >> +
> >
> > <snip>
> >
> >>         if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
> >>                 echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
> >> +
> >
> > Any reason for the two newlines above?
> >
> >>  endef
> >>
> >> +ifeq ($(BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW),y)
> >> +LIBSELINUX_DEPENDENCIES += host-swig
> >> +
> >> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> >> +LIBSELINUX_DEPENDENCIES += python3
> >> +LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)
> >> +LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
> >> +LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
> >> +else
> >> +LIBSELINUX_DEPENDENCIES += python
> >> +LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
> >> +LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
> >> +LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
> >> +endif
> >> +
> >> +LIBSELINUX_MAKE_OPTS += \
> >> +       PYINC="$(LIBSELINUX_PYINC)" \
> >> +       PYTHONLIBDIR="$(LIBSELINUX_PYTHONLIBDIR)" \

Please incorporate similar changes to the following I sent out
tonight.  You already had the PYSITEDIR added, but the PYLIBVER /
LIBSELINUX_PYTHONLIBDIR / PYTHONLIBDIR were removed when we bumped to
version 2.6
https://patchwork.ozlabs.org/patch/746684/

> >> +       PYLIBVER="$(LIBSELINUX_PYLIBVER)" \
> >> +       PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
> >> +       SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
> >> +
> >> +LIBSELINUX_BUILD_CMDS += $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) \
> >> +       $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) swigify pywrap
> >> +
> >> +LIBSELINUX_INSTALL_TARGET_CMDS += $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> >> +       $(LIBSELINUX_MAKE_OPTS) install-pywrap
> >> +
> >> +endif
> >> +
> >
> > I need to build and test this.  This was in the original libselinux
> > patchset and I believe we had issues in swig.
> >
>
> I did a build test but didn't have hardware available to execute.  I
> did verify the libselinux installed correctly to staging and that the
> swig related (selinux.py) item built/installed correctly
> (target/usr/lib/python3.5/site-packages/selinux/).
>
> Reviewed-by: Matt Weber <matthew.weber@rockwellcollins.com>
Thomas Petazzoni April 9, 2017, 1:44 p.m. UTC | #4
Hello,

On Thu,  2 Feb 2017 17:45:04 -0500, Adam Duskett wrote:
> libselinux currently does not compile it's python wrapper module
> for the target.  This is needed for audit2allow to function properly.
> 
> This patch allows for the python wrapper to be built.  The current
> makefile will try to install the python wrapper to the host directory
> unless the PYSITEDIR variable is set.  I wrapped the build of the
> python wrapper in a check for AUDIT2ALLOW because of the extra python
> dependency, as I am sure many users don't want to have to install
> python if they don't have to.
> 
> Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
> ---
>  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)

Applied to master with the following changes:

    [Thomas:
     - Remove useless empty lines, as noted by Matt Weber
     - Move code related to python bindings before builds/install
       commands, since those commands will use variables defined by the
       python bindings logic.
     - Instead of enabling the python bindings when
       BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW is set, enable the python
       bindings when python is available. We generally try to avoid
       looking at options of other packages to decide what to install.
     - Introduce LIBSELINUX_MAKE_TARGETS and
       LIBSELINUX_MAKE_INSTALL_TARGETS variable, in order to avoid
       duplicate the make/make install commands.
     - As suggested by Matt Weber, remove LIBSELINUX_PYTHONLIBDIR
       definitions, and don't pass PYLIBVER and PYTHONLIBDIR in
    MAKE_OPTS.]

Thanks!

Thomas
Thomas Petazzoni April 11, 2017, 12:40 p.m. UTC | #5
Hello,

On Thu,  2 Feb 2017 17:45:04 -0500, Adam Duskett wrote:
> libselinux currently does not compile it's python wrapper module
> for the target.  This is needed for audit2allow to function properly.
> 
> This patch allows for the python wrapper to be built.  The current
> makefile will try to install the python wrapper to the host directory
> unless the PYSITEDIR variable is set.  I wrapped the build of the
> python wrapper in a check for AUDIT2ALLOW because of the extra python
> dependency, as I am sure many users don't want to have to install
> python if they don't have to.
> 
> Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
> ---
>  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)

This causes some build failures:
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/build-end.log.

Could you have a look ?

Thanks a lot!

Thomas
Matt Weber April 12, 2017, 12:53 p.m. UTC | #6
Thomas

On Tue, Apr 11, 2017 at 7:40 AM, Thomas Petazzoni <thomas.petazzoni@free-
electrons.com> wrote:

> Hello,
>
> On Thu,  2 Feb 2017 17:45:04 -0500, Adam Duskett wrote:
> > libselinux currently does not compile it's python wrapper module
> > for the target.  This is needed for audit2allow to function properly.
> >
> > This patch allows for the python wrapper to be built.  The current
> > makefile will try to install the python wrapper to the host directory
> > unless the PYSITEDIR variable is set.  I wrapped the build of the
> > python wrapper in a check for AUDIT2ALLOW because of the extra python
> > dependency, as I am sure many users don't want to have to install
> > python if they don't have to.
> >
> > Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
> > ---
> >  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
>
> This causes some build failures:
> http://autobuild.buildroot.net/results/db1/db1e6f3054092fc55
> 76ccab8e04a3b9d74ca9a8c/build-end.log.
>
> Could you have a look ?
> <http://free-electrons.com>
>

Yep, will take a look this morning.

-Matt
Matt Weber April 12, 2017, 1:54 p.m. UTC | #7
Thomas,

On Wed, Apr 12, 2017 at 7:53 AM, Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
> Thomas
>
> On Tue, Apr 11, 2017 at 7:40 AM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>>
>> Hello,
>>
>> On Thu,  2 Feb 2017 17:45:04 -0500, Adam Duskett wrote:
>> > libselinux currently does not compile it's python wrapper module
>> > for the target.  This is needed for audit2allow to function properly.
>> >
>> > This patch allows for the python wrapper to be built.  The current
>> > makefile will try to install the python wrapper to the host directory
>> > unless the PYSITEDIR variable is set.  I wrapped the build of the
>> > python wrapper in a check for AUDIT2ALLOW because of the extra python
>> > dependency, as I am sure many users don't want to have to install
>> > python if they don't have to.
>> >
>> > Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
>> > ---
>> >  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
>> >  1 file changed, 32 insertions(+)
>>
>> This causes some build failures:
>>
>> http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/build-end.log.
>>

Oh fun, a new circular dependency.  Any ideas/examples for how this
has been handling in the past? ( I'm assuming other python/busybox
cases have come up.)
Recursion detected for  : busybox
which is a dependency of: ncurses
which is a dependency of: python
which is a dependency of: libselinux
which is a dependency of: busybox
make: *** [graph-depends] Error 1
Matt Weber April 12, 2017, 2 p.m. UTC | #8
Thomas

On Wed, Apr 12, 2017 at 8:54 AM, Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
> Thomas,
>
> On Wed, Apr 12, 2017 at 7:53 AM, Matthew Weber
> <matthew.weber@rockwellcollins.com> wrote:
>> Thomas
>>
>> On Tue, Apr 11, 2017 at 7:40 AM, Thomas Petazzoni
>> <thomas.petazzoni@free-electrons.com> wrote:
>>>
>>> Hello,
>>>
>>> On Thu,  2 Feb 2017 17:45:04 -0500, Adam Duskett wrote:
>>> > libselinux currently does not compile it's python wrapper module
>>> > for the target.  This is needed for audit2allow to function properly.
>>> >
>>> > This patch allows for the python wrapper to be built.  The current
>>> > makefile will try to install the python wrapper to the host directory
>>> > unless the PYSITEDIR variable is set.  I wrapped the build of the
>>> > python wrapper in a check for AUDIT2ALLOW because of the extra python
>>> > dependency, as I am sure many users don't want to have to install
>>> > python if they don't have to.
>>> >
>>> > Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
>>> > ---
>>> >  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
>>> >  1 file changed, 32 insertions(+)
>>>
>>> This causes some build failures:
>>>
>>> http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/build-end.log.
>>>
>
> Oh fun, a new circular dependency.  Any ideas/examples for how this
> has been handling in the past? ( I'm assuming other python/busybox
> cases have come up.)
> Recursion detected for  : busybox
> which is a dependency of: ncurses
> which is a dependency of: python
> which is a dependency of: libselinux
> which is a dependency of: busybox
> make: *** [graph-depends] Error 1

Maybe the ncurses ordering dependency can check for python and if set,
use that as it's item to depend-on/install after?
<from ncurses.mk>
# Install after busybox for the full-blown versions
ifeq ($(BR2_PACKAGE_BUSYBOX),y)
NCURSES_DEPENDENCIES += busybox
endif

-Matt
Matt Weber April 12, 2017, 8:45 p.m. UTC | #9
Thomas,

On Wed, Apr 12, 2017 at 9:00 AM, Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
>
> Thomas
>
> On Wed, Apr 12, 2017 at 8:54 AM, Matthew Weber
> <matthew.weber@rockwellcollins.com> wrote:
> > Thomas,
> >
> > On Wed, Apr 12, 2017 at 7:53 AM, Matthew Weber
> > <matthew.weber@rockwellcollins.com> wrote:
> >> Thomas
> >>
> >> On Tue, Apr 11, 2017 at 7:40 AM, Thomas Petazzoni
> >> <thomas.petazzoni@free-electrons.com> wrote:
> >>>
> >>> Hello,
> >>>
> >>> On Thu,  2 Feb 2017 17:45:04 -0500, Adam Duskett wrote:
> >>> > libselinux currently does not compile it's python wrapper module
> >>> > for the target.  This is needed for audit2allow to function properly.
> >>> >
> >>> > This patch allows for the python wrapper to be built.  The current
> >>> > makefile will try to install the python wrapper to the host directory
> >>> > unless the PYSITEDIR variable is set.  I wrapped the build of the
> >>> > python wrapper in a check for AUDIT2ALLOW because of the extra python
> >>> > dependency, as I am sure many users don't want to have to install
> >>> > python if they don't have to.
> >>> >
> >>> > Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
> >>> > ---
> >>> >  package/libselinux/libselinux.mk | 32 ++++++++++++++++++++++++++++++++
> >>> >  1 file changed, 32 insertions(+)
> >>>
> >>> This causes some build failures:
> >>>
> >>> http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/build-end.log.
> >>>
>

Proposing this fix.
https://patchwork.ozlabs.org/patch/750170/
diff mbox

Patch

diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk
index 44120c4..fba5d41 100644
--- a/package/libselinux/libselinux.mk
+++ b/package/libselinux/libselinux.mk
@@ -30,6 +30,7 @@  endef
 define LIBSELINUX_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
+		
 endef
 
 define LIBSELINUX_INSTALL_TARGET_CMDS
@@ -39,8 +40,39 @@  define LIBSELINUX_INSTALL_TARGET_CMDS
 	if [ ! -d "$(TARGET_DIR)/selinux" ]; then mkdir $(TARGET_DIR)/selinux; fi
 	if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
 		echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
+		
 endef
 
+ifeq ($(BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW),y)
+LIBSELINUX_DEPENDENCIES += host-swig
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+LIBSELINUX_DEPENDENCIES += python3
+LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)
+LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
+LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
+else
+LIBSELINUX_DEPENDENCIES += python
+LIBSELINUX_PYTHONLIBDIR = -L$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
+LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
+LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
+endif
+
+LIBSELINUX_MAKE_OPTS += \
+	PYINC="$(LIBSELINUX_PYINC)" \
+	PYTHONLIBDIR="$(LIBSELINUX_PYTHONLIBDIR)" \
+	PYLIBVER="$(LIBSELINUX_PYLIBVER)" \
+	PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
+	SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
+
+LIBSELINUX_BUILD_CMDS += $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) \
+	$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) swigify pywrap
+
+LIBSELINUX_INSTALL_TARGET_CMDS += $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+	$(LIBSELINUX_MAKE_OPTS) install-pywrap
+
+endif
+
 HOST_LIBSELINUX_DEPENDENCIES = \
 	host-libsepol host-pcre host-swig