1{ fetchFromGitHub
2, lib
3, stdenv
4, autoreconfHook
5, pkg-config
6, gettext
7, python3
8, texinfo
9, help2man
10, libyaml
11, perl
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "liblouis";
16 version = "3.29.0";
17
18 outputs = [ "out" "dev" "info" "doc" ]
19 # configure: WARNING: cannot generate manual pages while cross compiling
20 ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "man" ];
21
22 src = fetchFromGitHub {
23 owner = "liblouis";
24 repo = "liblouis";
25 rev = "v${finalAttrs.version}";
26 hash = "sha256-TaMPl53FlUSZIsjhoTYcv3Y+j86fDHuBTjiyr/uP1tM=";
27 };
28
29 strictDeps = true;
30 nativeBuildInputs = [
31 autoreconfHook
32 pkg-config
33 gettext
34 python3
35 # Docs, man, info
36 texinfo
37 help2man
38 ];
39
40 buildInputs = [
41 # lou_checkYaml
42 libyaml
43 ];
44
45 nativeCheckInputs = [
46 perl
47 ];
48
49 configureFlags = [
50 # Required by Python bindings
51 "--enable-ucs4"
52 ];
53
54 postPatch = ''
55 patchShebangs tests
56 substituteInPlace python/louis/__init__.py.in --replace "###LIBLOUIS_SONAME###" "$out/lib/liblouis.so"
57 '';
58
59 postInstall = ''
60 pushd python
61 python setup.py install --prefix="$out" --optimize=1
62 popd
63 '';
64
65 doCheck = true;
66
67 meta = with lib; {
68 description = "Open-source braille translator and back-translator";
69 homepage = "https://liblouis.io/";
70 license = with licenses; [
71 lgpl21Plus # library
72 gpl3Plus # tools
73 ];
74 maintainers = with maintainers; [ jtojnar ];
75 platforms = platforms.unix;
76 };
77})