Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 50 lines 1.8 kB view raw
1{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, pkg-config, ispc, tbb, glfw, 2 openimageio, libjpeg, libpng, libpthreadstubs, libX11, glib }: 3 4stdenv.mkDerivation rec { 5 pname = "embree"; 6 version = "3.13.5"; 7 8 src = fetchFromGitHub { 9 owner = "embree"; 10 repo = "embree"; 11 rev = "v${version}"; 12 sha256 = "sha256-tfM4SGOFVBG0pQK9B/iN2xDaW3yjefnTtsoUad75m80="; 13 }; 14 15 patches = [ 16 (fetchpatch { 17 name = "fixed-compilation-issues-for-arm-aarch64-processor-under-linux.patch"; 18 url = "https://github.com/embree/embree/commit/82ca6b5ccb7abe0403a658a0e079926478f04cb1.patch"; 19 hash = "sha256-l9S4PBk+yQUypQ22l05daD0ruouZKE4VHkGvzKxkH4o="; 20 }) 21 ]; 22 23 postPatch = '' 24 # Fix duplicate /nix/store/.../nix/store/.../ paths 25 sed -i "s|SET(EMBREE_ROOT_DIR .*)|set(EMBREE_ROOT_DIR $out)|" \ 26 common/cmake/embree-config.cmake 27 sed -i "s|$""{EMBREE_ROOT_DIR}/||" common/cmake/embree-config.cmake 28 substituteInPlace common/math/math.h --replace 'defined(__MACOSX__) && !defined(__INTEL_COMPILER)' 0 29 substituteInPlace common/math/math.h --replace 'defined(__WIN32__) || defined(__FreeBSD__)' 'defined(__WIN32__) || defined(__FreeBSD__) || defined(__MACOSX__)' 30 ''; 31 32 cmakeFlags = [ 33 "-DEMBREE_TUTORIALS=OFF" 34 "-DEMBREE_RAY_MASK=ON" 35 "-DTBB_ROOT=${tbb}" 36 "-DTBB_INCLUDE_DIR=${tbb.dev}/include" 37 ]; 38 39 nativeBuildInputs = [ ispc pkg-config cmake ]; 40 buildInputs = [ tbb glfw openimageio libjpeg libpng libX11 libpthreadstubs ] 41 ++ lib.optionals stdenv.isDarwin [ glib ]; 42 43 meta = with lib; { 44 description = "High performance ray tracing kernels from Intel"; 45 homepage = "https://embree.github.io/"; 46 maintainers = with maintainers; [ hodapp gebner ]; 47 license = licenses.asl20; 48 platforms = platforms.unix; 49 }; 50}