{ lib, stdenv, fetchFromGitHub, cmake, compressonator-sdk }: let cmplibs = "CMP_Compressonator" + lib.optionalString (!stdenv.isAarch64) " CMP_Core CMP_Core_SSE CMP_Core_AVX CMP_Core_AVX512"; in stdenv.mkDerivation rec { pname = "vtex2"; version = "0.2.0"; src = fetchFromGitHub { owner = "StrataSource"; repo = pname; rev = "v${version}"; fetchSubmodules = true; hash = "sha256-LcrRGOOYJB2d/NhlfK5jFXcLNwVA0hcrX7zEquna3LA="; }; cmakeFlags = [ "-DBUILD_GUI=OFF" ]; postPatch = '' sed -E -i 's/_?stricmp/strcasecmp/g' \ external/vtflib/VTFLib/VMT{Wrapper,GroupNode}.cpp sed -i 's/--no-undefined/-undefined,error/' \ external/vtflib/CMakeLists.txt sed -i 's/CMP_Compressonator/${cmplibs}/' \ external/vtflib/CMakeLists.txt cp ${compressonator-sdk}/lib/libCMP_*.a \ external/vtflib/thirdparty/lib/x64/ cp ${compressonator-sdk}/include/compressonator.h \ external/vtflib/thirdparty/include/Compressonator.h ''; nativeBuildInputs = [ cmake ]; meta = { homepage = src.url; description = "VTF converter and editor"; license = lib.licenses.mit; platforms = lib.platforms.unix; }; }