2016-01-18 00:04:40 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, autoreconfHook, makeWrapper
|
2014-11-06 11:32:59 +01:00
|
|
|
, ncurses, cpio, gperf, perl, cdrkit, flex, bison, qemu, pcre, augeas, libxml2
|
|
|
|
, acl, libcap, libcap_ng, libconfig, systemd, fuse, yajl, libvirt, hivex
|
2017-02-22 07:01:09 +01:00
|
|
|
, gmp, readline, file, libintlperl, GetoptLong, SysVirt, numactl, xen, libapparmor
|
|
|
|
, getopt, perlPackages, ocamlPackages }:
|
2014-11-06 11:32:59 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "libguestfs-${version}";
|
2017-04-13 17:50:32 +02:00
|
|
|
version = "1.36.3";
|
2014-11-06 11:32:59 +01:00
|
|
|
|
|
|
|
appliance = fetchurl {
|
2017-03-31 04:19:02 +02:00
|
|
|
url = "http://libguestfs.org/download/binaries/appliance/appliance-1.36.1.tar.xz";
|
|
|
|
sha256 = "1klvr13gpg615hgjvviwpxlj839lbwwsrq7x100qg5zmmjfhl125";
|
2014-11-06 11:32:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
src = fetchurl {
|
2017-04-13 17:50:32 +02:00
|
|
|
url = "http://libguestfs.org/download/1.36-stable/libguestfs-${version}.tar.gz";
|
|
|
|
sha256 = "0dhb69b7svjgnrmbyvizdz5vsgsrr95ypz0qvp3kz83jyj6sa76m";
|
2014-11-06 11:32:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
2016-01-18 00:04:40 +01:00
|
|
|
makeWrapper pkgconfig autoreconfHook ncurses cpio gperf perl
|
2014-11-06 11:32:59 +01:00
|
|
|
cdrkit flex bison qemu pcre augeas libxml2 acl libcap libcap_ng libconfig
|
|
|
|
systemd fuse yajl libvirt gmp readline file hivex libintlperl GetoptLong
|
2017-02-22 07:01:09 +01:00
|
|
|
SysVirt numactl xen libapparmor getopt perlPackages.ModuleBuild
|
|
|
|
] ++ (with ocamlPackages; [ ocaml findlib ocamlbuild ocaml_libvirt ocaml_gettext ounit ]);
|
2014-11-06 11:32:59 +01:00
|
|
|
|
2017-02-22 07:01:09 +01:00
|
|
|
prePatch = ''
|
|
|
|
# build-time scripts
|
|
|
|
substituteInPlace run.in --replace '#!/bin/bash' '#!/bin/sh'
|
|
|
|
substituteInPlace ocaml-link.sh --replace '#!/bin/bash' '#!/bin/sh'
|
|
|
|
|
|
|
|
# $(OCAMLLIB) is read-only "${ocamlPackages.ocaml}/lib/ocaml"
|
|
|
|
substituteInPlace ocaml/Makefile.am --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
|
|
|
|
substituteInPlace ocaml/Makefile.in --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
|
|
|
|
substituteInPlace v2v/test-harness/Makefile.am --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
|
|
|
|
substituteInPlace v2v/test-harness/Makefile.in --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
|
|
|
|
'';
|
2014-11-06 11:32:59 +01:00
|
|
|
configureFlags = "--disable-appliance --disable-daemon";
|
|
|
|
patches = [ ./libguestfs-syms.patch ];
|
2015-10-05 13:23:01 +02:00
|
|
|
NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2/";
|
2017-02-22 07:01:09 +01:00
|
|
|
installFlags = "REALLY_INSTALL=yes";
|
2014-11-06 11:32:59 +01:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for bin in $out/bin/*; do
|
|
|
|
wrapProgram "$bin" \
|
2017-03-26 13:17:51 +02:00
|
|
|
--prefix "PATH" : "$out/bin:${hivex}/bin:${qemu}/bin" \
|
2014-11-06 11:32:59 +01:00
|
|
|
--prefix "PERL5LIB" : "$PERL5LIB:$out/lib/perl5/site_perl"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
mkdir -p "$out/lib/guestfs"
|
|
|
|
tar -Jxvf "$appliance" --strip 1 -C "$out/lib/guestfs"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Tools for accessing and modifying virtual machine disk images";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
homepage = http://libguestfs.org/;
|
|
|
|
maintainers = with maintainers; [offline];
|
2015-11-17 21:29:29 +01:00
|
|
|
platforms = platforms.linux;
|
2015-03-23 13:25:20 +01:00
|
|
|
hydraPlatforms = [];
|
2014-11-06 11:32:59 +01:00
|
|
|
};
|
|
|
|
}
|