2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-09-25 04:45:31 +00:00
|
|
|
, fetch
|
|
|
|
, cmake
|
|
|
|
, zlib
|
|
|
|
, ncurses
|
|
|
|
, swig
|
|
|
|
, which
|
|
|
|
, libedit
|
|
|
|
, libxml2
|
|
|
|
, llvm
|
|
|
|
, clang-unwrapped
|
|
|
|
, python3
|
|
|
|
, version
|
|
|
|
, darwin
|
|
|
|
, lit
|
|
|
|
, enableManpages ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (rec {
|
|
|
|
pname = "lldb";
|
|
|
|
inherit version;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
src = fetch pname "1yzjbsn81l2r3v9js2fxrglkwvz1f2rxyxh6430nydbrs0bqklz8";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
patches = [ ./lldb-procfs.patch ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake python3 which swig lit ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
ncurses
|
|
|
|
zlib
|
|
|
|
libedit
|
|
|
|
libxml2
|
|
|
|
llvm
|
|
|
|
]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [
|
2020-09-25 04:45:31 +00:00
|
|
|
darwin.libobjc
|
|
|
|
darwin.apple_sdk.libs.xpc
|
|
|
|
darwin.apple_sdk.frameworks.Foundation
|
|
|
|
darwin.bootstrap_cmds
|
|
|
|
darwin.apple_sdk.frameworks.Carbon
|
|
|
|
darwin.apple_sdk.frameworks.Cocoa
|
|
|
|
];
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2020-10-16 20:44:37 +00:00
|
|
|
"-DLLVM_ENABLE_RTTI=OFF"
|
2020-09-25 04:45:31 +00:00
|
|
|
"-DClang_DIR=${clang-unwrapped}/lib/cmake"
|
|
|
|
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2020-09-25 04:45:31 +00:00
|
|
|
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
2020-10-16 20:44:37 +00:00
|
|
|
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals enableManpages [
|
2020-09-25 04:45:31 +00:00
|
|
|
"-DLLVM_ENABLE_SPHINX=ON"
|
|
|
|
"-DSPHINX_OUTPUT_MAN=ON"
|
|
|
|
"-DSPHINX_OUTPUT_HTML=OFF"
|
2020-10-16 20:44:37 +00:00
|
|
|
];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Editor support
|
|
|
|
# vscode:
|
|
|
|
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
|
|
|
|
mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
|
|
|
|
ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-09-25 04:45:31 +00:00
|
|
|
description = "A next-generation high-performance debugger";
|
|
|
|
homepage = "https://lldb.llvm.org";
|
|
|
|
license = licenses.ncsa;
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2021-02-05 17:12:51 +00:00
|
|
|
} // lib.optionalAttrs enableManpages {
|
2020-09-25 04:45:31 +00:00
|
|
|
pname = "lldb-manpages";
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make docs-lldb-man
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# manually install lldb man page
|
|
|
|
mkdir -p $out/share/man/man1
|
|
|
|
install docs/man/lldb.1 -t $out/share/man/man1/
|
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = null;
|
|
|
|
postInstall = null;
|
|
|
|
|
|
|
|
outputs = [ "out" ];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta.description = "man pages for LLDB ${version}";
|
|
|
|
})
|