Permalink
Browse files

python:

 * simplify Build/PyMod macro(s)
 * refs #1839


git-svn-id: file:///var/svn/freetz/trunk@10145 149334a1-2f27-0410-a3b9-fc62619ac1e6
  • Loading branch information...
1 parent c7cd984 commit ab717ed4631942fd30890b94406b00cedbbae371 er13 committed Feb 18, 2013
@@ -16,12 +16,7 @@ $(PKG_UNPACKED)
$(PKG_CONFIGURED_NOP)
$($(PKG)_TARGET_BINARY): $($(PKG)_DIR)/.configured
- $(call Build/PyMod, \
- $(PYTHON_IMAGING_LIBRARY_DIR), \
- install --prefix=/usr --root=$(abspath $(PYTHON_IMAGING_LIBRARY_DEST_DIR)), \
- TARGET_ARCH="$(FREETZ_TARGET_ARCH)", \
- $(PYTHON_IMAGING_LIBRARY_DEST_DIR)$(PYTHON_SITE_PKG_DIR) \
- )
+ $(call Build/PyMod/PKG, PYTHON_IMAGING_LIBRARY, , TARGET_ARCH=$(FREETZ_TARGET_ARCH))
$(RM) -r $(PYTHON_IMAGING_LIBRARY_DEST_DIR)/usr/bin
(cd $(PYTHON_IMAGING_LIBRARY_DEST_DIR)$(PYTHON_SITE_PKG_DIR); mv PIL/PIL-*.egg-info .;)
@@ -16,12 +16,7 @@ $(PKG_UNPACKED)
$(PKG_CONFIGURED_CONFIGURE)
$($(PKG)_TARGET_BINARY): $($(PKG)_DIR)/.configured
- $(call Build/PyMod, \
- $(PYTHON_PYCRYPTO_DIR), \
- install --prefix=/usr --root=$(abspath $(PYTHON_PYCRYPTO_DEST_DIR)), \
- TARGET_ARCH="$(FREETZ_TARGET_ARCH)", \
- $(PYTHON_PYCRYPTO_DEST_DIR)$(PYTHON_SITE_PKG_DIR) \
- )
+ $(call Build/PyMod/PKG, PYTHON_PYCRYPTO, , TARGET_ARCH=$(FREETZ_TARGET_ARCH))
$(pkg):
@@ -17,13 +17,7 @@ $(PKG_UNPACKED)
$(PKG_CONFIGURED_NOP)
$($(PKG)_TARGET_BINARY): $($(PKG)_DIR)/.configured
- $(call Build/PyMod, \
- $(PYTHON_PYCURL_DIR), \
- install --prefix=/usr --root=$(abspath $(PYTHON_PYCURL_DEST_DIR)) \
- --curl-config=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/bin/curl-config, \
- , \
- $(PYTHON_PYCURL_DEST_DIR)$(PYTHON_SITE_PKG_DIR) \
- )
+ $(call Build/PyMod/PKG, PYTHON_PYCURL, --curl-config=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/bin/curl-config)
$(pkg):
@@ -17,12 +17,7 @@ $(PKG_UNPACKED)
$(PKG_CONFIGURED_NOP)
$($(PKG)_TARGET_BINARY): $($(PKG)_DIR)/.configured
- $(call Build/PyMod, \
- $(PYTHON_PYOPENSSL_DIR), \
- install --prefix=/usr --root=$(abspath $(PYTHON_PYOPENSSL_DEST_DIR)), \
- , \
- $(PYTHON_PYOPENSSL_DEST_DIR)$(PYTHON_SITE_PKG_DIR) \
- )
+ $(call Build/PyMod/PKG, PYTHON_PYOPENSSL)
$(pkg):
@@ -15,6 +15,8 @@ PYTHON:=python$(PYTHON_MAJOR_VERSION)
HOST_PYTHON_BIN:=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/bin/hostpython
+# $(1) => statements to be executed before calling host-python
+# $(2) => parameters to be passed to host-python
define HostPython
( \
export PYTHONPATH="$(PYTHON_STAGING_LIB_DIR):$(TARGET_TOOLCHAIN_STAGING_DIR)/$(PYTHON_SITE_PKG_DIR)"; \
@@ -29,7 +31,7 @@ endef
# $(2) => additional arguments to setup.py
# $(3) => additional variables
# $(4) => dir to look for .so files to be stripped
-define Build/PyMod
+define Build/PyMod/Generic
$(call HostPython, \
cd $(strip $(1)); \
$(TARGET_CONFIGURE_ENV) \
@@ -40,3 +42,16 @@ define Build/PyMod
)
$(if $(strip $(4)),find $(strip $(4)) -type f -name "*.so" -exec $(TARGET_STRIP) \{\} \+)
endef
+
+# $(1) => PKG value
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/PyMod/PKG
+ $(call Build/PyMod/Generic, \
+ $($(strip $(1))_DIR), \
+ install --prefix=/usr --root=$(abspath $($(strip $(1))_DEST_DIR)) \
+ $(2), \
+ $(3), \
+ $($(strip $(1))_DEST_DIR)$(PYTHON_SITE_PKG_DIR) \
+ )
+endef

0 comments on commit ab717ed

Please sign in to comment.