2010-09-09 17:45:18 +01:00
|
|
|
{ stdenv, fetchurl, which, zlib, pkgconfig, SDL, openssl, python
|
2010-09-14 14:50:32 +01:00
|
|
|
, libuuid, gettext, ncurses, dev86, iasl, pciutils, bzip2, xz
|
|
|
|
, lvm2, utillinux, procps }:
|
2010-09-09 17:45:18 +01:00
|
|
|
|
|
|
|
let version = "4.0.1"; in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "xen-${version}";
|
|
|
|
|
2008-10-04 16:24:08 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://bits.xensource.com/oss-xen/release/${version}/xen-${version}.tar.gz";
|
2010-09-09 17:45:18 +01:00
|
|
|
sha256 = "0ww8j5fa2jxg0zyx7d7z9jyv2j47m8w420sy16w3rf8d80lisvbf";
|
2008-10-04 16:24:08 +01:00
|
|
|
};
|
|
|
|
|
2010-09-09 17:45:18 +01:00
|
|
|
patches =
|
|
|
|
[ # Xen looks for headers in /usr/include and for libraries using
|
|
|
|
# ldconfig. Don't do that.
|
|
|
|
./has-header.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ which zlib pkgconfig SDL openssl python libuuid gettext ncurses
|
|
|
|
dev86 iasl pciutils bzip2 xz
|
|
|
|
];
|
|
|
|
|
2010-09-16 16:21:28 +01:00
|
|
|
makeFlags = "PREFIX=$(out) CONFIG_DIR=/etc";
|
2010-09-09 17:45:18 +01:00
|
|
|
|
|
|
|
buildFlags = "xen tools";
|
2008-10-04 16:24:08 +01:00
|
|
|
|
2010-09-14 14:50:32 +01:00
|
|
|
preBuild =
|
|
|
|
''
|
|
|
|
substituteInPlace tools/libfsimage/common/fsimage_plugin.c \
|
|
|
|
--replace /usr $out
|
|
|
|
|
|
|
|
substituteInPlace tools/blktap2/lvm/lvm-util.c \
|
|
|
|
--replace /usr/sbin/vgs ${lvm2}/sbin/vgs \
|
|
|
|
--replace /usr/sbin/lvs ${lvm2}/sbin/lvs
|
|
|
|
|
|
|
|
substituteInPlace tools/hotplug/Linux/network-bridge \
|
|
|
|
--replace /usr/bin/logger ${utillinux}/bin/logger
|
|
|
|
|
|
|
|
substituteInPlace tools/xenmon/xenmon.py \
|
|
|
|
--replace /usr/bin/pkill ${procps}/bin/pkill
|
|
|
|
|
|
|
|
substituteInPlace tools/xenstat/Makefile \
|
|
|
|
--replace /usr/include/curses.h ${ncurses}/include/curses.h
|
|
|
|
|
|
|
|
# Work around a bug in our GCC wrapper: `gcc -MF foo -v' doesn't
|
|
|
|
# print the GCC version number properly.
|
|
|
|
substituteInPlace xen/Makefile \
|
|
|
|
--replace '$(CC) $(CFLAGS) -v' '$(CC) -v'
|
2010-09-16 16:21:28 +01:00
|
|
|
|
|
|
|
substituteInPlace tools/python/xen/xend/server/BlktapController.py \
|
|
|
|
--replace /usr/sbin/tapdisk2 $out/sbin/tapdisk2
|
|
|
|
|
|
|
|
substituteInPlace tools/python/xen/xend/XendQCoWStorageRepo.py \
|
|
|
|
--replace /usr/sbin/qcow-create $out/sbin/qcow-create
|
2010-09-14 14:50:32 +01:00
|
|
|
'';
|
|
|
|
|
2010-09-09 17:45:18 +01:00
|
|
|
installPhase =
|
|
|
|
''
|
|
|
|
cp -prvd dist/install/nix/store/* $out
|
|
|
|
cp -prvd dist/install/boot $out/boot
|
2010-09-16 16:21:28 +01:00
|
|
|
cp -prvd dist/install/etc $out/etc
|
2010-09-09 17:45:18 +01:00
|
|
|
''; # */
|
2008-10-04 16:24:08 +01:00
|
|
|
|
2010-09-10 11:53:17 +01:00
|
|
|
postFixup =
|
|
|
|
''
|
2010-09-14 14:50:32 +01:00
|
|
|
# Set the Python search path in all Python scripts.
|
2010-09-10 11:53:17 +01:00
|
|
|
for fn in $(grep -l '#!.*python' $out/bin/* $out/sbin/*); do
|
|
|
|
sed -i "$fn" -e "1 a import sys\nsys.path = ['$out/lib/python2.6/site-packages'] + sys.path"
|
|
|
|
done
|
2010-09-14 14:50:32 +01:00
|
|
|
|
|
|
|
# Remove calls to `env'.
|
|
|
|
for fn in $(grep -l '#!.*/env.*python' $out/bin/* $out/sbin/*); do
|
|
|
|
sed -i "$fn" -e "1 s^/nix/store/.*/env.*python^${python}/bin/python^"
|
|
|
|
done
|
2010-09-10 11:53:17 +01:00
|
|
|
''; # */
|
|
|
|
|
2008-10-04 16:24:08 +01:00
|
|
|
meta = {
|
2010-09-09 17:45:18 +01:00
|
|
|
homepage = http://www.xen.org/;
|
|
|
|
description = "Xen hypervisor and management tools for Dom0";
|
2008-10-04 16:24:08 +01:00
|
|
|
};
|
|
|
|
}
|