2022-02-10 20:34:41 +00:00
|
|
|
{ lib
|
2023-10-09 19:29:22 +00:00
|
|
|
, coreutils
|
2022-02-10 20:34:41 +00:00
|
|
|
, stdenv
|
2024-07-31 10:19:44 +00:00
|
|
|
, fetchFromGitLab
|
2022-02-10 20:34:41 +00:00
|
|
|
, fetchpatch
|
|
|
|
, getopt
|
|
|
|
, libcap
|
|
|
|
, gnused
|
|
|
|
, nixosTests
|
2023-10-09 19:29:22 +00:00
|
|
|
, testers
|
2024-07-31 10:19:44 +00:00
|
|
|
, autoreconfHook
|
|
|
|
, po4a
|
2022-02-10 20:34:41 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2024-07-31 10:19:44 +00:00
|
|
|
version = "1.32.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "fakeroot";
|
|
|
|
|
2024-07-31 10:19:44 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "clint";
|
|
|
|
repo = "fakeroot";
|
|
|
|
rev = "upstream/${finalAttrs.version}";
|
|
|
|
domain = "salsa.debian.org";
|
|
|
|
hash = "sha256-j1qSMPNCtAxClqYqWkRNQmtxkitYi7g/9KtQ5XqcX3w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
patches = lib.optionals stdenv.isLinux [
|
|
|
|
./einval.patch
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
# patches needed for musl libc, borrowed from alpine packaging.
|
|
|
|
# it is applied regardless of the environment to prevent patchrot
|
|
|
|
(fetchpatch {
|
|
|
|
name = "do-not-redefine-id_t.patch";
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/fakeroot/do-not-redefine-id_t.patch?id=f68c541324ad07cc5b7f5228501b5f2ce4b36158";
|
|
|
|
sha256 = "sha256-i9PoWriSrQ7kLZzbvZT3Kq1oXzK9mTyBqq808BGepOw=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fakeroot-no64.patch";
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/fakeroot/fakeroot-no64.patch?id=f68c541324ad07cc5b7f5228501b5f2ce4b36158";
|
|
|
|
sha256 = "sha256-NCDaB4nK71gvz8iQxlfaQTazsG0SBUQ/RAnN+FqwKkY=";
|
|
|
|
})
|
2024-07-31 10:19:44 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "addendum-charset-conversion.patch";
|
|
|
|
url = "https://salsa.debian.org/clint/fakeroot/-/commit/b769fb19fd89d696a5e0fd70b974f833f6a0655a.patch";
|
|
|
|
hash = "sha256-3z1g+xzlyTpa055kpsoumP/E8srDlZss6B7Fv5A0QkU=";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2024-07-31 10:19:44 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook po4a ];
|
2023-10-09 19:29:22 +00:00
|
|
|
buildInputs = lib.optional (!stdenv.isDarwin) libcap;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postUnpack = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
sed -i \
|
|
|
|
-e 's@getopt@${getopt}/bin/getopt@g' \
|
|
|
|
-e 's@sed@${gnused}/bin/sed@g' \
|
|
|
|
-e 's@kill@${coreutils}/bin/kill@g' \
|
|
|
|
-e 's@/bin/ls@${coreutils}/bin/ls@g' \
|
|
|
|
-e 's@cut@${coreutils}/bin/cut@g' \
|
2024-07-31 10:19:44 +00:00
|
|
|
source/scripts/fakeroot.in
|
|
|
|
'';
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
pushd doc
|
|
|
|
po4a -k 0 --variable "srcdir=../doc/" po4a/po4a.cfg
|
|
|
|
popd
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
2023-10-09 19:29:22 +00:00
|
|
|
version = testers.testVersion {
|
2024-01-02 11:29:13 +00:00
|
|
|
package = finalAttrs.finalPackage;
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
2022-02-10 20:34:41 +00:00
|
|
|
# A lightweight *unit* test that exercises fakeroot and fakechroot together:
|
|
|
|
nixos-etc = nixosTests.etc.test-etc-fakeroot;
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://salsa.debian.org/clint/fakeroot";
|
|
|
|
description = "Give a fake root environment through LD_PRELOAD";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2024-07-31 10:19:44 +00:00
|
|
|
maintainers = [ ];
|
2021-01-15 22:18:51 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|