1{ lib, stdenv, fetchurl, fetchpatch, libX11, libXaw }:
2
3let
4 getPatch = { name, sha256 }: fetchpatch {
5 inherit name sha256;
6 url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/${name}"
7 + "?h=packages/t1lib&id=643a4c2c58e70072b5bc1e9e4624162517b58357";
8 };
9
10 patches = map getPatch [
11 { name = "lib-cleanup.diff"; sha256 = "1w3q1y4zk0y4mf2s2x9z4cd8d4af8i868c8837p40mz3dqrai4zp"; }
12 { name = "format-security.diff"; sha256 = "0cca94bif9dsc6iwpcnk1504gb3sl3nsqhni85c21q9aywyz26l3"; }
13 { name = "CVE-2011-0764.diff"; sha256 = "1j0y3f38im7srpqjg9jvx8as6sxkz8gw7hglcxnxl9qylx8mr2jh"; }
14 { name = "CVE-2011-1552_1553_1554.patch"; sha256 = "16cyq6jhyhh8912j8hapx9pq4rzxk36ljlkxlnyi7i3wr8iz1dir"; }
15 { name = "CVE-2010-2642.patch"; sha256 = "175zvyr9v1xs22k2svgxqjcpz5nihfa7j46hn9nzvkqcrhm5m9y8"; }
16 # this ^ also fixes CVE-2011-5244
17 ];
18in
19stdenv.mkDerivation rec {
20 pname = "t1lib";
21 version = "5.1.2";
22
23 src = fetchurl {
24 url = "mirror://ibiblioPubLinux/libs/graphics/${pname}-${version}.tar.gz";
25 hash = "sha256-ghMotQVPeJCg0M0vUoJScHBd82QdvUdtWNF+Vu2Ve1k=";
26 };
27 inherit patches;
28
29 buildInputs = [ libX11 libXaw ];
30 buildFlags = [ "without_doc" ];
31
32 postInstall = lib.optionalString (!stdenv.isDarwin) ''
33 # ??
34 chmod +x $out/lib/*.so.*
35 '';
36
37 meta = with lib; {
38 homepage = "http://www.t1lib.org/";
39 description = "A type 1 font rasterizer library for UNIX/X11";
40 license = with licenses; [ gpl2 lgpl2 ];
41 platforms = platforms.unix;
42 };
43}