depot/third_party/nixpkgs/pkgs/tools/graphics/ueberzugpp/default.nix
Default email 5e9e1146e1 Project import generated by Copybara.
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
2023-08-05 00:07:22 +02:00

107 lines
2.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, cli11
, openssl
, zeromq
, cppzmq
, tbb_2021_8
, spdlog
, libsodium
, fmt
, vips
, nlohmann_json
, libsixel
, microsoft-gsl
, chafa
, enableOpencv ? stdenv.isLinux
, opencv
, enableWayland ? stdenv.isLinux
, extra-cmake-modules
, wayland
, wayland-protocols
, enableX11 ? stdenv.isLinux
, xorg
, withoutStdRanges ? stdenv.isDarwin
, range-v3
}:
stdenv.mkDerivation rec {
pname = "ueberzugpp";
version = "2.8.9";
src = fetchFromGitHub {
owner = "jstkdng";
repo = "ueberzugpp";
rev = "v${version}";
hash = "sha256-RW2dKueidFM/RkGfOAorHukGVm1srbuAlyUP/r+JWi0=";
};
# error: no member named 'ranges' in namespace 'std'
postPatch = lib.optionalString withoutStdRanges ''
for f in src/canvas/chafa.cpp src/canvas/iterm2/iterm2.cpp src/terminal.cpp; do
sed -i "1i #include <range/v3/algorithm/for_each.hpp>" $f
sed -i "2i #include <range/v3/algorithm/reverse.hpp>" $f
substituteInPlace $f \
--replace "#include <ranges>" "" \
--replace "std::ranges" "ranges"
done
'';
strictDeps = true;
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
openssl
zeromq
cppzmq
tbb_2021_8
spdlog
libsodium
fmt
vips
nlohmann_json
libsixel
microsoft-gsl
chafa
cli11
] ++ lib.optionals enableOpencv [
opencv
] ++ lib.optionals enableWayland [
extra-cmake-modules
wayland
wayland-protocols
] ++ lib.optionals enableX11 [
xorg.libX11
xorg.xcbutilimage
] ++ lib.optionals withoutStdRanges [
range-v3
];
cmakeFlags = lib.optionals (!enableOpencv) [
"-DENABLE_OPENCV=OFF"
] ++ lib.optionals enableWayland [
"-DENABLE_WAYLAND=ON"
] ++ lib.optionals (!enableX11) [
"-DENABLE_X11=OFF"
];
# error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.14 or newer
preBuild = lib.optionalString (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "11.0") ''
export MACOSX_DEPLOYMENT_TARGET=10.14
'';
meta = with lib; {
description = "Drop in replacement for ueberzug written in C++";
homepage = "https://github.com/jstkdng/ueberzugpp";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ aleksana wegank ];
platforms = platforms.unix;
};
}