summaryrefslogtreecommitdiff
path: root/pkgs/by-name/li/libbytesize/package.nix
blob: 48619381acda2fb21a56030976c86004c6d90578 (about) (plain)
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
{
  lib,
  autoreconfHook,
  docbook_xml_dtd_43,
  docbook_xsl,
  fetchFromGitHub,
  gettext,
  gmp,
  gtk-doc,
  libxslt,
  mpfr,
  pcre2,
  pkg-config,
  python3Packages,
  stdenv,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libbytesize";
  version = "2.11";

  src = fetchFromGitHub {
    owner = "storaged-project";
    repo = "libbytesize";
    rev = finalAttrs.version;
    hash = "sha256-scOnucn7xp6KKEtkpwfyrdzcntJF2l0h0fsQotcceLc=";
  };

  outputs = [
    "out"
    "dev"
    "devdoc"
    "man"
  ];

  nativeBuildInputs = [
    autoreconfHook
    docbook_xml_dtd_43
    docbook_xsl
    gettext
    gtk-doc
    libxslt
    pkg-config
    python3Packages.python
  ];

  nativeInstallCheckInputs = [
    python3Packages.pythonImportsCheckHook
  ];

  buildInputs = [
    gmp
    mpfr
    pcre2
  ];

  doInstallCheck = true;
  strictDeps = true;

  postInstall = ''
    substituteInPlace $out/${python3Packages.python.sitePackages}/bytesize/bytesize.py \
      --replace-fail 'CDLL("libbytesize.so.1")' "CDLL('$out/lib/libbytesize.so.1')"

    # Force compilation of .pyc files to make them deterministic
    ${python3Packages.python.interpreter} -m compileall $out/${python3Packages.python.sitePackages}/bytesize
  '';

  pythonImportsCheck = [ "bytesize" ];

  meta = {
    homepage = "https://github.com/storaged-project/libbytesize";
    description = "Tiny library providing a C 'class' for working with arbitrary big sizes in bytes";
    license = lib.licenses.lgpl2Plus;
    mainProgram = "bscalc";
    maintainers = with lib.maintainers; [ ];
    platforms = lib.platforms.linux;
  };
})