1 { lib, stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412, docbook_xsl, libxml2, fixDarwinDylibNames, pkgsStatic }:
3 stdenv.mkDerivation rec {
7 url = "mirror://sourceforge/giflib/giflib-${version}.tar.gz";
8 sha256 = "1gbrg03z1b6rlrvjyc6d41bc8j1bsr7rm8206gb1apscyii5bnii";
11 patches = lib.optional stdenv.hostPlatform.isDarwin
13 # https://sourceforge.net/p/giflib/bugs/133/
14 name = "darwin-soname.patch";
15 url = "https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attachment/Makefile.patch";
16 sha256 = "12afkqnlkl3n1hywwgx8sqnhp3bz0c5qrwcv8j9hifw1lmfhv67r";
21 substituteInPlace Makefile \
22 --replace 'PREFIX = /usr/local' 'PREFIX = ${builtins.placeholder "out"}'
24 # Upstream build system does not support NOT building shared libraries.
25 + lib.optionalString stdenv.hostPlatform.isStatic ''
26 sed -i '/all:/ s/libgif.so//' Makefile
27 sed -i '/all:/ s/libutil.so//' Makefile
28 sed -i '/-m 755 libgif.so/ d' Makefile
29 sed -i '/ln -sf libgif.so/ d' Makefile
32 nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
34 passthru.tests.static = pkgsStatic.giflib;
37 description = "A library for reading and writing gif images";
38 platforms = lib.platforms.unix;
39 license = lib.licenses.mit;
40 maintainers = with lib.maintainers; [ ];