rmlint: darwin support

by providing correct build flags.
Also remove same sources of non-determinism.
Thanks to @abathur.

Signed-off-by: Andreas Schmid <service@aaschmid.de>
This commit is contained in:
Andreas Schmid 2021-04-04 15:33:01 +02:00
parent 7462194620
commit b0a1a08800

View file

@ -18,6 +18,8 @@
, wrapGAppsHook , wrapGAppsHook
, withGui ? false }: , withGui ? false }:
assert withGui -> !stdenv.isDarwin;
with lib; with lib;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "rmlint"; pname = "rmlint";
@ -30,12 +32,9 @@ stdenv.mkDerivation rec {
sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x"; sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x";
}; };
CFLAGS="-I${lib.getDev util-linux}/include";
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config pkg-config
sphinx sphinx
gettext
scons scons
] ++ lib.optionals withGui [ ] ++ lib.optionals withGui [
makeWrapper makeWrapper
@ -57,9 +56,21 @@ stdenv.mkDerivation rec {
python3.pkgs.pygobject3 python3.pkgs.pygobject3
]; ];
# this doesn't seem to support configureFlags, and appends $out afterwards, prePatch = ''
# so add the --without-gui in front of it export CFLAGS="$NIX_CFLAGS_COMPILE"
prefixKey = lib.optionalString (!withGui) " --without-gui " + "--prefix="; export LDFLAGS="''${NIX_LDFLAGS//-rpath /-Wl,-rpath=}"
# remove sources of nondeterminism
substituteInPlace lib/cmdline.c \
--replace "__DATE__" "\"Jan 1 1970\"" \
--replace "__TIME__" "\"00:00:00\""
substituteInPlace docs/SConscript \
--replace "gzip -c " "gzip -cn "
'';
prefixKey = "--prefix=";
sconsFlags = lib.optionals (!withGui) [ "--without-gui" ];
# in GUI mode, this shells out to itself, and tries to import python modules # in GUI mode, this shells out to itself, and tries to import python modules
postInstall = lib.optionalString withGui '' postInstall = lib.optionalString withGui ''
@ -70,8 +81,8 @@ stdenv.mkDerivation rec {
meta = { meta = {
description = "Extremely fast tool to remove duplicates and other lint from your filesystem"; description = "Extremely fast tool to remove duplicates and other lint from your filesystem";
homepage = "https://rmlint.readthedocs.org"; homepage = "https://rmlint.readthedocs.org";
platforms = platforms.linux; platforms = platforms.unix;
license = licenses.gpl3; license = licenses.gpl3;
maintainers = [ maintainers.koral ]; maintainers = with maintainers; [ aaschmid koral ];
}; };
} }