image_optim: add oxipng, fix optional workers
Support for [oxipng](https://github.com/shssoichiro/oxipng) was added with [version 0.31.0](https://github.com/toy/image_optim/blob/master/CHANGELOG.markdown#v0310-2021-10-03). So we add `oxipng` as an optional dependency. If some optional workers are disabled `image_optim` fails with an error message like: ``` Bin resolving errors: pngout worker: `pngout` not found; please provide proper binary or disable this worker (--no-pngout argument or `:pngout => false` through options) ``` To fix the problem the flag `--no-program` is added while wrapping if the worker `program` is disabled.
This commit is contained in:
parent
5d1eee6cf0
commit
96c41775f0
|
@ -1,9 +1,10 @@
|
|||
{ lib, bundlerApp, bundlerUpdateScript, makeWrapper,
|
||||
withPngcrush ? true, pngcrush,
|
||||
withPngout ? true, pngout,
|
||||
withPngout ? false, pngout, # disabled by default because it's unfree
|
||||
withAdvpng ? true, advancecomp,
|
||||
withOptipng ? true, optipng,
|
||||
withPngquant ? true, pngquant,
|
||||
withOxipng ? true, oxipng,
|
||||
withJhead ? true, jhead,
|
||||
withJpegoptim ? true, jpegoptim,
|
||||
withJpegrecompress ? true, jpeg-archive,
|
||||
|
@ -15,18 +16,31 @@
|
|||
with lib;
|
||||
|
||||
let
|
||||
optionalDepsPath = []
|
||||
++ optional withPngcrush pngcrush
|
||||
optionalDepsPath = optional withPngcrush pngcrush
|
||||
++ optional withPngout pngout
|
||||
++ optional withAdvpng advancecomp
|
||||
++ optional withOptipng optipng
|
||||
++ optional withPngquant pngquant
|
||||
++ optional withOxipng oxipng
|
||||
++ optional withJhead jhead
|
||||
++ optional withJpegoptim jpegoptim
|
||||
++ optional withJpegrecompress jpeg-archive
|
||||
++ optional withJpegtran libjpeg
|
||||
++ optional withGifsicle gifsicle
|
||||
++ optional withSvgo svgo;
|
||||
|
||||
disabledWorkersFlags = optional (!withPngcrush) "--no-pngcrush"
|
||||
++ optional (!withPngout) "--no-pngout"
|
||||
++ optional (!withAdvpng) "--no-advpng"
|
||||
++ optional (!withOptipng) "--no-optipng"
|
||||
++ optional (!withPngquant) "--no-pngquant"
|
||||
++ optional (!withOxipng) "--no-oxipng"
|
||||
++ optional (!withJhead) "--no-jhead"
|
||||
++ optional (!withJpegoptim) "--no-jpegoptim"
|
||||
++ optional (!withJpegrecompress) "--no-jpegrecompress"
|
||||
++ optional (!withJpegtran) "--no-jpegtran"
|
||||
++ optional (!withGifsicle) "--no-gifsicle"
|
||||
++ optional (!withSvgo) "--no-svgo";
|
||||
in
|
||||
|
||||
bundlerApp {
|
||||
|
@ -39,16 +53,23 @@ bundlerApp {
|
|||
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/image_optim \
|
||||
--prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)}
|
||||
--prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)} \
|
||||
--add-flags "${lib.concatStringsSep " " disabledWorkersFlags}"
|
||||
'';
|
||||
|
||||
passthru.updateScript = bundlerUpdateScript "image_optim";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Command line tool and ruby interface to optimize (lossless compress, optionally lossy) jpeg, png, gif and svg images using external utilities (advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegrescan, jpegtran, optipng, pngcrush, pngout, pngquant, svgo)";
|
||||
homepage = "https://github.com/toy/image_optim";
|
||||
license = licenses.mit;
|
||||
description = "Optimize images using multiple utilities";
|
||||
longDescription = ''
|
||||
Command line tool and ruby interface to optimize (lossless compress,
|
||||
optionally lossy) jpeg, png, gif and svg images using external utilities
|
||||
(advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegrescan,
|
||||
jpegtran, optipng, oxipng, pngcrush, pngout, pngquant, svgo)
|
||||
'';
|
||||
homepage = "https://github.com/toy/image_optim";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ srghma nicknovitski ];
|
||||
platforms = platforms.all;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue