From patchwork Sun Apr 5 22:06:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Barnett X-Patchwork-Id: 458289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 3289E140271 for ; Mon, 6 Apr 2015 08:06:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=RuHp2GQb; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id DF4D4A1BA1; Sun, 5 Apr 2015 22:06:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o5F7zGfB8Wp6; Sun, 5 Apr 2015 22:06:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9D797A1BA2; Sun, 5 Apr 2015 22:06:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 07FC21BF984 for ; Sun, 5 Apr 2015 22:06:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 039D2A1B89 for ; Sun, 5 Apr 2015 22:06:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r-_uQQwEcfDD for ; Sun, 5 Apr 2015 22:06:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ig0-f169.google.com (mail-ig0-f169.google.com [209.85.213.169]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E44ABA1B87 for ; Sun, 5 Apr 2015 22:06:29 +0000 (UTC) Received: by igblo3 with SMTP id lo3so10137501igb.1 for ; Sun, 05 Apr 2015 15:06:29 -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=RuHp2GQbiNzKB8umWPytBK95ic0cue5TiPWqCUIsdBZr4r+Da9GfrBz2sy175AtNOl 6ALYYEXaRYgXGcmdhkYWC5ubGHj95iY5XzbmeLU8whmeXAmidBcwzYpJtl4ryjNoBZwc XcVQSXWnfXz/RqSI9+7Om2vzZzPOmm2Lu/NDOQpyjSXQJYzNYaJOfrqNxjxme6yAFkxy 7j8iAi+d/RXhCG8NSocfvmWSUX96ytbm8CCNVLUZL1qmEMcX/4IzUCQ0xRsayYBhPLBC AgEMELZlklhwFUTW16w13ITZTXDRmPIPhO4YolCOHNXUMryWj+CgYY/jPppRSr16Vd3I A00g== X-Received: by 10.107.167.145 with SMTP id q139mr18477575ioe.16.1428271589329; Sun, 05 Apr 2015 15:06:29 -0700 (PDT) Received: from localhost.localdomain (50-83-61-125.client.mchsi.com. [50.83.61.125]) by mx.google.com with ESMTPSA id kc1sm1753011igb.0.2015.04.05.15.06.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Apr 2015 15:06:28 -0700 (PDT) From: Ryan Barnett To: buildroot@buildroot.org Date: Sun, 5 Apr 2015 17:06:25 -0500 Message-Id: <1428271585-27285-2-git-send-email-ryanbarnett3@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428271585-27285-1-git-send-email-ryanbarnett3@gmail.com> References: <1428271585-27285-1-git-send-email-ryanbarnett3@gmail.com> Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [PATCH v4 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))