summary refs log tree commit diff
path: root/pkgs/development/libraries/pdf2xml/default.nix
blob: 0f9a3dc2b2dad88d1bc0c91b414bf7a731365cdc (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
{stdenv, fetchurl, libxpdf, libxml2}:

stdenv.mkDerivation {
  name = "pdf2xml";
  
  src = fetchurl {
      url = http://nixos.org/tarballs/pdf2xml.tar.gz;
      sha256 = "04rl7ppxqgnvxvvws669cxp478lnrdmiqj0g3m4p69bawfjc4z3w";
  };
  sourceRoot = "pdf2xml/pdf2xml";
  
  buildInputs = [libxml2 libxpdf];

  patches = [./pdf2xml.patch];

  preBuild = ''
    cp Makefile.linux Makefile
  
    sed -i 's|/usr/include/libxml2|${libxml2}/include/libxml2|' Makefile
    sed -i 's|-lxml2|-lxml2 -L${libxml2}/lib|' Makefile
    sed -i 's|XPDF = xpdf_3.01|XPDF = ${libxpdf}/lib|' Makefile

    mkdir exe
  '';
  
  installPhase = ''
    mkdir -p $out/bin
    cp exe/* $out/bin
  '';
}