2016-01-17 23:04:40 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig, autoreconfHook, makeWrapper
|
2014-11-06 10:32:59 +00: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 06:01:09 +00:00
|
|
|
, gmp, readline, file, libintlperl, GetoptLong, SysVirt, numactl, xen, libapparmor
|
2018-01-09 13:36:37 +00:00
|
|
|
, getopt, perlPackages, ocamlPackages
|
|
|
|
, javaSupport ? false, jdk ? null }:
|
|
|
|
|
|
|
|
assert javaSupport -> jdk != null;
|
2014-11-06 10:32:59 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "libguestfs-${version}";
|
2018-02-21 19:31:25 +00:00
|
|
|
version = "1.38.0";
|
2014-11-06 10:32:59 +00:00
|
|
|
|
|
|
|
appliance = fetchurl {
|
2018-02-21 19:31:25 +00:00
|
|
|
url = "http://libguestfs.org/download/binaries/appliance/appliance-1.38.0.tar.xz";
|
|
|
|
sha256 = "05481qxgidakga871yb5rgpyci2jaxmplmkh6y79anfh5m19nzhy";
|
2014-11-06 10:32:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
src = fetchurl {
|
2018-02-21 19:31:25 +00:00
|
|
|
url = "http://libguestfs.org/download/1.38-stable/libguestfs-${version}.tar.gz";
|
|
|
|
sha256 = "0cgapiad3x5ggwm097mq62hng3bv91p5gmrikrb6adfaasr1l6m3";
|
2014-11-06 10:32:59 +00:00
|
|
|
};
|
|
|
|
|
2017-09-14 19:24:37 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2014-11-06 10:32:59 +00:00
|
|
|
buildInputs = [
|
2017-09-14 19:24:37 +00:00
|
|
|
makeWrapper autoreconfHook ncurses cpio gperf perl
|
2014-11-06 10:32:59 +00: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 06:01:09 +00:00
|
|
|
SysVirt numactl xen libapparmor getopt perlPackages.ModuleBuild
|
2018-01-09 13:36:37 +00:00
|
|
|
] ++ (with ocamlPackages; [ ocaml findlib ocamlbuild ocaml_libvirt ocaml_gettext ounit ])
|
|
|
|
++ stdenv.lib.optional javaSupport jdk;
|
2014-11-06 10:32:59 +00:00
|
|
|
|
2017-02-22 06:01:09 +00: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'
|
2017-05-19 11:29:29 +00:00
|
|
|
|
|
|
|
# some scripts hardcore /usr/bin/env which is not available in the build env
|
|
|
|
patchShebangs .
|
2017-02-22 06:01:09 +00:00
|
|
|
'';
|
2018-02-22 00:26:49 +00:00
|
|
|
configureFlags = [ "--disable-appliance" "--disable-daemon" "--with-distro=NixOS" ]
|
2018-01-09 13:36:37 +00:00
|
|
|
++ stdenv.lib.optionals (!javaSupport) [ "--disable-java" "--without-java" ];
|
2014-11-06 10:32:59 +00:00
|
|
|
patches = [ ./libguestfs-syms.patch ];
|
2015-10-05 11:23:01 +00:00
|
|
|
NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2/";
|
2017-02-22 06:01:09 +00:00
|
|
|
installFlags = "REALLY_INSTALL=yes";
|
2017-05-19 11:29:29 +00:00
|
|
|
enableParallelBuilding = true;
|
2014-11-06 10:32:59 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for bin in $out/bin/*; do
|
|
|
|
wrapProgram "$bin" \
|
2017-03-26 11:17:51 +00:00
|
|
|
--prefix "PATH" : "$out/bin:${hivex}/bin:${qemu}/bin" \
|
2014-11-06 10:32:59 +00: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 20:29:29 +00:00
|
|
|
platforms = platforms.linux;
|
2015-03-23 12:25:20 +00:00
|
|
|
hydraPlatforms = [];
|
2014-11-06 10:32:59 +00:00
|
|
|
};
|
|
|
|
}
|