1{ stdenv
2, lib
3, fetchFromGitHub
4, cmake
5, clang
6, libclang
7, zlib
8, openexr
9, openimageio
10, llvm
11, boost
12, flex
13, bison
14, partio
15, pugixml
16, util-linux
17, python3
18}:
19
20let
21
22 boost_static = boost.override { enableStatic = true; };
23
24in stdenv.mkDerivation rec {
25 pname = "openshadinglanguage";
26 version = "1.12.12.0";
27
28 src = fetchFromGitHub {
29 owner = "AcademySoftwareFoundation";
30 repo = "OpenShadingLanguage";
31 rev = "v${version}";
32 hash = "sha256-kxfDhqF8uTdLqt99rTOk8TWBdN5NF7zm98CT0DbLrW0=";
33 };
34
35 cmakeFlags = [
36 "-DBoost_ROOT=${boost}"
37 "-DUSE_BOOST_WAVE=ON"
38 "-DENABLE_RTTI=ON"
39
40 # Build system implies llvm-config and llvm-as are in the same directory.
41 # Override defaults.
42 "-DLLVM_DIRECTORY=${llvm}"
43 "-DLLVM_CONFIG=${llvm.dev}/bin/llvm-config"
44 "-DLLVM_BC_GENERATOR=${clang}/bin/clang++"
45
46 # Set C++11 to C++14 required for LLVM10+
47 "-DCMAKE_CXX_STANDARD=14"
48 ];
49
50 preConfigure = "patchShebangs src/liboslexec/serialize-bc.bash ";
51
52 nativeBuildInputs = [
53 bison
54 clang
55 cmake
56 flex
57 ];
58
59 buildInputs = [
60 boost_static
61 libclang
62 llvm
63 openexr
64 openimageio
65 partio
66 pugixml
67 python3.pkgs.pybind11
68 util-linux # needed just for hexdump
69 zlib
70 ];
71
72 postFixup = ''
73 substituteInPlace "$out"/lib/pkgconfig/*.pc \
74 --replace '=''${exec_prefix}//' '=/'
75 '';
76
77 meta = with lib; {
78 description = "Advanced shading language for production GI renderers";
79 homepage = "https://opensource.imageworks.com/osl.html";
80 maintainers = with maintainers; [ hodapp ];
81 license = licenses.bsd3;
82 platforms = platforms.linux;
83 };
84}