Merge pull request #202114 from codedownio/cling-0.9

cling: update to 0.9

authored by Ryan Lahfa and committed by GitHub 4b36fe99 d3de39a3

+130 -16
+50 -16
pkgs/development/interpreters/cling/default.nix
··· 1 - { lib, stdenv 1 + { lib 2 + , stdenv 2 3 , python3 3 4 , libffi 4 5 , git 5 6 , cmake 6 7 , zlib 7 8 , fetchgit 9 + , fetchFromGitHub 8 10 , makeWrapper 9 11 , runCommand 10 - , llvmPackages_5 12 + , llvmPackages_9 11 13 , glibc 12 14 , ncurses 13 15 }: 14 16 15 17 let 18 + # The LLVM 9 headers have a couple bugs we need to patch 19 + fixedLlvmDev = runCommand "llvm-dev-${llvmPackages_9.llvm.version}" { buildInputs = [git]; } '' 20 + mkdir $out 21 + cp -r ${llvmPackages_9.llvm.dev}/include $out 22 + cd $out 23 + chmod -R u+w include 24 + git apply ${./fix-llvm-include.patch} 25 + ''; 26 + 16 27 unwrapped = stdenv.mkDerivation rec { 17 28 pname = "cling-unwrapped"; 18 - version = "0.7"; 29 + version = "0.9"; 19 30 20 31 src = fetchgit { 21 32 url = "http://root.cern/git/clang.git"; 22 - # This commit has the tag cling-0.7 so we use it, even though cpt.py 23 - # tries to use refs/tags/cling-patches-rrelease_50 24 - rev = "354b25b5d915ff3b1946479ad07f3f2768ea1621"; 25 - branchName = "cling-patches"; 26 - sha256 = "0q8q2nnvjx3v59ng0q3qqqhzmzf4pmfqqiy3rz1f3drx5w3lgyjg"; 33 + rev = "cling-v0.9"; 34 + sha256 = "sha256-ft1NUIclSiZ9lN3Z3DJCWA0U9q/K1M0TKkZr+PjsFYk="; 27 35 }; 28 36 29 - clingSrc = fetchgit { 30 - url = "http://root.cern/git/cling.git"; 31 - rev = "70163975eee5a76b45a1ca4016bfafebc9b57e07"; 32 - sha256 = "1mv2fhk857kp5rq714bq49iv7gy9fgdwibydj5wy1kq2m3sf3ysi"; 37 + clingSrc = fetchFromGitHub { 38 + owner = "root-project"; 39 + repo = "cling"; 40 + rev = "v0.9"; 41 + sha256 = "0wx3fi19wfjcph5kclf8108i436y79ddwakrcf0lgxnnxhdjyd29"; 33 42 }; 34 43 35 - preConfigure = '' 44 + prePatch = '' 36 45 echo "add_llvm_external_project(cling)" >> tools/CMakeLists.txt 46 + 37 47 cp -r $clingSrc ./tools/cling 38 48 chmod -R a+w ./tools/cling 39 49 ''; 40 50 41 - nativeBuildInputs = [ python3 git cmake llvmPackages_5.llvm.dev ]; 42 - buildInputs = [ libffi llvmPackages_5.llvm zlib ncurses ]; 51 + patches = [ 52 + ./no-clang-cpp.patch 53 + 54 + # https://github.com/root-project/root/commit/286d96b12aad8688b9d8e4b3b5df843dcfb716a8 55 + ./fix-llvm-dylib-usage.patch 56 + 57 + ./force-install-cling-targets.patch 58 + ]; 59 + 60 + nativeBuildInputs = [ python3 git cmake ]; 61 + buildInputs = [ libffi zlib ncurses ]; 43 62 44 63 strictDeps = true; 45 64 46 65 cmakeFlags = [ 66 + "-DLLVM_BINARY_DIR=${llvmPackages_9.llvm.out}" 67 + "-DLLVM_CONFIG=${llvmPackages_9.llvm.dev}/bin/llvm-config" 68 + "-DLLVM_LIBRARY_DIR=${llvmPackages_9.llvm.lib}/lib" 69 + "-DLLVM_MAIN_INCLUDE_DIR=${fixedLlvmDev}/include" 70 + "-DLLVM_TABLEGEN_EXE=${llvmPackages_9.llvm.out}/bin/llvm-tblgen" 71 + "-DLLVM_TOOLS_BINARY_DIR=${llvmPackages_9.llvm.out}/bin" 72 + "-DLLVM_TOOL_CLING_BUILD=ON" 73 + 47 74 "-DLLVM_TARGETS_TO_BUILD=host;NVPTX" 48 75 "-DLLVM_ENABLE_RTTI=ON" 49 76 50 77 # Setting -DCLING_INCLUDE_TESTS=ON causes the cling/tools targets to be built; 51 78 # see cling/tools/CMakeLists.txt 52 79 "-DCLING_INCLUDE_TESTS=ON" 80 + "-DCLANG-TOOLS=OFF" 81 + # "--trace-expand" 53 82 ]; 83 + 84 + postInstall = lib.optionalString (!stdenv.isDarwin) '' 85 + mkdir -p $out/share/Jupyter 86 + cp -r /build/clang/tools/cling/tools/Jupyter/kernel $out/share/Jupyter 87 + ''; 54 88 55 89 meta = with lib; { 56 90 description = "The Interactive C++ Interpreter"; ··· 77 111 "-nostdinc++" 78 112 "-isystem" "${lib.getDev stdenv.cc.libc}/include" 79 113 "-I" "${lib.getDev unwrapped}/include" 80 - "-I" "${lib.getLib unwrapped}/lib/clang/5.0.2/include" 114 + "-I" "${lib.getLib unwrapped}/lib/clang/9.0.1/include" 81 115 ]; 82 116 83 117 # Autodetect the include paths for the compiler used to build Cling, in the same way Cling does at
+24
pkgs/development/interpreters/cling/fix-llvm-dylib-usage.patch
··· 1 + diff --git a/tools/cling/tools/driver/CMakeLists.txt b/tools/cling/tools/driver/CMakeLists.txt 2 + --- a/tools/cling/tools/driver/CMakeLists.txt 3 + +++ b/tools/cling/tools/driver/CMakeLists.txt 4 + @@ -9,10 +9,10 @@ 5 + # Keep symbols for JIT resolution 6 + set(LLVM_NO_DEAD_STRIP 1) 7 + 8 + +set(LLVM_LINK_COMPONENTS support) 9 + + 10 + if(BUILD_SHARED_LIBS) 11 + set(LIBS 12 + - LLVMSupport 13 + - 14 + clangFrontendTool 15 + 16 + clingInterpreter 17 + @@ -25,8 +25,6 @@ if(BUILD_SHARED_LIBS) 18 + ) 19 + else() 20 + set(LIBS 21 + - LLVMSupport 22 + - 23 + clangASTMatchers 24 + clangFrontendTool
+27
pkgs/development/interpreters/cling/fix-llvm-include.patch
··· 1 + diff --git a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h 2 + index 16202d8..3afdac3 100644 3 + --- a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h 4 + +++ b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h 5 + @@ -220,7 +220,7 @@ public: 6 + Error removeModule(VModuleKey K) { 7 + auto I = ModuleMap.find(K); 8 + assert(I != ModuleMap.end() && "VModuleKey K not valid here"); 9 + - auto EDM = std::move(I.second); 10 + + auto EDM = std::move(I->second); 11 + ModuleMap.erase(I); 12 + return EDM->removeModuleFromBaseLayer(BaseLayer); 13 + } 14 + diff --git a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h 15 + index d9535ce..4c688c3 100644 16 + --- a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h 17 + +++ b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h 18 + @@ -472,7 +472,9 @@ private: 19 + 20 + // NB! `LinkedObjects` needs to be destroyed before `NotifyFreed` because 21 + // `~ConcreteLinkedObject` calls `NotifyFreed` 22 + +protected: 23 + std::map<VModuleKey, std::unique_ptr<LinkedObject>> LinkedObjects; 24 + +private: 25 + bool ProcessAllSections = false; 26 + }; 27 +
+16
pkgs/development/interpreters/cling/force-install-cling-targets.patch
··· 1 + diff --git a/tools/cling/cmake/modules/CMakeLists.txt b/tools/cling/cmake/modules/CMakeLists.txt 2 + --- a/tools/cling/cmake/modules/CMakeLists.txt 3 + +++ b/tools/cling/cmake/modules/CMakeLists.txt 4 + @@ -54,10 +54,8 @@ set(CLING_CONFIG_EXPORTS_FILE) 5 + 6 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 7 + get_property(cling_has_exports GLOBAL PROPERTY CLING_HAS_EXPORTS) 8 + - if(cling_has_exports) 9 + - install(EXPORT ClingTargets DESTINATION ${CLING_INSTALL_PACKAGE_DIR} 10 + - COMPONENT cling-cmake-exports) 11 + - endif() 12 + + install(EXPORT ClingTargets DESTINATION ${CLING_INSTALL_PACKAGE_DIR} 13 + + COMPONENT cling-cmake-exports) 14 + 15 + install(FILES 16 + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClingConfig.cmake
+13
pkgs/development/interpreters/cling/no-clang-cpp.patch
··· 1 + diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt 2 + index 590d708d83..340ae529d4 100644 3 + --- a/tools/driver/CMakeLists.txt 4 + +++ b/tools/driver/CMakeLists.txt 5 + @@ -63,7 +63,7 @@ endif() 6 + add_dependencies(clang clang-resource-headers) 7 + 8 + if(NOT CLANG_LINKS_TO_CREATE) 9 + - set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp) 10 + + set(CLANG_LINKS_TO_CREATE clang++ clang-cl) 11 + endif() 12 + 13 + foreach(link ${CLANG_LINKS_TO_CREATE})