7869d16545
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
db29857eb3
, 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)`
113 lines
2.6 KiB
Nix
113 lines
2.6 KiB
Nix
{ lib, stdenv
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, pkg-config
|
|
, libclang
|
|
, libllvm
|
|
, libdrm
|
|
, libX11
|
|
, libpthreadstubs
|
|
, libXdmcp
|
|
, libXdamage
|
|
, libXext
|
|
, python3
|
|
, ocl-icd
|
|
, libGL
|
|
, makeWrapper
|
|
, beignet
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "beignet";
|
|
version = "unstable-2018.08.20";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "intel";
|
|
repo = "beignet";
|
|
rev = "fc5f430cb7b7a8f694d86acbb038bd5b38ec389c";
|
|
sha256 = "1z64v69w7f52jrskh1jfyh1x46mzfhjrqxj9hhgzh3xxv9yla32h";
|
|
};
|
|
|
|
patches = [ ./clang_llvm.patch ];
|
|
|
|
postPatch = ''
|
|
substituteInPlace CMakeLists.txt --replace /etc/OpenCL/vendors "\''${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors"
|
|
patchShebangs src/git_sha1.sh
|
|
'';
|
|
|
|
cmakeFlags = [ "-DCLANG_LIBRARY_DIR=${libclang.lib}/lib" ];
|
|
|
|
buildInputs = [
|
|
libllvm
|
|
libclang
|
|
libX11
|
|
libXext
|
|
libpthreadstubs
|
|
libdrm
|
|
libXdmcp
|
|
libXdamage
|
|
ocl-icd
|
|
libGL
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
pkg-config
|
|
python3
|
|
];
|
|
|
|
passthru.utests = stdenv.mkDerivation {
|
|
pname = "beignet-utests";
|
|
inherit version src;
|
|
|
|
preConfigure = ''
|
|
cd utests
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
python3
|
|
pkg-config
|
|
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
|
|
'';
|
|
};
|
|
|
|
meta = with lib; {
|
|
homepage = "https://cgit.freedesktop.org/beignet/";
|
|
description = "OpenCL Library for Intel Ivy Bridge and newer GPUs";
|
|
longDescription = ''
|
|
The package provides an open source implementation of the OpenCL specification for Intel GPUs.
|
|
It supports the Intel OpenCL runtime library and compiler.
|
|
'';
|
|
license = licenses.lgpl21Plus;
|
|
maintainers = with maintainers; [ artuuge zimbatm ];
|
|
platforms = platforms.linux;
|
|
# Requires libdrm_intel
|
|
badPlatforms = [ "aarch64-linux" ];
|
|
};
|
|
}
|