diff options
Diffstat (limited to 'pkgs/development/compilers/llvm')
-rw-r--r-- | pkgs/development/compilers/llvm/12/default.nix | 13 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/13/default.nix | 14 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/14/default.nix | 12 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/15/default.nix | 12 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/16/default.nix | 12 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/17/default.nix | 12 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/18/default.nix | 12 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/common/clang-tools/default.nix | 59 | ||||
-rwxr-xr-x | pkgs/development/compilers/llvm/common/clang-tools/wrapper | 27 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/common/clang/default.nix | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/git/default.nix | 18 |
11 files changed, 170 insertions, 23 deletions
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index d3b823215c52f..c7c119a45b8ae 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -1,7 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, substitute, substituteAll, fetchFromGitHub, fetchpatch -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub, fetchpatch, fetchurl +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -17,6 +17,10 @@ then null else pkgs.bintools , darwin +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: let @@ -145,6 +149,9 @@ let # python3 = pkgs.python3; # don't use python-boot # }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 0b231a91512b8..ffbbe1deb0d4e 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -1,7 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, fetchpatch -, libxml2, python3, isl, fetchFromGitHub, substitute, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub, fetchpatch +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -40,7 +40,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null - +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -171,6 +174,9 @@ in let # python3 = pkgs.python3; # don't use python-boot # }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index a80b3aa4ffff7..06972af065c98 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -1,6 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, libxml2, python3, fetchFromGitHub, substitute, substituteAll, fetchpatch, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub, fetchpatch +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -39,6 +40,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -140,6 +145,9 @@ in let # python3 = pkgs.python3; # don't use python-boot # }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix index e30e9f9a59db7..e50e35b2c4eb0 100644 --- a/pkgs/development/compilers/llvm/15/default.nix +++ b/pkgs/development/compilers/llvm/15/default.nix @@ -1,6 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, libxml2, python3, fetchFromGitHub, fetchpatch, substitute, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub, fetchpatch +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -39,6 +40,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -183,6 +188,9 @@ in let python3 = pkgs.python3; # don't use python-boot }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix index 426bcb4c46d88..80b2424b14cc0 100644 --- a/pkgs/development/compilers/llvm/16/default.nix +++ b/pkgs/development/compilers/llvm/16/default.nix @@ -1,6 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -39,6 +40,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -177,6 +182,9 @@ in let python3 = pkgs.python3; # don't use python-boot }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM diff --git a/pkgs/development/compilers/llvm/17/default.nix b/pkgs/development/compilers/llvm/17/default.nix index a6d7f48eb800c..84979d24b1971 100644 --- a/pkgs/development/compilers/llvm/17/default.nix +++ b/pkgs/development/compilers/llvm/17/default.nix @@ -1,6 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, libxml2, python3, fetchFromGitHub, fetchpatch, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub, fetchpatch +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -39,6 +40,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -171,6 +176,9 @@ in let python3 = pkgs.python3; # don't use python-boot }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM diff --git a/pkgs/development/compilers/llvm/18/default.nix b/pkgs/development/compilers/llvm/18/default.nix index d62ae9c820b21..878f1e3a8e7e4 100644 --- a/pkgs/development/compilers/llvm/18/default.nix +++ b/pkgs/development/compilers/llvm/18/default.nix @@ -1,6 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -39,6 +40,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -171,6 +176,9 @@ in let python3 = pkgs.python3; # don't use python-boot }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM diff --git a/pkgs/development/compilers/llvm/common/clang-tools/default.nix b/pkgs/development/compilers/llvm/common/clang-tools/default.nix new file mode 100644 index 0000000000000..7ecf0c5c431de --- /dev/null +++ b/pkgs/development/compilers/llvm/common/clang-tools/default.nix @@ -0,0 +1,59 @@ +{ + lib, + stdenv, + clang-unwrapped, + clang, + libcxxClang, + llvm_meta, + # enableLibcxx will use the c++ headers from clang instead of gcc. + # This shouldn't have any effect on platforms that use clang as the default compiler already. + enableLibcxx ? false, +}: + +stdenv.mkDerivation { + unwrapped = clang-unwrapped; + + pname = "clang-tools"; + version = lib.getVersion clang-unwrapped; + dontUnpack = true; + clang = if enableLibcxx then libcxxClang else clang; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + + for tool in $unwrapped/bin/clang-*; do + tool=$(basename "$tool") + + # Compilers have their own derivation, no need to include them here: + if [[ $tool == "clang-cl" || $tool == "clang-cpp" ]]; then + continue + fi + + # Clang's derivation produces a lot of binaries, but the tools we are + # interested in follow the `clang-something` naming convention - except + # for clang-$version (e.g. clang-13), which is the compiler again: + if [[ ! $tool =~ ^clang\-[a-zA-Z_\-]+$ ]]; then + continue + fi + + ln -s $out/bin/clangd $out/bin/$tool + done + + if [[ -z "$(ls -A $out/bin)" ]]; then + echo "Found no binaries - maybe their location or naming convention changed?" + exit 1 + fi + + substituteAll ${./wrapper} $out/bin/clangd + chmod +x $out/bin/clangd + + runHook postInstall + ''; + + meta = llvm_meta // { + description = "Standalone command line tools for C++ development"; + maintainers = with lib.maintainers; [ patryk27 ]; + }; +} diff --git a/pkgs/development/compilers/llvm/common/clang-tools/wrapper b/pkgs/development/compilers/llvm/common/clang-tools/wrapper new file mode 100755 index 0000000000000..1008023fdc0d1 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/clang-tools/wrapper @@ -0,0 +1,27 @@ +#!/bin/sh + +buildcpath() { + local path after + while (( $# )); do + case $1 in + -isystem) + shift + path=$path${path:+':'}$1 + ;; + -idirafter) + shift + after=$after${after:+':'}$1 + ;; + esac + shift + done + echo $path${after:+':'}$after +} + +export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \ + $(<@clang@/nix-support/libc-cflags)):@clang@/resource-root/include +export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \ + $(<@clang@/nix-support/libcxx-cxxflags) \ + $(<@clang@/nix-support/libc-cflags)):@clang@/resource-root/include + +exec -a "$0" @unwrapped@/bin/$(basename $0) "$@" diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix index e597ec4d604b1..dc175e085f0b6 100644 --- a/pkgs/development/compilers/llvm/common/clang/default.nix +++ b/pkgs/development/compilers/llvm/common/clang/default.nix @@ -198,7 +198,7 @@ let ''; }) // (lib.optionalAttrs (lib.versionAtLeast release_version "15") { - env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform && !stdenv.hostPlatform.useLLVM) { # The following warning is triggered with (at least) gcc >= # 12, but appears to occur only for cross compiles. NIX_CFLAGS_COMPILE = "-Wno-maybe-uninitialized"; diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 464c405dc0606..ff76aad22a718 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -1,6 +1,7 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja +{ lowPrio, newScope, pkgs, lib, stdenv , preLibcCrossHeaders -, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith +, substitute, substituteAll, fetchFromGitHub, fetchpatch +, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross , targetLlvm @@ -19,9 +20,9 @@ # LLVM release information; specify one of these but not both: , gitRelease ? { version = "19.0.0-git"; - rev = "78ee473784e5ef6f0b19ce4cb111fb6e4d23c6b2"; - rev-version = "19.0.0-unstable-2024-06-12"; - sha256 = "sha256-oLVMwWjo6Nt8ZsTnDTfoiM5U0+1lVIc1NO+4qBNYlzs="; + rev = "a9ac31910db3975d5e92a6265ab29dafd6a4691d"; + rev-version = "19.0.0-unstable-2024-06-23"; + sha256 = "sha256-MTt2FU84rgu6FqB9aCO6M54VZexoogkdx5RKS1NzSkk="; } # i.e.: # { @@ -44,6 +45,10 @@ # to you to make sure that the LLVM repo given matches the release configuration # specified. , monorepoSrc ? null +# Allows passthrough to packages via newScope. This makes it possible to +# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get +# an llvmPackages whose packages are overridden in an internally consistent way. +, ... }@args: assert @@ -176,6 +181,9 @@ in let python3 = pkgs.python3; # don't use python-boot }); + # Wrapper for standalone command line utilities + clang-tools = callPackage ../common/clang-tools { }; + # pick clang appropriate for package set we are targeting clang = /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM |