whois: add package
authorPaul Spooren <mail@aparcar.org>
Wed, 18 Nov 2020 20:22:58 +0000 (10:22 -1000)
committerPaul Spooren <mail@aparcar.org>
Fri, 20 Nov 2020 18:24:38 +0000 (08:24 -1000)
Better a separate package than enabling it via busybox.
Special thanks to @neheb for the Makefile patches.

Signed-off-by: Paul Spooren <mail@aparcar.org>
utils/whois/Makefile [new file with mode: 0644]
utils/whois/patches/010-no-crypt.patch [new file with mode: 0644]
utils/whois/patches/020-no-idn2.patch [new file with mode: 0644]
utils/whois/patches/030-no-mkpasswd.patch [new file with mode: 0644]
utils/whois/test.sh [new file with mode: 0644]

diff --git a/utils/whois/Makefile b/utils/whois/Makefile
new file mode 100644 (file)
index 0000000..60d5e38
--- /dev/null
@@ -0,0 +1,48 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=whois
+PKG_VERSION:=5.5.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/w/whois
+PKG_HASH:=3efa700dbf38d127c31b21af3176cd6e5a69f96a056be60ac1dcd13df7717393
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_DEPENDS:=perl/host
+
+PKG_MAINTAINER:=Paul Spooren <mail@aparcar.org>
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/whois
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Intelligent WHOIS client
+  URL:=https://github.com/rfc1036/whois
+endef
+
+define Package/whois/description
+This client is intelligent and can automatically select the appropriate whois
+server for most queries.
+
+The internal database is often more accurate than IANA's published one, but
+please send me any information you have regarding domains and network resources
+which are not correctly handled by the program.
+endef
+
+EXTRA_CFLAGS+=-DHAVE_GETOPT_LONG
+MAKE_FLAGS += PERL=$(STAGING_DIR_HOSTPKG)/usr/bin/perl
+
+define Package/whois/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/whois $(1)/usr/bin/whois
+endef
+
+$(eval $(call BuildPackage,whois))
diff --git a/utils/whois/patches/010-no-crypt.patch b/utils/whois/patches/010-no-crypt.patch
new file mode 100644 (file)
index 0000000..ba6a40f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -56,8 +56,6 @@ DEFS += -DHAVE_ICONV
+ endif
+
+ ifeq ($(shell $(PKG_CONFIG) --exists 'libxcrypt >= 4.1' || echo NO),)
+-DEFS += -DHAVE_CRYPT_H -DHAVE_LINUX_CRYPT_GENSALT $(shell $(PKG_CONFIG) --cflags libcrypt)
+-mkpasswd_LDADD += $(shell $(PKG_CONFIG) --libs libcrypt)
+ else ifdef HAVE_XCRYPT
+ DEFS += -DHAVE_XCRYPT_H -DHAVE_LINUX_CRYPT_GENSALT
+ mkpasswd_LDADD += -lxcrypt
diff --git a/utils/whois/patches/020-no-idn2.patch b/utils/whois/patches/020-no-idn2.patch
new file mode 100644 (file)
index 0000000..e65ba6c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -43,8 +43,6 @@ $(error Please fix your build system to stop defining HAVE_LIBIDN!)
+ endif
+
+ ifeq ($(shell $(PKG_CONFIG) --exists 'libidn2 >= 2.0.3' || echo NO),)
+-whois_LDADD += $(shell $(PKG_CONFIG) --libs libidn2)
+-DEFS += -DHAVE_LIBIDN2 $(shell $(PKG_CONFIG) --cflags libidn2)
+ else ifeq ($(shell $(PKG_CONFIG) --exists 'libidn' || echo NO),)
+ whois_LDADD += $(shell $(PKG_CONFIG) --libs libidn)
+ DEFS += -DHAVE_LIBIDN $(shell $(PKG_CONFIG) --cflags libidn)
diff --git a/utils/whois/patches/030-no-mkpasswd.patch b/utils/whois/patches/030-no-mkpasswd.patch
new file mode 100644 (file)
index 0000000..bdaa41a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -72,7 +72,7 @@ endif
+ CPPFLAGS += $(DEFS) $(INCLUDES)
+ ##############################################################################
+-all: Makefile.depend whois mkpasswd pos
++all: Makefile.depend whois pos
+ ##############################################################################
+ %.o: %.c
diff --git a/utils/whois/test.sh b/utils/whois/test.sh
new file mode 100644 (file)
index 0000000..8d7455c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+whois --version | grep "$2"