aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs/vtex2.nix
blob: bbc16d5a30ee6e5ab0043015cd082f9db758717e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ 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;
  };
}