Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / misc / drivers / foomatic-filters / default.nix
blobc9a7d10bd8b075ed4b90b266ef85728d10bd25ed
1 { lib, stdenv, fetchpatch, fetchurl, pkg-config, perl, cups, dbus, enscript }:
3 stdenv.mkDerivation rec {
4   pname = "foomatic-filters";
5   version = "4.0.17";
7   src = fetchurl {
8     url = "https://www.openprinting.org/download/foomatic/foomatic-filters-${version}.tar.gz";
9     sha256 = "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2";
10   };
12   nativeBuildInputs = [ pkg-config ];
13   buildInputs = [ perl cups dbus enscript ];
15   patches = [
16     (fetchpatch {
17       name = "CVE-2015-8327+CVE-2015-8560.patch";
18       url = "https://salsa.debian.org/debian/foomatic-filters/raw/a3abbef2d2f8c7e62d2fe64f64afe294563fdf8f/debian/patches/0500-r7406_also_consider_the_back_tick_as_an_illegal_shell_escape_character.patch";
19       sha256 = "055nwi3sjf578nk40bqsch3wx8m2h65hdih0wmxflb6l0hwkq4p4";
20     })
21   ];
23   preConfigure =
24     ''
25       substituteInPlace foomaticrip.c --replace /bin/bash ${stdenv.shell}
26     '';
28   # Workaround build failure on -fno-common toolchains like upstream
29   # gcc-10. Otherwise build fails as:
30   #   ld: foomatic_rip-options.o:/build/foomatic-filters-4.0.17/options.c:49: multiple definition of
31   #     `cupsfilter'; foomatic_rip-foomaticrip.o:/build/foomatic-filters-4.0.17/foomaticrip.c:158: first defined here
32   env.NIX_CFLAGS_COMPILE = "-fcommon";
34   installTargets = [ "install-cups" ];
36   installFlags = [
37     "CUPS_FILTERS=$(out)/lib/cups/filter"
38     "CUPS_BACKENDS=$(out)/lib/cups/backend"
39   ];
41   meta = {
42     description = "Foomatic printing filters";
43     maintainers = [ lib.maintainers.raskin ];
44     platforms = lib.platforms.linux;
45     license = lib.licenses.gpl2Plus;
46   };