Merge pull request #126091 from tcmal/master

lldb: fix python lldb library
This commit is contained in:
Michael Raskin 2021-06-10 20:53:55 +00:00 committed by GitHub
commit 6c32f4e172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 207 additions and 5 deletions

View File

@ -13,6 +13,7 @@
, version
, darwin
, lit
, makeWrapper
, enableManpages ? false
}:
@ -30,7 +31,7 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
cmake python3 which swig lit
cmake python3 which swig lit makeWrapper
] ++ lib.optionals enableManpages [
python3.pkgs.sphinx python3.pkgs.recommonmark
];
@ -68,7 +69,15 @@ stdenv.mkDerivation (rec {
doCheck = false;
installCheckPhase = ''
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
return 1;
fi
'';
postInstall = ''
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
# Editor support
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json

View File

@ -63,3 +63,29 @@ index aff75d7db334..98a527c5e761 100644
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index 752113b..010f187 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -62,7 +62,7 @@ endif()
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf74802..1c98cae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,7 +222,7 @@ if (LLDB_ENABLE_PYTHON)
if(LLDB_BUILD_FRAMEWORK)
set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
else()
- set(LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_RELATIVE_PATH})
+ set(LLDB_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH})
endif()
if (NOT CMAKE_CFG_INTDIR STREQUAL ".")
string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})

View File

@ -13,6 +13,7 @@
, version
, darwin
, lit
, makeWrapper
, enableManpages ? false
}:
@ -30,7 +31,7 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
cmake python3 which swig lit
cmake python3 which swig lit makeWrapper
] ++ lib.optionals enableManpages [
python3.pkgs.sphinx python3.pkgs.recommonmark
];
@ -68,7 +69,15 @@ stdenv.mkDerivation (rec {
doCheck = false;
installCheckPhase = ''
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
return 1;
fi
'';
postInstall = ''
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
# Editor support
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json

View File

@ -63,3 +63,29 @@ index efba2f74904f..e08413b1dbb1 100644
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index 752113b..010f187 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -62,7 +62,7 @@ endif()
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf74802..1c98cae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,7 +222,7 @@ if (LLDB_ENABLE_PYTHON)
if(LLDB_BUILD_FRAMEWORK)
set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
else()
- set(LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_RELATIVE_PATH})
+ set(LLDB_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH})
endif()
if (NOT CMAKE_CFG_INTDIR STREQUAL ".")
string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})

View File

@ -19,6 +19,7 @@
, Carbon
, Cocoa
, lit
, makeWrapper
, enableManpages ? false
}:
@ -41,7 +42,7 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
cmake python3 which swig lit
cmake python3 which swig lit makeWrapper
] ++ lib.optionals enableManpages [
python3.pkgs.sphinx python3.pkgs.recommonmark
];
@ -84,7 +85,15 @@ stdenv.mkDerivation (rec {
doCheck = false;
installCheckPhase = ''
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
return 1;
fi
'';
postInstall = ''
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
# Editor support
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json

View File

@ -63,3 +63,29 @@ index 734167e51bc5..f95761b5df58 100644
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index 752113b..010f187 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -62,7 +62,7 @@ endif()
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5633e2..86e4738 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,7 +79,7 @@ if (LLDB_ENABLE_PYTHON)
if(LLDB_BUILD_FRAMEWORK)
set(lldb_python_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
else()
- set(lldb_python_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
+ set(lldb_python_target_dir "${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH}/lldb")
endif()
get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")

View File

@ -12,6 +12,7 @@
, python3
, version
, darwin
, makeWrapper
}:
stdenv.mkDerivation rec {
@ -37,7 +38,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
cmake python3 which swig
cmake python3 which swig makeWrapper
];
buildInputs = [
@ -61,7 +62,15 @@ stdenv.mkDerivation rec {
doCheck = false;
installCheckPhase = ''
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
return 1;
fi
'';
postInstall = ''
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
mkdir -p $out/share/man/man1
cp ../docs/lldb.1 $out/share/man/man1/

View File

@ -79,3 +79,42 @@ index b5316540fdf3..3c3c882d503f 100644
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cdf22c4..d56fc6a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
--cfgBldDir=${lldb_scripts_dir}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
- --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
+ --lldbLibDir=${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
${use_python_wrapper_from_src_dir}
${use_six_py_from_system}
VERBATIM
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index a9059dd..d76a47d 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -124,7 +124,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
link_directories("${LLVM_LIBRARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/lib${LLVM_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
set(LLDB_BUILT_STANDALONE 1)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 3598247..bd60451 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -47,7 +47,7 @@ if(NOT LLDB_BUILD_FRAMEWORK)
endif()
set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
- set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+ set(SWIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
# Install the LLDB python module
install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})

View File

@ -12,6 +12,7 @@
, python3
, version
, darwin
, makeWrapper
, lit
}:
@ -29,7 +30,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
cmake python3 which swig lit
cmake python3 which swig lit makeWrapper
];
buildInputs = [
@ -58,7 +59,15 @@ stdenv.mkDerivation rec {
doCheck = false;
installCheckPhase = ''
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
return 1;
fi
'';
postInstall = ''
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
# man page
mkdir -p $out/share/man/man1
install ../docs/lldb.1 -t $out/share/man/man1/

View File

@ -63,3 +63,43 @@ index b5316540fdf3..3c3c882d503f 100644
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cdf22c4..d56fc6a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
--cfgBldDir=${lldb_scripts_dir}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
- --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
+ --lldbLibDir=${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
${use_python_wrapper_from_src_dir}
${use_six_py_from_system}
VERBATIM
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index b726797..1f057ac 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -95,7 +95,7 @@ include_directories(
"${CLANG_INCLUDE_DIRS}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/lib${LLVM_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
set(LLDB_BUILT_STANDALONE 1)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 7de7973..b70aecc 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -50,7 +50,8 @@ if(NOT LLDB_BUILD_FRAMEWORK)
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
- -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
+ -c "import distutils.sysconfig, sys; print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+ ${CMAKE_INSTALL_LIBDIR}/../
OUTPUT_VARIABLE SWIG_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)