at 24.11-pre 64 lines 1.8 kB view raw
1{ stdenv 2, lib 3, fetchurl 4, fetchpatch 5, fixDarwinDylibNames 6, pkgsStatic 7}: 8 9stdenv.mkDerivation rec { 10 pname = "giflib"; 11 version = "5.2.2"; 12 13 src = fetchurl { 14 url = "mirror://sourceforge/giflib/giflib-${version}.tar.gz"; 15 hash = "sha256-vn/70FfK3r4qoURUL9kMaDjGoIO16KkEi47jtmsp1fs="; 16 }; 17 18 patches = [ 19 ./CVE-2021-40633.patch 20 ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ 21 # Build dll libraries. 22 (fetchurl { 23 url = "https://aur.archlinux.org/cgit/aur.git/plain/001-mingw-build.patch?h=mingw-w64-giflib&id=b7311edf54824ac797c7916cd3ddc3a4b2368a19"; 24 hash = "sha256-bBx7lw7FWtxZJ+E9AAbKIpCGcJnS5lrGpjYcv/zBtKk="; 25 }) 26 27 # Install executables. 28 ./mingw-install-exes.patch 29 ]; 30 31 nativeBuildInputs = lib.optionals stdenv.isDarwin [ 32 fixDarwinDylibNames 33 ]; 34 35 makeFlags = [ 36 "PREFIX=${builtins.placeholder "out"}" 37 ]; 38 39 postPatch = '' 40 # we don't want to build HTML documentation 41 substituteInPlace doc/Makefile \ 42 --replace-fail "all: allhtml manpages" "all: manpages" 43 '' + lib.optionalString stdenv.hostPlatform.isStatic '' 44 # Upstream build system does not support NOT building shared libraries. 45 sed -i '/all:/ s/$(LIBGIFSO)//' Makefile 46 sed -i '/all:/ s/$(LIBUTILSO)//' Makefile 47 sed -i '/-m 755 $(LIBGIFSO)/ d' Makefile 48 sed -i '/ln -sf $(LIBGIFSOVER)/ d' Makefile 49 sed -i '/ln -sf $(LIBGIFSOMAJOR)/ d' Makefile 50 ''; 51 52 passthru.tests = { 53 static = pkgsStatic.giflib; 54 }; 55 56 meta = { 57 description = "A library for reading and writing gif images"; 58 homepage = "https://giflib.sourceforge.net/"; 59 platforms = lib.platforms.unix ++ lib.platforms.windows; 60 license = lib.licenses.mit; 61 maintainers = with lib.maintainers; [ ]; 62 branch = "5.2"; 63 }; 64}