btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / wh / whois / package.nix
blobfc122ebd2f76a2422bce8420a0ff8246283234a6
1 { lib, stdenv, fetchFromGitHub, fetchpatch, perl, gettext, pkg-config, libidn2, libiconv }:
3 stdenv.mkDerivation rec {
4   version = "5.5.23";
5   pname = "whois";
7   src = fetchFromGitHub {
8     owner = "rfc1036";
9     repo = "whois";
10     rev = "v${version}";
11     hash = "sha256-c/Mx2HXAj6mHH8rElG7+F94sSrVSL1N9HZBvaMWUjlw=";
12   };
14   patches = [
15     (fetchpatch {
16       url = "https://github.com/macports/macports-ports/raw/93de4e9fc1e5e8427bf98f48209e783a5e8fab57/net/whois/files/implicit.patch";
17       extraPrefix = "";
18       hash = "sha256-ogVylQz//tpXxPNIWIHkhghvToU1z1D1FfnUBdZLyRY=";
19     })
20   ];
22   env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
23     # whois fails to link libiconv on Darwin.
24     NIX_LDFLAGS = "-liconv";
25   };
27   nativeBuildInputs = [ perl gettext pkg-config ];
28   buildInputs = [ libidn2 libiconv ];
30   preConfigure = ''
31     for i in Makefile po/Makefile; do
32       substituteInPlace $i --replace "prefix = /usr" "prefix = $out"
33     done
34   '';
36   makeFlags = [ "HAVE_ICONV=1" ];
37   buildFlags = [ "whois" ];
39   installTargets = [ "install-whois" ];
41   meta = with lib; {
42     description = "Intelligent WHOIS client from Debian";
43     longDescription = ''
44       This package provides a commandline client for the WHOIS (RFC 3912)
45       protocol, which queries online servers for information such as contact
46       details for domains and IP address assignments. It can intelligently
47       select the appropriate WHOIS server for most queries.
48     '';
50     homepage = "https://packages.qa.debian.org/w/whois.html";
51     license = licenses.gpl2Plus;
52     maintainers = with maintainers; [ fpletz ];
53     platforms = platforms.unix;
54     mainProgram = "whois";
55   };