nixpkgs/pkgs/development/libraries/gd/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

68 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchurl
, fetchpatch
, autoconf
, automake
, pkg-config
, zlib
, libpng
, libjpeg
, libwebp
, libtiff
, withXorg ? true
, libXpm
, libavif
, fontconfig
, freetype
}:
stdenv.mkDerivation rec {
pname = "gd";
version = "2.3.3";
src = fetchurl {
url = "https://github.com/libgd/libgd/releases/download/${pname}-${version}/libgd-${version}.tar.xz";
sha256 = "0qas3q9xz3wgw06dm2fj0i189rain6n60z1vyq50d5h7wbn25s1z";
};
patches = [
(fetchpatch { # included in > 2.3.3
name = "restore-GD_FLIP.patch";
url = "https://github.com/libgd/libgd/commit/f4bc1f5c26925548662946ed7cfa473c190a104a.diff";
sha256 = "XRXR3NOkbEub3Nybaco2duQk0n8vxif5mTl2AUacn9w=";
})
];
hardeningDisable = [ "format" ];
configureFlags = [
"--enable-gd-formats"
]
# -pthread gets passed to clang, causing warnings
++ lib.optional stdenv.hostPlatform.isDarwin "--enable-werror=no";
nativeBuildInputs = [ autoconf automake pkg-config ];
buildInputs = [ zlib freetype libpng libjpeg libwebp libtiff libavif ]
++ lib.optionals withXorg [ fontconfig libXpm ];
outputs = [ "bin" "dev" "out" ];
postFixup = ''
moveToOutput "bin/gdlib-config" $dev
'';
enableParallelBuilding = true;
doCheck = false; # fails 2 tests
meta = with lib; {
homepage = "https://libgd.github.io/";
description = "Dynamic image creation library";
license = licenses.free; # some custom license
platforms = platforms.unix;
maintainers = [ ];
};
}