2012/9/5 Jonas Gorski <[email protected]>

> On 5 September 2012 16:50, Jonh Wendell <[email protected]> wrote:
> > 2012/9/5 Jonas Gorski <[email protected]>
> >> On 23 August 2012 19:31, Jonh Wendell <[email protected]> wrote:
> >> > From d3f62517f73201522eb36a4030cb54b26b4eb069 Mon Sep 17 00:00:00 2001
> >> > From: Jonh Wendell <[email protected]>
> >> > Date: Thu, 23 Aug 2012 14:24:09 -0300
> >> > Subject: [PATCH] [package/procps] Allow selection of applets to be
> >> > installed
> >> >
> >> > This patch adds a menu entry under procps package, allowing the
> >> > selection of which packages are actually installed.
> >>
> >> Is there a reason for using a menu and not just packaging these
> >> utilities individually like it is done for e.g. coreutils?
> >
> >
> > No, there isn't a strong reason to do that way. I can rework the patch if
> > this is the preferred way.
>
> Then please do so, it is much more user friendly. The menu way would
> force users to always compile their own version of the package if they
> need a certain applet of it.
>
>
> Regards
> Jonas
>

Thanks for your input/review. Here comes the second try, folowing the same
schema as coreutils.

>From 8d463cff582327b49e32a9410588d9a339c76b07 Mon Sep 17 00:00:00 2001
From: Jonh Wendell <[email protected]>
Date: Wed, 5 Sep 2012 16:42:47 -0300
Subject: [PATCH] [package] procps: Split package into subpackages

Split procps package into various subpackages, one for
each applet. This allows the user to choose which applets
they want. This is similar to coreutils package.

All subpackages are defaulted to YES, to keep the current
behaviour, i.e., selecting procps package will select
all its subpackages.

Signed-off-by: Jonh Wendell <[email protected]>
---
 utils/procps/Makefile |   54
++++++++++++++++++++++++++++++++++---------------
 1 file changed, 38 insertions(+), 16 deletions(-)

diff --git a/utils/procps/Makefile b/utils/procps/Makefile
index 8e16706..cf2e2df 100644
--- a/utils/procps/Makefile
+++ b/utils/procps/Makefile
@@ -19,7 +19,11 @@ PKG_BUILD_PARALLEL:=1

 include $(INCLUDE_DIR)/package.mk

-define Package/procps
+PROCPS_APPLETS := \
+    ps free pgrep pkill pmap pwdx skill w \
+    slabtop snice tload top vmstat watch
+
+define Package/procps/Default
   SECTION:=utils
   CATEGORY:=Utilities
   DEPENDS:=+libncurses
@@ -27,35 +31,53 @@ define Package/procps
   URL:=http://procps.sourceforge.net/
 endef

+define Package/procps
+  $(call Package/procps/Default)
+  MENU:=1
+endef
+
 define Package/procps/description
  procps is the package that has a bunch of small useful utilities that
give
  information about processes using the /proc filesystem. The package
  includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill.
 endef

+define GenPlugin
+ define Package/$(1)
+   $(call Package/procps/Default)
+   DEPENDS:=procps
+   TITLE:=Applet $(2) from the procps package
+   DEFAULT:=y
+ endef
+
+ define Package/$(1)/description
+  Installs the applet $(2).
+ endef
+endef
+
+$(foreach a,$(PROCPS_APPLETS),$(eval $(call GenPlugin,procps-$(a),$(a))))
+
 MAKE_FLAGS += \
     CFLAGS="$(TARGET_CFLAGS)" \
     CPPFLAGS="$(TARGET_CPPFLAGS)" \
     LDFLAGS="$(TARGET_LDFLAGS)" \

 define Package/procps/install
-    $(INSTALL_DIR) $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/free $(1)/usr/bin/
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/ps/ps $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/pgrep $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/pkill $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/pmap $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/pwdx $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/skill $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/slabtop $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/snice $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/tload $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/top $(1)/usr/bin/
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/vmstat $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/w $(1)/usr/bin
-    $(INSTALL_BIN) $(PKG_BUILD_DIR)/watch $(1)/usr/bin
     $(INSTALL_DIR) $(1)/usr/lib
     $(INSTALL_BIN) $(PKG_BUILD_DIR)/proc/libproc-$(PKG_VERSION).so
$(1)/usr/lib/
 endef

+AUXDIR_ps := "ps/"
+
+define BuildPlugin
+  define Package/$(1)/install
+    $(INSTALL_DIR) $$(1)/usr/bin
+    $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(AUXDIR_$(2))$(2) $$(1)/usr/bin/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
 $(eval $(call BuildPackage,procps))
+
+$(foreach a,$(PROCPS_APPLETS),$(eval $(call BuildPlugin,procps-$(a),$(a))))
-- 
1.7.9.5


-- 
Jonh Wendell
http://www.bani.com.br
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to