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