From df28e19d177abd14270df1e8c88378d2fe410c00 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 31 Dec 2024 11:55:06 +0100 Subject: [PATCH 1/2] solc: 0.8.21 -> 0.8.28 Diff: https://github.com/ethereum/solidity/compare/v0.8.21...v0.8.28 Changelog: https://github.com/ethereum/solidity/releases/tag/v0.8.28 --- pkgs/by-name/so/solc/package.nix | 77 ++++++++++++++++---------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/pkgs/by-name/so/solc/package.nix b/pkgs/by-name/so/solc/package.nix index db9dada8db20..d36dc55bb69d 100644 --- a/pkgs/by-name/so/solc/package.nix +++ b/pkgs/by-name/so/solc/package.nix @@ -9,6 +9,7 @@ jq, ncurses, python3, + versionCheckHook, z3Support ? true, z3_4_11 ? null, cvc4Support ? gccStdenv.hostPlatform.isLinux, @@ -27,34 +28,24 @@ assert z3Support -> z3 != null && lib.versionAtLeast z3.version "4.11.0"; assert cvc4Support -> cvc4 != null && cln != null && gmp != null; let - jsoncppVersion = "1.9.3"; - jsoncppUrl = "https://github.com/open-source-parsers/jsoncpp/archive/${jsoncppVersion}.tar.gz"; - jsoncpp = fetchzip { - url = jsoncppUrl; - sha256 = "1vbhi503rgwarf275ajfdb8vpdcbn1f7917wjkf8jghqwb1c24lq"; - }; - - range3Version = "0.12.0"; - range3Url = "https://github.com/ericniebler/range-v3/archive/${range3Version}.tar.gz"; - range3 = fetchzip { - url = range3Url; - sha256 = "sha256-bRSX91+ROqG1C3nB9HSQaKgLzOHEFy9mrD2WW3PRBWU="; - }; - - fmtlibVersion = "8.0.1"; - fmtlibUrl = "https://github.com/fmtlib/fmt/archive/${fmtlibVersion}.tar.gz"; - fmtlib = fetchzip { - url = fmtlibUrl; - sha256 = "1mnvxqsan034d2jiqnw2yvkljl7lwvhakmj5bscwp1fpkn655bbw"; - }; - pname = "solc"; - version = "0.8.21"; - meta = with lib; { + + version = "0.8.28"; + linuxHash = "sha256-kosJ10stylGK5NUtsnMM7I+OfhR40TXPQDvnggOFLLc="; + darwinHash = "sha256-gVFbDlPeqiZtVJVFzKrApalubU6CAcd/ZzsscQl22eo="; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = [ "--version" ]; + doInstallCheck = true; + + meta = { description = "Compiler for Ethereum smart contract language Solidity"; homepage = "https://github.com/ethereum/solidity"; - license = licenses.gpl3; - maintainers = with maintainers; [ + changelog = "https://github.com/ethereum/solidity/releases/tag/v${version}"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ dbrock akru lionello @@ -65,23 +56,21 @@ let solc = if gccStdenv.hostPlatform.isLinux then gccStdenv.mkDerivation rec { - inherit pname version meta; + inherit + pname + version + nativeInstallCheckInputs + versionCheckProgramArg + doInstallCheck + meta + ; # upstream suggests avoid using archive generated by github src = fetchzip { url = "https://github.com/ethereum/solidity/releases/download/v${version}/solidity_${version}.tar.gz"; - sha256 = "sha256-6EeRmxAmb1nCQ2FTNtWfQ7HCH0g9nJXC3jnhV0KEOwk="; + hash = linuxHash; }; - postPatch = '' - substituteInPlace cmake/jsoncpp.cmake \ - --replace "${jsoncppUrl}" ${jsoncpp} - substituteInPlace cmake/range-v3.cmake \ - --replace "${range3Url}" ${range3} - substituteInPlace cmake/fmtlib.cmake \ - --replace "${fmtlibUrl}" ${fmtlib} - ''; - cmakeFlags = [ "-DBoost_USE_STATIC_LIBS=OFF" @@ -143,9 +132,12 @@ let popd ''; - doInstallCheck = true; installCheckPhase = '' + runHook preInstallCheck + $out/bin/solc --version > /dev/null + + runHook postInstallCheck ''; passthru.tests = { @@ -156,11 +148,18 @@ let } else gccStdenv.mkDerivation rec { - inherit pname version meta; + inherit + pname + version + nativeInstallCheckInputs + versionCheckProgramArg + doInstallCheck + meta + ; src = pkgs.fetchurl { url = "https://github.com/ethereum/solidity/releases/download/v${version}/solc-macos"; - sha256 = "sha256-GdBldJ+wjL/097RShKxVhTBjhl9q6GIeTe+l2Ti5pQI="; + hash = darwinHash; }; dontUnpack = true; From 3b085fd66da985920f650ddb625497620cfc8748 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 31 Dec 2024 13:06:12 +0100 Subject: [PATCH 2/2] solc: fix build on GCC 14 --- pkgs/by-name/so/solc/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/so/solc/package.nix b/pkgs/by-name/so/solc/package.nix index d36dc55bb69d..b104d8130f37 100644 --- a/pkgs/by-name/so/solc/package.nix +++ b/pkgs/by-name/so/solc/package.nix @@ -71,6 +71,15 @@ let hash = linuxHash; }; + # Fix build with GCC 14 + # Submitted upstream: https://github.com/ethereum/solidity/pull/15685 + postPatch = '' + substituteInPlace test/yulPhaser/Chromosome.cpp \ + --replace-fail \ + "BOOST_TEST(abs" \ + "BOOST_TEST(fabs" + ''; + cmakeFlags = [ "-DBoost_USE_STATIC_LIBS=OFF"