1{
2 lib,
3 stdenv,
4 fetchurl,
5 lynx,
6}:
7
8stdenv.mkDerivation (finalAttrs: {
9 pname = "jwhois";
10 version = "4.0";
11
12 src = fetchurl {
13 url = "mirror://gnu/jwhois/jwhois-${finalAttrs.version}.tar.gz";
14 hash = "sha256-+pu4Z4K5FcbXMLtyP4dtybNFphfbN1qvNBbsIlU81k4=";
15 };
16
17 patches = [
18 ./connect.patch
19 ./service-name.patch
20 ];
21
22 postPatch = ''
23 # avoids error on darwin where `-Werror=implicit-function-declaration` is set by default
24 sed 1i'void timeout_init();' -i src/jwhois.c
25
26 substituteInPlace example/jwhois.conf \
27 --replace-fail "/usr/bin/lynx" ${lib.getExe lynx}
28 '';
29
30 makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ];
31
32 postInstall = ''
33 ln -s $out/bin/jwhois $out/bin/whois
34 '';
35
36 env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv";
37
38 meta = {
39 description = "Client for the WHOIS protocol allowing you to query the owner of a domain name";
40 homepage = "https://www.gnu.org/software/jwhois/";
41 license = lib.licenses.gpl3Only;
42 platforms = lib.platforms.unix;
43 };
44})