python-pycparser: add python3 variant
authorAlexandru Ardelean <redacted>
Tue, 31 Jan 2017 16:02:23 +0000 (18:02 +0200)
committerAlexandru Ardelean <redacted>
Wed, 1 Feb 2017 09:55:05 +0000 (11:55 +0200)
Signed-off-by: Alexandru Ardelean <redacted>
lang/python-pycparser/Makefile

index 37e6c8403883d5385dc5ea4f2560e7aea0b61310..d151eb1cc2c416d882cbf97723b197c242d72bb0 100644 (file)
@@ -9,14 +9,22 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pycparser
 PKG_VERSION:=2.14
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://pypi.python.org/packages/source/p/pycparser
-PKG_MD5SUM:=a2bc8d28c923b4fe2b2c3b4b51a4f935
+PKG_HASH:=7959b4a74abdc27b312fed1c21e6caf9309ce0b29ea86b591fd2e99ecdf27f73
 
-PKG_BUILD_DEPENDS:=python python-setuptools
-HOST_BUILD_DEPENDS:=python/host python-setuptools/host python-ply/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:=python-ply/host
+ifdef CONFIG_PACKAGE_python-pycparser
+HOST_BUILD_DEPENDS+=python/host
+endif
+ifdef CONFIG_PACKAGE_python3-pycparser
+HOST_BUILD_DEPENDS+=python3/host
+endif
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
@@ -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-pycparser/Default
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  URL:=https://github.com/eliben/pycparser
+endef
 
 define Package/python-pycparser
-       SECTION:=lang
-       CATEGORY:=Languages
-       SUBMENU:=Python
-       TITLE:=python-pycparser
-       URL:=https://github.com/eliben/pycparser
-       DEPENDS:=+python-light +python-ply
+$(call Package/python-pycparser/Default)
+  TITLE:=python-pycparser
+  DEPENDS:=+python-light +python-ply
+  VARIANT:=python
+endef
+
+define Package/python3-pycparser
+$(call Package/python-pycparser/Default)
+  TITLE:=python3-pycparser
+  DEPENDS:=+python3-light +python3-ply
+  VARIANT:=python3
 endef
 
 define Package/python-pycparser/description
@@ -42,13 +62,28 @@ module designed to be easily integrated into applications that need to parse
 C source code.
 endef
 
-define Build/Compile
-       $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
+define Package/python3-pycparser/description
+$(call Package/python-pycparser/description)
+.
+(Variant for Python3)
 endef
 
-define Host/Compile
+ifdef CONFIG_PACKAGE_python-pycparser
+define Host/Compile/python-pycparser
        $(call Build/Compile/HostPyMod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
 endef
+endif
+
+ifdef CONFIG_PACKAGE_python3-pycparser
+define Host/Compile/python3-pycparser
+       $(call Build/Compile/HostPy3Mod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
+endef
+endif
+
+define Host/Compile
+$(call Host/Compile/python-pycparser)
+$(call Host/Compile/python3-pycparser)
+endef
 
 define Host/Install
 endef
@@ -57,3 +92,6 @@ $(eval $(call HostBuild))
 
 $(eval $(call PyPackage,python-pycparser))
 $(eval $(call BuildPackage,python-pycparser))
+
+$(eval $(call Py3Package,python3-pycparser))
+$(eval $(call BuildPackage,python3-pycparser))
git clone https://git.99rst.org/PROJECT