summary refs log tree commit diff
path: root/pkgs/development/libraries/nvidia-texture-tools/default.nix
blob: a010ae9bd1ad37a31e05a1012f40e6945ef97f42 (plain) (blame)
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
{ stdenv, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
  name = "nvidia-texture-tools-${version}";
  version = "2.1.0";

  src = fetchFromGitHub {
    owner = "castano";
    repo = "nvidia-texture-tools";
    rev = version;
    sha256 = "0p8ja0k323nkgm07z0qlslg6743vimy9rf3wad2968az0vwzjjyx";
  };

  nativeBuildInputs = [ cmake ];

  outputs = [ "out" "dev" "lib" ];

  postPatch = ''
    # Make a recently added pure virtual function just virtual,
    # to keep compatibility.
    sed -i 's/virtual void endImage() = 0;/virtual void endImage() {}/' src/nvtt/nvtt.h
  '';

  cmakeFlags = [
    "-DNVTT_SHARED=TRUE"
  ];

  postInstall = ''
    moveToOutput include "$dev"
    moveToOutput lib "$lib"
  '';

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    description = "A set of cuda-enabled texture tools and compressors";
    homepage = "https://github.com/castano/nvidia-texture-tools";
    license = licenses.mit;
    platforms = platforms.linux;
  };
}