diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/libguestfs | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libguestfs')
3 files changed, 113 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix b/nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix new file mode 100644 index 000000000000..9c2b317ab086 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix @@ -0,0 +1,11 @@ +{ fetchzip }: + +fetchzip { + name = "libguestfs-appliance-1.38.0"; + url = "http://libguestfs.org/download/binaries/appliance/appliance-1.38.0.tar.xz"; + sha256 = "15rxwj5qjflizxk7slpbrj9lcwkd2lgm52f5yv101qba4yyn3g76"; + + meta = { + hydraPlatforms = []; # Hydra fails with "Output limit exceeded" + }; +} diff --git a/nixpkgs/pkgs/development/libraries/libguestfs/default.nix b/nixpkgs/pkgs/development/libraries/libguestfs/default.nix new file mode 100644 index 000000000000..aad6365e4c2d --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libguestfs/default.nix @@ -0,0 +1,89 @@ +{ stdenv, fetchurl, pkgconfig, autoreconfHook, makeWrapper +, ncurses, cpio, gperf, perl, cdrkit, flex, bison, qemu, pcre, augeas, libxml2 +, acl, libcap, libcap_ng, libconfig, systemd, fuse, yajl, libvirt, hivex +, gmp, readline, file, libintl_perl, GetoptLong, SysVirt, numactl, xen, libapparmor +, getopt, perlPackages, ocamlPackages +, appliance ? null +, javaSupport ? false, jdk ? null }: + +assert appliance == null || stdenv.lib.isDerivation appliance; +assert javaSupport -> jdk != null; + +stdenv.mkDerivation rec { + name = "libguestfs-${version}"; + version = "1.38.6"; + + src = fetchurl { + url = "http://libguestfs.org/download/1.38-stable/libguestfs-${version}.tar.gz"; + sha256 = "1v2mggx2jlaq4m3p5shc46gzf7vmaayha6r0nwdnyzd7x6q0is7p"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + makeWrapper autoreconfHook ncurses cpio gperf perl + cdrkit flex bison qemu pcre augeas libxml2 acl libcap libcap_ng libconfig + systemd fuse yajl libvirt gmp readline file hivex libintl_perl GetoptLong + SysVirt numactl xen libapparmor getopt perlPackages.ModuleBuild + ] ++ (with ocamlPackages; [ ocaml findlib ocamlbuild ocaml_libvirt ocaml_gettext ounit ]) + ++ stdenv.lib.optional javaSupport jdk; + + 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' + + # some scripts hardcore /usr/bin/env which is not available in the build env + patchShebangs . + ''; + configureFlags = [ "--disable-appliance" "--disable-daemon" "--with-distro=NixOS" ] + ++ stdenv.lib.optionals (!javaSupport) [ "--disable-java" "--without-java" ]; + patches = [ ./libguestfs-syms.patch ]; + NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2/"; + installFlags = "REALLY_INSTALL=yes"; + enableParallelBuilding = true; + + postInstall = '' + for bin in $out/bin/*; do + wrapProgram "$bin" \ + --prefix PATH : "$out/bin:${hivex}/bin:${qemu}/bin" \ + --prefix PERL5LIB : "$out/lib/perl5/site_perl" + done + ''; + + postFixup = stdenv.lib.optionalString (appliance != null) '' + mkdir -p $out/{lib,lib64} + ln -s ${appliance} $out/lib64/guestfs + ln -s ${appliance} $out/lib/guestfs + ''; + + doInstallCheck = appliance != null; + installCheckPhase = '' + export HOME=$(mktemp -d) # avoid access to /homeless-shelter/.guestfish + + ${qemu}/bin/qemu-img create -f qcow2 disk1.img 10G + + $out/bin/guestfish <<'EOF' + add-drive disk1.img + run + list-filesystems + part-disk /dev/sda mbr + mkfs ext2 /dev/sda1 + list-filesystems + EOF + ''; + + 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]; + platforms = platforms.linux; + hydraPlatforms = []; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch b/nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch new file mode 100644 index 000000000000..09c4b1393ce7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch @@ -0,0 +1,13 @@ +diff --git a/lib/Makefile.am b/lib/Makefile.am +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -168,8 +168,7 @@ libguestfs_la_LIBADD = \ + # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'. + # Include the version script to limit which symbols are exported. + libguestfs_la_LDFLAGS = \ +- -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \ +- $(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms ++ -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) + + if HAVE_FUSE + # XXX Unfortunately FUSE_CFLAGS defines _FILE_OFFSET_BITS=64. |