diff --git a/pkgs/development/compilers/solc/default.nix b/pkgs/development/compilers/solc/default.nix index d94ce75e3f55..edb7fc61d2a3 100644 --- a/pkgs/development/compilers/solc/default.nix +++ b/pkgs/development/compilers/solc/default.nix @@ -1,16 +1,15 @@ { stdenv, fetchzip, fetchFromGitHub, boost, cmake, z3 }: let - version = "0.4.23"; - rev = "124ca40dc525a987a88176c6e5170978e82fa290"; - sha256 = "07l8rfqh95yrdmbxc4pfb77s06k5v65dk3rgdqscqmwchkndrmm0"; - jsoncppURL = https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz; + version = "0.4.24"; + rev = "e67f0147998a9e3835ed3ce8bf6a0a0c634216c5"; + sha256 = "1gy2miv6ia1z98zy6w4y03balwfr964bnvwzyg8v7pn2mayqnaap"; + jsoncppURL = https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz; jsoncpp = fetchzip { url = jsoncppURL; - sha256 = "0jz93zv17ir7lbxb3dv8ph2n916rajs8i96immwx9vb45pqid3n0"; + sha256 = "1z0gj7a6jypkijmpknis04qybs1hkd04d1arr3gy89lnxmp6qzlm"; }; in - stdenv.mkDerivation { name = "solc-${version}"; @@ -21,7 +20,6 @@ stdenv.mkDerivation { }; patches = [ - ./patches/boost-shared-libs.patch ./patches/shared-libs-install.patch ]; @@ -30,17 +28,23 @@ stdenv.mkDerivation { echo >commit_hash.txt "${rev}" substituteInPlace cmake/jsoncpp.cmake \ --replace "${jsoncppURL}" ${jsoncpp} - substituteInPlace cmake/EthCompilerSettings.cmake \ - --replace "add_compile_options(-Werror)" "" + + # To allow non-standard CMAKE_INSTALL_LIBDIR (fixed in upstream, not yet released) + substituteInPlace cmake/jsoncpp.cmake \ + --replace "\''${CMAKE_INSTALL_LIBDIR}" "lib" \ + --replace "# Build static lib but suitable to be included in a shared lib." "-DCMAKE_INSTALL_LIBDIR=lib" ''; cmakeFlags = [ "-DBoost_USE_STATIC_LIBS=OFF" "-DBUILD_SHARED_LIBS=ON" "-DINSTALL_LLLC=ON" - "-DTESTS=OFF" ]; + doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform == stdenv.buildPlatform; + checkPhase = "LD_LIBRARY_PATH=./libsolc:./libsolidity:./liblll:./libevmasm:./libdevcore:$LD_LIBRARY_PATH " + + "./test/soltest -p -- --no-ipc --no-smt --testpath ../test"; + nativeBuildInputs = [ cmake ]; buildInputs = [ boost z3 ]; diff --git a/pkgs/development/compilers/solc/patches/boost-shared-libs.patch b/pkgs/development/compilers/solc/patches/boost-shared-libs.patch deleted file mode 100644 index 499fc46c6caf..000000000000 --- a/pkgs/development/compilers/solc/patches/boost-shared-libs.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt -index 97b01c83..0bdec4b4 100644 ---- a/libsolidity/CMakeLists.txt -+++ b/libsolidity/CMakeLists.txt -@@ -28,7 +28,7 @@ else() - endif() - - add_library(solidity ${sources} ${headers}) --target_link_libraries(solidity PUBLIC evmasm devcore) -+target_link_libraries(solidity PUBLIC evmasm devcore ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}) - - if (${Z3_FOUND}) - target_link_libraries(solidity PUBLIC ${Z3_LIBRARY}) -diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt -index 5c480093..d6538ee2 100644 ---- a/lllc/CMakeLists.txt -+++ b/lllc/CMakeLists.txt -@@ -1,5 +1,5 @@ - add_executable(lllc main.cpp) --target_link_libraries(lllc PRIVATE lll) -+target_link_libraries(lllc PRIVATE lll ${Boost_SYSTEM_LIBRARY}) - - if (INSTALL_LLLC) - include(GNUInstallDirs) diff --git a/pkgs/development/compilers/solc/patches/shared-libs-install.patch b/pkgs/development/compilers/solc/patches/shared-libs-install.patch index 732797e5ae7d..70162bfbcb6a 100644 --- a/pkgs/development/compilers/solc/patches/shared-libs-install.patch +++ b/pkgs/development/compilers/solc/patches/shared-libs-install.patch @@ -1,11 +1,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4ac56b43..dacf3853 100644 +index 0c05208f..8893648e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -48,6 +48,19 @@ add_subdirectory(libevmasm) +@@ -48,6 +48,20 @@ add_subdirectory(libevmasm) add_subdirectory(libsolidity) add_subdirectory(libsolc) ++ +install(DIRECTORY libdevcore/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libdevcore + FILES_MATCHING PATTERN "*.h") @@ -38,7 +39,7 @@ index 86192c1b..e7f15e93 100644 @@ -3,3 +3,4 @@ file(GLOB headers "*.h") add_library(evmasm ${sources} ${headers}) - target_link_libraries(evmasm PUBLIC jsoncpp devcore) + target_link_libraries(evmasm PUBLIC devcore) +install(TARGETS evmasm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index 4cdc073a..b61f03c7 100644 @@ -50,11 +51,10 @@ index 4cdc073a..b61f03c7 100644 target_link_libraries(lll PUBLIC evmasm devcore) +install(TARGETS lll LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt -index 97b01c83..e876177e 100644 +index 0bdec4b4..e876177e 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt -@@ -28,7 +28,8 @@ else() - endif() +@@ -29,6 +29,7 @@ endif() add_library(solidity ${sources} ${headers}) target_link_libraries(solidity PUBLIC evmasm devcore ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})