diff mbox

[OpenWrt-Devel] ubi-utils: package mkfs.ubifs and mtdinfo into ubi-utils

Message ID 1461851833-25393-1-git-send-email-ardeleanalex@gmail.com
State Rejected
Headers show

Commit Message

Alexandru Ardelean April 28, 2016, 1:57 p.m. UTC
This is a partial backport from mtd-utils.
mtd-utils exposed multiple sub-packages.

I think mtd-utils was part of the oldpackages ; I haven't checked.
But it seems that mtd-utils and ubi-utils are pretty much the same.

The only thing we need on top of ubi-utils are the 'mkfs.ubifs' and
'mtdinfo' commands.

I had thought about just adding the 2 cmds to the ubi-utils install rule
but maybe for a more generic use-case they might not be needed.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
 package/utils/ubi-utils/Makefile | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff mbox

Patch

diff --git a/package/utils/ubi-utils/Makefile b/package/utils/ubi-utils/Makefile
index b89a5d2..c34e1a2 100644
--- a/package/utils/ubi-utils/Makefile
+++ b/package/utils/ubi-utils/Makefile
@@ -30,6 +30,10 @@  PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
 
 include $(INCLUDE_DIR)/package.mk
 
+FILES:= \
+	mkfs.ubifs:+libuuid:+liblzo:+zlib \
+	mtdinfo
+
 define Package/ubi-utils
   TITLE:=Utilities for ubi info/debug
   SECTION:=utils
@@ -42,6 +46,18 @@  define Package/ubi-utils/description
   Utilities for manipulating memory technology devices.
 endef
 
+define PartGen
+define Package/ubi-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))
+  TITLE:=$(firstword $(subst :, ,$(1))) package from ubi-utils
+  URL:=http://www.linux-mtd.infradead.org/
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=@NAND_SUPPORT +ubi-utils $(wordlist 2,$(words $(subst :, ,$(1))),$(subst :, ,$(1)))
+endef
+endef
+
+$(foreach file,$(FILES),$(eval $(call PartGen,$(file))))
+
 MAKE_FLAGS += \
 	DESTDIR="$(PKG_INSTALL_DIR)" \
 	BUILDDIR="$(PKG_BUILD_DIR)" \
@@ -57,5 +73,16 @@  define Package/ubi-utils/install
 		$(PKG_INSTALL_DIR)/usr/sbin/{ubinfo,ubinize,ubirename,ubirmvol,ubirsvol,ubiupdatevol} $(1)/usr/sbin/
 endef
 
+define PartInstall
+define Package/ubi-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))/install
+	$(INSTALL_DIR) $$(1)/usr/sbin
+	$(INSTALL_BIN) \
+		$(PKG_INSTALL_DIR)/usr/sbin/$(firstword $(subst :, ,$(1))) \
+		$$(1)/usr/sbin/
+endef
+endef
+
+$(foreach file,$(FILES),$(eval $(call PartInstall,$(file))))
 
 $(eval $(call BuildPackage,ubi-utils))
+$(foreach file,$(FILES),$(eval $(call BuildPackage,ubi-utils-$(subst _,-,$(firstword $(subst :, ,$(file)))))))