Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchFromGitHub 4, nix-update-script 5, cmake 6, python3 7, gtest 8, withAnimation ? true 9, withTranscoder ? true 10, eigen 11, ghc_filesystem 12, tinygltf 13}: 14 15let 16 cmakeBool = b: if b then "ON" else "OFF"; 17in 18stdenv.mkDerivation rec { 19 version = "1.5.6"; 20 pname = "draco"; 21 22 src = fetchFromGitHub { 23 owner = "google"; 24 repo = "draco"; 25 rev = version; 26 hash = "sha256-2YQMav0JJMbJ2bvnN/Xv90tjE/OWLbrZDO4WlaOvcfI="; 27 fetchSubmodules = true; 28 }; 29 30 # ld: unknown option: --start-group 31 postPatch = '' 32 substituteInPlace cmake/draco_targets.cmake \ 33 --replace "^Clang" "^AppleClang" 34 ''; 35 36 buildInputs = [ gtest ] 37 ++ lib.optionals withTranscoder [ eigen ghc_filesystem tinygltf ]; 38 39 nativeBuildInputs = [ cmake python3 ]; 40 41 cmakeFlags = [ 42 "-DDRACO_ANIMATION_ENCODING=${cmakeBool withAnimation}" 43 "-DDRACO_GOOGLETEST_PATH=${gtest}" 44 "-DBUILD_SHARED_LIBS=${cmakeBool true}" 45 "-DDRACO_TRANSCODER_SUPPORTED=${cmakeBool withTranscoder}" 46 ] ++ lib.optionals withTranscoder [ 47 "-DDRACO_EIGEN_PATH=${eigen}/include/eigen3" 48 "-DDRACO_FILESYSTEM_PATH=${ghc_filesystem}" 49 "-DDRACO_TINYGLTF_PATH=${tinygltf}" 50 ]; 51 52 passthru.updateScript = nix-update-script { }; 53 54 meta = with lib; { 55 description = "Library for compressing and decompressing 3D geometric meshes and point clouds"; 56 homepage = "https://google.github.io/draco/"; 57 changelog = "https://github.com/google/draco/releases/tag/${version}"; 58 license = licenses.asl20; 59 maintainers = with maintainers; [ jansol ]; 60 platforms = platforms.all; 61 }; 62}