1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6}:
7
8stdenv.mkDerivation {
9 pname = "nvidia-texture-tools";
10 version = "2.1.2-unstable-2020-12-21";
11
12 src = fetchFromGitHub {
13 owner = "castano";
14 repo = "nvidia-texture-tools";
15 rev = "aeddd65f81d36d8cb7b169b469ef25156666077e";
16 hash = "sha256-BYNm8CxPQbfmnnzNmOQ2Dc8HSyO8mkqzYsBZ5T80398=";
17 };
18
19 postPatch = ''
20 # Make a recently added pure virtual function just virtual,
21 # to keep compatibility.
22 sed -i 's/virtual void endImage() = 0;/virtual void endImage() {}/' src/nvtt/nvtt.h
23 ''
24 + lib.optionalString stdenv.hostPlatform.isAarch64 ''
25 # remove x86_64-only libraries
26 sed -i '/bc1enc/d' src/nvtt/tests/CMakeLists.txt
27 sed -i '/libsquish/d;/CMP_Core/d' extern/CMakeLists.txt
28 '';
29
30 outputs = [
31 "out"
32 "dev"
33 "lib"
34 ];
35
36 nativeBuildInputs = [
37 cmake
38 ];
39
40 cmakeFlags = [
41 (lib.cmakeBool "NVTT_SHARED" true)
42 ];
43
44 postInstall = ''
45 moveToOutput include "$dev"
46 moveToOutput lib "$lib"
47 '';
48
49 meta = with lib; {
50 description = "Set of cuda-enabled texture tools and compressors";
51 homepage = "https://github.com/castano/nvidia-texture-tools";
52 license = licenses.mit;
53 maintainers = with maintainers; [ wegank ];
54 platforms = platforms.unix;
55 };
56}