From patchwork Wed Sep 28 16:17:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Roberts, William C" X-Patchwork-Id: 9354147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE4846077B for ; Wed, 28 Sep 2016 16:18:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C014329734 for ; Wed, 28 Sep 2016 16:18:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B46BF29738; Wed, 28 Sep 2016 16:18:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (emsm-gh1-uea10.nsa.gov [8.44.101.8]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 717C629734 for ; Wed, 28 Sep 2016 16:18:15 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,410,1470700800"; d="scan'208";a="18062896" IronPort-PHdr: =?us-ascii?q?9a23=3A7otHWR2w+rflaJW4smDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?segfKvad9pjvdHbS+e9qxAeQG96KsbQd1KGH7ejJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2PbrnD61zMOABK3bVMz?= =?us-ascii?q?fbWvXNeNxJXpn8mJuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM8?= =?us-ascii?q?5fxGdvOE7B102kvpT4wYRnuxh0l7phspcYEPayQ6NtVrFcDTI7I0gp9cbrsl/F?= =?us-ascii?q?VgLJ6XwCFi0NnxNODxLC7R2/WpbqrgPmp+F932+cJsSwQrcqHXy547xDVA7jiC?= =?us-ascii?q?BBMSUwtm7QlJ9elqVe9Q2goxh+youSa8ePM/BzZL/GVdIcWWdFGM1WUn8SSrig?= =?us-ascii?q?ZpcCWrJSdd1TqJPw8h5X9RY=3D?= X-IPAS-Result: =?us-ascii?q?A2HqBACg7OtX/wHyM5BdHAEBBAEBCgEBFwEBBAEBCgEBgxQ?= =?us-ascii?q?BAQEBAR6BU6YFlEcighSFUkwBAQEBAQEBAQIBAlsngjIEAxMFghgCNxQgDgMJA?= =?us-ascii?q?hcIIQgIAwEtFRgHCwUYBIgsvRgliDuGZAIRAYV6BZl2j2sCiXuFb0iQIVSFJVY?= =?us-ascii?q?BhQIPF2GBKAEBAQ?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 28 Sep 2016 16:18:13 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8SGIAr6005964; Wed, 28 Sep 2016 12:18:11 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u8SGI9P2004044 for ; Wed, 28 Sep 2016 12:18:09 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8SGI87W005956; Wed, 28 Sep 2016 12:18:08 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DAAwDX7OtX/yNjr8ZdGgEBAQECAQEBAQgBAQEBgz8BAQEBAR6BU7ZAhBUUghmDcYFhTAECAQEBAQECXoYIMIEPEohNvQwBMIg7hmSGDgWZdo9rAo9qSJAhVIJNglhWAYUCgi8BAQE X-IPAS-Result: A1DAAwDX7OtX/yNjr8ZdGgEBAQECAQEBAQgBAQEBgz8BAQEBAR6BU7ZAhBUUghmDcYFhTAECAQEBAQECXoYIMIEPEohNvQwBMIg7hmSGDgWZdo9rAo9qSJAhVIJNglhWAYUCgi8BAQE X-IronPort-AV: E=Sophos;i="5.30,410,1470715200"; d="scan'208";a="5733950" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 28 Sep 2016 12:18:03 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AH5PNnxSEBxYqLlxxFveS8Pz7nNpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa65ZRGN2/xhgRfzUJnB7Loc0qyN4vqmADNLsMjJmUtBWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4?= =?us-ascii?q?Ov7yUtaLyZ/mjabrpNaCPU1hv3mUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFm0vbsrwXO?= =?us-ascii?q?QTGC7XoECC1WzkIJUED560ThU5PwtDbqnvZs0ymde8vtRPY7Xirmp7xmQRnkki?= =?us-ascii?q?AGO3s98XrLotBhh6Jc5hS6rlpwxJCQKJqZL9Jib6jdepUcXmMHUcFPBAJbBYbp?= =?us-ascii?q?cIoLC+sIOKBT6ZP6rVYUsQCWBA+wCeepwThN1Sy+5rEzz+l0SVKO5wcnBd9b9S?= =?us-ascii?q?qMoQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0FcBADl6+tX/yNjr8ZdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFwEBBAEBCgEBgxQBAQEBAR6BU6YFkDuEFRSCGYNxgWFMAQEBAQEBAQECAQJ?= =?us-ascii?q?bJ4IyBAEVBYMQMIEPEohNvQwBMIg7hmSGDgWZdo9rAo9qSJAhVIUlVgGFAm6BQ?= =?us-ascii?q?QEBAQ?= X-IPAS-Result: =?us-ascii?q?A0FcBADl6+tX/yNjr8ZdGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxQBAQEBAR6BU6YFkDuEFRSCGYNxgWFMAQEBAQEBAQECAQJbJ4IyBAEVBYMQM?= =?us-ascii?q?IEPEohNvQwBMIg7hmSGDgWZdo9rAo9qSJAhVIUlVgGFAm6BQQEBAQ?= X-IronPort-AV: E=Sophos;i="5.30,410,1470700800"; d="scan'208";a="19630862" Received: from fmsmga002-icc.fm.intel.com ([198.175.99.35]) by emsm-gh1-uea11.nsa.gov with ESMTP; 28 Sep 2016 16:18:02 +0000 Received: from fmsmga005-icc.fm.intel.com ([198.175.99.4]) by fmsmga002-icc.fm.intel.com with ESMTP; 28 Sep 2016 09:18:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,410,1470726000"; d="scan'208";a="14187277" Received: from egluckma-mobl1.amr.corp.intel.com (HELO wcrobert-MOBL1.amr.corp.intel.com) ([10.254.66.145]) by fmsmga005.fm.intel.com with ESMTP; 28 Sep 2016 09:18:01 -0700 From: william.c.roberts@intel.com To: selinux@tycho.nsa.gov, seandroid-list@tycho.nsa.gov, sds@tycho.nsa.gov Subject: [PATCH v3] libselinux: add ANDROID_HOST=y build option Date: Wed, 28 Sep 2016 12:17:59 -0400 Message-Id: <1475079479-22016-1-git-send-email-william.c.roberts@intel.com> X-Mailer: git-send-email 1.9.1 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP From: William Roberts To build the selinux host configuration, specify ANDROID_HOST=y on the Make command line. eg) make ANDROID_HOST=y --- libselinux/Makefile | 6 +++++- libselinux/src/Makefile | 8 ++++++++ libselinux/utils/Makefile | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/libselinux/Makefile b/libselinux/Makefile index cec2943..f607115 100644 --- a/libselinux/Makefile +++ b/libselinux/Makefile @@ -2,13 +2,17 @@ SUBDIRS = src include utils man DISABLE_SETRANS ?= n DISABLE_RPM ?= y +ANDROID_HOST ?= n +ifeq ($(ANDROID_HOST),y) + override DISABLE_SETRANS=y +endif ifeq ($(DISABLE_RPM),y) DISABLE_FLAGS+= -DDISABLE_RPM endif ifeq ($(DISABLE_SETRANS),y) DISABLE_FLAGS+= -DDISABLE_SETRANS endif -export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS +export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y) diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile index 7bf11a8..2c61fad 100644 --- a/libselinux/src/Makefile +++ b/libselinux/src/Makefile @@ -81,6 +81,14 @@ ifneq (,$(filter i386,$(ARCH))) TLSFLAGS += -mno-tls-direct-seg-refs endif +ifeq ($(ANDROID_HOST),y) +DISABLE_FLAGS+= -DNO_MEDIA_BACKEND -DNO_DB_BACKEND -DNO_X_BACKEND \ + -DBUILD_HOST +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 +endif + SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(DISABLE_FLAGS) SWIGRUBY = swig -Wall -ruby -o $(SWIGRUBYCOUT) -outdir ./ $(DISABLE_FLAGS) diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile index 7898c08..e56a953 100644 --- a/libselinux/utils/Makefile +++ b/libselinux/utils/Makefile @@ -28,7 +28,11 @@ override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $ LDLIBS += -L../src -lselinux -L$(LIBDIR) PCRE_LDFLAGS ?= -lpcre +ifeq ($(ANDROID_HOST),y) +TARGETS=sefcontext_compile +else TARGETS=$(patsubst %.c,%,$(wildcard *.c)) +endif sefcontext_compile: LDLIBS += $(PCRE_LDFLAGS) ../src/libselinux.a -lsepol