[package] shadow: rework Makefile
[packages.git] / utils / shadow / Makefile
1 #
2 # Copyright (C) 2008-2013 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:=shadow
11 PKG_VERSION:=4.1.5.1
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://pkg-shadow.alioth.debian.org/releases
16 PKG_MD5SUM:=a00449aa439c69287b6d472191dc2247
17
18 PKG_FIXUP:=autoreconf
19 PKG_BUILD_PARALLEL:=1
20 PKG_INSTALL:=1
21
22 include $(INCLUDE_DIR)/package.mk
23
24 SHADOW_APPLETS := \
25         chage groupadd groupdel groupmod groups passwd su \
26         useradd userdel usermod
27
28 CONFIGURE_ARGS += \
29         --without-audit \
30         --without-libpam \
31         --without-selinux \
32         --without-acl \
33         --without-attr \
34         --without-tcb \
35         --without-nscd
36
37 define Package/shadow/Default
38   SECTION:=utils
39   CATEGORY:=Utilities
40   TITLE:=The PLD Linux shadow utilities
41   URL:=http://pkg-shadow.alioth.debian.org/
42 endef
43
44 define Package/shadow
45   $(call Package/shadow/Default)
46   MENU:=1
47 endef
48
49 define Package/shadow/description
50   Full versions of standard shadow utilities. Normally, you would not
51   use this package, since the functionality in BusyBox is more than
52   sufficient and much smaller.
53 endef
54
55 define Package/shadow/install
56         true
57 endef
58
59
60 define Package/shadow-common
61   $(call Package/shadow/Default)
62   TITLE:=Shared definitions for the PLD Linux shadow utilities
63   DEPENDS:=shadow
64 endef
65
66
67 define GenPlugin
68   define Package/shadow-$(1)
69     $(call Package/shadow/Default)
70     TITLE:=Utility $(1) from the PLD Linux shadow utilities
71     DEPENDS:=shadow +shadow-common
72   endef
73
74   define Package/shadow-$(1)/description
75     Full version of standard $(1) utility. Normally, you would not use this
76     package, since the functionality in BusyBox is more than sufficient.
77   endef
78 endef
79
80 $(foreach u,$(SHADOW_APPLETS),$(eval $(call GenPlugin,$(u))))
81
82
83 define Package/shadow-common/conffiles
84 /etc/login.defs
85 endef
86
87 define Package/shadow-common/install
88         $(INSTALL_DIR) $(1)/etc
89         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/login.defs $(1)/etc/
90 endef
91
92
93 define BuildPlugin
94   define Package/shadow-$(1)/install
95         [ -x "$(PKG_INSTALL_DIR)/usr/sbin/$(1)" ] && { \
96                 $(INSTALL_DIR) $$(1)/usr/sbin; \
97                 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/$(1) $$(1)/usr/sbin/; \
98         } || { \
99                 $(INSTALL_DIR) $$(1)/usr/bin; \
100                 $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/; \
101         }
102   endef
103
104   $$(eval $$(call BuildPackage,shadow-$(1)))
105 endef
106
107 $(foreach u,$(SHADOW_APPLETS),$(eval $(call BuildPlugin,$(u))))
108
109 $(eval $(call BuildPackage,shadow))
110 $(eval $(call BuildPackage,shadow-common))