From patchwork Fri Oct 4 01:12:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Barnett X-Patchwork-Id: 280447 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 50B412C00C8 for ; Fri, 4 Oct 2013 11:12:24 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8CE078B08B; Fri, 4 Oct 2013 01:12:23 +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 JRupJxeXXEyn; Fri, 4 Oct 2013 01:12:21 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 615018B0E8; Fri, 4 Oct 2013 01:12:21 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D06381C292B for ; Fri, 4 Oct 2013 01:12:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CBFAF8A9F4 for ; Fri, 4 Oct 2013 01:12:20 +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 wqe+vEgcAcrx for ; Fri, 4 Oct 2013 01:12:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from secvs02.rockwellcollins.com (secvs02.rockwellcollins.com [205.175.225.241]) by whitealder.osuosl.org (Postfix) with ESMTPS id DD8348A998 for ; Fri, 4 Oct 2013 01:12:19 +0000 (UTC) Received: from nosuchhost.198.131.in-addr.arpa (HELO collinscrsmtp02.rockwellcollins.com) ([131.198.63.133]) by mail-virt.rockwellcollins.com with ESMTP; 03 Oct 2013 20:12:19 -0500 Received: from ares ([131.198.63.11]) by collinscrsmtp02.rockwellcollins.com (Lotus Domino Release 8.5.2FP2 HF162) with ESMTP id 2013100320121896-2112919 ; Thu, 3 Oct 2013 20:12:18 -0500 From: Ryan Barnett To: buildroot@busybox.net Date: Thu, 3 Oct 2013 20:12:05 -0500 Message-Id: <1380849129-18517-2-git-send-email-rjbarnet@rockwellcollins.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1380849129-18517-1-git-send-email-rjbarnet@rockwellcollins.com> References: <1380849129-18517-1-git-send-email-rjbarnet@rockwellcollins.com> X-MIMETrack: Itemize by SMTP Server on CollinsCRSMTP02/CedarRapids/RockwellCollins(Release 8.5.2FP2 HF162|May 16, 2011) at 10/03/2013 08:12:18 PM, Serialize by Router on CollinsCRSMTP02/CedarRapids/RockwellCollins(Release 8.5.2FP2 HF162|May 16, 2011) at 10/03/2013 08:12:19 PM, Serialize complete at 10/03/2013 08:12:19 PM X-TNEFEvaluated: 1 Subject: [Buildroot] [PATCH 1/5] python-pyasn: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 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-bounces@busybox.net Signed-off-by: Ryan Barnett --- The definition of CFLAGS/LDFLAGS/LDSHARED is necessary since the compilation of won't work correctly using either TARGET_CONFIGURE_OPTS because it won't link against the correct python library. Also using python-distutilcross doesn't work as the setup.py doesn't understand the -x option. --- v1 -> v2 * Added comment explain why the -I and -L options are needed which is the same comment as PyCrypto package. * Added PYTHONPATH definition to the install target command * Added host-version of PyAsn since PySNMP-apps will not be able to find the installed version of PyASN and try to install it. --- package/Config.in | 1 + package/python-pyasn/Config.in | 13 ++++++ package/python-pyasn/python-pyasn.mk | 73 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 0 deletions(-) create mode 100644 package/python-pyasn/Config.in create mode 100644 package/python-pyasn/python-pyasn.mk diff --git a/package/Config.in b/package/Config.in index b7fdb89..3592cb7 100644 --- a/package/Config.in +++ b/package/Config.in @@ -396,6 +396,7 @@ source "package/python-meld3/Config.in" source "package/python-netifaces/Config.in" source "package/python-nfc/Config.in" source "package/python-protobuf/Config.in" +source "package/python-pyasn/Config.in" source "package/python-pygame/Config.in" source "package/python-pyparsing/Config.in" source "package/python-pyro/Config.in" diff --git a/package/python-pyasn/Config.in b/package/python-pyasn/Config.in new file mode 100644 index 0000000..a352fe4 --- /dev/null +++ b/package/python-pyasn/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_PYTHON_PYASN + bool "python-pyasn" + depends on BR2_PACKAGE_PYTHON + depends on BR2_INSTALL_LIBSTDCPP + help + PyASN is a Python extension module that enables you to + perform very fast IP address to Autonomous System Number + lookups. + + https://code.google.com/p/pyasn/ + +comment "python-pyasn requires C++ support in toolchain" + depends on !BR2_INSTALL_LIBSTDCPP diff --git a/package/python-pyasn/python-pyasn.mk b/package/python-pyasn/python-pyasn.mk new file mode 100644 index 0000000..bfad659 --- /dev/null +++ b/package/python-pyasn/python-pyasn.mk @@ -0,0 +1,73 @@ +################################################################################ +# +# python-pyasn +# +################################################################################ + +PYTHON_PYASN_VERSION = 1.2 +PYTHON_PYASN_SOURCE = PyASN-$(PYTHON_PYASN_VERSION).zip +PYTHON_PYASN_SITE = https://pyasn.googlecode.com/files +PYTHON_PYASN_LICENSE = LGPL + +PYTHON_PYASN_DEPENDENCIES = python +HOST_PYTHON_PYASN_DEPENDENCIES = host-python + +############# +# Target +############# +define PYTHON_PYASN_EXTRACT_CMDS + unzip -d $(@D) $(DL_DIR)/$(PYTHON_PYASN_SOURCE) + mv $(@D)/PyASN-$(PYTHON_PYASN_VERSION)/* $(@D) + $(RM) -r $(@D)/PyASN-$(PYTHON_PYASN_VERSION) +endef + +# The additional -I and -L are needed to ensure that the $(STAGING_DIR) +# header and library files are pulled. Otherwise the distutils package before +# the ones that the distutils package will find the headers/libraries that are +# located at $(HOST_DIR)/usr. +define PYTHON_PYASN_BUILD_CMDS + (cd $(@D); \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + CXX="$(TARGET_CXX)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) -I$(STAGING_DIR)/usr/include" \ + LDSHARED="$(TARGET_CC) -shared" \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \ + $(HOST_DIR)/usr/bin/python setup.py build_ext \ + --include-dirs=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \ + ) + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build) +endef + +# PYTHONPATH definition is need for install since an error could +# be thrown about installing to location that isn't in PYTHONPATH +define PYTHON_PYASN_INSTALL_TARGET_CMDS + (cd $(@D); \ + PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \ + $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + +############# +# Host +############# +define HOST_PYTHON_PYASN_EXTRACT_CMDS + unzip -d $(@D) $(DL_DIR)/$(PYTHON_PYASN_SOURCE) + mv $(@D)/PyASN-$(PYTHON_PYASN_VERSION)/* $(@D) + $(RM) -r $(@D)/PyASN-$(PYTHON_PYASN_VERSION) +endef + +define HOST_PYTHON_PYASN_BUILD_CMDS + (cd $(@D); \ + $(HOST_DIR)/usr/bin/python setup.py build_ext \ + ) + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build) +endef + +define HOST_PYTHON_PYASN_INSTALL_TARGET_CMDS + (cd $(@D); \ + $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + + +$(eval $(generic-package)) +$(eval $(host-generic-package))