2019-07-27 19:27:00 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkgconfig
|
|
|
|
|
|
|
|
, bison
|
|
|
|
, flex
|
|
|
|
, llvmPackages_8
|
|
|
|
, opencl-clang
|
|
|
|
, python
|
|
|
|
, spirv-llvm-translator
|
|
|
|
|
|
|
|
, buildWithPatches ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
llvmPkgs = llvmPackages_8 // {
|
|
|
|
inherit spirv-llvm-translator;
|
|
|
|
};
|
|
|
|
inherit (llvmPkgs) llvm;
|
|
|
|
inherit (if buildWithPatches then opencl-clang else llvmPkgs) clang clang-unwrapped spirv-llvm-translator;
|
|
|
|
inherit (stdenv.lib) getVersion optional optionals versionOlder versions;
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "intel-graphics-compiler";
|
2020-06-10 02:38:28 +01:00
|
|
|
version = "1.0.4062";
|
2019-07-27 19:27:00 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "intel";
|
|
|
|
repo = "intel-graphics-compiler";
|
|
|
|
rev = "igc-${version}";
|
2020-06-10 02:38:28 +01:00
|
|
|
sha256 = "1fr9mb7s5f0kiwxf04lqbyqbxfsvki0kwnpcy41m3p3la22mqz47";
|
2019-07-27 19:27:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ clang cmake bison flex llvm python ];
|
|
|
|
|
|
|
|
buildInputs = [ clang opencl-clang spirv-llvm-translator ];
|
|
|
|
|
|
|
|
# checkInputs = [ lit pythonPackages.nose ];
|
|
|
|
|
|
|
|
# FIXME: How do we run the test suite?
|
|
|
|
# https://github.com/intel/intel-graphics-compiler/issues/98
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
# Handholding the braindead build script
|
|
|
|
# We put this in a derivation because the cmake requires an absolute path
|
|
|
|
prebuilds = stdenv.mkDerivation {
|
|
|
|
name = "igc-cclang-prebuilds";
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
ln -s ${clang}/bin/clang $out/
|
|
|
|
ln -s clang $out/clang-${versions.major (getVersion clang)}
|
|
|
|
ln -s ${opencl-clang}/lib/* $out/
|
|
|
|
ln -s ${clang-unwrapped}/lib/clang/${getVersion clang}/include/opencl-c.h $out/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCCLANG_BUILD_PREBUILDS=ON"
|
|
|
|
"-DCCLANG_BUILD_PREBUILDS_DIR=${prebuilds}"
|
|
|
|
"-DIGC_PREFERRED_LLVM_VERSION=${getVersion llvm}"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/intel/intel-graphics-compiler";
|
2019-07-27 19:27:00 +01:00
|
|
|
description = "LLVM-based compiler for OpenCL targeting Intel Gen graphics hardware";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ gloaming ];
|
|
|
|
};
|
|
|
|
}
|