depot/third_party/nixpkgs/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix
Default email cf3f6e7a7d Project import generated by Copybara.
GitOrigin-RevId: 24eb3f87fc610f18de7076aee7c5a84ac5591e3e
2020-11-30 09:33:03 +01:00

38 lines
1.1 KiB
Nix

{ cmake, fetchFromGitHub, makeWrapper, opencv3, stdenv, ocl-icd, opencl-headers
, cudaSupport ? false, cudatoolkit ? null
}:
stdenv.mkDerivation rec {
pname = "waifu2x-converter-cpp";
version = "5.3.3";
src = fetchFromGitHub {
owner = "DeadSix27";
repo = pname;
rev = "v${version}";
sha256 = "04r0xyjknvcwk70ilj1p3qwlcz3i6sqgcp0qbc9qwxnsgrrgz09w";
};
patchPhase = ''
# https://github.com/DeadSix27/waifu2x-converter-cpp/issues/123
sed -i 's:{"PNG", false},:{"PNG", true},:' src/main.cpp
'';
buildInputs = [
ocl-icd opencv3 opencl-headers
] ++ stdenv.lib.optional cudaSupport cudatoolkit;
nativeBuildInputs = [ cmake makeWrapper ];
preFixup = ''
wrapProgram $out/bin/waifu2x-converter-cpp --prefix LD_LIBRARY_PATH : "${ocl-icd}/lib"
'';
meta = {
description = "Improved fork of Waifu2X C++ using OpenCL and OpenCV";
homepage = "https://github.com/DeadSix27/waifu2x-converter-cpp";
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.xzfc ];
platforms = stdenv.lib.platforms.linux;
};
}