nixpkgs/pkgs/tools/graphics/optipng/default.nix
Alexis Hildebrandt 755b915a15 treewide: Remove indefinite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
2024-06-09 23:07:45 +02:00

47 lines
1.2 KiB
Nix

{ lib, stdenv, fetchurl, libpng
, static ? stdenv.hostPlatform.isStatic
}:
# This package comes with its own copy of zlib, libpng and pngxtern
stdenv.mkDerivation rec {
pname = "optipng";
version = "0.7.8";
src = fetchurl {
url = "mirror://sourceforge/optipng/optipng-${version}.tar.gz";
hash = "sha256-JaO9aEgfIVAsyqD0wT+E3PayAzjkxOjFHyzvvYUTOYw=";
};
buildInputs = [ libpng ];
# Workaround for crash in cexcept.h. See
# https://github.com/NixOS/nixpkgs/issues/28106
preConfigure = ''
export LD=$CC
'';
# OptiPNG does not like --static, --build or --host
dontDisableStatic = true;
dontAddStaticConfigureFlags = true;
configurePlatforms = [ ];
configureFlags = [
"--with-system-zlib"
"--with-system-libpng"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
#"-prefix=$out"
];
postInstall = if stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isWindows then ''
mv "$out"/bin/optipng{,.exe}
'' else null;
meta = with lib; {
homepage = "https://optipng.sourceforge.net/";
description = "PNG optimizer";
license = licenses.zlib;
platforms = platforms.unix;
mainProgram = "optipng";
};
}