2022-03-03 09:18:17 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ninja, cmake, python3, llvmPackages, spirv-llvm-translator }:
|
2017-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
llvm = llvmPackages.llvm;
|
2019-06-09 12:51:48 +01:00
|
|
|
clang-unwrapped = llvmPackages.clang-unwrapped;
|
2017-12-01 00:00:00 +00:00
|
|
|
in
|
2015-03-28 20:54:27 +00:00
|
|
|
|
2021-07-20 16:25:02 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libclc";
|
2022-03-03 09:18:17 +00:00
|
|
|
version = "12.0.1";
|
2015-03-28 20:54:27 +00:00
|
|
|
|
2015-05-13 14:32:32 +01:00
|
|
|
src = fetchFromGitHub {
|
2021-07-20 16:25:02 +01:00
|
|
|
owner = "llvm";
|
|
|
|
repo = "llvm-project";
|
|
|
|
rev = "llvmorg-${version}";
|
2022-03-03 09:18:17 +00:00
|
|
|
sha256 = "08s5w2db9imb2yaqsvxs6pg21csi1cf6wa35rf8x6q07mam7j8qv";
|
2015-03-28 20:54:27 +00:00
|
|
|
};
|
2021-07-20 16:25:02 +01:00
|
|
|
sourceRoot = "source/libclc";
|
2015-03-28 20:54:27 +00:00
|
|
|
|
2021-07-20 16:25:02 +01:00
|
|
|
# cmake expects all required binaries to be in the same place, so it will not be able to find clang without the patch
|
2015-03-28 20:54:27 +00:00
|
|
|
postPatch = ''
|
2021-07-20 16:25:02 +01:00
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace 'find_program( LLVM_CLANG clang PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
|
2022-03-03 09:18:17 +00:00
|
|
|
'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 )'
|
2015-03-28 20:54:27 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-03 09:18:17 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja python3 spirv-llvm-translator ];
|
2021-07-20 16:25:02 +01:00
|
|
|
buildInputs = [ llvm clang-unwrapped ];
|
|
|
|
strictDeps = true;
|
2022-01-08 06:37:27 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
|
|
|
];
|
2020-02-14 17:31:53 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2022-05-28 14:38:40 +01:00
|
|
|
broken = stdenv.isDarwin;
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://libclc.llvm.org/";
|
2015-05-13 14:32:32 +01:00
|
|
|
description = "Implementation of the library requirements of the OpenCL C programming language";
|
2015-03-28 20:54:27 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|