1{
2 stdenv,
3 lib,
4 fetchurl,
5 fetchpatch,
6 python3,
7 autoreconfHook,
8 versionCheckHook,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "itstool";
13 version = "2.0.7";
14
15 src = fetchurl {
16 url = "http://files.itstool.org/${pname}/${pname}-${version}.tar.bz2";
17 hash = "sha256-a5p80poSu5VZj1dQ6HY87niDahogf4W3TYsydbJ+h8o=";
18 };
19
20 patches = [
21 # https://github.com/itstool/itstool/pull/51
22 (fetchpatch {
23 name = "fix-insufficiently-quoted-regular-expressions-pr51";
24 url = "https://github.com/itstool/itstool/commit/19f9580f27aa261ea383b395fdef7e153f3f9e6d.patch";
25 hash = "sha256-5J4mRXQu24o2rqVtaXN/ETgj6A8R0Ym+YkZhqhZTzIc=";
26 })
27 ];
28
29 strictDeps = true;
30
31 postPatch = ''
32 # Do not let autoconf find Python, but set it directly. This fixes cross-compilation.
33 substituteInPlace configure.ac \
34 --replace-fail 'AM_PATH_PYTHON([2.6])' "" \
35 --replace-fail 'AC_MSG_ERROR(Python module $py_module is needed to run this package)' ""
36 substituteInPlace itstool.in \
37 --replace-fail "@PYTHON@" "${python3.interpreter}"
38 '';
39
40 nativeBuildInputs = [
41 autoreconfHook
42 python3.pkgs.wrapPython
43 ];
44
45 pythonPath = [
46 python3.pkgs.libxml2
47 ];
48
49 postFixup = ''
50 wrapPythonPrograms
51 '';
52
53 nativeInstallCheckInputs = [ versionCheckHook ];
54 doInstallCheck = true;
55
56 meta = {
57 homepage = "https://itstool.org/";
58 description = "XML to PO and back again";
59 mainProgram = "itstool";
60 license = lib.licenses.gpl3Plus;
61 platforms = lib.platforms.all;
62 maintainers = [ ];
63 };
64}