Skip to content

Commit 1e6420b

Browse files
author
Jaap van der Plas
committed
revert solc version
1 parent 4ddead8 commit 1e6420b

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed

nix/overlay.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ rev: final: prev: {
4242

4343
retesteth = final.callPackage ./retesteth.nix { };
4444
lllc = final.callPackage ./lllc.nix { };
45+
solc = final.callPackage ./solc.nix { };
4546
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 0c05208f..8893648e 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -48,6 +48,22 @@ add_subdirectory(libevmasm)
6+
add_subdirectory(libsolidity)
7+
add_subdirectory(libsolc)
8+
9+
+install(DIRECTORY libdevcore/
10+
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libdevcore
11+
+ FILES_MATCHING PATTERN "*.h")
12+
+install(DIRECTORY libevmasm/
13+
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libevmasm
14+
+ FILES_MATCHING PATTERN "*.h")
15+
+install(DIRECTORY libsolidity/
16+
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libsolidity
17+
+ FILES_MATCHING PATTERN "*.h")
18+
+install(DIRECTORY libyul/
19+
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyul
20+
+ FILES_MATCHING PATTERN "*.h")
21+
+install(DIRECTORY liblangutil/
22+
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/liblangutil
23+
+ FILES_MATCHING PATTERN "*.h")
24+
+
25+
if (NOT EMSCRIPTEN)
26+
add_subdirectory(solc)
27+
add_subdirectory(liblll)
28+
diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt
29+
index fa7e3f48..1f9f52b4 100644
30+
--- a/libdevcore/CMakeLists.txt
31+
+++ b/libdevcore/CMakeLists.txt
32+
@@ -6,3 +6,4 @@ target_link_libraries(devcore PRIVATE jsoncpp ${Boost_FILESYSTEM_LIBRARIES} ${Bo
33+
target_include_directories(devcore PUBLIC "${CMAKE_SOURCE_DIR}")
34+
target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
35+
add_dependencies(devcore solidity_BuildInfo.h)
36+
+install(TARGETS devcore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
37+
diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt
38+
index 86192c1b..e7f15e93 100644
39+
--- a/libevmasm/CMakeLists.txt
40+
+++ b/libevmasm/CMakeLists.txt
41+
@@ -3,3 +3,4 @@ file(GLOB headers "*.h")
42+
43+
add_library(evmasm ${sources} ${headers})
44+
target_link_libraries(evmasm PUBLIC devcore)
45+
+install(TARGETS evmasm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
46+
diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt
47+
index 0bdec4b4..e876177e 100644
48+
--- a/libsolidity/CMakeLists.txt
49+
+++ b/libsolidity/CMakeLists.txt
50+
@@ -29,6 +29,7 @@ endif()
51+
52+
add_library(solidity ${sources} ${z3_SRCS} ${cvc4_SRCS})
53+
target_link_libraries(solidity PUBLIC yul evmasm langutil devcore Boost::boost Boost::filesystem Boost::system)
54+
+install(TARGETS solidity LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
55+
56+
if (${Z3_FOUND})
57+
target_link_libraries(solidity PUBLIC ${Z3_LIBRARY})
58+
--- a/libyul/CMakeLists.txt
59+
+++ b/libyul/CMakeLists.txt
60+
@@ -43,3 +43,4 @@ endif()
61+
optimiser/VarDeclPropagator.cpp
62+
)
63+
target_link_libraries(yul PUBLIC evmasm devcore langutil)
64+
+install(TARGETS yul LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
65+
--- a/liblangutil/CMakeLists.txt
66+
+++ b/liblangutil/CMakeLists.txt
67+
@@ -11,3 +11,4 @@ endif()
68+
69+
add_library(langutil ${sources})
70+
target_link_libraries(langutil PUBLIC devcore)
71+
+install(TARGETS langutil LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

nix/solc.nix

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{ stdenv, fetchzip, boost, cmake, ncurses, python2
2+
, z3Support ? true, z3 ? null, cvc4Support ? true, cvc4 ? null
3+
, cln ? null, gmp ? null
4+
}:
5+
6+
assert z3Support -> z3 != null && stdenv.lib.versionAtLeast z3.version "4.6.0";
7+
assert cvc4Support -> cvc4 != null && cln != null && gmp != null;
8+
9+
let
10+
jsoncppURL = https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz;
11+
jsoncpp = fetchzip {
12+
url = jsoncppURL;
13+
sha256 = "1z0gj7a6jypkijmpknis04qybs1hkd04d1arr3gy89lnxmp6qzlm";
14+
};
15+
buildSharedLibs = stdenv.hostPlatform.isLinux;
16+
in
17+
stdenv.mkDerivation rec {
18+
19+
pname = "solc";
20+
version = "0.5.11";
21+
22+
# upstream suggests avoid using archive generated by github
23+
src = fetchzip {
24+
url = "https://github.com/ethereum/solidity/releases/download/v${version}/solidity_${version}.tar.gz";
25+
sha256 = "0679s5pqbfy7fgpb4f3ppgj8iafxb64g046v8vhp29mf3dsdcnyl";
26+
};
27+
28+
patches = stdenv.lib.optionals buildSharedLibs [ ./patches/shared-libs-install.patch ];
29+
30+
postPatch = ''
31+
substituteInPlace cmake/jsoncpp.cmake \
32+
--replace "${jsoncppURL}" ${jsoncpp}
33+
'';
34+
35+
cmakeFlags = [
36+
"-DBoost_USE_STATIC_LIBS=OFF"
37+
] ++ stdenv.lib.optionals buildSharedLibs [
38+
"-DBUILD_SHARED_LIBS=ON"
39+
] ++ stdenv.lib.optionals (!z3Support) [
40+
"-DUSE_Z3=OFF"
41+
] ++ stdenv.lib.optionals (!cvc4Support) [
42+
"-DUSE_CVC4=OFF"
43+
];
44+
45+
nativeBuildInputs = [ cmake ];
46+
buildInputs = [ boost ]
47+
++ stdenv.lib.optionals z3Support [ z3 ]
48+
++ stdenv.lib.optionals cvc4Support [ cvc4 cln gmp ];
49+
checkInputs = [ ncurses python2 ];
50+
51+
# Test fails on darwin for unclear reason
52+
doCheck = stdenv.hostPlatform.isLinux;
53+
54+
checkPhase = ''
55+
while IFS= read -r -d ''' dir
56+
do
57+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$dir
58+
export LD_LIBRARY_PATH
59+
done < <(find . -type d -print0)
60+
61+
pushd ..
62+
# IPC tests need aleth avaliable, so we disable it
63+
sed -i "s/IPC_ENABLED=true/IPC_ENABLED=false\nIPC_FLAGS=\"--no-ipc\"/" ./scripts/tests.sh
64+
for i in ./scripts/*.sh; do
65+
patchShebangs "$i"
66+
done
67+
for i in ./scripts/*.py; do
68+
patchShebangs "$i"
69+
done
70+
for i in ./test/*.sh; do
71+
patchShebangs "$i"
72+
done
73+
TERM=xterm ./scripts/tests.sh
74+
popd
75+
'';
76+
77+
outputs = [ "out" "dev" ];
78+
79+
meta = with stdenv.lib; {
80+
description = "Compiler for Ethereum smart contract language Solidity";
81+
homepage = https://github.com/ethereum/solidity;
82+
license = licenses.gpl3;
83+
platforms = with platforms; linux ++ darwin;
84+
maintainers = with maintainers; [ dbrock akru lionello sifmelcara ];
85+
inherit version;
86+
};
87+
}

0 commit comments

Comments
 (0)