python-cffi: add python3 variant
authorAlexandru Ardelean <redacted>
Tue, 31 Jan 2017 16:08:48 +0000 (18:08 +0200)
committerAlexandru Ardelean <redacted>
Wed, 1 Feb 2017 09:56:14 +0000 (11:56 +0200)
Signed-off-by: Alexandru Ardelean <redacted>
lang/python-cffi/Makefile

index b6d15fd6a9fa1213925e122ef79b371507559894..aa16f500c7f7e2b34069afb5e870cdb558385635 100644 (file)
@@ -9,14 +9,22 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cffi
 PKG_VERSION:=1.8.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://pypi.python.org/packages/0a/f3/686af8873b70028fccf67b15c78fd4e4667a3da995007afc71e786d61b0a
-PKG_MD5SUM:=c8e877fe0426a99d0cf5872cf2f95b27
+PKG_HASH:=c321bd46faa7847261b89c0469569530cad5a41976bb6dba8202c0159f476568
 
-PKG_BUILD_DEPENDS:=python python-setuptools
-HOST_BUILD_DEPENDS:=libffi/host python/host python-setuptools/host python-pycparser/host
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-$(PKG_NAME)-$(PKG_VERSION)
+PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+HOST_BUILD_DEPENDS:=libffi/host python-pycparser/host
+ifdef CONFIG_PACKAGE_python-cffi
+HOST_BUILD_DEPENDS+=python/host
+endif
+ifdef CONFIG_PACKAGE_python3-cffi
+HOST_BUILD_DEPENDS+=python3/host
+endif
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE
@@ -25,28 +33,56 @@ PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 $(call include_mk, python-package.mk)
-$(call include_mk, python-host.mk)
+$(call include_mk, python3-package.mk)
+
+define Package/python-cffi/Default
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  URL:=http://cffi.readthedocs.org/
+  DEPENDS:=+libffi
+endef
 
 define Package/python-cffi
-       SECTION:=lang
-       CATEGORY:=Languages
-       SUBMENU:=Python
-       TITLE:=python-cffi
-       URL:=http://cffi.readthedocs.org/
-       DEPENDS:=+libffi +python-light +python-pycparser
+$(call Package/python-cffi/Default)
+  TITLE:=python-cffi
+  DEPENDS+=+python-light +python-pycparser
+  VARIANT:=python
+endef
+
+define Package/python3-cffi
+$(call Package/python-cffi/Default)
+  TITLE:=python3-cffi
+  DEPENDS+=+python3-light +python3-pycparser
+  VARIANT:=python3
 endef
 
 define Package/python-cffi/description
 Foreign Function Interface for Python calling C code.
 endef
 
-define Build/Compile
-       $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
+define Package/python3-cffi/description
+$(call Package/python-cffi/description)
+.
+(Variant for Python3)
 endef
 
-define Host/Compile
+ifdef CONFIG_PACKAGE_python-cffi
+define Host/Compile/python-cffi
        $(call Build/Compile/HostPyMod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
 endef
+endif
+
+ifdef CONFIG_PACKAGE_python3-cffi
+define Host/Compile/python3-cffi
+       $(call Build/Compile/HostPy3Mod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
+endef
+endif
+
+define Host/Compile
+$(call Host/Compile/python-cffi)
+$(call Host/Compile/python3-cffi)
+endef
 
 define Host/Install
 endef
@@ -55,3 +91,6 @@ $(eval $(call HostBuild))
 
 $(eval $(call PyPackage,python-cffi))
 $(eval $(call BuildPackage,python-cffi))
+
+$(eval $(call Py3Package,python3-cffi))
+$(eval $(call BuildPackage,python3-cffi))
git clone https://git.99rst.org/PROJECT