mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
Compare commits
8 Commits
d8ca282fc0
...
bump-llvm-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d30a7e37e | ||
|
|
399f05e523 | ||
|
|
33144afc52 | ||
|
|
18432fbe7e | ||
|
|
12e2b297af | ||
|
|
b027a36262 | ||
|
|
54e7bb38e9 | ||
|
|
9843d0dd57 |
@@ -306,6 +306,10 @@ in let
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libclc = callPackage ./libclc {
|
||||
inherit llvm_meta targetLlvm;
|
||||
};
|
||||
|
||||
libcxxabi = let
|
||||
# CMake will "require" a compiler capable of compiling C++ programs
|
||||
# cxx-header's build does not actually use one so it doesn't really matter
|
||||
|
||||
62
pkgs/development/compilers/llvm/15/libclc/default.nix
Normal file
62
pkgs/development/compilers/llvm/15/libclc/default.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, llvm_meta
|
||||
, monorepoSrc
|
||||
, runCommand
|
||||
, cmake
|
||||
, ninja
|
||||
, python3
|
||||
, llvm
|
||||
, targetLlvm
|
||||
, clang-unwrapped
|
||||
, spirv-llvm-translator
|
||||
, version
|
||||
} @ args:
|
||||
|
||||
let
|
||||
llvm = if stdenv.buildPlatform == stdenv.hostPlatform then args.llvm else targetLlvm;
|
||||
spirv = spirv-llvm-translator.override {
|
||||
llvm = args.llvm; # use LLVM for the build platform here, not targetLlvm
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libclc";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
'';
|
||||
|
||||
# cmake expects all required binaries to be in the same place, so it will not be able to find clang without the patch
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace 'find_program( LLVM_CLANG clang PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
||||
'find_program( LLVM_CLANG clang PATHS "${clang-unwrapped}/bin" NO_DEFAULT_PATH )' \
|
||||
--replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
||||
'find_program( LLVM_SPIRV llvm-spirv PATHS "${spirv}/bin" NO_DEFAULT_PATH )'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 spirv ];
|
||||
buildInputs = [ llvm clang-unwrapped ];
|
||||
strictDeps = true;
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
||||
# the libclc build uses the `clang` we pass in to build OpenCL C files but
|
||||
# we don't want it to use this `clang` for building C/C++ files
|
||||
#
|
||||
# usually the `cmake` setup hook passes in `-DCMAKE_CXX_COMPILER=$CXX` where
|
||||
# `$CXX` is the name of the compiler (i.e. `g++`, `clang++`, etc); in cases
|
||||
# where the stdenv is `clang` based this causes `cmake` to search `$PATH`
|
||||
# for `clang++` and to find our unwrapped `clang` instead of the stdenv's
|
||||
#
|
||||
# so, we explicitly tell CMake to use the C/C++ compiler from the stdenv:
|
||||
"-DCMAKE_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
|
||||
"-DCMAKE_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
|
||||
];
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "http://libclc.llvm.org/";
|
||||
description = "Implementation of the library requirements of the OpenCL C programming language";
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
# This is the default binutils, but with *this* version of LLD rather
|
||||
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||
# the `useLLVM` bootstrapping below.
|
||||
, targetLlvm
|
||||
, bootBintoolsNoLibc ?
|
||||
if stdenv.targetPlatform.linker == "lld"
|
||||
then null
|
||||
@@ -257,6 +258,10 @@ let
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libclc = callPackage ./libclc {
|
||||
inherit llvm_meta targetLlvm;
|
||||
};
|
||||
|
||||
libcxxabi = let
|
||||
# CMake will "require" a compiler capable of compiling C++ programs
|
||||
# cxx-header's build does not actually use one so it doesn't really matter
|
||||
@@ -296,7 +301,7 @@ let
|
||||
};
|
||||
|
||||
openmp = callPackage ./openmp {
|
||||
inherit llvm_meta;
|
||||
inherit llvm_meta targetLlvm;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
62
pkgs/development/compilers/llvm/git/libclc/default.nix
Normal file
62
pkgs/development/compilers/llvm/git/libclc/default.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, llvm_meta
|
||||
, monorepoSrc
|
||||
, runCommand
|
||||
, cmake
|
||||
, ninja
|
||||
, python3
|
||||
, llvm
|
||||
, targetLlvm
|
||||
, clang-unwrapped
|
||||
, spirv-llvm-translator
|
||||
, version
|
||||
} @ args:
|
||||
|
||||
let
|
||||
llvm = if stdenv.buildPlatform == stdenv.hostPlatform then args.llvm else targetLlvm;
|
||||
spirv = spirv-llvm-translator.override {
|
||||
llvm = args.llvm; # use LLVM for the build platform here, not targetLlvm
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libclc";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
'';
|
||||
|
||||
# cmake expects all required binaries to be in the same place, so it will not be able to find clang without the patch
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace 'find_program( LLVM_CLANG clang PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
||||
'find_program( LLVM_CLANG clang PATHS "${clang-unwrapped}/bin" NO_DEFAULT_PATH )' \
|
||||
--replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
||||
'find_program( LLVM_SPIRV llvm-spirv PATHS "${spirv}/bin" NO_DEFAULT_PATH )'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 spirv ];
|
||||
buildInputs = [ llvm clang-unwrapped ];
|
||||
strictDeps = true;
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
||||
# the libclc build uses the `clang` we pass in to build OpenCL C files but
|
||||
# we don't want it to use this `clang` for building C/C++ files
|
||||
#
|
||||
# usually the `cmake` setup hook passes in `-DCMAKE_CXX_COMPILER=$CXX` where
|
||||
# `$CXX` is the name of the compiler (i.e. `g++`, `clang++`, etc); in cases
|
||||
# where the stdenv is `clang` based this causes `cmake` to search `$PATH`
|
||||
# for `clang++` and to find our unwrapped `clang` instead of the stdenv's
|
||||
#
|
||||
# so, we explicitly tell CMake to use the C/C++ compiler from the stdenv:
|
||||
"-DCMAKE_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
|
||||
"-DCMAKE_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
|
||||
];
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "http://libclc.llvm.org/";
|
||||
description = "Implementation of the library requirements of the OpenCL C programming language";
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
, cmake
|
||||
, ninja
|
||||
, llvm
|
||||
, targetLlvm
|
||||
, lit
|
||||
, clang-unwrapped
|
||||
, perl
|
||||
@@ -34,7 +35,9 @@ stdenv.mkDerivation rec {
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [ cmake ninja perl pkg-config lit ];
|
||||
buildInputs = [ llvm ];
|
||||
buildInputs = [
|
||||
(if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
|
||||
];
|
||||
|
||||
# Unsup:Pass:XFail:Fail
|
||||
# 26:267:16:8
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
, llvm
|
||||
, spirv-headers
|
||||
, spirv-tools
|
||||
, testers
|
||||
}:
|
||||
|
||||
let
|
||||
# TODO(rrbutani): use release-version instead of version to support
|
||||
# `llvmPackages_git`.
|
||||
llvmMajor = lib.versions.major llvm.version;
|
||||
isROCm = lib.hasPrefix "rocm" llvm.pname;
|
||||
|
||||
@@ -28,7 +31,7 @@ let
|
||||
hash = "sha256-NoIoa20+2sH41rEnr8lsMhtfesrtdPINiXtUnxYVm8s=";
|
||||
} else throw "Incompatible LLVM version.";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "SPIRV-LLVM-Translator";
|
||||
inherit (branch) version;
|
||||
|
||||
@@ -64,11 +67,26 @@ stdenv.mkDerivation {
|
||||
install -D tools/llvm-spirv/llvm-spirv $out/bin/llvm-spirv
|
||||
'';
|
||||
|
||||
# On macOS the produced binaries' rpath references the build dir and is *not*
|
||||
# rewritten to the install dir by cmake during installation (when
|
||||
# `CMAKE_SKIP_BUILD_RPATH` is set to `Off`). So, we set rpath ourselves.
|
||||
preFixup = lib.optional stdenv.hostPlatform.isDarwin ''
|
||||
for exe in "$out/bin/"* ; do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -add_rpath "$out/lib" "$exe"
|
||||
done
|
||||
'';
|
||||
|
||||
passthru.tests.version = with finalAttrs; testers.testVersion {
|
||||
package = finalPackage;
|
||||
version = llvm.version;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/KhronosGroup/SPIRV-LLVM-Translator";
|
||||
description = "A tool and a library for bi-directional translation between SPIR-V and LLVM IR";
|
||||
license = licenses.ncsa;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ gloaming ];
|
||||
mainProgram = "llvm-spirv";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -307,6 +307,17 @@ in stdenv.mkDerivation {
|
||||
sha256 = "1rma1al0rbm3s3ql6bnvbcighp74lri1lcrwbyacgdqp80fgw1b6";
|
||||
}}
|
||||
|
||||
${lib.optionalString (!stdenv.isDarwin) ''
|
||||
# Needed to build with clang 15+ without disabling warnings; can drop this
|
||||
# once we update to 5.8.x.
|
||||
patch -p1 -d swift-corelibs-libdispatch -i ${fetchpatch {
|
||||
name = "swift-corelibs-libdispatch-fix-unused-but-set-warning";
|
||||
url = "https://github.com/apple/swift-corelibs-libdispatch/commit/915f25141a7c57b6a2a3bc8697572644af181ec5.patch";
|
||||
sha256 = "sha256-gxhMwSlE/y4LkOvmCaDMPjd7EcoX6xaacK4MLa3mOUM=";
|
||||
includes = ["src/shims/yield.c"];
|
||||
}}
|
||||
''}
|
||||
|
||||
${lib.optionalString stdenv.isLinux ''
|
||||
substituteInPlace llvm-project/clang/lib/Driver/ToolChains/Linux.cpp \
|
||||
--replace 'SysRoot + "/lib' '"${glibc}/lib" "' \
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, callPackage
|
||||
, fetchpatch
|
||||
, cmake
|
||||
, ninja
|
||||
, useSwift ? true, swift
|
||||
@@ -19,7 +20,18 @@ in stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake ]
|
||||
++ lib.optionals useSwift [ ninja swift ];
|
||||
|
||||
patches = [ ./disable-swift-overlay.patch ];
|
||||
patches = [
|
||||
./disable-swift-overlay.patch
|
||||
|
||||
# Needed to build with clang 15+ without disabling warnings; can drop this
|
||||
# once we update to 5.8.x.
|
||||
(fetchpatch {
|
||||
name = "swift-corelibs-libdispatch-fix-unused-but-set-warning";
|
||||
url = "https://github.com/apple/swift-corelibs-libdispatch/commit/915f25141a7c57b6a2a3bc8697572644af181ec5.patch";
|
||||
sha256 = "sha256-gxhMwSlE/y4LkOvmCaDMPjd7EcoX6xaacK4MLa3mOUM=";
|
||||
includes = ["src/shims/yield.c"];
|
||||
})
|
||||
];
|
||||
|
||||
cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON";
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
{ lib, stdenv, fetchFromGitHub, ninja, cmake, python3, llvmPackages, spirv-llvm-translator }:
|
||||
|
||||
let
|
||||
llvm = llvmPackages.llvm;
|
||||
clang-unwrapped = llvmPackages.clang-unwrapped;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libclc";
|
||||
version = "15.0.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "llvm";
|
||||
repo = "llvm-project";
|
||||
rev = "llvmorg-${version}";
|
||||
sha256 = "sha256-wjuZQyXQ/jsmvy6y1aksCcEDXGBjuhpgngF3XQJ/T4s=";
|
||||
};
|
||||
sourceRoot = "source/libclc";
|
||||
|
||||
# cmake expects all required binaries to be in the same place, so it will not be able to find clang without the patch
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace 'find_program( LLVM_CLANG clang PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
||||
'find_program( LLVM_CLANG clang PATHS "${clang-unwrapped}/bin" NO_DEFAULT_PATH )' \
|
||||
--replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
||||
'find_program( LLVM_SPIRV llvm-spirv PATHS "${spirv-llvm-translator}/bin" NO_DEFAULT_PATH )'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 spirv-llvm-translator ];
|
||||
buildInputs = [ llvm clang-unwrapped ];
|
||||
strictDeps = true;
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
broken = stdenv.isDarwin;
|
||||
homepage = "http://libclc.llvm.org/";
|
||||
description = "Implementation of the library requirements of the OpenCL C programming language";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -1867,6 +1867,7 @@ mapAliases ({
|
||||
inherit (stdenvAdapters) overrideCC;
|
||||
buildLlvmTools = buildPackages.llvmPackages_git.tools;
|
||||
targetLlvmLibraries = targetPackages.llvmPackages_git.libraries or llvmPackages_git.libraries;
|
||||
targetLlvm = targetPackages.llvmPackages_git.llvm or llvmPackages_git.llvm;
|
||||
});
|
||||
|
||||
# Added 2022-01-28
|
||||
|
||||
@@ -15547,7 +15547,7 @@ with pkgs;
|
||||
targetLlvm = targetPackages.llvmPackages_15.llvm or llvmPackages_15.llvm;
|
||||
}));
|
||||
|
||||
llvmPackages_latest = llvmPackages_14;
|
||||
llvmPackages_latest = llvmPackages_15;
|
||||
|
||||
llvmPackages_rocm = recurseIntoAttrs (callPackage ../development/compilers/llvm/rocm { });
|
||||
|
||||
@@ -21191,9 +21191,7 @@ with pkgs;
|
||||
|
||||
libcint = callPackage ../development/libraries/libcint { };
|
||||
|
||||
libclc = callPackage ../development/libraries/libclc {
|
||||
llvmPackages = llvmPackages_latest;
|
||||
};
|
||||
libclc = llvmPackages_latest.libclc;
|
||||
|
||||
libcli = callPackage ../development/libraries/libcli { };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user