summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/graphics
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2021-11-04 09:57:15 -0400
committerRandy Eckenrode <randy@largeandhighquality.com>2021-11-06 23:19:58 -0400
commit4dcf909d0437df6dc606a9117a8c00f30c70270b (patch)
tree7a15d88ff279893025faeb792ee0d093b05239aa /pkgs/tools/graphics
parentc207be6591e45e844f193f147c1f3447af054eba (diff)
pngout: 20150319 -> 20200115
- Also include support for additional architectures: aarch64-linux, armv7l-linux, and x86_64-darwin; and - Change license to `unfreeRedistributable` per the 2021-01-16 update on Ken’s utility page allowing non-commercial redistribution.
Diffstat (limited to 'pkgs/tools/graphics')
-rw-r--r--pkgs/tools/graphics/pngout/default.nix45
1 files changed, 30 insertions, 15 deletions
diff --git a/pkgs/tools/graphics/pngout/default.nix b/pkgs/tools/graphics/pngout/default.nix
index c2de8a4fb2ae..b6f19d2390e1 100644
--- a/pkgs/tools/graphics/pngout/default.nix
+++ b/pkgs/tools/graphics/pngout/default.nix
@@ -1,34 +1,49 @@
-{lib, stdenv, fetchurl}:
+{ lib
+, stdenv
+, fetchurl
+, unzip
+}:
let
- folder = if stdenv.hostPlatform.system == "i686-linux" then "i686"
- else if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64"
- else throw "Unsupported system: ${stdenv.hostPlatform.system}";
+ 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="; };
in
stdenv.mkDerivation rec {
pname = "pngout";
- version = "20150319";
+ version = "20200115";
src = fetchurl {
- url = "http://static.jonof.id.au/dl/kenutils/pngout-${version}-linux.tar.gz";
- sha256 = "0iwv941hgs2g7ljpx48fxs24a70m2whrwarkrb77jkfcd309x2h7";
+ inherit (download) hash;
+ url = "http://static.jonof.id.au/dl/kenutils/pngout-${version}-${download.extension}";
};
+ 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;
+
installPhase = ''
mkdir -p $out/bin
- cp ${folder}/pngout $out/bin
-
- ${if stdenv.hostPlatform.system == "i686-linux" then ''
- patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/bin/pngout
- '' else if stdenv.hostPlatform.system == "x86_64-linux" then ''
- patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2 $out/bin/pngout
- '' else ""}
+ cp ${platform.folder}/pngout $out/bin
+ '' + lib.optionalString stdenv.isLinux ''
+ patchelf --set-interpreter ${stdenv.glibc.out}/lib/${platform.ld-linux} $out/bin/pngout
'';
meta = {
description = "A tool that aggressively optimizes the sizes of PNG images";
- license = lib.licenses.unfree;
+ license = lib.licenses.unfreeRedistributable;
homepage = "http://advsys.net/ken/utils.htm";
+ platforms = lib.attrNames platforms;
maintainers = [ lib.maintainers.sander ];
};
}