fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, gccStdenv, fetchzip
2, boost
3, cmake
4, coreutils
5, fetchpatch
6, ncurses
7, python3
8, z3Support ? true
9, z3 ? null
10, cvc4Support ? gccStdenv.isLinux
11, cvc4 ? null
12, cln ? null
13, gmp ? null
14}:
15
16# compiling source/libsmtutil/CVC4Interface.cpp breaks on clang on Darwin,
17# general commandline tests fail at abiencoderv2_no_warning/ on clang on NixOS
18
19assert z3Support -> z3 != null && lib.versionAtLeast z3.version "4.6.0";
20assert cvc4Support -> cvc4 != null && cln != null && gmp != null;
21
22let
23 jsoncppVersion = "1.9.3";
24 jsoncppUrl = "https://github.com/open-source-parsers/jsoncpp/archive/${jsoncppVersion}.tar.gz";
25 jsoncpp = fetchzip {
26 url = jsoncppUrl;
27 sha256 = "1vbhi503rgwarf275ajfdb8vpdcbn1f7917wjkf8jghqwb1c24lq";
28 };
29
30 range3Version = "0.11.0";
31 range3Url = "https://github.com/ericniebler/range-v3/archive/${range3Version}.tar.gz";
32 range3 = fetchzip {
33 url = range3Url;
34 sha256 = "18230bg4rq9pmm5f8f65j444jpq56rld4fhmpham8q3vr1c1bdjh";
35 };
36
37 solc = gccStdenv.mkDerivation rec {
38 pname = "solc";
39 version = "0.8.2";
40
41 # upstream suggests avoid using archive generated by github
42 src = fetchzip {
43 url = "https://github.com/ethereum/solidity/releases/download/v${version}/solidity_${version}.tar.gz";
44 sha256 = "11w7sa1y2dirzh84k04fkwbfc6xpjp5jr65w1pmb2pnkjvvf46xq";
45 };
46
47 postPatch = ''
48 substituteInPlace cmake/jsoncpp.cmake \
49 --replace "${jsoncppUrl}" ${jsoncpp}
50 substituteInPlace cmake/range-v3.cmake \
51 --replace "${range3Url}" ${range3}
52 '';
53
54 cmakeFlags = [
55 "-DBoost_USE_STATIC_LIBS=OFF"
56 ] ++ lib.optionals (!z3Support) [
57 "-DUSE_Z3=OFF"
58 ] ++ lib.optionals (!cvc4Support) [
59 "-DUSE_CVC4=OFF"
60 ];
61
62 nativeBuildInputs = [ cmake ];
63 buildInputs = [ boost ]
64 ++ lib.optionals z3Support [ z3 ]
65 ++ lib.optionals cvc4Support [ cvc4 cln gmp ];
66 checkInputs = [ ncurses python3 ];
67
68 # tests take 60+ minutes to complete, only run as part of passthru tests
69 doCheck = false;
70
71 checkPhase = ''
72 while IFS= read -r -d ''' dir
73 do
74 LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$(pwd)/$dir
75 export LD_LIBRARY_PATH
76 done < <(find . -type d -print0)
77
78 pushd ..
79 # IPC tests need aleth avaliable, so we disable it
80 sed -i "s/IPC_ENABLED=true/IPC_ENABLED=false\nIPC_FLAGS=\"--no-ipc\"/" ./scripts/tests.sh
81 for i in ./scripts/*.sh ./scripts/*.py ./test/*.sh ./test/*.py; do
82 patchShebangs "$i"
83 done
84 TERM=xterm ./scripts/tests.sh
85 popd
86 '';
87
88 doInstallCheck = true;
89 installCheckPhase = ''
90 $out/bin/solc --version > /dev/null
91 '';
92
93 passthru.tests = {
94 solcWithTests = solc.overrideAttrs (attrs: { doCheck = true; });
95 };
96
97 meta = with lib; {
98 description = "Compiler for Ethereum smart contract language Solidity";
99 homepage = "https://github.com/ethereum/solidity";
100 license = licenses.gpl3;
101 maintainers = with maintainers; [ dbrock akru lionello sifmelcara ];
102 };
103 };
104in
105 solc