nixpkgs/pkgs/development/libraries/libgdiplus/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

54 lines
1.5 KiB
Nix

{ lib, stdenv, fetchzip, pkg-config, glib, cairo, Carbon, fontconfig
, libtiff, giflib, libjpeg, libpng
, libXrender, libexif, autoreconfHook }:
stdenv.mkDerivation (finalAttrs: {
pname = "libgdiplus";
version = "6.1";
# Using source archive to avoid fetching Git submodules.
# Git repo: https://github.com/mono/libgdiplus
src = fetchzip {
url = "https://download.mono-project.com/sources/libgdiplus/libgdiplus-${finalAttrs.version}.tar.gz";
hash = "sha256-+lP9ETlw3s0RUliQT1uBWZ2j6o3V9EECBQSppOYFq4Q=";
};
patches = [
# Fix pkg-config lookup when cross-compiling.
./configure-pkg-config.patch
];
NIX_LDFLAGS = "-lgif";
outputs = [ "out" "dev" ];
hardeningDisable = [ "format" ];
nativeBuildInputs = [ autoreconfHook pkg-config ];
configureFlags = lib.optional stdenv.cc.isClang "--host=${stdenv.hostPlatform.system}";
enableParallelBuilding = true;
buildInputs =
[ glib cairo fontconfig libtiff giflib
libjpeg libpng libXrender libexif
]
++ lib.optional stdenv.hostPlatform.isDarwin Carbon;
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
ln -s $out/lib/libgdiplus.0.dylib $out/lib/libgdiplus.so
'';
checkPhase = ''
make check -w
'';
meta = with lib; {
description = "Mono library that provides a GDI+-compatible API on non-Windows operating systems";
homepage = "https://www.mono-project.com/docs/gui/libgdiplus/";
platforms = platforms.unix;
license = licenses.mit;
};
})