[Buildroot] [PATCH 1/5] python-pyasn: new package
Ryan Barnett
rjbarnet at rockwellcollins.com
Fri Oct 4 01:12:05 UTC 2013
Signed-off-by: Ryan Barnett <rjbarnet at rockwellcollins.com>
---
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))
--
1.7.1
More information about the buildroot
mailing list