From patchwork Sun Apr 5 21:47:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Barnett X-Patchwork-Id: 458281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id C2C33140271 for ; Mon, 6 Apr 2015 07:47:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=LmWYvn97; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0CD2692102; Sun, 5 Apr 2015 21:47:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lMLixc6WyLDx; Sun, 5 Apr 2015 21:47:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7D4979212D; Sun, 5 Apr 2015 21:47:23 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B8F8C1BF984 for ; Sun, 5 Apr 2015 21:47:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B46269212D for ; Sun, 5 Apr 2015 21:47:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f-iPwpKl+dac for ; Sun, 5 Apr 2015 21:47:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vn0-f53.google.com (mail-vn0-f53.google.com [209.85.216.53]) by hemlock.osuosl.org (Postfix) with ESMTPS id 5D0D892102 for ; Sun, 5 Apr 2015 21:47:21 +0000 (UTC) Received: by vnbf62 with SMTP id f62so2111747vnb.3 for ; Sun, 05 Apr 2015 14:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H0aGahhrhdHbEfYQ7egwcgT5leGJt7QzpgVG1Ip4LfA=; b=LmWYvn97j7Xt06rtSq6laT6FY8l9oNKcVKahnseu6SX6wXboPiTp5BD/U3FAHmaxgL hRNrr3PTWNz3Kn1QU3YkZR2Z2U0YDhQPT3UnI50w4Gfh5RYOX6ytLzertHAQpWrQ5Wal X12DSSHtIHDrM1yZOC/5lRaV7/wX/WyL36hLNE4+N6B1uiuqiJRfaqAualQZluvu4Mgg 6FAVCl3JcItm2WIdzYAreBOXCP0BVhGaoxydzZ34PF0rmViuuIc5lMn4KNEZ6U2zdlhM Fae7pu05sltIBVFyBdclmD+3J+7FTH996vYqNlAB5WsqAqM4JxeyXit0sPD/TTRvW+8R KwJQ== X-Received: by 10.236.111.7 with SMTP id v7mr11516984yhg.24.1428270440604; Sun, 05 Apr 2015 14:47:20 -0700 (PDT) Received: from localhost.localdomain (50-83-61-125.client.mchsi.com. [50.83.61.125]) by mx.google.com with ESMTPSA id n8sm2290745yhn.10.2015.04.05.14.47.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Apr 2015 14:47:20 -0700 (PDT) From: Ryan Barnett To: buildroot@buildroot.org Date: Sun, 5 Apr 2015 16:47:13 -0500 Message-Id: <1428270433-12058-2-git-send-email-ryanbarnett3@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428270433-12058-1-git-send-email-ryanbarnett3@gmail.com> References: <1428270433-12058-1-git-send-email-ryanbarnett3@gmail.com> Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [PATCH v3 2/2] i2c-tools: add support to build python extension 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" Add a config option to build the python bindings for i2c-tools - py-smbus. The steps for building the python bindings is the same as the distutil steps that are a part of the python infrastructure. Signed-off-by: Ryan Barnett CC: Thomas Petazzoni CC: Baruch Siach CC: Yann E. MORIN --- Changes v2 -> v3: - Removed Config.in entry (suggested by Baruch) - Moved install and build defines with the CMD block (suggested by Yann) Changes v1 -> v2: - Fixed spelling in config entry - Utilize the python infrastructure variables for environment and build/install opts (suggested by Thomas P) - Only support python2.7 since this is not compatabile with python3 (suggested by Baruch) --- package/i2c-tools/i2c-tools.mk | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/package/i2c-tools/i2c-tools.mk b/package/i2c-tools/i2c-tools.mk index 0115e22..0accf82 100644 --- a/package/i2c-tools/i2c-tools.mk +++ b/package/i2c-tools/i2c-tools.mk @@ -10,8 +10,35 @@ I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases I2C_TOOLS_LICENSE = GPLv2+, GPLv2 (py-smbus) I2C_TOOLS_LICENSE_FILES = COPYING +# BASE_ENV taken from PKG_PYTHON_DISTUTILS_ENV in package/pkg-python.mk +I2C_TOOLS_PYTHON_BASE_ENV = \ + $(PKG_PYTHON_DISTUTILS_ENV) \ + CFLAGS="$(TARGET_CFLAGS) -I../include" + +# Build/install steps mirror the distutil python package type in the python package +# infrastructure +ifeq ($(BR2_PACKAGE_PYTHON),y) +I2C_TOOLS_DEPENDENCIES += python + +define I2C_TOOLS_BUILD_PYSMBUS + (cd $(@D)/py-smbus; \ + $(I2C_TOOLS_PYTHON_BASE_ENV) \ + $(HOST_DIR)/usr/bin/python setup.py build \ + $(PKG_PYTHON_DISTUTILS_BUILD_OPTS)) +endef + +define I2C_TOOLS_INSTALL_PYSMBUS + (cd $(@D)/py-smbus; \ + $(I2C_TOOLS_PYTHON_BASE_ENV) \ + $(HOST_DIR)/usr/bin/python setup.py install \ + $(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS)) +endef + +endif # BR2_PACKAGE_PYTHON + define I2C_TOOLS_BUILD_CMDS $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) + $(I2C_TOOLS_BUILD_PYSMBUS) endef define I2C_TOOLS_INSTALL_TARGET_CMDS @@ -19,6 +46,7 @@ define I2C_TOOLS_INSTALL_TARGET_CMDS do \ $(INSTALL) -m 755 -D $(@D)/tools/$$i $(TARGET_DIR)/usr/bin/$$i; \ done + $(I2C_TOOLS_INSTALL_PYSMBUS) endef $(eval $(generic-package))