at 24.11-pre 64 lines 1.9 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, fetchpatch 5, libintl 6, texinfo 7, buildPackages 8, pkgsStatic 9}: 10 11stdenv.mkDerivation rec { 12 pname = "indent"; 13 version = "2.2.13"; 14 15 src = fetchurl { 16 url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; 17 hash = "sha256-nmRjT8TOZ5eyBLy4iXzhT90KtIyldpb3h2fFnK5XgJU="; 18 }; 19 20 patches = [ 21 (fetchpatch { 22 name = "CVE-2023-40305.part-1.patch"; 23 url = "https://git.savannah.gnu.org/cgit/indent.git/patch/?id=df4ab2d19e247d059e0025789ba513418073ab6f"; 24 hash = "sha256-OLXBlYTdEuFK8SIsyC5Xr/hHWlvXiRqY2h79w+H5pGk="; 25 }) 26 (fetchpatch { 27 name = "CVE-2023-40305.part-2.patch"; 28 url = "https://git.savannah.gnu.org/cgit/indent.git/patch/?id=2685cc0bef0200733b634932ea7399b6cf91b6d7"; 29 hash = "sha256-t+QF7N1aqQ28J2O8esZ2bc5K042cUuZR4MeMeuWIgPw="; 30 }) 31 ]; 32 33 # avoid https://savannah.gnu.org/bugs/?64751 34 postPatch = '' 35 sed -E -i '/output\/else-comment-2-br(-ce)?.c/d' regression/TEST 36 sed -E -i 's/else-comment-2-br(-ce)?.c//g' regression/TEST 37 ''; 38 39 makeFlags = [ "AR=${stdenv.cc.targetPrefix}ar" ]; 40 41 strictDeps = true; 42 nativeBuildInputs = [ texinfo ]; 43 buildInputs = [ libintl ]; 44 depsBuildBuild = [ buildPackages.stdenv.cc ]; # needed when cross-compiling 45 46 env.NIX_CFLAGS_COMPILE = toString ( 47 lib.optional stdenv.cc.isClang "-Wno-implicit-function-declaration" 48 ++ lib.optional (stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc) "13") "-Wno-unused-but-set-variable" 49 ); 50 51 hardeningDisable = [ "format" ]; 52 53 doCheck = true; 54 55 passthru.tests.static = pkgsStatic.indent; 56 meta = { 57 homepage = "https://www.gnu.org/software/indent/"; 58 description = "A source code reformatter"; 59 mainProgram = "indent"; 60 license = lib.licenses.gpl3Plus; 61 maintainers = [ lib.maintainers.mmahut ]; 62 platforms = lib.platforms.unix; 63 }; 64}