1{ stdenv
2, fetchFromGitHub
3, cmake
4, jsoncpp
5, libjson_rpc_cpp
6, curl
7, boost
8, leveldb
9, cryptopp
10, libcpuid
11, opencl-headers
12, ocl-icd
13, miniupnpc
14, libmicrohttpd
15, gmp
16, libGLU_combined
17, extraCmakeFlags ? []
18}:
19stdenv.mkDerivation rec {
20 name = "cpp-ethereum-${version}";
21 version = "1.3.0";
22
23 src = fetchFromGitHub {
24 owner = "ethereum";
25 repo = "cpp-ethereum";
26 rev = "62ab9522e58df9f28d2168ea27999a214b16ea96";
27 sha256 = "1fxgpqhmjhpv0zzs1m3yf9h8mh25dqpa7pmcfy7f9qiqpfdr4zq9";
28 };
29
30 cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" extraCmakeFlags ];
31
32 configurePhase = ''
33 export BOOST_INCLUDEDIR=${boost.dev}/include
34 export BOOST_LIBRARYDIR=${boost.out}/lib
35
36 mkdir -p Build/Install
37 pushd Build
38
39 cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/Install $cmakeFlags
40 '';
41
42 enableParallelBuilding = true;
43
44 runPath = with stdenv.lib; makeLibraryPath ([ stdenv.cc.cc ] ++ buildInputs);
45
46 installPhase = ''
47 make install
48
49 mkdir -p $out
50
51 for f in Install/lib/*.so* $(find Install/bin -executable -type f); do
52 patchelf --set-rpath $runPath:$out/lib $f
53 done
54
55 cp -r Install/* $out
56 '';
57
58 buildInputs = [
59 cmake
60 jsoncpp
61 libjson_rpc_cpp
62 curl
63 boost
64 leveldb
65 cryptopp
66 libcpuid
67 opencl-headers
68 ocl-icd
69 miniupnpc
70 libmicrohttpd
71 gmp
72 libGLU_combined
73 ];
74
75 dontStrip = true;
76
77 meta = with stdenv.lib; {
78 description = "Ethereum C++ client";
79 homepage = https://github.com/ethereum/cpp-ethereum;
80 license = licenses.gpl3;
81 maintainers = with maintainers; [ artuuge ];
82 platforms = platforms.linux;
83 };
84}