at 18.03-beta 75 lines 3.1 kB view raw
1{ stdenv, fetchurl, pkgconfig, autoreconfHook, makeWrapper 2, ncurses, cpio, gperf, perl, cdrkit, flex, bison, qemu, pcre, augeas, libxml2 3, acl, libcap, libcap_ng, libconfig, systemd, fuse, yajl, libvirt, hivex 4, gmp, readline, file, libintlperl, GetoptLong, SysVirt, numactl, xen, libapparmor 5, getopt, perlPackages, ocamlPackages 6, javaSupport ? false, jdk ? null }: 7 8assert javaSupport -> jdk != null; 9 10stdenv.mkDerivation rec { 11 name = "libguestfs-${version}"; 12 version = "1.38.0"; 13 14 appliance = fetchurl { 15 url = "http://libguestfs.org/download/binaries/appliance/appliance-1.38.0.tar.xz"; 16 sha256 = "05481qxgidakga871yb5rgpyci2jaxmplmkh6y79anfh5m19nzhy"; 17 }; 18 19 src = fetchurl { 20 url = "http://libguestfs.org/download/1.38-stable/libguestfs-${version}.tar.gz"; 21 sha256 = "0cgapiad3x5ggwm097mq62hng3bv91p5gmrikrb6adfaasr1l6m3"; 22 }; 23 24 nativeBuildInputs = [ pkgconfig ]; 25 buildInputs = [ 26 makeWrapper autoreconfHook ncurses cpio gperf perl 27 cdrkit flex bison qemu pcre augeas libxml2 acl libcap libcap_ng libconfig 28 systemd fuse yajl libvirt gmp readline file hivex libintlperl GetoptLong 29 SysVirt numactl xen libapparmor getopt perlPackages.ModuleBuild 30 ] ++ (with ocamlPackages; [ ocaml findlib ocamlbuild ocaml_libvirt ocaml_gettext ounit ]) 31 ++ stdenv.lib.optional javaSupport jdk; 32 33 prePatch = '' 34 # build-time scripts 35 substituteInPlace run.in --replace '#!/bin/bash' '#!/bin/sh' 36 substituteInPlace ocaml-link.sh --replace '#!/bin/bash' '#!/bin/sh' 37 38 # $(OCAMLLIB) is read-only "${ocamlPackages.ocaml}/lib/ocaml" 39 substituteInPlace ocaml/Makefile.am --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml' 40 substituteInPlace ocaml/Makefile.in --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml' 41 substituteInPlace v2v/test-harness/Makefile.am --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml' 42 substituteInPlace v2v/test-harness/Makefile.in --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml' 43 44 # some scripts hardcore /usr/bin/env which is not available in the build env 45 patchShebangs . 46 ''; 47 configureFlags = [ "--disable-appliance" "--disable-daemon" "--with-distro=NixOS" ] 48 ++ stdenv.lib.optionals (!javaSupport) [ "--disable-java" "--without-java" ]; 49 patches = [ ./libguestfs-syms.patch ]; 50 NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2/"; 51 installFlags = "REALLY_INSTALL=yes"; 52 enableParallelBuilding = true; 53 54 postInstall = '' 55 for bin in $out/bin/*; do 56 wrapProgram "$bin" \ 57 --prefix "PATH" : "$out/bin:${hivex}/bin:${qemu}/bin" \ 58 --prefix "PERL5LIB" : "$PERL5LIB:$out/lib/perl5/site_perl" 59 done 60 ''; 61 62 postFixup = '' 63 mkdir -p "$out/lib/guestfs" 64 tar -Jxvf "$appliance" --strip 1 -C "$out/lib/guestfs" 65 ''; 66 67 meta = with stdenv.lib; { 68 description = "Tools for accessing and modifying virtual machine disk images"; 69 license = licenses.gpl2; 70 homepage = http://libguestfs.org/; 71 maintainers = with maintainers; [offline]; 72 platforms = platforms.linux; 73 hydraPlatforms = []; 74 }; 75}