about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/xidel/default.nix
blob: 479cc0ff1115b4f8a1d1a4b5984ffd403e65dc0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{ lib, stdenv, fetchFromGitHub, fpc, openssl }:

let
  flreSrc = fetchFromGitHub {
    owner = "benibela";
    repo = "flre";
    rev = "3e926d45d4352f1b7c7cd411ccd625df117dad5c";
    hash = "sha256-fs7CIjd3fwD/SORYh5pmJxIdrr8F9e36TNmnKUbUxP0=";
  };
  synapseSrc = fetchFromGitHub {
    owner = "benibela";
    repo = "ararat-synapse";
    rev = "7a77db926de66809080bada68b54172da7f84c0e";
    hash = "sha256-bVLQ0ohGJYtuP88Krxy9a7RnHHrW0OWw8H/uxa3PerU=";
  };
  rcmdlineSrc = fetchFromGitHub {
    owner = "benibela";
    repo = "rcmdline";
    rev = "ea02b770c4568717dd7b3b72da191a8bbcb4c751";
    hash = "sha256-6YtvAf0joRvtCKbUAaLwuwABw1GEIzammFLhboq9aG0=";
  };
  internettoolsSrc = fetchFromGitHub {
    owner = "benibela";
    repo = "internettools";
    rev = "dd972caaa4415468fa679ea7262976ead3fd3e38";
    hash = "sha256-09sADxPiE6ky1EX7dTXRBYVT3IarUcLYf5knzi7+CHU=";
  };
  pasdblstrutilsSrc = fetchFromGitHub {
    owner = "BeRo1985";
    repo = "pasdblstrutils";
    rev = "1696f0a2b822fef26c8992f96620f1be129cfa99";
    hash = "sha256-x0AjOTa1g7gJOR2iBO76yBt1kzcRNujHRUsq5QOlfP0=";
  };
in stdenv.mkDerivation rec {
  pname = "xidel";
  version = "unstable-2022-11-01";

  src = fetchFromGitHub {
    owner = "benibela";
    repo = pname;
    rev = "6d5655c1d73b88ddeb32d2450a35ee36e4762bb8";
    hash = "sha256-9x2d5AKRBjocRawRHdeI4heIM5nb00/F/EIj+/to7ac=";
  };

  nativeBuildInputs = [ fpc ];
  buildInputs = [ openssl ];

  NIX_LDFLAGS = [ "-lcrypto" ];

  patchPhase = ''
    patchShebangs \
      build.sh \
      tests/test.sh \
      tests/tests-file-module.sh \
      tests/tests.sh \
      tests/downloadTest.sh \
      tests/downloadTests.sh \
      tests/zorbajsoniq.sh \
      tests/zorbajsoniq/download.sh
  '';

  preBuildPhase = ''
    mkdir -p import/{flre,synapse,pasdblstrutils} rcmdline internettools
    cp -R ${flreSrc}/. import/flre
    cp -R ${synapseSrc}/. import/synapse
    cp -R ${pasdblstrutilsSrc}/. import/pasdblstrutils
    cp -R ${rcmdlineSrc}/. rcmdline
    cp -R ${internettoolsSrc}/. internettools
  '';

  buildPhase = ''
    runHook preBuildPhase
    ./build.sh
    runHook postBuildPhase
  '';

  installPhase = ''
    mkdir -p "$out/bin" "$out/share/man/man1"
    cp meta/xidel.1 "$out/share/man/man1/"
    cp xidel "$out/bin/"
  '';

  # disabled, because tests require network
  checkPhase = ''
    ./tests/tests.sh
  '';

  meta = with lib; {
    description = "Command line tool to download and extract data from HTML/XML pages as well as JSON APIs";
    homepage = "https://www.videlibri.de/xidel.html";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = [ maintainers.bjornfor ];
  };
}