From patchwork Thu Feb 2 22:45:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 723312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vDw7Z5X1xz9rxm for ; Fri, 3 Feb 2017 09:45:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HBtmMB64"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 036CD30435; Thu, 2 Feb 2017 22:45:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lrv+Zs9OP9Wu; Thu, 2 Feb 2017 22:45:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 06C403041C; Thu, 2 Feb 2017 22:45:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 365771BFC3F for ; Thu, 2 Feb 2017 22:45:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 321EC89999 for ; Thu, 2 Feb 2017 22:45:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k7jF25EjMZQp for ; Thu, 2 Feb 2017 22:45:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yw0-f195.google.com (mail-yw0-f195.google.com [209.85.161.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 07D4781E6F for ; Thu, 2 Feb 2017 22:45:10 +0000 (UTC) Received: by mail-yw0-f195.google.com with SMTP id u68so225794ywg.0 for ; Thu, 02 Feb 2017 14:45:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tV58nTaA2uM1M2+ZykYGG4zBiGZEt/HAyTCHUg8G/8A=; b=HBtmMB64BuW7H/OYZNBlqPq5+LCkJ8QE3DyBaGgFJf1XCyN/jqkM14A4lXpN6xfyXS 73AX3loQyzI3IaDL056sm8H9MBfDvJs4Rgs2syZ4gUTpMCwXR3h7iTmqs5WijYmUfQv3 JTg2aWJYoywlPV5bqC3jIKHl7MAgA+LG3qYRabG4j/RIUFN5fXcTuvMtjxZKSXPJadlF ynxkVMazNsSt6WOnjySsbRNwKaKcDbtJSGMoBuBLlJVOghr/VjmM/JR4G8eJVDA3ECQh c3tlImQwhkC3FTg6x6+kAh35xnnKMmaIYnNUppAvROUn7TYr8qos3ALqyrcNel+NZA2O ad4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tV58nTaA2uM1M2+ZykYGG4zBiGZEt/HAyTCHUg8G/8A=; b=EPoWlk40r1gPHdAfjO3Tm6N+JNem5hXxwDK2AX9aFiUb6pPI1ZvYYHa0HRU8IfCwDi hvcelMNTLrz+FROji/JAj6vNGtvrL/ovd0fmKcfwtdGXnyh1wm2ZPFZYp/1uqgqzQs4r 05kqI9b1ukp0r8Mnj0V813JcMWv+Ut1wI2UG6KcxI1nAVX1ax89ou5+tm0u2DIqlpEJZ F2jHn4TnARwKn9G/acIl01CAT4nJ5nFOWGMiJh3D226Ukya885P6UCQ0rLskhUlez07r YUsysWOHjsfnWO7fGgkN4sUmi7xHarELxjSWkGNY/SQMRuXjH+LelYrGNTm9+LE/H/M2 LWPw== X-Gm-Message-State: AIkVDXJJbn6waopjt53fliYKZon3POynifEcMhxYuGrJpn1GQN0cE/3Eae6SLKYeu+dv9Q== X-Received: by 10.129.48.2 with SMTP id w2mr7325173yww.295.1486075509189; Thu, 02 Feb 2017 14:45:09 -0800 (PST) Received: from aduskett.duskett ([96.36.42.19]) by smtp.gmail.com with ESMTPSA id s16sm13625376ywa.21.2017.02.02.14.45.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2017 14:45:08 -0800 (PST) From: Adam Duskett X-Google-Original-From: Adam Duskett To: buildroot@buildroot.org Date: Thu, 2 Feb 2017 17:45:04 -0500 Message-Id: <20170202224505.22882-3-Adamduskett@outlook.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202224505.22882-1-Adamduskett@outlook.com> References: <20170202224505.22882-1-Adamduskett@outlook.com> Cc: Adam Duskett Subject: [Buildroot] [PATCH 3/4] libselinux: allow compiling python wrapper module for target X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 Reviewed-by: Matt Weber --- 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 + 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