diff options
author | Artturi <Artturin@artturin.com> | 2023-09-06 21:17:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-06 21:17:12 +0300 |
commit | 872e54e9e72665421ba81327780313b915272a8b (patch) | |
tree | cf7a95421840869f700d842ceffe87f7331d378f | |
parent | 0d16a6b6a59e490a0b18d3a8a17ceca6267e1b44 (diff) | |
parent | d7d68a1a04b8846bff8b5816679441ad5c97f290 (diff) | |
download | nixpkgs-872e54e9e72665421ba81327780313b915272a8b.tar nixpkgs-872e54e9e72665421ba81327780313b915272a8b.tar.gz nixpkgs-872e54e9e72665421ba81327780313b915272a8b.tar.bz2 nixpkgs-872e54e9e72665421ba81327780313b915272a8b.tar.lz nixpkgs-872e54e9e72665421ba81327780313b915272a8b.tar.xz nixpkgs-872e54e9e72665421ba81327780313b915272a8b.tar.zst nixpkgs-872e54e9e72665421ba81327780313b915272a8b.zip |
Merge pull request #253533 from Artturin/llvmusesuball
-rw-r--r-- | pkgs/development/compilers/llvm/10/default.nix | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/11/default.nix | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/12/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/13/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/14/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/15/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/16/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/common/lldb.nix | 69 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/git/default.nix | 25 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/git/lldb/default.nix | 144 |
10 files changed, 92 insertions, 225 deletions
diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix index 08fe9380284..81bfe3e0c4e 100644 --- a/pkgs/development/compilers/llvm/10/default.nix +++ b/pkgs/development/compilers/llvm/10/default.nix @@ -137,7 +137,7 @@ let ./lldb/procfs.patch ./lldb/gnu-install-dirs.patch ]; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix index 41344619c3f..a54b332e3e6 100644 --- a/pkgs/development/compilers/llvm/11/default.nix +++ b/pkgs/development/compilers/llvm/11/default.nix @@ -152,7 +152,7 @@ let ./lldb/procfs.patch ./lldb/gnu-install-dirs.patch ]; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index 9f8d75061c3..0d4d0e6ecc3 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -139,19 +139,20 @@ let src = fetch "lldb" "0g3pj1m3chafavpr35r9fynm85y2hdyla6klj0h28khxs2613i78"; patches = let - resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch" - { - clangLibDir = "${libclang.lib}/lib"; - } '' - substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir - '')) { }; + resourceDirPatch = callPackage + ({ substituteAll, libclang }: substituteAll + { + src = ./lldb/resource-dir.patch; + clangLibDir = "${libclang.lib}/lib"; + }) + { }; in [ ./lldb/procfs.patch resourceDirPatch ./lldb/gnu-install-dirs.patch ]; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 37abf41a324..06a157f7a8f 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -138,12 +138,13 @@ let lldb = callPackage ../common/lldb.nix { patches = let - resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch" - { - clangLibDir = "${libclang.lib}/lib"; - } '' - substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir - '')) { }; + resourceDirPatch = callPackage + ({ substituteAll, libclang }: substituteAll + { + src = ./lldb/resource-dir.patch; + clangLibDir = "${libclang.lib}/lib"; + }) + { }; in [ ./lldb/procfs.patch @@ -164,7 +165,7 @@ let && !stdenv.targetPlatform.isAarch64 && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0") ) ./lldb/cpu_subtype_arm64e_replacement.patch; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 5a198cbbbbe..8b0dc428d39 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -139,12 +139,13 @@ let lldb = callPackage ../common/lldb.nix { patches = let - resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch" - { - clangLibDir = "${libclang.lib}/lib"; - } '' - substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir - '')) { }; + resourceDirPatch = callPackage + ({ substituteAll, libclang }: substituteAll + { + src = ./lldb/resource-dir.patch; + clangLibDir = "${libclang.lib}/lib"; + }) + { }; in [ ./lldb/procfs.patch @@ -165,7 +166,7 @@ let && !stdenv.targetPlatform.isAarch64 && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0") ) ./lldb/cpu_subtype_arm64e_replacement.patch; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix index 418383d3ce8..6fabe6edec6 100644 --- a/pkgs/development/compilers/llvm/15/default.nix +++ b/pkgs/development/compilers/llvm/15/default.nix @@ -187,12 +187,13 @@ in let lldb = callPackage ../common/lldb.nix { patches = let - resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch" - { - clangLibDir = "${libclang.lib}/lib"; - } '' - substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir - '')) { }; + resourceDirPatch = callPackage + ({ substituteAll, libclang }: substituteAll + { + src = ./lldb/resource-dir.patch; + clangLibDir = "${libclang.lib}/lib"; + }) + { }; in [ ./lldb/procfs.patch @@ -213,7 +214,7 @@ in let && !stdenv.targetPlatform.isAarch64 && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0") ) ./lldb/cpu_subtype_arm64e_replacement.patch; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix index b3a73a6fe19..9d7981ec3da 100644 --- a/pkgs/development/compilers/llvm/16/default.nix +++ b/pkgs/development/compilers/llvm/16/default.nix @@ -192,12 +192,13 @@ in let '') { }; patches = let - resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch" - { - clangLibDir = "${libclang.lib}/lib"; - } '' - substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir - '')) { }; + resourceDirPatch = callPackage + ({ substituteAll, libclang }: substituteAll + { + src = ./lldb/resource-dir.patch; + clangLibDir = "${libclang.lib}/lib"; + }) + { }; in [ # FIXME: do we need this? ./procfs.patch @@ -218,7 +219,7 @@ in let && !stdenv.targetPlatform.isAarch64 && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0") ) ./lldb/cpu_subtype_arm64e_replacement.patch; - inherit llvm_meta release_version; + inherit llvm_meta; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/common/lldb.nix b/pkgs/development/compilers/llvm/common/lldb.nix index 82ad9c304ea..1f5d4a1e338 100644 --- a/pkgs/development/compilers/llvm/common/lldb.nix +++ b/pkgs/development/compilers/llvm/common/lldb.nix @@ -45,25 +45,21 @@ stdenv.mkDerivation (rec { outputs = [ "out" "lib" "dev" ]; - sourceRoot = - if lib.versionOlder release_version "13" then null - else "${src.name}/${pname}"; + sourceRoot = lib.optional (lib.versionAtLeast release_version "13") "${src.name}/${pname}"; nativeBuildInputs = [ cmake - ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - ninja - ] ++ [ python3 which swig lit makeWrapper - ] ++ lib.optionals (lib.versionAtLeast release_version "14") [ lua5_3 ] ++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark + ] ++ lib.optionals (lib.versionAtLeast release_version "14") [ + ninja ]; buildInputs = [ @@ -87,11 +83,13 @@ stdenv.mkDerivation (rec { # # See here for context: # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132 - ++ lib.optional ( + ++ lib.optional + ( stdenv.targetPlatform.isDarwin - && !stdenv.targetPlatform.isAarch64 - && (lib.versionAtLeast release_version "15") - ) ( + && !stdenv.targetPlatform.isAarch64 + && (lib.versionAtLeast release_version "15") + ) + ( runCommand "bsm-audit-session-header" { } '' install -Dm444 \ "${lib.getDev darwin.apple_sdk.sdk}/include/bsm/audit_session.h" \ @@ -104,7 +102,7 @@ stdenv.mkDerivation (rec { cmakeFlags = [ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}" "-DLLVM_ENABLE_RTTI=OFF" - "-DClang_DIR=${libclang.dev}/lib/cmake" + "-DClang_DIR=${lib.getDev libclang}/lib/cmake" "-DLLVM_EXTERNAL_LIT=${lit}/bin/lit" ] ++ lib.optionals stdenv.isDarwin [ "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON" @@ -127,28 +125,21 @@ stdenv.mkDerivation (rec { ]; doCheck = false; + doInstallCheck = lib.versionOlder release_version "15"; # TODO: cleanup with mass-rebuild - installCheckPhase = - if ((lib.versions.major release_version) == "14") then '' - if [ ! -e $lib/${python3.sitePackages}/lldb/_lldb*.so ] ; then - echo "ERROR: python files not installed where expected!"; - return 1; - fi - if [ ! -e "$lib/lib/lua/${lua5_3.luaversion}/lldb.so" ] ; then - echo "ERROR: lua files not installed where expected!"; - return 1; - fi - '' else if (((lib.versions.major release_version) == "15") || (lib.versions.major release_version) == "16") then '' - if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then - return 1; - fi - '' else '' - if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then - echo "ERROR: python files not installed where expected!"; - return 1; - fi - ''; + installCheckPhase = '' + if [ ! -e $lib/${python3.sitePackages}/lldb/_lldb*.so ] ; then + echo "ERROR: python files not installed where expected!"; + return 1; + fi + '' # Something lua is built on older versions but this file doesn't exist. + + lib.optionalString (lib.versionAtLeast release_version "14") '' + if [ ! -e "$lib/lib/lua/${lua5_3.luaversion}/lldb.so" ] ; then + echo "ERROR: lua files not installed where expected!"; + return 1; + fi + ''; postInstall = '' wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/ @@ -157,7 +148,7 @@ stdenv.mkDerivation (rec { # 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/${if (lib.versionOlder release_version "12") then "llvm-vscode" else "lldb-vscode"} $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin + ln -s $out/bin/*-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin ''; meta = llvm_meta // { @@ -174,17 +165,15 @@ stdenv.mkDerivation (rec { (lib.versionOlder release_version "11" && stdenv.isDarwin && stdenv.isAarch64) || (((lib.versions.major release_version) == "13") && stdenv.isDarwin); }; -} // lib.optionalAttrs (lib.versionOlder release_version "15") { - doInstallCheck = true; } // lib.optionalAttrs enableManpages { pname = "lldb-manpages"; - buildPhase = - if lib.versionOlder release_version "15" then '' - make ${if (lib.versionOlder release_version "12") then "docs-man" else "docs-lldb-man"} - '' else null; + buildPhase = lib.optionalString (lib.versionOlder release_version "15") '' + make ${if (lib.versionOlder release_version "12") then "docs-man" else "docs-lldb-man"} + ''; + - ninjaFlags = if lib.versionAtLeast release_version "15" then [ "docs-lldb-man" ] else null; + ninjaFlags = lib.optionals (lib.versionAtLeast release_version "15") [ "docs-lldb-man" ]; propagatedBuildInputs = [ ]; diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 1504674da7e..3f970d2d1c3 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -184,11 +184,28 @@ in let inherit llvm_meta; }; - lldb = callPackage ./lldb { + lldb = callPackage ../common/lldb.nix { + src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/lldb "$out" + '') { }; + patches = + let + resourceDirPatch = callPackage + ({ substituteAll, libclang }: substituteAll + { + src = ./lldb/resource-dir.patch; + clangLibDir = "${libclang.lib}/lib"; + }) + { }; + in + [ + ./lldb/procfs.patch # FIXME: do we need this? + resourceDirPatch + ./lldb/gnu-install-dirs.patch + ]; inherit llvm_meta; - inherit (darwin) libobjc bootstrap_cmds; - inherit (darwin.apple_sdk.libs) xpc; - inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa; }; # Below, is the LLVM bootstrapping logic. It handles building a diff --git a/pkgs/development/compilers/llvm/git/lldb/default.nix b/pkgs/development/compilers/llvm/git/lldb/default.nix deleted file mode 100644 index a02c5ca4b13..00000000000 --- a/pkgs/development/compilers/llvm/git/lldb/default.nix +++ /dev/null @@ -1,144 +0,0 @@ -{ lib, stdenv, llvm_meta -, runCommand -, monorepoSrc -, cmake -, ninja -, zlib -, ncurses -, swig -, which -, libedit -, libxml2 -, libllvm -, libclang -, python3 -, version -, libobjc -, xpc -, Foundation -, bootstrap_cmds -, Carbon -, Cocoa -, lit -, makeWrapper -, enableManpages ? false -, lua5_3 -}: - -stdenv.mkDerivation (rec { - pname = "lldb"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./procfs.patch - (runCommand "resource-dir.patch" { - clangLibDir = "${libclang.lib}/lib"; - } '' - substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir - '') - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "lib" "dev" ]; - - nativeBuildInputs = [ - cmake ninja python3 which swig lit makeWrapper lua5_3 - ] ++ lib.optionals enableManpages [ - python3.pkgs.sphinx python3.pkgs.recommonmark - ]; - - buildInputs = [ - ncurses - zlib - libedit - libxml2 - libllvm - ] ++ lib.optionals stdenv.isDarwin [ - libobjc - xpc - Foundation - bootstrap_cmds - Carbon - Cocoa - ]; - - hardeningDisable = [ "format" ]; - - cmakeFlags = [ - "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}" - "-DLLVM_ENABLE_RTTI=OFF" - "-DClang_DIR=${libclang.dev}/lib/cmake" - "-DLLVM_EXTERNAL_LIT=${lit}/bin/lit" - ] ++ lib.optionals stdenv.isDarwin [ - "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON" - ] ++ lib.optionals (!stdenv.isDarwin) [ - "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic - ] ++ lib.optionals enableManpages [ - "-DLLVM_ENABLE_SPHINX=ON" - "-DSPHINX_OUTPUT_MAN=ON" - "-DSPHINX_OUTPUT_HTML=OFF" - ] ++ lib.optionals doCheck [ - "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" - "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++" - ]; - - 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 - 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 - ''; - - meta = llvm_meta // { - homepage = "https://lldb.llvm.org/"; - description = "A next-generation high-performance debugger"; - longDescription = '' - LLDB is a next generation, high-performance debugger. It is built as a set - of reusable components which highly leverage existing libraries in the - larger LLVM Project, such as the Clang expression parser and LLVM - disassembler. - ''; - }; -} // lib.optionalAttrs enableManpages { - pname = "lldb-manpages"; - - ninjaFlags = [ "docs-lldb-man" ]; - - propagatedBuildInputs = []; - - # manually install lldb man page - installPhase = '' - 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 = llvm_meta // { - description = "man pages for LLDB ${version}"; - }; -}) |