1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 autoreconfHook,
7 makeWrapper,
8 perlPackages,
9 ocamlPackages,
10 libxml2,
11 libintl,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "hivex";
16 version = "1.3.24";
17
18 src = fetchurl {
19 url = "https://libguestfs.org/download/hivex/${pname}-${version}.tar.gz";
20 hash = "sha256-pS+kXOzJp4rbLShgXWgmHk8f1FFKd4pUcwE9LMyKGTw=";
21 };
22
23 patches = [ ./hivex-syms.patch ];
24
25 postPatch = ''
26 substituteInPlace ocaml/Makefile.am \
27 --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib'
28 '';
29
30 strictDeps = true;
31 nativeBuildInputs =
32 [
33 autoreconfHook
34 makeWrapper
35 perlPackages.perl
36 pkg-config
37 ]
38 ++ (with ocamlPackages; [
39 ocaml
40 findlib
41 ]);
42 buildInputs =
43 [
44 libxml2
45 ]
46 ++ (with perlPackages; [
47 perl
48 IOStringy
49 ])
50 ++ lib.optionals stdenv.hostPlatform.isDarwin [ libintl ];
51
52 enableParallelBuilding = true;
53
54 postInstall = ''
55 wrapProgram $out/bin/hivexregedit \
56 --set PERL5LIB "$out/${perlPackages.perl.libPrefix}" \
57 --prefix "PATH" : "$out/bin"
58
59 wrapProgram $out/bin/hivexml \
60 --prefix "PATH" : "$out/bin"
61 '';
62
63 meta = with lib; {
64 description = "Windows registry hive extraction library";
65 license = licenses.lgpl2Only;
66 homepage = "https://github.com/libguestfs/hivex";
67 maintainers = with maintainers; [ offline ];
68 platforms = platforms.unix;
69 };
70}