From: Yousong Zhou Date: Sat, 13 Jul 2019 11:09:09 +0000 (+0000) Subject: coreutils: add alternatives support X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=93e7b098271cbfb84f99d2312de82ab50b3e6190;p=feed%2Fpackages.git coreutils: add alternatives support Fixes openwrt/packages#9290 Signed-off-by: Yousong Zhou (cherry-picked from commit 92820448519d43101f646339cbcc557761188b0e) --- diff --git a/utils/coreutils/Makefile b/utils/coreutils/Makefile index 32db0821ee..5e98f05ec5 100644 --- a/utils/coreutils/Makefile +++ b/utils/coreutils/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=coreutils PKG_VERSION:=8.23 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/coreutils @@ -31,6 +31,30 @@ COREUTILS_APPLETS := \ timeout touch tr true truncate tsort tty uname unexpand uniq unlink \ uptime users vdir wc who whoami yes +DIR_BIN := \ + base64 cat chgrp chmod chown cp date dd echo false kill link ln ls \ + mkdir mknod mktemp mv nice printenv pwd rm rmdir sleep stat stty sync \ + touch true uname + +DIR_USR_BIN := \ + basename cksum comm cut dirname du env expand expr factor fold groups \ + head hostid id install logname md5sum mkfifo nl nohup nproc od paste \ + printf readlink realpath seq sha1sum sha256sum sha512sum shred shuf \ + sort split sum tac tail tee test timeout tr truncate tty unexpand uniq \ + unlink uptime users wc who whoami yes + +DIR_USR_SBIN := \ + chroot + +# BusyBox does not provide these yet +DIR_OTHERS := \ + chcon csplit dir dircolors fmt join pathchk pinky pr ptx runcon \ + sha224sum sha384sum stdbuf tsort vdir + +$(eval $(foreach a,$(DIR_BIN),ALTS_$(a):=300:/bin/$(a):/usr/bin/gnu-$(a)$(newline))) +$(eval $(foreach a,$(DIR_USR_BIN),ALTS_$(a):=300:/usr/bin/$(a):/usr/bin/gnu-$(a)$(newline))) +$(eval $(foreach a,$(DIR_USR_SBIN),ALTS_$(a):=300:/usr/sbin/$(a):/usr/bin/gnu-$(a)$(newline))) + DEPENDS_sort = +libpthread DEPENDS_timeout = +librt DEPENDS_expr = +libgmp @@ -68,6 +92,7 @@ define GenPlugin $(call Package/coreutils/Default) DEPENDS:=coreutils $(DEPENDS_$(2)) TITLE:=Utility $(2) from the GNU core utilities + ALTERNATIVES:=$(ALTS_$(2)) endef define Package/$(1)/description @@ -105,7 +130,7 @@ endef define BuildPlugin define Package/$(1)/install $(INSTALL_DIR) $$(1)/usr/bin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/$(if $(ALTS_$(2)),gnu-$(2),$(2)) $(foreach f,$(FILES_$(2)), $(INSTALL_DIR) $$(1)/$(dir $(f)) $(INSTALL_BIN) $(PKG_INSTALL_DIR)/$(f) $$(1)/$(f)