procps-ng: Re-add procps-ng with API version 4
[feed/packages.git] / utils / procps-ng / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=procps-ng
11 PKG_VERSION:=4.0.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@SF/procps-ng
16 PKG_HASH:=22870d6feb2478adb617ce4f09a787addaf2d260c5a8aa7b17d889a962c5e42e
17
18 PKG_MAINTAINER:=
19 PKG_LICENSE:=GPL-2.0-or-later
20 PKG_LICENSE_FILES:=COPYING COPYING.LIB
21 PKG_CPE_ID:=cpe:/a:procps-ng_project:procps-ng
22
23 PKG_BUILD_PARALLEL:=1
24 PKG_INSTALL:=1
25 PKG_FIXUP:=autoreconf
26
27 include $(INCLUDE_DIR)/package.mk
28
29 CONFIGURE_ARGS += --enable-skill
30
31 # most of these have alternatives provided by busybox applets
32 PROCPS_APPLETS := \
33 free kill pgrep pkill pmap ps pwdx skill slabtop \
34 snice sysctl tload top uptime vmstat w watch
35
36 # procps-ng will be configured with "--bindir=/usr/bin --sbindir=/usr/sbin" and
37 # as such executables will be installed there by default, but some of them need
38 # to reside in locations such as /bin and /sbin to be in accordance with
39 # busybox alternatives which is also other distributions like debian and centos
40 # are doing
41 PROCPS_APPLETS_SRC_DIR_SBIN:=sysctl
42 procps-applets-src-dir=$(if $(filter $(PROCPS_APPLETS_SRC_DIR_SBIN),$(1)),/usr/sbin,/usr/bin)
43
44 PROCPS_APPLETS_DIR_BIN:=kill ps watch
45 PROCPS_APPLETS_DIR_SBIN:=sysctl
46 procps-applets-dir=$(if $(filter $(PROCPS_APPLETS_DIR_BIN),$(1)),/bin,$(if $(filter $(PROCPS_APPLETS_DIR_SBIN),$(1)),/sbin,/usr/bin))
47
48 define Package/procps-ng/Default
49 SECTION:=utils
50 CATEGORY:=Utilities
51 DEPENDS:=+libncurses
52 TITLE:=procps-ng utilities
53 URL:=https://gitlab.com/procps-ng/procps
54 endef
55
56 define Build/Prepare
57 $(call Build/Prepare/Default)
58 echo "$(PKG_VERSION)" > "$(PKG_BUILD_DIR)/.tarball-version"
59 endef
60
61 define Package/procps-ng
62 $(call Package/procps-ng/Default)
63 MENU:=1
64 endef
65
66 define Package/procps-ng/description
67 procps is a set of command line and full-screen utilities that provide information out of the pseudo-filesystem
68 most commonly located at /proc. This filesystem provides a simple interface to the kernel data structures.
69 The programs of procps generally concentrate on the structures that describe the processess running on the system.
70
71 NOTE: some utilities provided by procps-ng packages (ps, uptime, kill, ...) are installed as busybox applets, by default.
72 Conflicting applets should be removed from the build to avoid file conflicts.
73 endef
74
75 define GenPlugin
76 define Package/procps-ng-$(1)
77 $(call Package/procps-ng/Default)
78 DEPENDS:=procps-ng
79 TITLE:=Applet $(1) from the procps-ng package
80 ALTERNATIVES:=200:$(2)/$(1):/usr/libexec/$(1)-procps-ng
81 endef
82
83 define Package/procps-ng-$(1)/description
84 Installs the applet $(1).
85 endef
86 endef
87
88 $(foreach a,$(PROCPS_APPLETS),$(eval $(call GenPlugin,$(a),$(call procps-applets-dir,$(a)))))
89
90 MAKE_FLAGS += \
91 CFLAGS="$(TARGET_CFLAGS)" \
92 CPPFLAGS="$(TARGET_CPPFLAGS)" \
93 LDFLAGS="$(TARGET_LDFLAGS)" \
94
95 define Package/procps-ng/install
96 $(INSTALL_DIR) $(1)/usr/lib
97 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libproc2.so* $(1)/usr/lib/
98 endef
99
100 define Build/InstallDev
101 $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib
102 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
103 $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
104 endef
105
106 define BuildPlugin
107 define Package/procps-ng-$(1)/install
108 $(INSTALL_DIR) $$(1)/usr/libexec
109 $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(2)/$(1) $$(1)/usr/libexec/$(1)-procps-ng
110 endef
111
112 $$(eval $$(call BuildPackage,procps-ng-$(1)))
113 endef
114
115 $(foreach a,$(PROCPS_APPLETS),$(eval $(call BuildPlugin,$(a),$(call procps-applets-src-dir,$(a)))))
116 $(eval $(call BuildPackage,procps-ng))