You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
4.6 KiB

  1. #
  2. # Copyright (C) 2008-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=coreutils
  9. PKG_VERSION:=8.32
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@GNU/coreutils
  13. PKG_HASH:=4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa
  14. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  15. PKG_LICENSE:=GPL-3.0-or-later
  16. PKG_LICENSE_FILES:=COPYING
  17. PKG_CPE_ID:=cpe:/a:gnu:coreutils
  18. PKG_BUILD_PARALLEL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. COREUTILS_APPLETS := \
  21. base32 base64 basename basenc b2sum cat chcon chgrp chmod chown chroot \
  22. cksum comm cp csplit cut date dd df dir dircolors dirname du echo env \
  23. expand expr factor false fmt fold groups head hostid id install join \
  24. kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl \
  25. nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd \
  26. readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum \
  27. sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty sum \
  28. sync tac tail tee test timeout touch tr true truncate tsort tty uname \
  29. unexpand uniq unlink uptime users vdir wc who whoami yes
  30. DIR_BIN := \
  31. base64 cat chgrp chmod chown cp date dd df echo false kill link ln ls \
  32. mkdir mknod mktemp mv nice printenv pwd rm rmdir sleep stat stty sync \
  33. touch true uname
  34. DIR_USR_BIN := \
  35. basename cksum comm cut dirname du env expand expr factor fold groups \
  36. head hostid id install logname md5sum mkfifo nl nohup nproc od paste \
  37. printf readlink realpath seq sha1sum sha256sum sha512sum shred shuf \
  38. sort split sum tac tail tee test timeout tr truncate tty unexpand uniq \
  39. unlink uptime users wc who whoami yes
  40. DIR_USR_SBIN := \
  41. chroot
  42. # BusyBox does not provide these yet
  43. DIR_OTHERS := \
  44. base32 b2sum basenc chcon csplit dir dircolors fmt join numfmt pathchk \
  45. pinky pr ptx runcon sha224sum sha384sum stdbuf tsort vdir
  46. $(eval $(foreach a,$(DIR_BIN),ALTS_$(a):=300:/bin/$(a):/usr/bin/gnu-$(a)$(newline)))
  47. $(eval $(foreach a,$(DIR_USR_BIN),ALTS_$(a):=300:/usr/bin/$(a):/usr/bin/gnu-$(a)$(newline)))
  48. $(eval $(foreach a,$(DIR_USR_SBIN),ALTS_$(a):=300:/usr/sbin/$(a):/usr/bin/gnu-$(a)$(newline)))
  49. DEPENDS_sort = +libpthread
  50. DEPENDS_timeout = +librt
  51. DEPENDS_expr = +libgmp
  52. DEPENDS_factor = +libgmp
  53. DEPENDS_cp = +libacl
  54. DEPENDS_dir = +libacl +libcap
  55. DEPENDS_install = +libacl
  56. DEPENDS_ls = +libacl +libcap
  57. DEPENDS_mv = +libacl
  58. DEPENDS_vdir = +libacl +libcap
  59. FILES_stdbuf := usr/lib/coreutils/libstdbuf.so
  60. define Package/coreutils/Default
  61. SECTION:=utils
  62. CATEGORY:=Utilities
  63. TITLE:=The GNU core utilities
  64. URL:=http://www.gnu.org/software/coreutils/
  65. endef
  66. define Package/coreutils
  67. $(call Package/coreutils/Default)
  68. TITLE:=The GNU core utilities
  69. MENU:=1
  70. endef
  71. define Package/coreutils/description
  72. Full versions of standard GNU utilities. If an equivalent Busybox applet is
  73. available, you should consider compiling that instead as Busybox applets are
  74. usually smaller, at the expense of reduced functionality.
  75. endef
  76. define GenPlugin
  77. define Package/$(1)
  78. $(call Package/coreutils/Default)
  79. DEPENDS:=coreutils $(DEPENDS_$(2))
  80. TITLE:=Utility $(2) from the GNU core utilities
  81. ALTERNATIVES:=$(ALTS_$(2))
  82. endef
  83. define Package/$(1)/description
  84. Full version of standard GNU $(2) utility.
  85. endef
  86. endef
  87. $(foreach a,$(COREUTILS_APPLETS),$(eval $(call GenPlugin,coreutils-$(a),$(a))))
  88. CONFIGURE_VARS += \
  89. gl_cv_func_mbrtowc_incomplete_state=yes \
  90. gl_cv_func_mbrtowc_retval=yes \
  91. gl_cv_func_wcrtomb_retval=yes
  92. ifneq ($(CONFIG_USE_UCLIBC),)
  93. CONFIGURE_VARS += \
  94. ac_cv_type_pthread_spinlock_t=$(if $(filter 0.9.30% 0.9.2% 0.9.31%,$(call qstrip,$(CONFIG_UCLIBC_VERSION))),no,yes)
  95. endif
  96. CONFIGURE_ARGS += \
  97. --disable-xattr \
  98. --enable-install-program=su \
  99. --enable-threads=posix \
  100. --enable-acl \
  101. --disable-assert \
  102. --disable-rpath \
  103. --disable-libsmack \
  104. --enable-libcap \
  105. --without-linux-crypto \
  106. --without-openssl \
  107. --$(if $(CONFIG_USE_MUSL),with,without)-included-regex \
  108. --without-selinux \
  109. --with-gmp
  110. define Build/Compile
  111. $(MAKE) -C $(PKG_BUILD_DIR) \
  112. DESTDIR="$(PKG_INSTALL_DIR)" \
  113. SHELL="/bin/bash" \
  114. all install
  115. endef
  116. define Package/coreutils/install
  117. true
  118. endef
  119. define BuildPlugin
  120. define Package/$(1)/install
  121. $(INSTALL_DIR) $$(1)/usr/bin
  122. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/$(if $(ALTS_$(2)),gnu-$(2),$(2))
  123. $(foreach f,$(FILES_$(2)),
  124. $(INSTALL_DIR) $$(1)/$(dir $(f))
  125. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/$(f) $$(1)/$(f)
  126. )
  127. endef
  128. $$(eval $$(call BuildPackage,$(1)))
  129. endef
  130. $(eval $(call BuildPackage,coreutils))
  131. $(foreach a,$(COREUTILS_APPLETS),$(eval $(call BuildPlugin,coreutils-$(a),$(a))))