2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, mozjpeg, makeWrapper, coreutils, parallel, findutils }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "jpeg-archive";
|
|
|
|
version = "2.2.0"; # can be found here https://github.com/danielgtaylor/jpeg-archive/blob/master/src/util.c#L15
|
|
|
|
|
|
|
|
# update with
|
|
|
|
# nix-prefetch-git https://github.com/danielgtaylor/jpeg-archive
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danielgtaylor";
|
|
|
|
repo = "jpeg-archive";
|
|
|
|
rev = "8da4bf76b6c3c0e11e4941294bfc1857c119419b";
|
|
|
|
sha256 = "1639y9qp2ls80fzimwmwds792q8rq5p6c14c0r4jswx4yp6dcs33";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ mozjpeg ];
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
# allow override LIBJPEG
|
|
|
|
substituteInPlace Makefile --replace 'LIBJPEG =' 'LIBJPEG ?='
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# Workaround build failure on -fno-common toolchains like upstream
|
|
|
|
# gcc-10. Otherwise build fails as:
|
|
|
|
# ld: src/util.o:(.bss+0x0): multiple definition of `progname'; /build/ccBZT2Za.o:(.bss+0x20): first defined here
|
|
|
|
# https://github.com/danielgtaylor/jpeg-archive/issues/119
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeFlags = [
|
2021-05-20 23:08:51 +00:00
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
2020-04-24 23:36:52 +00:00
|
|
|
"PREFIX=$(out)"
|
|
|
|
"MOZJPEG_PREFIX=${mozjpeg}"
|
2021-05-20 23:08:51 +00:00
|
|
|
"LIBJPEG=${mozjpeg}/lib/libjpeg${stdenv.hostPlatform.extensions.sharedLibrary}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/jpeg-archive \
|
|
|
|
--set PATH "$out/bin:${coreutils}/bin:${parallel}/bin:${findutils}/bin"
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utilities for archiving photos for saving to long term storage or serving over the web";
|
|
|
|
homepage = "https://github.com/danielgtaylor/jpeg-archive";
|
2020-06-18 07:06:33 +00:00
|
|
|
license = licenses.mit;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.srghma ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|