python-ply: add python3 variant
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Tue, 31 Jan 2017 15:56:49 +0000 (17:56 +0200)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Wed, 1 Feb 2017 09:51:30 +0000 (11:51 +0200)
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
lang/python-ply/Makefile

index 0b0e5537f35b1fd7b50e316716453c364faf6a90..61b34a312640f0f00a3e9c1f0033e24b706fbbc5 100644 (file)
@@ -9,14 +9,22 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ply
 PKG_VERSION:=3.9
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.dabeaz.com/ply
-PKG_MD5SUM:=c5c5767376eff902617fd9874f0c76b7
+PKG_HASH:=0d7e2940b9c57151392fceaa62b0865c45e06ce1e36687fd8d03f011a907f43e
 
-PKG_BUILD_DEPENDS:=python python-setuptools
-HOST_BUILD_DEPENDS:=python/host python-setuptools/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:=
+ifdef CONFIG_PACKAGE_python-ply
+HOST_BUILD_DEPENDS+=python/host
+endif
+ifdef CONFIG_PACKAGE_python3-ply
+HOST_BUILD_DEPENDS+=python3/host
+endif
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=README.md
@@ -25,15 +33,27 @@ 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-ply/Default
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  URL:=http://www.dabeaz.com/ply/
+endef
 
 define Package/python-ply
-       SECTION:=lang
-       CATEGORY:=Languages
-       SUBMENU:=Python
-       TITLE:=python-ply
-       URL:=http://www.dabeaz.com/ply/
-       DEPENDS:=+python-light
+$(call Package/python-ply/Default)
+  TITLE:=python-ply
+  DEPENDS:=+python-light
+  VARIANT:=python
+endef
+
+define Package/python3-ply
+$(call Package/python-ply/Default)
+  TITLE:=python3-ply
+  DEPENDS:=+python3-light
+  VARIANT:=python3
 endef
 
 define Package/python-ply/description
@@ -41,13 +61,28 @@ PLY is a 100% Python implementation of the common parsing tools lex
 and yacc.
 endef
 
-define Build/Compile
-       $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
+define Package/python3-ply/description
+$(call Package/python-ply/description)
+.
+(Variant for Python3)
 endef
 
-define Host/Compile
+ifdef CONFIG_PACKAGE_python-ply
+define Host/Compile/python-ply
        $(call Build/Compile/HostPyMod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
 endef
+endif
+
+ifdef CONFIG_PACKAGE_python3-ply
+define Host/Compile/python3-ply
+       $(call Build/Compile/HostPy3Mod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
+endef
+endif
+
+define Host/Compile
+$(call Host/Compile/python-ply)
+$(call Host/Compile/python3-ply)
+endef
 
 define Host/Install
 endef
@@ -56,3 +91,6 @@ $(eval $(call HostBuild))
 
 $(eval $(call PyPackage,python-ply))
 $(eval $(call BuildPackage,python-ply))
+
+$(eval $(call Py3Package,python3-ply))
+$(eval $(call BuildPackage,python3-ply))