Merge pull request #202114 from codedownio/cling-0.9
cling: update to 0.9
This commit is contained in:
@@ -1,57 +1,91 @@
|
||||
{ lib, stdenv
|
||||
{ lib
|
||||
, stdenv
|
||||
, python3
|
||||
, libffi
|
||||
, git
|
||||
, cmake
|
||||
, zlib
|
||||
, fetchgit
|
||||
, fetchFromGitHub
|
||||
, makeWrapper
|
||||
, runCommand
|
||||
, llvmPackages_5
|
||||
, llvmPackages_9
|
||||
, glibc
|
||||
, ncurses
|
||||
}:
|
||||
|
||||
let
|
||||
# The LLVM 9 headers have a couple bugs we need to patch
|
||||
fixedLlvmDev = runCommand "llvm-dev-${llvmPackages_9.llvm.version}" { buildInputs = [git]; } ''
|
||||
mkdir $out
|
||||
cp -r ${llvmPackages_9.llvm.dev}/include $out
|
||||
cd $out
|
||||
chmod -R u+w include
|
||||
git apply ${./fix-llvm-include.patch}
|
||||
'';
|
||||
|
||||
unwrapped = stdenv.mkDerivation rec {
|
||||
pname = "cling-unwrapped";
|
||||
version = "0.7";
|
||||
version = "0.9";
|
||||
|
||||
src = fetchgit {
|
||||
url = "http://root.cern/git/clang.git";
|
||||
# This commit has the tag cling-0.7 so we use it, even though cpt.py
|
||||
# tries to use refs/tags/cling-patches-rrelease_50
|
||||
rev = "354b25b5d915ff3b1946479ad07f3f2768ea1621";
|
||||
branchName = "cling-patches";
|
||||
sha256 = "0q8q2nnvjx3v59ng0q3qqqhzmzf4pmfqqiy3rz1f3drx5w3lgyjg";
|
||||
rev = "cling-v0.9";
|
||||
sha256 = "sha256-ft1NUIclSiZ9lN3Z3DJCWA0U9q/K1M0TKkZr+PjsFYk=";
|
||||
};
|
||||
|
||||
clingSrc = fetchgit {
|
||||
url = "http://root.cern/git/cling.git";
|
||||
rev = "70163975eee5a76b45a1ca4016bfafebc9b57e07";
|
||||
sha256 = "1mv2fhk857kp5rq714bq49iv7gy9fgdwibydj5wy1kq2m3sf3ysi";
|
||||
clingSrc = fetchFromGitHub {
|
||||
owner = "root-project";
|
||||
repo = "cling";
|
||||
rev = "v0.9";
|
||||
sha256 = "0wx3fi19wfjcph5kclf8108i436y79ddwakrcf0lgxnnxhdjyd29";
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
prePatch = ''
|
||||
echo "add_llvm_external_project(cling)" >> tools/CMakeLists.txt
|
||||
|
||||
cp -r $clingSrc ./tools/cling
|
||||
chmod -R a+w ./tools/cling
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ python3 git cmake llvmPackages_5.llvm.dev ];
|
||||
buildInputs = [ libffi llvmPackages_5.llvm zlib ncurses ];
|
||||
patches = [
|
||||
./no-clang-cpp.patch
|
||||
|
||||
# https://github.com/root-project/root/commit/286d96b12aad8688b9d8e4b3b5df843dcfb716a8
|
||||
./fix-llvm-dylib-usage.patch
|
||||
|
||||
./force-install-cling-targets.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ python3 git cmake ];
|
||||
buildInputs = [ libffi zlib ncurses ];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_BINARY_DIR=${llvmPackages_9.llvm.out}"
|
||||
"-DLLVM_CONFIG=${llvmPackages_9.llvm.dev}/bin/llvm-config"
|
||||
"-DLLVM_LIBRARY_DIR=${llvmPackages_9.llvm.lib}/lib"
|
||||
"-DLLVM_MAIN_INCLUDE_DIR=${fixedLlvmDev}/include"
|
||||
"-DLLVM_TABLEGEN_EXE=${llvmPackages_9.llvm.out}/bin/llvm-tblgen"
|
||||
"-DLLVM_TOOLS_BINARY_DIR=${llvmPackages_9.llvm.out}/bin"
|
||||
"-DLLVM_TOOL_CLING_BUILD=ON"
|
||||
|
||||
"-DLLVM_TARGETS_TO_BUILD=host;NVPTX"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
|
||||
# Setting -DCLING_INCLUDE_TESTS=ON causes the cling/tools targets to be built;
|
||||
# see cling/tools/CMakeLists.txt
|
||||
"-DCLING_INCLUDE_TESTS=ON"
|
||||
"-DCLANG-TOOLS=OFF"
|
||||
# "--trace-expand"
|
||||
];
|
||||
|
||||
postInstall = lib.optionalString (!stdenv.isDarwin) ''
|
||||
mkdir -p $out/share/Jupyter
|
||||
cp -r /build/clang/tools/cling/tools/Jupyter/kernel $out/share/Jupyter
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "The Interactive C++ Interpreter";
|
||||
homepage = "https://root.cern/cling/";
|
||||
@@ -77,7 +111,7 @@ let
|
||||
"-nostdinc++"
|
||||
"-isystem" "${lib.getDev stdenv.cc.libc}/include"
|
||||
"-I" "${lib.getDev unwrapped}/include"
|
||||
"-I" "${lib.getLib unwrapped}/lib/clang/5.0.2/include"
|
||||
"-I" "${lib.getLib unwrapped}/lib/clang/9.0.1/include"
|
||||
];
|
||||
|
||||
# Autodetect the include paths for the compiler used to build Cling, in the same way Cling does at
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
diff --git a/tools/cling/tools/driver/CMakeLists.txt b/tools/cling/tools/driver/CMakeLists.txt
|
||||
--- a/tools/cling/tools/driver/CMakeLists.txt
|
||||
+++ b/tools/cling/tools/driver/CMakeLists.txt
|
||||
@@ -9,10 +9,10 @@
|
||||
# Keep symbols for JIT resolution
|
||||
set(LLVM_NO_DEAD_STRIP 1)
|
||||
|
||||
+set(LLVM_LINK_COMPONENTS support)
|
||||
+
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(LIBS
|
||||
- LLVMSupport
|
||||
-
|
||||
clangFrontendTool
|
||||
|
||||
clingInterpreter
|
||||
@@ -25,8 +25,6 @@ if(BUILD_SHARED_LIBS)
|
||||
)
|
||||
else()
|
||||
set(LIBS
|
||||
- LLVMSupport
|
||||
-
|
||||
clangASTMatchers
|
||||
clangFrontendTool
|
||||
@@ -0,0 +1,27 @@
|
||||
diff --git a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
|
||||
index 16202d8..3afdac3 100644
|
||||
--- a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
|
||||
+++ b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
Error removeModule(VModuleKey K) {
|
||||
auto I = ModuleMap.find(K);
|
||||
assert(I != ModuleMap.end() && "VModuleKey K not valid here");
|
||||
- auto EDM = std::move(I.second);
|
||||
+ auto EDM = std::move(I->second);
|
||||
ModuleMap.erase(I);
|
||||
return EDM->removeModuleFromBaseLayer(BaseLayer);
|
||||
}
|
||||
diff --git a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
|
||||
index d9535ce..4c688c3 100644
|
||||
--- a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
|
||||
+++ b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
|
||||
@@ -472,7 +472,9 @@ private:
|
||||
|
||||
// NB! `LinkedObjects` needs to be destroyed before `NotifyFreed` because
|
||||
// `~ConcreteLinkedObject` calls `NotifyFreed`
|
||||
+protected:
|
||||
std::map<VModuleKey, std::unique_ptr<LinkedObject>> LinkedObjects;
|
||||
+private:
|
||||
bool ProcessAllSections = false;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/tools/cling/cmake/modules/CMakeLists.txt b/tools/cling/cmake/modules/CMakeLists.txt
|
||||
--- a/tools/cling/cmake/modules/CMakeLists.txt
|
||||
+++ b/tools/cling/cmake/modules/CMakeLists.txt
|
||||
@@ -54,10 +54,8 @@ set(CLING_CONFIG_EXPORTS_FILE)
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
get_property(cling_has_exports GLOBAL PROPERTY CLING_HAS_EXPORTS)
|
||||
- if(cling_has_exports)
|
||||
- install(EXPORT ClingTargets DESTINATION ${CLING_INSTALL_PACKAGE_DIR}
|
||||
- COMPONENT cling-cmake-exports)
|
||||
- endif()
|
||||
+ install(EXPORT ClingTargets DESTINATION ${CLING_INSTALL_PACKAGE_DIR}
|
||||
+ COMPONENT cling-cmake-exports)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClingConfig.cmake
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
|
||||
index 590d708d83..340ae529d4 100644
|
||||
--- a/tools/driver/CMakeLists.txt
|
||||
+++ b/tools/driver/CMakeLists.txt
|
||||
@@ -63,7 +63,7 @@ endif()
|
||||
add_dependencies(clang clang-resource-headers)
|
||||
|
||||
if(NOT CLANG_LINKS_TO_CREATE)
|
||||
- set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
|
||||
+ set(CLANG_LINKS_TO_CREATE clang++ clang-cl)
|
||||
endif()
|
||||
|
||||
foreach(link ${CLANG_LINKS_TO_CREATE})
|
||||
Reference in New Issue
Block a user