nixpkgs/pkgs/build-support/release/debian-build.nix
Eelco Dolstra d25aa3c8a5 * checkinstall: build properly on x86_64.
* checkinstall: get rid of the RUNPATH in the LD_PRELOAD library so
  that it works with native Glibc (e.g. in VM builds).
* debBuild: use our own checkinstall.  In particular this allows us to
  build Debs on x86_64.

svn path=/nixpkgs/trunk/; revision=13608
2008-12-10 17:12:19 +00:00

74 lines
1.9 KiB
Nix

# This function compiles a source tarball in a virtual machine image
# that contains a Debian-like (i.e. dpkg-based) OS.
{vmTools, fetchurl}: args: with args;
vmTools.runInLinuxImage (stdenv.mkDerivation (
{
name = "debian-build";
doCheck = true;
prefix = "/usr";
phases = "installExtraDebsPhase sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase";
}
// args //
{
src = src.path;
# !!! cut&paste from rpm-build.nix
postHook = ''
ensureDir $out/nix-support
cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
# If `src' is the result of a call to `makeSourceTarball', then it
# has a subdirectory containing the actual tarball(s). If there are
# multiple tarballs, just pick the first one.
echo $src
if test -d $src/tarballs; then
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
fi
''; # */
installExtraDebsPhase = ''
for i in $extraDebs; do
dpkg --install $i
done
'';
sysInfoPhase = ''
echo "System/kernel: $(uname -a)"
if test -e /etc/debian_version; then echo "Debian release: $(cat /etc/debian_version)"; fi
header "installed Debian packages"
dpkg-query --list
stopNest
'';
installCommand = ''
export LOGNAME=root
${checkinstall}/sbin/checkinstall -y -D make install
ensureDir $out/debs
find . -name "*.deb" -exec cp {} $out/debs \;
shopt -s nullglob
for i in $out/debs/*.deb; do
header "Generated DEB package: $i"
dpkg-deb --info $i
echo "file deb $i" >> $out/nix-support/hydra-build-products
stopNest
done
''; # */
meta = (if args ? meta then args.meta else {}) // {
description = "Build of a Deb package on ${args.diskImage.fullName} (${args.diskImage.name})";
};
}
))