69 lines
1.6 KiB
Nix
69 lines
1.6 KiB
Nix
{
|
|
stdenv
|
|
, fetchFromGitHub
|
|
, enableDebug ? false
|
|
, lib
|
|
, cmake
|
|
, pkg-config
|
|
, libdrm
|
|
, libelf
|
|
, opencl-headers
|
|
, ocl-icd
|
|
, git
|
|
, boost
|
|
, ncurses
|
|
, openssl
|
|
, rapidjson
|
|
, protobuf
|
|
, python3
|
|
, libuuid
|
|
, curl
|
|
, libsystemtap
|
|
, libxcrypt
|
|
, udev
|
|
}:
|
|
|
|
with lib;
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "xilinx-xrt";
|
|
version = "dc81a9cc";
|
|
src = fetchFromGitHub {
|
|
owner = "Xilinx";
|
|
repo = "XRT";
|
|
rev = "dc81a9cc852bf44e71aa3edde7c8f7d54f355eab";
|
|
hash = "sha256-SG1gIO8Bvgs5XQ7HswjWNavPH+m8xHXqauztuJa6aEo=";
|
|
fetchSubmodules = true;
|
|
};
|
|
dontStrip = true;
|
|
patches = [
|
|
./xilinx-xrt-aiebu.patch
|
|
./xilinx-xrt-icd.patch
|
|
];
|
|
cmakeFlags = [
|
|
"-DXRT_INSTALL_PREFIX=${placeholder "out"}"
|
|
"-DXRT_INSTALL_DIR=${placeholder "out"}"
|
|
"-DXRT_NATIVE_BUILD=yes"
|
|
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
|
|
];
|
|
# A directory named "build" already exists
|
|
cmakeBuildDir = "the-build";
|
|
|
|
# Replace all occurences of /usr to $out, although some are not correct. By
|
|
# default they are replaced by /var/empty
|
|
dontFixCmake = true;
|
|
preConfigure = ''
|
|
find "." -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print |
|
|
while read fn; do
|
|
sed -e 's^/usr\([ /]\|$\)^'$out'\1^g' -e 's^/opt\([ /]\|$\)^'$out'\1^g' < "$fn" > "$fn.tmp"
|
|
mv "$fn.tmp" "$fn"
|
|
done
|
|
'';
|
|
nativeBuildInputs = [ cmake pkg-config git ];
|
|
buildInputs = [ libdrm.dev opencl-headers ocl-icd boost.dev ncurses
|
|
openssl.dev rapidjson protobuf python3 libelf libuuid.dev curl.dev
|
|
libsystemtap libxcrypt udev.out udev.dev
|
|
];
|
|
hardeningDisable = [ "all" ];
|
|
}
|