2021-11-04 13:57:15 +00:00
|
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
stdenv,
|
|
|
|
|
fetchurl,
|
|
|
|
|
unzip,
|
|
|
|
|
}:
|
2014-08-14 13:59:22 +00:00
|
|
|
|
|
|
|
|
|
let
|
2021-11-04 13:57:15 +00:00
|
|
|
|
platforms = {
|
|
|
|
|
aarch64-linux = {
|
|
|
|
|
folder = "aarch64";
|
|
|
|
|
ld-linux = "ld-linux-aarch64.so.1";
|
|
|
|
|
};
|
|
|
|
|
armv7l-linux = {
|
|
|
|
|
folder = "armv7";
|
|
|
|
|
ld-linux = "ld-linux-armhf.so.3";
|
|
|
|
|
};
|
|
|
|
|
i686-linux = {
|
|
|
|
|
folder = "i686";
|
|
|
|
|
ld-linux = "ld-linux.so.2";
|
|
|
|
|
};
|
|
|
|
|
x86_64-darwin = {
|
|
|
|
|
folder = ".";
|
|
|
|
|
};
|
|
|
|
|
x86_64-linux = {
|
|
|
|
|
folder = "amd64";
|
|
|
|
|
ld-linux = "ld-linux-x86-64.so.2";
|
2024-12-10 19:26:33 +00:00
|
|
|
|
};
|
2021-11-04 13:57:15 +00:00
|
|
|
|
};
|
|
|
|
|
platform =
|
|
|
|
|
platforms."${stdenv.hostPlatform.system}"
|
|
|
|
|
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
|
download =
|
|
|
|
|
if stdenv.hostPlatform.isDarwin then
|
|
|
|
|
{
|
|
|
|
|
extension = "macos.zip";
|
|
|
|
|
hash = "sha256-MnL6lH7q/BrACG4fFJNfnvoh0JClVeaJIlX+XIj2aG4=";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
extension = "linux.tar.gz";
|
|
|
|
|
hash = "sha256-rDi7pvDeKQM96GZTjDr6ZDQTGbaVu+OI77xf2egw6Sg=";
|
|
|
|
|
};
|
2014-08-14 13:59:22 +00:00
|
|
|
|
in
|
2021-08-12 18:41:54 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "pngout";
|
2021-11-04 13:57:15 +00:00
|
|
|
|
version = "20200115";
|
2014-08-14 13:59:22 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-11-04 13:57:15 +00:00
|
|
|
|
inherit (download) hash;
|
|
|
|
|
url = "http://static.jonof.id.au/dl/kenutils/pngout-${version}-${download.extension}";
|
2014-08-14 13:59:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-11-04 13:57:15 +00:00
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ unzip ];
|
|
|
|
|
|
|
|
|
|
# pngout is code-signed on Darwin, so don’t alter the binary to avoid breaking the signature.
|
|
|
|
|
dontFixup = stdenv.hostPlatform.isDarwin;
|
|
|
|
|
|
2014-08-14 13:59:22 +00:00
|
|
|
|
installPhase =
|
|
|
|
|
''
|
|
|
|
|
mkdir -p $out/bin
|
2021-11-04 13:57:15 +00:00
|
|
|
|
cp ${platform.folder}/pngout $out/bin
|
|
|
|
|
''
|
|
|
|
|
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
2022-05-10 21:52:26 +00:00
|
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/${platform.ld-linux} $out/bin/pngout
|
2014-08-14 13:59:22 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = {
|
2014-12-30 02:31:03 +00:00
|
|
|
|
description = "Tool that aggressively optimizes the sizes of PNG images";
|
2022-06-16 23:40:08 +00:00
|
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
2021-11-04 13:57:15 +00:00
|
|
|
|
license = lib.licenses.unfreeRedistributable;
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "http://advsys.net/ken/utils.htm";
|
2021-11-04 13:57:15 +00:00
|
|
|
|
platforms = lib.attrNames platforms;
|
2021-01-15 09:19:50 +00:00
|
|
|
|
maintainers = [ lib.maintainers.sander ];
|
2023-11-23 02:51:17 +00:00
|
|
|
|
mainProgram = "pngout";
|
2014-08-14 13:59:22 +00:00
|
|
|
|
};
|
|
|
|
|
}
|