1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 libxml2,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "xml2";
11 version = "0.5";
12
13 src = fetchurl {
14 url = "https://web.archive.org/web/20160427221603/http://download.ofb.net/gale/xml2-${version}.tar.gz";
15 sha256 = "01cps980m99y99cnmvydihga9zh3pvdsqag2fi1n6k2x7rfkl873";
16 };
17
18 nativeBuildInputs = [ pkg-config ];
19 buildInputs = [ libxml2 ];
20
21 doInstallCheck = true;
22 installCheckPhase = ''
23 runHook preInstallCheck
24
25 echo -n 'checking csv2 and 2csv...'
26 $out/bin/csv2 -f <<< $'a,b\n1,2' \
27 | $out/bin/2csv record a b \
28 | grep -qF '1,2'
29 echo ' ok'
30
31 echo -n 'checking xml2 and 2xml...'
32 $out/bin/xml2 <<< $'<a>abc</a>' \
33 | $out/bin/2xml \
34 | grep -qF '<a>abc</a>'
35 echo ' ok'
36
37 runHook postInstallCheck
38 '';
39
40 meta = with lib; {
41 homepage = "https://web.archive.org/web/20160515005047/http://dan.egnor.name:80/xml2";
42 description = "Tools for command line processing of XML, HTML, and CSV";
43 license = licenses.gpl2Plus;
44 platforms = platforms.all;
45 maintainers = [ maintainers.rycee ];
46 };
47}