From e097f7efc77726a17acca7be3e6e2346331883f3 Mon Sep 17 00:00:00 2001 From: tcmal Date: Tue, 8 Jun 2021 13:36:06 +0100 Subject: [PATCH 1/3] lldb: fix python lldb library _lldb.so is now properly symlinked to the shared library. applies to lldb 8 through 12. fixes #125183 --- pkgs/development/compilers/llvm/10/lldb/default.nix | 6 ++++++ .../compilers/llvm/10/lldb/gnu-install-dirs.patch | 13 +++++++++++++ pkgs/development/compilers/llvm/11/lldb/default.nix | 6 ++++++ .../compilers/llvm/11/lldb/gnu-install-dirs.patch | 13 +++++++++++++ pkgs/development/compilers/llvm/12/lldb/default.nix | 6 ++++++ .../compilers/llvm/12/lldb/gnu-install-dirs.patch | 13 +++++++++++++ pkgs/development/compilers/llvm/8/lldb/default.nix | 6 ++++++ .../compilers/llvm/8/lldb/gnu-install-dirs.patch | 13 +++++++++++++ pkgs/development/compilers/llvm/9/lldb/default.nix | 6 ++++++ .../compilers/llvm/9/lldb/gnu-install-dirs.patch | 13 +++++++++++++ 10 files changed, 95 insertions(+) diff --git a/pkgs/development/compilers/llvm/10/lldb/default.nix b/pkgs/development/compilers/llvm/10/lldb/default.nix index 04b9e06e77a3..7ce7e1f81503 100644 --- a/pkgs/development/compilers/llvm/10/lldb/default.nix +++ b/pkgs/development/compilers/llvm/10/lldb/default.nix @@ -68,6 +68,12 @@ stdenv.mkDerivation (rec { doCheck = false; + installCheckPhase = '' + if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + return 1; + fi + ''; + postInstall = '' # Editor support # vscode: diff --git a/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch index 053a580e45ec..d781779bbe00 100644 --- a/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch @@ -63,3 +63,16 @@ 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}) \ No newline at end of file diff --git a/pkgs/development/compilers/llvm/11/lldb/default.nix b/pkgs/development/compilers/llvm/11/lldb/default.nix index 785ac4671ef5..ed118537a5dd 100644 --- a/pkgs/development/compilers/llvm/11/lldb/default.nix +++ b/pkgs/development/compilers/llvm/11/lldb/default.nix @@ -68,6 +68,12 @@ stdenv.mkDerivation (rec { doCheck = false; + installCheckPhase = '' + if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + return 1; + fi + ''; + postInstall = '' # Editor support # vscode: diff --git a/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch index a4769109523d..ac071617dd4a 100644 --- a/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch @@ -63,3 +63,16 @@ 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}) \ No newline at end of file diff --git a/pkgs/development/compilers/llvm/12/lldb/default.nix b/pkgs/development/compilers/llvm/12/lldb/default.nix index 07517308b467..24cbcabddad3 100644 --- a/pkgs/development/compilers/llvm/12/lldb/default.nix +++ b/pkgs/development/compilers/llvm/12/lldb/default.nix @@ -84,6 +84,12 @@ stdenv.mkDerivation (rec { doCheck = false; + installCheckPhase = '' + if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + return 1; + fi + ''; + postInstall = '' # Editor support # vscode: diff --git a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch index 98321f4479e6..0435784a2474 100644 --- a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch @@ -63,3 +63,16 @@ 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}) \ No newline at end of file diff --git a/pkgs/development/compilers/llvm/8/lldb/default.nix b/pkgs/development/compilers/llvm/8/lldb/default.nix index ee1f678996a6..27ed52189b16 100644 --- a/pkgs/development/compilers/llvm/8/lldb/default.nix +++ b/pkgs/development/compilers/llvm/8/lldb/default.nix @@ -61,6 +61,12 @@ stdenv.mkDerivation rec { doCheck = false; + installCheckPhase = '' + if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + return 1; + fi + ''; + postInstall = '' mkdir -p $out/share/man/man1 cp ../docs/lldb.1 $out/share/man/man1/ diff --git a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch index b2e79086beda..eb1ca727df4a 100644 --- a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch @@ -79,3 +79,16 @@ 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/pkgs/development/compilers/llvm/9/lldb/default.nix b/pkgs/development/compilers/llvm/9/lldb/default.nix index 9957a0218da8..ee42e391b583 100644 --- a/pkgs/development/compilers/llvm/9/lldb/default.nix +++ b/pkgs/development/compilers/llvm/9/lldb/default.nix @@ -58,6 +58,12 @@ stdenv.mkDerivation rec { doCheck = false; + installCheckPhase = '' + if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + return 1; + fi + ''; + postInstall = '' # man page mkdir -p $out/share/man/man1 diff --git a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch index cb4e400b3678..a482aac57798 100644 --- a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch @@ -63,3 +63,16 @@ 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 From cc7740ae770c52ac1f385aa25cfc143fe79c6b6e Mon Sep 17 00:00:00 2001 From: tcmal Date: Wed, 9 Jun 2021 16:09:29 +0100 Subject: [PATCH 2/3] lldb: python into lib & wrap binary --- .../compilers/llvm/10/lldb/default.nix | 7 +++++-- .../compilers/llvm/10/lldb/gnu-install-dirs.patch | 15 ++++++++++++++- .../compilers/llvm/11/lldb/default.nix | 7 +++++-- .../compilers/llvm/11/lldb/gnu-install-dirs.patch | 15 ++++++++++++++- .../compilers/llvm/12/lldb/default.nix | 7 +++++-- .../compilers/llvm/12/lldb/gnu-install-dirs.patch | 15 ++++++++++++++- .../development/compilers/llvm/8/lldb/default.nix | 7 +++++-- .../compilers/llvm/8/lldb/gnu-install-dirs.patch | 13 +++++++++++++ .../development/compilers/llvm/9/lldb/default.nix | 7 +++++-- .../compilers/llvm/9/lldb/gnu-install-dirs.patch | 13 +++++++++++++ 10 files changed, 93 insertions(+), 13 deletions(-) diff --git a/pkgs/development/compilers/llvm/10/lldb/default.nix b/pkgs/development/compilers/llvm/10/lldb/default.nix index 7ce7e1f81503..a762151a586c 100644 --- a/pkgs/development/compilers/llvm/10/lldb/default.nix +++ b/pkgs/development/compilers/llvm/10/lldb/default.nix @@ -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 ]; @@ -69,12 +70,14 @@ stdenv.mkDerivation (rec { doCheck = false; installCheckPhase = '' - if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + 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 diff --git a/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch index d781779bbe00..0a7539db5e6b 100644 --- a/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch @@ -75,4 +75,17 @@ index 752113b..010f187 100644 +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}) \ No newline at end of file + 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}) diff --git a/pkgs/development/compilers/llvm/11/lldb/default.nix b/pkgs/development/compilers/llvm/11/lldb/default.nix index ed118537a5dd..46d6c6628e10 100644 --- a/pkgs/development/compilers/llvm/11/lldb/default.nix +++ b/pkgs/development/compilers/llvm/11/lldb/default.nix @@ -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 ]; @@ -69,12 +70,14 @@ stdenv.mkDerivation (rec { doCheck = false; installCheckPhase = '' - if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + 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 diff --git a/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch index ac071617dd4a..fd49be395a3a 100644 --- a/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch @@ -75,4 +75,17 @@ index 752113b..010f187 100644 +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}) \ No newline at end of file + 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}) diff --git a/pkgs/development/compilers/llvm/12/lldb/default.nix b/pkgs/development/compilers/llvm/12/lldb/default.nix index 24cbcabddad3..0712396cccfa 100644 --- a/pkgs/development/compilers/llvm/12/lldb/default.nix +++ b/pkgs/development/compilers/llvm/12/lldb/default.nix @@ -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 ]; @@ -85,12 +86,14 @@ stdenv.mkDerivation (rec { doCheck = false; installCheckPhase = '' - if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + 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 diff --git a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch index 0435784a2474..afc945ce2614 100644 --- a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch @@ -75,4 +75,17 @@ index 752113b..010f187 100644 +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}) \ No newline at end of file + 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}") diff --git a/pkgs/development/compilers/llvm/8/lldb/default.nix b/pkgs/development/compilers/llvm/8/lldb/default.nix index 27ed52189b16..b6025f722ebb 100644 --- a/pkgs/development/compilers/llvm/8/lldb/default.nix +++ b/pkgs/development/compilers/llvm/8/lldb/default.nix @@ -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 = [ @@ -62,12 +63,14 @@ stdenv.mkDerivation rec { doCheck = false; installCheckPhase = '' - if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + 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/ diff --git a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch index eb1ca727df4a..ffc946816b0d 100644 --- a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch @@ -92,3 +92,16 @@ index cdf22c4..d56fc6a 100644 ${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/pkgs/development/compilers/llvm/9/lldb/default.nix b/pkgs/development/compilers/llvm/9/lldb/default.nix index ee42e391b583..63edc60828eb 100644 --- a/pkgs/development/compilers/llvm/9/lldb/default.nix +++ b/pkgs/development/compilers/llvm/9/lldb/default.nix @@ -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 = [ @@ -59,12 +60,14 @@ stdenv.mkDerivation rec { doCheck = false; installCheckPhase = '' - if [ ! -e "$out/lib/python3.8/site-packages/lldb/_lldb.so" ] ; then + 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/ diff --git a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch index a482aac57798..7876220e4d33 100644 --- a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch @@ -76,3 +76,16 @@ index cdf22c4..d56fc6a 100644 ${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) From 674a24e5bbf3149e710d46af06c4fa22ac8ee2a6 Mon Sep 17 00:00:00 2001 From: tcmal Date: Thu, 10 Jun 2021 21:01:10 +0100 Subject: [PATCH 3/3] lldb: fix 8&9 --- .../compilers/llvm/8/lldb/gnu-install-dirs.patch | 13 +++++++++++++ .../compilers/llvm/9/lldb/gnu-install-dirs.patch | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch index ffc946816b0d..08b6fae654e5 100644 --- a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch @@ -105,3 +105,16 @@ index a9059dd..d76a47d 100644 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}) diff --git a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch index 7876220e4d33..6ceb29ced92f 100644 --- a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch @@ -89,3 +89,17 @@ index b726797..1f057ac 100644 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) +