mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 10:53:11 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
64 lines
1.7 KiB
Nix
64 lines
1.7 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchurl
|
|
, fixDarwinDylibNames
|
|
, pkgsStatic
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "giflib";
|
|
version = "5.2.2";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/giflib/giflib-${version}.tar.gz";
|
|
hash = "sha256-vn/70FfK3r4qoURUL9kMaDjGoIO16KkEi47jtmsp1fs=";
|
|
};
|
|
|
|
patches = [
|
|
./CVE-2021-40633.patch
|
|
] ++ lib.optionals stdenv.hostPlatform.isMinGW [
|
|
# Build dll libraries.
|
|
(fetchurl {
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/001-mingw-build.patch?h=mingw-w64-giflib&id=b7311edf54824ac797c7916cd3ddc3a4b2368a19";
|
|
hash = "sha256-bBx7lw7FWtxZJ+E9AAbKIpCGcJnS5lrGpjYcv/zBtKk=";
|
|
})
|
|
|
|
# Install executables.
|
|
./mingw-install-exes.patch
|
|
];
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
fixDarwinDylibNames
|
|
];
|
|
|
|
makeFlags = [
|
|
"PREFIX=${builtins.placeholder "out"}"
|
|
];
|
|
|
|
postPatch = ''
|
|
# we don't want to build HTML documentation
|
|
substituteInPlace doc/Makefile \
|
|
--replace-fail "all: allhtml manpages" "all: manpages"
|
|
'' + lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
# Upstream build system does not support NOT building shared libraries.
|
|
sed -i '/all:/ s/$(LIBGIFSO)//' Makefile
|
|
sed -i '/all:/ s/$(LIBUTILSO)//' Makefile
|
|
sed -i '/-m 755 $(LIBGIFSO)/ d' Makefile
|
|
sed -i '/ln -sf $(LIBGIFSOVER)/ d' Makefile
|
|
sed -i '/ln -sf $(LIBGIFSOMAJOR)/ d' Makefile
|
|
'';
|
|
|
|
passthru.tests = {
|
|
static = pkgsStatic.giflib;
|
|
};
|
|
|
|
meta = {
|
|
description = "Library for reading and writing gif images";
|
|
homepage = "https://giflib.sourceforge.net/";
|
|
platforms = lib.platforms.unix ++ lib.platforms.windows;
|
|
license = lib.licenses.mit;
|
|
maintainers = [ ];
|
|
branch = "5.2";
|
|
};
|
|
}
|