1{ stdenv, fetchzip, fetchFromGitHub, boost, cmake
2, z3Support ? true, z3 ? null
3}:
4
5assert z3Support -> z3 != null;
6
7let
8 version = "0.5.3";
9 rev = "10d17f245839f208ec5085309022a32cd2502f55";
10 sha256 = "1jq41pd3nj534cricy1nq6wgk4wlwg239387n785aswpwd705jbb";
11 jsoncppURL = https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz;
12 jsoncpp = fetchzip {
13 url = jsoncppURL;
14 sha256 = "1z0gj7a6jypkijmpknis04qybs1hkd04d1arr3gy89lnxmp6qzlm";
15 };
16in
17stdenv.mkDerivation {
18 name = "solc-${version}";
19
20 src = fetchFromGitHub {
21 owner = "ethereum";
22 repo = "solidity";
23 inherit rev sha256;
24 };
25
26 patches = [
27 ./patches/shared-libs-install.patch
28 ];
29
30 postPatch = ''
31 touch prerelease.txt
32 echo >commit_hash.txt "${rev}"
33 substituteInPlace cmake/jsoncpp.cmake \
34 --replace "${jsoncppURL}" ${jsoncpp}
35 '';
36
37 cmakeFlags = [
38 "-DBoost_USE_STATIC_LIBS=OFF"
39 "-DBUILD_SHARED_LIBS=ON"
40 ] ++ stdenv.lib.optionals (!z3Support) [
41 "-DUSE_Z3=OFF"
42 ];
43
44 doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform == stdenv.buildPlatform;
45 checkPhase = "LD_LIBRARY_PATH=./libsolc:./libsolidity:./libevmasm:./libdevcore:./libyul:./liblangutil:$LD_LIBRARY_PATH " +
46 "./test/soltest -p -- --no-ipc --no-smt --testpath ../test";
47
48 nativeBuildInputs = [ cmake ];
49 buildInputs = [ boost ]
50 ++ stdenv.lib.optionals z3Support [ z3 ];
51
52 outputs = [ "out" "dev" ];
53
54 meta = with stdenv.lib; {
55 description = "Compiler for Ethereum smart contract language Solidity";
56 homepage = https://github.com/ethereum/solidity;
57 license = licenses.gpl3;
58 platforms = with platforms; linux ++ darwin;
59 maintainers = with maintainers; [ dbrock akru lionello ];
60 inherit version;
61 };
62}