Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, libjpeg, fetchpatch }: 2 3stdenv.mkDerivation rec { 4 pname = "jhead"; 5 version = "3.06.0.1"; 6 7 src = fetchFromGitHub { 8 owner = "Matthias-Wandel"; 9 repo = "jhead"; 10 rev = version; 11 sha256 = "0zgh36486cpcnf7xg6dwf7rhz2h4gpayqvdk8hmrx6y418b2pfyf"; 12 }; 13 14 patches = [ 15 # Just a spelling/whitespace change, but makes it easier to apply the rest. 16 (fetchpatch { 17 url = "https://github.com/Matthias-Wandel/jhead/commit/8384c6fd2ebfb8eb8bd96616343e73af0e575131.patch"; 18 sha256 = "sha256-f3FOIqgFr5QPAsBjvUVAOf1CAqw8pNAVx+pZZuMjq3c="; 19 includes = [ "jhead.c" ]; 20 }) 21 (fetchpatch { 22 url = "https://github.com/Matthias-Wandel/jhead/commit/63aff8e9bd8c970fedf87f0ec3a1f3368bf2421e.patch"; 23 sha256 = "sha256-jyhGdWuwd/eP5uuS8uLYiTJZJdxxLYdsvl0jnQC+Y5c="; 24 includes = [ "jhead.c" ]; 25 }) 26 27 # Fixes around CVE-2022-41751 28 (fetchpatch { 29 url = "https://github.com/Matthias-Wandel/jhead/commit/6985da52c9ad4f5f6c247269cb5508fae34a971c.patch"; 30 sha256 = "sha256-8Uw0Udr9aZEMrD/0zS498MVw+rJqpFukvjb7FgzjgT4="; 31 }) 32 (fetchpatch { 33 url = "https://github.com/Matthias-Wandel/jhead/commit/3fe905cf674f8dbac8a89e58cee1b4850abf9530.patch"; 34 sha256 = "sha256-5995EV/pOktZc45c7fLl+oQqyutRDQJl3eNutR1JGJo="; 35 }) 36 (fetchpatch { 37 url = "https://github.com/joachim-reichel/jhead/commit/ec67262b8e5a4b05d8ad6898a09f1dc3fc032062.patch"; 38 sha256 = "sha256-a3KogIV45cRNthJSPygIRw1m2KBJZJSIGSWfsr7FWs4="; 39 }) 40 (fetchpatch { 41 url = "https://github.com/joachim-reichel/jhead/commit/65de38cb68747c6f8397608b56b58ce15271a1fe.patch"; 42 sha256 = "sha256-xf0d2hxW4rVZwffrYJVVFQ3cDMOcPoGbCdrrQKxf16M="; 43 }) 44 ]; 45 46 buildInputs = [ libjpeg ]; 47 48 makeFlags = [ "CPPFLAGS=" "CFLAGS=-O3" "LDFLAGS=" ]; 49 50 installPhase = '' 51 mkdir -p \ 52 $out/bin \ 53 $out/man/man1 \ 54 $out/share/doc/${pname}-${version} 55 56 cp -v jhead $out/bin 57 cp -v jhead.1 $out/man/man1 58 cp -v *.txt $out/share/doc/${pname}-${version} 59 ''; 60 61 meta = with lib; { 62 homepage = "http://www.sentex.net/~mwandel/jhead/"; 63 description = "Exif Jpeg header manipulation tool"; 64 license = licenses.publicDomain; 65 maintainers = with maintainers; [ rycee ]; 66 platforms = platforms.all; 67 }; 68}