1 { lib, stdenv, fetchurl, perl, zlib, bzip2, xz, zstd
2 , makeWrapper, coreutils, autoreconfHook, pkg-config
5 stdenv.mkDerivation rec {
7 version = "1.21.1ubuntu2.1";
10 url = "mirror://ubuntu/pool/main/d/dpkg/dpkg_${version}.tar.xz";
11 sha256 = "sha256-YvVQbQn2MhOIOE43VO0H1QsKIYCsjNAFzKMoFeSrqZk=";
16 "--with-admindir=/var/lib/dpkg"
17 "PERL_LIBDIR=$(out)/${perl.libPrefix}"
18 (lib.optionalString stdenv.isDarwin "--disable-linker-optimisations")
19 (lib.optionalString stdenv.isDarwin "--disable-start-stop-daemon")
22 enableParallelBuilding = true;
25 # Nice: dpkg has a circular dependency on itself. Its configure
26 # script calls scripts/dpkg-architecture, which calls "dpkg" in
27 # $PATH. It doesn't actually use its result, but fails if it
28 # isn't present, so make a dummy available.
33 for i in $(find . -name Makefile.in); do
34 substituteInPlace $i --replace "install-data-local:" "disabled:" ;
41 # Dpkg commands sometimes calls out to shell commands
42 substituteInPlace lib/dpkg/dpkg.h \
43 --replace '"dpkg-deb"' \"$out/bin/dpkg-deb\" \
44 --replace '"dpkg-split"' \"$out/bin/dpkg-split\" \
45 --replace '"dpkg-query"' \"$out/bin/dpkg-query\" \
46 --replace '"dpkg-divert"' \"$out/bin/dpkg-divert\" \
47 --replace '"dpkg-statoverride"' \"$out/bin/dpkg-statoverride\" \
48 --replace '"dpkg-trigger"' \"$out/bin/dpkg-trigger\" \
49 --replace '"dpkg"' \"$out/bin/dpkg\" \
50 --replace '"debsig-verify"' \"$out/bin/debsig-verify\" \
51 --replace '"rm"' \"${coreutils}/bin/rm\" \
52 --replace '"cat"' \"${coreutils}/bin/cat\" \
53 --replace '"diff"' \"${coreutils}/bin/diff\"
56 buildInputs = [ perl zlib bzip2 xz zstd ];
57 nativeBuildInputs = [ makeWrapper perl autoreconfHook pkg-config ];
61 for i in $out/bin/*; do
62 if head -n 1 $i | grep -q perl; then
63 substituteInPlace $i --replace \
64 "${perl}/bin/perl" "${perl}/bin/perl -I $out/${perl.libPrefix}"
68 mkdir -p $out/etc/dpkg
69 cp -r scripts/t/origins $out/etc/dpkg
73 description = "The Debian package manager";
74 homepage = "https://wiki.debian.org/Teams/Dpkg";
75 license = licenses.gpl2Plus;
76 platforms = platforms.unix;
77 maintainers = with maintainers; [ siriobalmelli ];