2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2019-06-07 10:22:48 +01:00
|
|
|
, fetchFromGitHub
|
2016-04-23 23:14:04 +01:00
|
|
|
, cmake
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
, libclang
|
|
|
|
, libllvm
|
2016-04-23 23:14:04 +01:00
|
|
|
, libdrm
|
|
|
|
, libX11
|
|
|
|
, libpthreadstubs
|
|
|
|
, libXdmcp
|
|
|
|
, libXdamage
|
2017-01-19 23:49:34 +00:00
|
|
|
, libXext
|
|
|
|
, python3
|
2016-04-23 23:14:04 +01:00
|
|
|
, ocl-icd
|
2018-02-24 12:06:44 +00:00
|
|
|
, libGL
|
2017-01-19 23:49:34 +00:00
|
|
|
, makeWrapper
|
|
|
|
, beignet
|
2017-11-01 15:21:45 +00:00
|
|
|
}:
|
2016-04-23 23:14:04 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "beignet";
|
2019-06-07 10:22:48 +01:00
|
|
|
version = "unstable-2018.08.20";
|
2016-04-23 23:14:04 +01:00
|
|
|
|
2019-06-07 10:22:48 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "intel";
|
|
|
|
repo = "beignet";
|
|
|
|
rev = "fc5f430cb7b7a8f694d86acbb038bd5b38ec389c";
|
|
|
|
sha256 = "1z64v69w7f52jrskh1jfyh1x46mzfhjrqxj9hhgzh3xxv9yla32h";
|
2017-11-01 15:21:45 +00:00
|
|
|
};
|
2016-04-23 23:14:04 +01:00
|
|
|
|
2017-11-01 15:21:45 +00:00
|
|
|
patches = [ ./clang_llvm.patch ];
|
2016-04-23 23:14:04 +01:00
|
|
|
|
2017-01-19 23:49:34 +00:00
|
|
|
postPatch = ''
|
2019-06-07 10:22:48 +01:00
|
|
|
substituteInPlace CMakeLists.txt --replace /etc/OpenCL/vendors "\''${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors"
|
2017-01-19 23:49:34 +00:00
|
|
|
patchShebangs src/git_sha1.sh
|
2017-11-01 15:21:45 +00:00
|
|
|
'';
|
2016-04-23 23:14:04 +01:00
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
cmakeFlags = [ "-DCLANG_LIBRARY_DIR=${libclang.lib}/lib" ];
|
2016-04-23 23:14:04 +01:00
|
|
|
|
2017-11-01 15:21:45 +00:00
|
|
|
buildInputs = [
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
libllvm
|
|
|
|
libclang
|
2017-11-01 15:21:45 +00:00
|
|
|
libX11
|
2017-01-19 23:49:34 +00:00
|
|
|
libXext
|
2016-04-23 23:14:04 +01:00
|
|
|
libpthreadstubs
|
2017-11-01 15:21:45 +00:00
|
|
|
libdrm
|
2016-04-23 23:14:04 +01:00
|
|
|
libXdmcp
|
|
|
|
libXdamage
|
|
|
|
ocl-icd
|
2018-02-24 12:06:44 +00:00
|
|
|
libGL
|
2016-04-23 23:14:04 +01:00
|
|
|
];
|
|
|
|
|
2017-01-19 23:49:34 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2017-01-19 23:49:34 +00:00
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
passthru.utests = stdenv.mkDerivation {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "beignet-utests";
|
2017-01-19 23:49:34 +00:00
|
|
|
inherit version src;
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
cd utests
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
python3
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2017-01-19 23:49:34 +00:00
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
ocl-icd
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
wrapBin() {
|
|
|
|
install -Dm755 "$1" "$out/bin/$(basename "$1")"
|
|
|
|
wrapProgram "$out/bin/$(basename "$1")" \
|
|
|
|
--set OCL_BITCODE_LIB_PATH ${beignet}/lib/beignet/beignet.bc \
|
|
|
|
--set OCL_HEADER_FILE_DIR "${beignet}/lib/beignet/include" \
|
|
|
|
--set OCL_PCH_PATH "${beignet}/lib/beignet/beignet.pch" \
|
|
|
|
--set OCL_GBE_PATH "${beignet}/lib/beignet/libgbe.so" \
|
|
|
|
--set OCL_INTERP_PATH "${beignet}/lib/beignet/libgbeinterp.so" \
|
|
|
|
--set OCL_KERNEL_PATH "$out/lib/beignet/kernels" \
|
|
|
|
--set OCL_IGNORE_SELF_TEST 1
|
|
|
|
}
|
|
|
|
|
|
|
|
install -Dm755 libutests.so $out/lib/libutests.so
|
|
|
|
wrapBin utest_run
|
|
|
|
wrapBin flat_address_space
|
|
|
|
mkdir $out/lib/beignet
|
|
|
|
cp -r ../../kernels $out/lib/beignet
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://cgit.freedesktop.org/beignet/";
|
2016-04-23 23:14:04 +01:00
|
|
|
description = "OpenCL Library for Intel Ivy Bridge and newer GPUs";
|
|
|
|
longDescription = ''
|
2019-06-07 10:22:48 +01:00
|
|
|
The package provides an open source implementation of the OpenCL specification for Intel GPUs.
|
|
|
|
It supports the Intel OpenCL runtime library and compiler.
|
2016-04-23 23:14:04 +01:00
|
|
|
'';
|
|
|
|
license = licenses.lgpl21Plus;
|
2017-11-01 15:21:45 +00:00
|
|
|
maintainers = with maintainers; [ artuuge zimbatm ];
|
2016-04-23 23:14:04 +01:00
|
|
|
platforms = platforms.linux;
|
2018-12-09 23:47:36 +00:00
|
|
|
# Requires libdrm_intel
|
|
|
|
badPlatforms = [ "aarch64-linux" ];
|
2017-11-01 15:21:45 +00:00
|
|
|
};
|
2016-04-23 23:14:04 +01:00
|
|
|
}
|