Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / libAfterImage / default.nix
blob828a6891e293c8de9dcd54e359d4e6c0d262fd0c
1 { lib, stdenv, fetchurl, fetchpatch, autoreconfHook, giflib, libjpeg, libpng, libX11, zlib
2 , static ? stdenv.hostPlatform.isStatic
3 , withX ? !stdenv.isDarwin }:
5 stdenv.mkDerivation {
6   pname = "libAfterImage";
7   version = "1.20";
9   src = fetchurl {
10     name = "libAfterImage-1.20.tar.bz2";
11     urls = [
12       "https://sourceforge.net/projects/afterstep/files/libAfterImage/1.20/libAfterImage-1.20.tar.bz2/download"
13       "ftp://ftp.afterstep.org/stable/libAfterImage/libAfterImage-1.20.tar.bz2"
14     ];
15     sha256 = "0n74rxidwig3yhr6fzxsk7y19n1nq1f296lzrvgj5pfiyi9k48vf";
16   };
18   patches = [
19     # add back --with-gif option
20     (fetchpatch {
21       name = "libafterimage-gif.patch";
22       url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libafterimage/files/libafterimage-gif.patch?id=4aa4fca00611b0b3a4007870da43cc5fd63f76c4";
23       sha256 = "16pa94wlqpd7h6mzs4f0qm794yk1xczrwsgf93kdd3g0zbjq3rnr";
24     })
26     # fix build with newer giflib
27     (fetchpatch {
28       name = "libafterimage-giflib5-v2.patch";
29       url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch?id=4aa4fca00611b0b3a4007870da43cc5fd63f76c4";
30       sha256 = "0qwydqy9bm73cg5n3vm97aj4jfi70p7fxqmfbi54vi78z593brln";
31       stripLen = 1;
32     })
34     # fix build with newer libpng
35     (fetchpatch {
36       name = "libafterimage-libpng15.patch";
37       url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libafterimage/files/libafterimage-libpng15.patch?id=4aa4fca00611b0b3a4007870da43cc5fd63f76c4";
38       sha256 = "1qyvf7786hayasfnnilfbri3p99cfz5wjpbli3gdqj2cvk6mpydv";
39     })
41     # fix an ldconfig problem
42     (fetchpatch {
43       name = "libafterimage-makefile.patch";
44       url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libafterimage/files/libafterimage-makefile.in.patch?id=4aa4fca00611b0b3a4007870da43cc5fd63f76c4";
45       sha256 = "1n6fniz6dldms615046yhc4mlg9gb53y4yfia8wfz6szgq5zicj4";
46     })
48     # Fix build failure against binutils-2.36:
49     #  https://sourceforge.net/p/afterstep/bugs/5/
50     (fetchpatch {
51       name = "binutils-2.36.patch";
52       url = "https://sourceforge.net/p/afterstep/bugs/5/attachment/libafterimage-binutils-2.36-support.patch";
53       sha256 = "1cfgm2ffwlsmhvvfmrxlglddaigr99k88d5xqva9pkl3mmzy3jym";
54       # workaround '-p0' patchflags below.
55       stripLen = 1;
56     })
58     # fix https://github.com/root-project/root/issues/10990
59     (fetchpatch {
60       url = "https://github.com/root-project/root/pull/11243/commits/e177a477b0be05ef139094be1e96a99ece06350a.diff";
61       hash = "sha256-2DQmJGHmATHawl3dk9dExncVe1sXzJQyy4PPwShoLTY=";
62       stripLen = 5;
63     })
64   ];
65   patchFlags = [ "-p0" ];
67   nativeBuildInputs = [ autoreconfHook ];
68   buildInputs = [ giflib libjpeg libpng zlib ] ++ lib.optional withX libX11;
70   preConfigure = ''
71     rm -rf {libjpeg,libpng,libungif,zlib}/
72     substituteInPlace Makefile.in \
73       --replace "include .depend" ""
74   '' + lib.optionalString stdenv.isDarwin ''
75     substituteInPlace Makefile.in \
76       --replace "-soname," "-install_name,$out/lib/"
77   '';
79   configureFlags = [
80     "--with-gif"
81     "--disable-mmx-optimization"
82     "--${if static then "enable" else "disable"}-staticlibs"
83     "--${if !static then "enable" else "disable"}-sharedlibs"
84     "--${if withX then "with" else "without"}-x"
85   ];
87   env = lib.optionalAttrs stdenv.cc.isClang {
88     NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
89   };
91   meta = with lib; {
92     homepage = "http://www.afterstep.org/afterimage/";
93     description = "A generic image manipulation library";
94     platforms = platforms.unix;
95     maintainers = [ maintainers.veprbl ];
96     license = licenses.lgpl21;
97   };