mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-20 11:11:43 -04: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" ```
52 lines
1.5 KiB
Nix
52 lines
1.5 KiB
Nix
{ lib, stdenv, fetchurl, zlib, apngSupport ? true
|
|
, testers
|
|
}:
|
|
|
|
assert zlib != null;
|
|
|
|
let
|
|
patchVersion = "1.6.43";
|
|
patch_src = fetchurl {
|
|
url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
|
|
hash = "sha256-0QdXnpDVU4bQDmCG6nUJQvIqBLmrR2u6DGYHcM76/iI=";
|
|
};
|
|
whenPatched = lib.optionalString apngSupport;
|
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
|
pname = "libpng" + whenPatched "-apng";
|
|
version = "1.6.43";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/libpng/libpng-${finalAttrs.version}.tar.xz";
|
|
hash = "sha256-alygZSOSotfJ2yrltAIQhDwLvAgcvUEIJasAzFnxSmw=";
|
|
};
|
|
postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1"
|
|
+ lib.optionalString stdenv.hostPlatform.isFreeBSD ''
|
|
|
|
sed -i 1i'int feenableexcept(int __mask);' contrib/libtests/pngvalid.c
|
|
'';
|
|
|
|
outputs = [ "out" "dev" "man" ];
|
|
outputBin = "dev";
|
|
|
|
propagatedBuildInputs = [ zlib ];
|
|
|
|
doCheck = true;
|
|
|
|
passthru = {
|
|
inherit zlib;
|
|
|
|
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Official reference implementation for the PNG file format" + whenPatched " with animation patch";
|
|
homepage = "http://www.libpng.org/pub/png/libpng.html";
|
|
changelog = "https://github.com/pnggroup/libpng/blob/v${finalAttrs.version}/CHANGES";
|
|
license = licenses.libpng2;
|
|
pkgConfigModules = [ "libpng" "libpng16" ];
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ vcunat ];
|
|
};
|
|
})
|