2021-12-06 16:07:01 +00:00
|
|
|
|
{ lib
|
|
|
|
|
, stdenv
|
|
|
|
|
, fetchurl
|
|
|
|
|
, unzip
|
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
let
|
2021-12-06 16:07:01 +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"; };
|
|
|
|
|
};
|
|
|
|
|
platform = platforms."${stdenv.hostPlatform.system}"
|
|
|
|
|
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
|
download = if stdenv.isDarwin
|
|
|
|
|
then { extension = "macos.zip"; hash = "sha256-MnL6lH7q/BrACG4fFJNfnvoh0JClVeaJIlX+XIj2aG4="; }
|
|
|
|
|
else { extension = "linux.tar.gz"; hash = "sha256-rDi7pvDeKQM96GZTjDr6ZDQTGbaVu+OI77xf2egw6Sg="; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
in
|
2021-08-18 13:19:15 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "pngout";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
version = "20200115";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-12-06 16:07:01 +00:00
|
|
|
|
inherit (download) hash;
|
|
|
|
|
url = "http://static.jonof.id.au/dl/kenutils/pngout-${version}-${download.extension}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.isDarwin [ unzip ];
|
|
|
|
|
|
|
|
|
|
# pngout is code-signed on Darwin, so don’t alter the binary to avoid breaking the signature.
|
|
|
|
|
dontFixup = stdenv.isDarwin;
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
installPhase = ''
|
|
|
|
|
mkdir -p $out/bin
|
2021-12-06 16:07:01 +00:00
|
|
|
|
cp ${platform.folder}/pngout $out/bin
|
|
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2022-06-16 17:23:12 +00:00
|
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/${platform.ld-linux} $out/bin/pngout
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
|
description = "Tool that aggressively optimizes the sizes of PNG images";
|
2022-07-14 12:49:19 +00:00
|
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
license = lib.licenses.unfreeRedistributable;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
homepage = "http://advsys.net/ken/utils.htm";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
platforms = lib.attrNames platforms;
|
2021-01-15 22:18:51 +00:00
|
|
|
|
maintainers = [ lib.maintainers.sander ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
mainProgram = "pngout";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
}
|