summary refs log tree commit diff
path: root/pkgs/applications/misc/llpp/default.nix
blob: 372adef4375c4e284b49f7d3e2370f92712e87dc (plain) (blame)
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
{ stdenv, lib, makeWrapper, fetchgit, pkgconfig, ninja, ocaml, findlib, mupdf
, gtk3, openjpeg, jbig2dec, mujs, xsel, openssl, freetype, ncurses }:

assert lib.versionAtLeast (lib.getVersion ocaml) "4.02";

stdenv.mkDerivation rec {
  name = "llpp-${version}";
  version = "2018-03-02";

  src = fetchgit {
    url = "git://repo.or.cz/llpp.git";
    rev = "0ab1fbbf142b6df6d6bae782e3af2ec50f32dec9";
    sha256 = "1h0hrmxwm7ripgp051788p8ad0q38dc9nvjx87mdwlkwk9qc0dis";
    fetchSubmodules = false;
  };

  nativeBuildInputs = [ pkgconfig makeWrapper ninja ];
  buildInputs = [ ocaml findlib mupdf gtk3 jbig2dec openjpeg mujs openssl freetype ncurses ];

  dontStrip = true;

  configurePhase = ''
    sed -i -e 's+ocamlc --version+ocamlc -version+' build.sh
    sed -i -e 's+-I \$srcdir/mupdf/include -I \$srcdir/mupdf/thirdparty/freetype/include+-I ${freetype.dev}/include+' build.sh
    sed -i -e 's+-lmupdf +-lfreetype -lz -lharfbuzz -ljbig2dec -lopenjp2 -ljpeg -lmupdf +' build.sh
    sed -i -e 's+-L\$srcdir/mupdf/build/native ++' build.sh
  '';

  buildPhase = ''
    sh ./build.sh build
  '';

  installPhase = ''
    install -d $out/bin $out/lib
    install build/llpp $out/bin
    wrapProgram $out/bin/llpp \
        --prefix CAML_LD_LIBRARY_PATH ":" "$out/lib" \
        --prefix PATH ":" "${xsel}/bin"
  '';

  meta = with stdenv.lib; {
    homepage = http://repo.or.cz/w/llpp.git;
    description = "A MuPDF based PDF pager written in OCaml";
    platforms = platforms.linux;
    maintainers = with maintainers; [ pSub ];
    license = licenses.gpl3;
  };
}