From patchwork Fri Oct 4 01:12:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Barnett X-Patchwork-Id: 280448 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 BE9172C00C8 for ; Fri, 4 Oct 2013 11:12:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id F14B38B8A0; Fri, 4 Oct 2013 01:12:34 +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 l5q7a2yBLINU; Fri, 4 Oct 2013 01:12:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D48A08B7C0; Fri, 4 Oct 2013 01:12:32 +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 E4CD21C292B for ; Fri, 4 Oct 2013 01:12:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E07708A9F4 for ; Fri, 4 Oct 2013 01:12:31 +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 ej-QV9-7R4-b for ; Fri, 4 Oct 2013 01:12:31 +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 CBEEB8A998 for ; Fri, 4 Oct 2013 01:12:30 +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:29 -0500 Received: from ares ([131.198.63.11]) by collinscrsmtp02.rockwellcollins.com (Lotus Domino Release 8.5.2FP2 HF162) with ESMTP id 2013100320122985-2112934 ; Thu, 3 Oct 2013 20:12:29 -0500 From: Ryan Barnett To: buildroot@busybox.net Date: Thu, 3 Oct 2013 20:12:06 -0500 Message-Id: <1380849129-18517-3-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:29 PM, Serialize by Router on CollinsCRSMTP02/CedarRapids/RockwellCollins(Release 8.5.2FP2 HF162|May 16, 2011) at 10/03/2013 08:12:30 PM, Serialize complete at 10/03/2013 08:12:30 PM X-TNEFEvaluated: 1 Subject: [Buildroot] [PATCH 2/5] python-pycrypto: 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 --- v1 -> v2 * Fixed issue with not actually cross compiling the C shared libraries for the traget. * Some not so pretty things was were done to accomplish the cross compiling but I'd rather do this than having to patch the package to fix the cross compiling issues. * Added dependancy on GMP since it is needed for all the crypto libraries to work and the pacakge to compile correctly. * Added PYTHONPATH definition to the install target command * Added host so install of PySNMP-apps would work --- package/Config.in | 1 + package/python-pycrypto/Config.in | 9 +++ package/python-pycrypto/python-pycrypto.mk | 79 ++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 0 deletions(-) create mode 100644 package/python-pycrypto/Config.in create mode 100644 package/python-pycrypto/python-pycrypto.mk diff --git a/package/Config.in b/package/Config.in index 3592cb7..a1f7901 100644 --- a/package/Config.in +++ b/package/Config.in @@ -397,6 +397,7 @@ 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-pycrypto/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-pycrypto/Config.in b/package/python-pycrypto/Config.in new file mode 100644 index 0000000..0f076da --- /dev/null +++ b/package/python-pycrypto/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_PYTHON_PYCRYPTO + bool "python-pycrypto" + depends on BR2_PACKAGE_PYTHON + select BR2_PACKAGE_GMP + help + PyCrypto is a collection of cryptographic algorithms and + protocols, implemented for use from Python. + + http://www.pycrypto.org/ diff --git a/package/python-pycrypto/python-pycrypto.mk b/package/python-pycrypto/python-pycrypto.mk new file mode 100644 index 0000000..f68a487 --- /dev/null +++ b/package/python-pycrypto/python-pycrypto.mk @@ -0,0 +1,79 @@ +################################################################################ +# +# python-pycrypto +# +################################################################################ + +PYTHON_PYCRYPTO_VERSION = 2.6 +PYTHON_PYCRYPTO_SOURCE = pycrypto-$(PYTHON_PYCRYPTO_VERSION).tar.gz +PYTHON_PYCRYPTO_SITE = http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto +PYTHON_PYCRYPTO_LICENSE = Public Domain, Python 2.2 License (HMAC.py, setup.py) + +PYTHON_PYCRYPTO_LICENSE_FILES = COPYRIGHT LEGAL/copy/LICENSE.libtom \ + LEGAL/copy/LICENSE.orig LEGAL/copy/LICENSE.python-2.2 + +PYTHON_PYCRYPTO_DEPENDENCIES = python gmp +HOST_PYTHON_PYCRYPTO_DEPENDENCIES = host-python host-gmp + +############# +# Target +############# + +# The configure step needs to be run outside of the setup.py since it isn't +# run correctly for cross-compiling +define PYTHON_PYCRYPTO_CONFIGURE_CMDS + (cd $(@D) && \ + $(TARGET_CONFIGURE_OPTS) \ + $(TARGET_CONFIGURE_ARGS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --sysconfdir=/etc \ + --program-prefix="" \ + ) +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_PYCRYPTO_BUILD_CMDS + (cd $(@D); \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -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_PYCRYPTO_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_PYCRYPTO_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_PYCRYPTO_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))