6 , clang-tools-extra_src ? null
13 stdenv.mkDerivation rec {
18 nativeBuildInputs = [ cmake python ];
20 buildInputs = [ llvm ];
22 hardeningDisable = [ "all" ];
25 "-DLLVM_CMAKE_PATH=${llvm}/lib/cmake/llvm"
26 "-DLLVM_MAIN_SRC_DIR=${llvm.src}"
27 "-DCLANG_SOURCE_DIR=${src}"
28 "-DLLVM_ENABLE_RTTI=ON"
33 #undef LLVM_REPOSITORY
35 #undef CLANG_REPOSITORY
38 postUnpack = lib.optionalString (!(isNull clang-tools-extra_src)) ''
39 ln -s ${clang-tools-extra_src} $sourceRoot/tools/extra
42 # Rather than let cmake extract version information from LLVM or
43 # clang source control repositories, we generate the wanted
44 # `VCSVersion.inc` file ourselves and remove it from the
45 # depencencies of the `clangBasic` target.
47 sed 's/ ''${version_inc}//' -i lib/Basic/CMakeLists.txt
48 sed 's|sys::path::parent_path(BundlerExecutable)|StringRef("${llvm}/bin")|' -i tools/clang-offload-bundler/ClangOffloadBundler.cpp
49 sed 's|\([[:space:]]*std::string Linker = \)getToolChain().GetProgramPath(getShortName())|\1"${lld}/bin/ld.lld"|' -i lib/Driver/ToolChains/AMDGPU.cpp
50 substituteInPlace lib/Driver/ToolChains/AMDGPU.h --replace ld.lld ${lld}/bin/ld.lld
51 sed 's|configure_file(AST/gen_ast_dump_json_test.py ''${LLVM_TOOLS_BINARY_DIR}/gen_ast_dump_json_test.py COPYONLY)||' -i test/CMakeLists.txt
56 echo "$VCSVersion" > lib/Basic/VCSVersion.inc
65 description = "ROCm fork of the clang C/C++/Objective-C/Objective-C++ LLVM compiler frontend";
66 homepage = "https://llvm.org/";
67 license = with licenses; [ ncsa ];
68 maintainers = with maintainers; [ danieldk ];
69 platforms = platforms.linux;