diffutils: provide diff, cmp as alternatives

Resolves openwrt/packages#6361

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
(Backported from commit b02e4eafd1)
This commit is contained in:
Yousong Zhou 2019-06-12 05:50:36 +00:00
parent 04c9e6708f
commit 12c96eaad6
1 changed files with 8 additions and 18 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=diffutils
PKG_VERSION:=3.6
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/diffutils
@ -27,6 +27,10 @@ define Package/diffutils
DEPENDS:=+USE_GLIBC:librt
TITLE:=diffutils
URL:=http://www.gnu.org/software/diffutils/
ALTERNATIVES:=\
200:/usr/bin/cmp:/usr/bin/gnu-cmp \
200:/usr/bin/diff:/usr/bin/gnu-diff \
endef
define Package/diffutils/description
@ -40,23 +44,9 @@ TARGET_CFLAGS += --std=gnu99
define Package/diffutils/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sdiff,diff3,diff,cmp} $(1)/usr/bin/
endef
define Package/diffutils/preinst
#!/bin/sh
for x in sdiff diff3 diff cmp; do
[ -L "$${IPKG_INSTROOT}/usr/bin/$$x" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/$$x"
done
exit 0
endef
define Package/diffutils/postrm
#!/bin/sh
for x in sdiff diff3 diff cmp; do
/bin/busybox $$x -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/$$x
done
exit 0
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sdiff,diff3} $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/diff $(1)/usr/bin/gnu-diff
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cmp $(1)/usr/bin/gnu-cmp
endef
$(eval $(call BuildPackage,diffutils))