nixpkgs/pkgs/tools/graphics/dcraw/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

43 lines
1.1 KiB
Nix

{lib, stdenv, fetchurl, libjpeg, lcms2, gettext, libiconv }:
stdenv.mkDerivation rec {
pname = "dcraw";
version = "9.28.0";
src = fetchurl {
url = "https://www.dechifro.org/dcraw/archive/dcraw-${version}.tar.gz";
sha256 = "1fdl3xa1fbm71xzc3760rsjkvf0x5jdjrvdzyg2l9ka24vdc7418";
};
nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
buildInputs = [ libjpeg lcms2 gettext ];
# Jasper is disabled because the library is abandoned and has many
# CVEs.
patchPhase = ''
substituteInPlace install \
--replace 'prefix=/usr/local' 'prefix=$out' \
--replace gcc '$CC' \
--replace '-ljasper' '-DNO_JASPER=1'
'';
buildPhase = ''
mkdir -p $out/bin
sh -e install
'';
meta = {
homepage = "https://www.dechifro.org/dcraw/";
description = "Decoder for many camera raw picture formats";
license = lib.licenses.free;
platforms = lib.platforms.unix; # Once had cygwin problems
maintainers = [ ];
knownVulnerabilities = [
"CVE-2018-19655"
"CVE-2018-19565"
"CVE-2018-19566"
"CVE-2018-19567"
"CVE-2018-19568"
];
};
}