[utils] coreutils: Stopped coreutils from building as long as no plugin is selected.
[packages.git] / utils / coreutils / Makefile
1 #
2 # Copyright (C) 2008-2010 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:=coreutils
11 PKG_VERSION:=8.8
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@GNU/coreutils
16 PKG_MD5SUM:=bad596d9654e299eedea0eaf93f178fa
17 PKG_BUILD_DEPENDS:=libpthread
18
19 include $(INCLUDE_DIR)/package.mk
20
21 COREUTILS_APPLETS:=\
22         base64 basename cat chcon chgrp chmod chown chroot cksum comm cp \
23         csplit cut date dd dir dircolors dirname du echo env expand expr \
24         factor false fmt fold groups head hostid id install join kill link \
25         ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc \
26         od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir \
27         runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf \
28         sleep sort split stat stdbuf stty su sum sync tac tail tee test timeout \
29         touch tr true truncate tsort tty uname unexpand uniq unlink uptime users \
30         vdir wc who whoami yes
31
32 define Package/coreutils/Default
33   SECTION:=utils
34   CATEGORY:=Utilities
35   TITLE:=The GNU core utilities
36   URL:=http://www.gnu.org/software/coreutils/
37 endef
38
39 define Package/coreutils
40   $(call Package/coreutils/Default)
41   TITLE:=The GNU core utilities
42   MENU:=1
43 endef
44
45 define Package/coreutils/description
46         Full versions of standard GNU utilities.  Normally, you would not
47         use this package, since the functionality in BusyBox is more than
48         sufficient and much smaller.
49 endef
50
51 define GenPlugin
52   define Package/$(1)
53      $(call Package/coreutils/Default)
54      DEPENDS:=coreutils
55      TITLE:=Utility $(2) from the GNU core utilities
56   endef
57
58   define Package/$(1)/description
59         Full version of standard GNU $(2) utility.  Normally, you would not
60         use this package, since the functionality in BusyBox is more than
61         sufficient.
62   endef
63 endef
64
65 $(foreach a,$(COREUTILS_APPLETS),$(eval $(call GenPlugin,coreutils-$(a),$(a))))
66
67 CONFIGURE_VARS += \
68         gl_cv_func_mbrtowc_incomplete_state=yes \
69         gl_cv_func_mbrtowc_retval=yes \
70         gl_cv_func_wcrtomb_retval=yes
71
72 ifneq ($(CONFIG_USE_UCLIBC),)
73   CONFIGURE_VARS += \
74         ac_cv_type_pthread_spinlock_t=$(if $(filter 0.9.30% 0.9.2% 0.9.31%,$(call qstrip,$(CONFIG_UCLIBC_VERSION))),no,yes)
75 endif
76
77 CONFIGURE_ARGS += \
78         --enable-install-program=su
79
80 define Build/Compile
81         $(MAKE) -C $(PKG_BUILD_DIR) \
82                 DESTDIR="$(PKG_INSTALL_DIR)" \
83                 SHELL="/bin/bash" \
84                 all install install-root
85 endef
86
87 define BuildPlugin
88   define Package/$(1)/install
89         $(INSTALL_DIR) $$(1)/usr/bin
90         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
91   endef
92
93   $$(eval $$(call BuildPackage,$(1)))
94 endef
95
96 $(eval $(call BuildPackage,coreutils))
97
98 $(foreach a,$(COREUTILS_APPLETS),$(eval $(call BuildPlugin,coreutils-$(a),$(a))))