cpp_ethereum: use the ocl-icd package

This commit is contained in:
artuuge 2016-07-02 00:46:20 +02:00
parent 83fd63995a
commit 5a8bf2c32b
2 changed files with 13 additions and 38 deletions

View File

@ -13,16 +13,9 @@
, libmicrohttpd , libmicrohttpd
, mesa , mesa
, withOpenCL ? false
, opencl-headers ? null , opencl-headers ? null
, ocl-icd ? null
, withAMD ? false
, amdappsdk ? null
, withBeignet ? false
, beignet ? null
, withCUDA ? false
, nvidia_x11 ? null
, withGUI ? false , withGUI ? false
, qtwebengine ? null , qtwebengine ? null
@ -40,21 +33,11 @@
, extraCmakeFlags ? [] , extraCmakeFlags ? []
}: }:
assert withAMD -> (amdappsdk != null); assert withOpenCL -> (opencl-headers != null) && (ocl-icd != null);
assert withBeignet -> (beignet != null);
assert withCUDA -> (nvidia_x11 != null);
assert stdenv.lib.findSingle (x: x) true false [ withAMD withBeignet withCUDA ];
assert withGUI -> (qtwebengine != null) && (qtbase != null) && (qtdeclarative != null); assert withGUI -> (qtwebengine != null) && (qtbase != null) && (qtdeclarative != null);
assert withProfiling -> (gperftools != null); assert withProfiling -> (gperftools != null);
assert withEVMJIT -> (llvm != null) && (zlib != null) && (ncurses != null); assert withEVMJIT -> (llvm != null) && (zlib != null) && (ncurses != null);
let
withOpenCL = (stdenv.lib.any (x: x) [ withAMD withBeignet withCUDA ]);
in
assert withOpenCL -> (opencl-headers != null);
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "cpp-ethereum-${version}"; name = "cpp-ethereum-${version}";
version = "1.2.9"; version = "1.2.9";
@ -65,20 +48,16 @@ stdenv.mkDerivation rec {
sha256 = "0k8w8gqzy71x77p0p85r38gfdnzrlzk2yvb3ablml9ppg4qb4ch5"; sha256 = "0k8w8gqzy71x77p0p85r38gfdnzrlzk2yvb3ablml9ppg4qb4ch5";
}; };
patchPhase = stdenv.lib.optional withBeignet ''
sed -i -re 's#NAMES\ (OpenCL.*)#NAMES\ libcl.so\ \1#g' webthree-helpers/cmake/FindOpenCL.cmake
'';
cmakeFlags = with stdenv.lib; concatStringsSep " " (flatten [ cmakeFlags = with stdenv.lib; concatStringsSep " " (flatten [
"-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release"
"-DGUI=${toString withGUI}" "-DGUI=${toString withGUI}"
"-DETHASHCL=${toString withOpenCL}" "-DETHASHCL=${toString withOpenCL}"
"-DPROFILING=${toString withProfiling}" "-DPROFILING=${toString withProfiling}"
"-DEVMJIT=${toString withEVMJIT}" "-DEVMJIT=${toString withEVMJIT}"
(optional withOpenCL "-DCMAKE_INCLUDE_PATH=${opencl-headers}/include") (optional withOpenCL [
(optional withAMD "-DCMAKE_LIBRARY_PATH=${amdappsdk}/lib") "-DCMAKE_INCLUDE_PATH=${opencl-headers}/include"
(optional withBeignet "-DCMAKE_LIBRARY_PATH=${beignet}/lib/beignet") "-DCMAKE_LIBRARY_PATH=${ocl-icd}/lib"
(optional withCUDA "-DCMAKE_LIBRARY_PATH=${nvidia_x11}/lib") ])
(optional withEVMJIT "-DCMAKE_PREFIX_PATH=${llvm}") (optional withEVMJIT "-DCMAKE_PREFIX_PATH=${llvm}")
extraCmakeFlags extraCmakeFlags
]); ]);
@ -106,10 +85,10 @@ stdenv.mkDerivation rec {
curl curl
libmicrohttpd libmicrohttpd
mesa mesa
(optional withOpenCL opencl-headers) (optional withOpenCL [
(optional withAMD amdappsdk) opencl-headers
(optional withBeignet beignet) ocl-icd
(optional withCUDA nvidia_x11) ])
(optional withGUI [ (optional withGUI [
qtwebengine qtwebengine
qtbase qtbase
@ -123,10 +102,7 @@ stdenv.mkDerivation rec {
]) ])
]; ];
runPath = with stdenv.lib; concatStringsSep ":" (flatten [ runPath = with stdenv.lib; (makeLibraryPath (flatten [ stdenv.cc.cc buildInputs ]));
(makeLibraryPath (flatten [ stdenv.cc.cc buildInputs ]))
(optional withBeignet "${beignet}/lib/beignet")
]);
installPhase = '' installPhase = ''
make install make install

View File

@ -12251,8 +12251,7 @@ in
conkeror = self.wrapFirefox conkeror-unwrapped { }; conkeror = self.wrapFirefox conkeror-unwrapped { };
cpp_ethereum = callPackage ../applications/misc/webthree-umbrella { cpp_ethereum = callPackage ../applications/misc/webthree-umbrella {
# withCUDA = true; withOpenCL = true;
# inherit (linuxPackages) nvidia_x11;
# withEVMJIT = true; # withEVMJIT = true;
# inherit (pkgs.llvmPackages_38) llvm; # inherit (pkgs.llvmPackages_38) llvm;