2023-08-15 08:48:25 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchgit
|
|
|
|
, perl
|
|
|
|
, gnutar
|
|
|
|
, zlib
|
|
|
|
, bzip2
|
|
|
|
, xz
|
|
|
|
, zstd
|
|
|
|
, libmd
|
|
|
|
, makeWrapper
|
|
|
|
, coreutils
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, diffutils
|
2023-08-23 08:53:09 +00:00
|
|
|
, glibc ? !stdenv.hostPlatform.isDarwin
|
2024-08-02 12:19:10 +00:00
|
|
|
, darwin
|
2021-12-11 10:57:47 +00:00
|
|
|
}:
|
2008-03-12 20:46:47 +00:00
|
|
|
|
2016-01-24 19:31:44 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "dpkg";
|
2024-08-02 12:19:09 +00:00
|
|
|
version = "1.22.10";
|
2010-06-16 11:50:06 +00:00
|
|
|
|
2022-10-31 22:52:03 +00:00
|
|
|
src = fetchgit {
|
|
|
|
url = "https://git.launchpad.net/ubuntu/+source/dpkg";
|
|
|
|
rev = "applied/${version}";
|
2024-08-02 12:19:09 +00:00
|
|
|
hash = "sha256-D/9nQXwzgLo+odn72WHuCJDjipfWdim2ZdSLTI2VlgE=";
|
2008-03-12 20:46:47 +00:00
|
|
|
};
|
|
|
|
|
2015-11-26 17:44:44 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--disable-dselect"
|
2023-08-15 08:48:25 +00:00
|
|
|
"--disable-start-stop-daemon"
|
2015-11-26 17:44:44 +00:00
|
|
|
"--with-admindir=/var/lib/dpkg"
|
|
|
|
"PERL_LIBDIR=$(out)/${perl.libPrefix}"
|
2022-10-31 22:52:03 +00:00
|
|
|
"TAR=${gnutar}/bin/tar"
|
2023-08-15 08:48:25 +00:00
|
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-linker-optimisations";
|
2008-03-12 20:46:47 +00:00
|
|
|
|
2021-12-11 10:57:47 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2008-03-13 14:58:17 +00:00
|
|
|
preConfigure = ''
|
2015-08-31 13:21:10 +00:00
|
|
|
# Nice: dpkg has a circular dependency on itself. Its configure
|
2008-03-13 14:58:17 +00:00
|
|
|
# script calls scripts/dpkg-architecture, which calls "dpkg" in
|
2015-08-31 13:21:10 +00:00
|
|
|
# $PATH. It doesn't actually use its result, but fails if it
|
|
|
|
# isn't present, so make a dummy available.
|
2008-03-13 14:58:17 +00:00
|
|
|
touch $TMPDIR/dpkg
|
|
|
|
chmod +x $TMPDIR/dpkg
|
|
|
|
PATH=$TMPDIR:$PATH
|
2008-03-14 13:44:58 +00:00
|
|
|
|
2012-11-08 15:13:23 +00:00
|
|
|
for i in $(find . -name Makefile.in); do
|
2012-10-07 14:02:46 +00:00
|
|
|
substituteInPlace $i --replace "install-data-local:" "disabled:" ;
|
|
|
|
done
|
2008-03-13 14:58:17 +00:00
|
|
|
'';
|
|
|
|
|
2023-08-15 08:48:25 +00:00
|
|
|
postPatch = ''
|
2017-10-28 09:07:43 +00:00
|
|
|
patchShebangs .
|
|
|
|
|
|
|
|
# Dpkg commands sometimes calls out to shell commands
|
|
|
|
substituteInPlace lib/dpkg/dpkg.h \
|
|
|
|
--replace '"dpkg-deb"' \"$out/bin/dpkg-deb\" \
|
|
|
|
--replace '"dpkg-split"' \"$out/bin/dpkg-split\" \
|
|
|
|
--replace '"dpkg-query"' \"$out/bin/dpkg-query\" \
|
|
|
|
--replace '"dpkg-divert"' \"$out/bin/dpkg-divert\" \
|
|
|
|
--replace '"dpkg-statoverride"' \"$out/bin/dpkg-statoverride\" \
|
|
|
|
--replace '"dpkg-trigger"' \"$out/bin/dpkg-trigger\" \
|
|
|
|
--replace '"dpkg"' \"$out/bin/dpkg\" \
|
|
|
|
--replace '"debsig-verify"' \"$out/bin/debsig-verify\" \
|
|
|
|
--replace '"rm"' \"${coreutils}/bin/rm\" \
|
|
|
|
--replace '"cat"' \"${coreutils}/bin/cat\" \
|
2023-08-15 08:48:25 +00:00
|
|
|
--replace '"diff"' \"${diffutils}/bin/diff\"
|
2023-08-23 08:53:09 +00:00
|
|
|
'' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
2023-08-15 08:48:25 +00:00
|
|
|
substituteInPlace src/main/help.c \
|
|
|
|
--replace '"ldconfig"' \"${glibc.bin}/bin/ldconfig\"
|
2017-10-28 09:07:43 +00:00
|
|
|
'';
|
|
|
|
|
2024-08-02 12:19:10 +00:00
|
|
|
buildInputs = [ perl zlib bzip2 xz zstd libmd ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ];
|
2021-12-11 10:57:47 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper perl autoreconfHook pkg-config ];
|
2012-11-08 15:13:23 +00:00
|
|
|
|
|
|
|
postInstall =
|
|
|
|
''
|
|
|
|
for i in $out/bin/*; do
|
|
|
|
if head -n 1 $i | grep -q perl; then
|
2021-02-24 19:53:45 +00:00
|
|
|
substituteInPlace $i --replace \
|
|
|
|
"${perl}/bin/perl" "${perl}/bin/perl -I $out/${perl.libPrefix}"
|
2012-11-08 15:13:23 +00:00
|
|
|
fi
|
2015-04-20 01:54:29 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $out/etc/dpkg
|
|
|
|
cp -r scripts/t/origins $out/etc/dpkg
|
2012-11-08 15:13:23 +00:00
|
|
|
'';
|
2008-03-12 20:46:47 +00:00
|
|
|
|
2023-04-06 05:19:55 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2008-03-12 20:46:47 +00:00
|
|
|
description = "Debian package manager";
|
2020-03-10 18:56:46 +00:00
|
|
|
homepage = "https://wiki.debian.org/Teams/Dpkg";
|
2015-05-28 17:20:29 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2016-09-05 05:14:36 +00:00
|
|
|
platforms = platforms.unix;
|
2020-05-13 18:19:18 +00:00
|
|
|
maintainers = with maintainers; [ siriobalmelli ];
|
2008-03-12 20:46:47 +00:00
|
|
|
};
|
|
|
|
}
|