diffutils: provide diff, cmp as alternatives
authorYousong Zhou <redacted>
Wed, 12 Jun 2019 05:50:36 +0000 (05:50 +0000)
committerYousong Zhou <redacted>
Sat, 15 Jun 2019 05:28:43 +0000 (13:28 +0800)
Resolves openwrt/packages#6361

Signed-off-by: Yousong Zhou <redacted>
devel/diffutils/Makefile

index 3f93ef67eb14aaa303bbb69acc071ba15d6a6790..65a41f8ebb775c0ffe61b20ab347714e3dab42de 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=diffutils
 PKG_VERSION:=3.7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GNU/diffutils
@@ -30,6 +30,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
@@ -43,23 +47,9 @@ CONFIGURE_VARS += \
 
 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))
git clone https://git.99rst.org/PROJECT