summary refs log tree commit diff
path: root/pkgs/development/libraries/libdevil/default.nix
blob: afbff3dc0cff0969c9cb507da0f677ebea4403ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ stdenv, fetchurl, libjpeg, libpng, libmng, lcms1, libtiff, openexr, libGL
, libX11, pkgconfig, OpenGL
}:

stdenv.mkDerivation rec {

  pname = "libdevil";
  version = "1.7.8";

  src = fetchurl {
    url = "mirror://sourceforge/openil/DevIL-${version}.tar.gz";
    sha256 = "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8";
  };

  outputs = [ "out" "dev" ];

  buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr libGL libX11 ]
    ++ stdenv.lib.optionals stdenv.isDarwin [ OpenGL ];
  nativeBuildInputs = [ pkgconfig ];

  configureFlags = [ "--enable-ILU" "--enable-ILUT" ];

  preConfigure = ''
    sed -i 's, -std=gnu99,,g' configure
    sed -i 's,malloc.h,stdlib.h,g' src-ILU/ilur/ilur.c
  '' + stdenv.lib.optionalString stdenv.cc.isClang ''
    sed -i 's/libIL_la_CXXFLAGS = $(AM_CFLAGS)/libIL_la_CXXFLAGS =/g' lib/Makefile.in
  '';

  postConfigure = ''
    sed -i '/RESTRICT_KEYWORD/d' include/IL/config.h
  '';

  patches =
    [ ( fetchurl {
        url = http://patch-tracker.debian.org/patch/series/dl/devil/1.7.8-6.1/03_CVE-2009-3994.diff;
        sha256 = "0qkx2qfv02igbrmsn6z5a3lbrbwjfh3rb0c2sj54wy0j1f775hbc";
      } )
      ./ftbfs-libpng15.patch
      ./il_endian.h.patch
    ];

  enableParallelBuilding = true;

  postPatch = ''
    for a in test/Makefile.in test/format_test/format_checks.sh.in ; do
      substituteInPlace $a \
        --replace /bin/bash ${stdenv.shell}
    done
  '';

  meta = with stdenv.lib; {
    homepage = http://openil.sourceforge.net/;
    description = "An image library which can can load, save, convert, manipulate, filter and display a wide variety of image formats";
    license = licenses.lgpl2;
    platforms = platforms.mesaPlatforms;
    maintainers = [ maintainers.phreedom ];
  };
}