nixpkgs/pkgs/tools/misc/fortune/default.nix
f0x52 f36eb34b67
fortune: remove offensive quotes from build (#171153)
This builds the package with -DNO_OFFENSIVE=true, keeping out the
off (offensive) directory from the resulting fortune files. It
also removes the men-women quotes from the resulting db.

Where various default fortune files include some questionable
quotes, this removes the ones even the upstream finds offensive,
and the men-women category. This is also in line with what Fedora
does:
https://src.fedoraproject.org/rpms/fortune-mod/blob/main/f/fortune-mod.spec#_64-74,
and has done in some capacity for years.
2022-05-01 16:58:25 +00:00

52 lines
1.3 KiB
Nix

{ lib, stdenv, fetchurl, cmake, recode, perl }:
stdenv.mkDerivation rec {
pname = "fortune-mod";
version = "3.12.0";
# We use fetchurl instead of fetchFromGitHub because the release pack has some
# special files.
src = fetchurl {
url = "https://github.com/shlomif/fortune-mod/releases/download/${pname}-${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-fVrtfLmZiVDTSeuoOltX/vunGSizSw+ZhQhBn9t0C3E=";
};
nativeBuildInputs = [ cmake perl ];
buildInputs = [ recode ];
cmakeFlags = [
"-DLOCALDIR=${placeholder "out"}/share/fortunes"
"-DNO_OFFENSIVE=true"
];
patches = [ (builtins.toFile "not-a-game.patch" ''
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 865e855..5a59370 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,7 +154,7 @@ ENDMACRO()
my_exe(
"fortune"
"fortune/fortune.c"
- "games"
+ "bin"
)
my_exe(
--
'') ];
postFixup = ''
rm -f $out/share/fortunes/men-women*
'';
meta = with lib; {
mainProgram = "fortune";
description = "A program that displays a pseudorandom message from a database of quotations";
license = licenses.bsdOriginal;
platforms = platforms.unix;
maintainers = with maintainers; [ vonfry ];
};
}