1{
2 lib,
3 autoreconfHook,
4 docbook_xml_dtd_43,
5 docbook_xsl,
6 fetchFromGitHub,
7 gettext,
8 gmp,
9 gtk-doc,
10 libxslt,
11 mpfr,
12 pcre2,
13 pkg-config,
14 python3Packages,
15 stdenv,
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "libbytesize";
20 version = "2.11";
21
22 src = fetchFromGitHub {
23 owner = "storaged-project";
24 repo = "libbytesize";
25 rev = finalAttrs.version;
26 hash = "sha256-scOnucn7xp6KKEtkpwfyrdzcntJF2l0h0fsQotcceLc=";
27 };
28
29 outputs = [
30 "out"
31 "dev"
32 "devdoc"
33 "man"
34 ];
35
36 nativeBuildInputs = [
37 autoreconfHook
38 docbook_xml_dtd_43
39 docbook_xsl
40 gettext
41 gtk-doc
42 libxslt
43 pkg-config
44 python3Packages.python
45 ];
46
47 nativeInstallCheckInputs = [
48 python3Packages.pythonImportsCheckHook
49 ];
50
51 buildInputs = [
52 gmp
53 mpfr
54 pcre2
55 ];
56
57 doInstallCheck = true;
58 strictDeps = true;
59
60 postInstall = ''
61 substituteInPlace $out/${python3Packages.python.sitePackages}/bytesize/bytesize.py \
62 --replace-fail 'CDLL("libbytesize.so.1")' "CDLL('$out/lib/libbytesize.so.1')"
63
64 # Force compilation of .pyc files to make them deterministic
65 ${python3Packages.python.pythonOnBuildForHost.interpreter} -m compileall $out/${python3Packages.python.sitePackages}/bytesize
66 '';
67
68 pythonImportsCheck = [ "bytesize" ];
69
70 meta = {
71 homepage = "https://github.com/storaged-project/libbytesize";
72 description = "Tiny library providing a C 'class' for working with arbitrary big sizes in bytes";
73 license = lib.licenses.lgpl2Plus;
74 mainProgram = "bscalc";
75 maintainers = with lib.maintainers; [ ];
76 platforms = lib.platforms.linux;
77 };
78})