From 16a067504776101cdc147a867567630617baa1b0 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 12 May 2023 22:41:24 +0100 Subject: [PATCH] imagelol: fix build on gcc-12 Without the change build fails on gcc-12 as: ImageLOL.inl: In member function 'ImageLOL::u64 ImageLOL::ImageLOLWriter::write(const T&)': ImageLOL.inl:16:30: error: 'reverse_copy' is not a member of 'std' 16 | std::reverse_copy(begin, end, std::begin(bytes)); | ^~~~~~~~~~~~ Full build log: https://hydra.nixos.org/log/iph14caknll41zd90a4dn1jbafzzfj67-imagelol-0.2.drv ZHF: #230712 --- pkgs/tools/compression/imagelol/default.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/compression/imagelol/default.nix b/pkgs/tools/compression/imagelol/default.nix index 4711c14cfebe..857de32ad886 100644 --- a/pkgs/tools/compression/imagelol/default.nix +++ b/pkgs/tools/compression/imagelol/default.nix @@ -1,4 +1,9 @@ -{ lib, stdenv, fetchFromGitHub, cmake }: +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, cmake +}: stdenv.mkDerivation rec { pname = "imagelol"; @@ -12,6 +17,20 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + patches = [ + # upstream gcc-12 compatibility fix + (fetchpatch { + name = "gcc-12.patch"; + url = "https://github.com/MCredstoner2004/ImageLOL/commit/013fb1f901d88f5fd21a896bfab47c7fff0737d7.patch"; + hash = "sha256-RVaG2xbUqE4CxqI2lhvug2qihT6A8vN+pIfK58CXLDw="; + includes = [ "imagelol/ImageLOL.inl" ]; + # change lib/ for imagelol + stripLen = 2; + extraPrefix = "imagelol/"; + }) + ]; + + # fix for case-sensitive filesystems # https://github.com/MCredstoner2004/ImageLOL/issues/1 postPatch = ''