From 0a488516be2caf29d2518a07363a2956646286bb Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Sun, 24 May 2020 15:02:07 +0200 Subject: [PATCH] boolector: 3.0.0 -> 3.2.1 enable tests optionnally enable gmp --- .../science/logic/boolector/cmake-gtest.patch | 16 ++++++++ .../science/logic/boolector/default.nix | 41 ++++++++++--------- 2 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 pkgs/applications/science/logic/boolector/cmake-gtest.patch diff --git a/pkgs/applications/science/logic/boolector/cmake-gtest.patch b/pkgs/applications/science/logic/boolector/cmake-gtest.patch new file mode 100644 index 000000000000..61a64d3abbbf --- /dev/null +++ b/pkgs/applications/science/logic/boolector/cmake-gtest.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/googletest-download.cmake b/cmake/googletest-download.cmake +index 0ec4d558..d0910313 100644 +--- a/cmake/googletest-download.cmake ++++ b/cmake/googletest-download.cmake +@@ -9,10 +9,7 @@ ExternalProject_Add( + googletest + SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src" + BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build" +- GIT_REPOSITORY +- https://github.com/google/googletest.git +- GIT_TAG +- release-1.10.0 ++ URL REPLACEME + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" diff --git a/pkgs/applications/science/logic/boolector/default.nix b/pkgs/applications/science/logic/boolector/default.nix index 105e911ed4fd..aedc8e3484a9 100644 --- a/pkgs/applications/science/logic/boolector/default.nix +++ b/pkgs/applications/science/logic/boolector/default.nix @@ -1,37 +1,31 @@ -{ stdenv, fetchFromGitHub, fetchpatch -, cmake, lingeling, btor2tools +{ stdenv, fetchFromGitHub, lib, python3 +, cmake, lingeling, btor2tools, gtest, gmp }: stdenv.mkDerivation rec { pname = "boolector"; - version = "3.0.0"; + version = "3.2.1"; src = fetchFromGitHub { owner = "boolector"; repo = "boolector"; rev = "refs/tags/${version}"; - sha256 = "15i3ni5klss423m57wcy1gx0m5wfrjmglapwg85pm7fb3jj1y7sz"; + sha256 = "0jkmaw678njqgkflzj9g374yk1mci8yqvsxkrqzlifn6bwhwb7ci"; }; - patches = [ - (fetchpatch { - name = "CVE-2019-7560.patch"; - url = "https://github.com/Boolector/boolector/commit/8d979d02e0482c7137c9f3a34e6d430dbfd1f5c5.patch"; - sha256 = "1a1g02mk8b0azzjcigdn5zpshn0dn05fciwi8sd5q38yxvnvpbbi"; - }) - ]; + postPatch = '' + sed s@REPLACEME@file://${gtest.src}@ ${./cmake-gtest.patch} | patch -p1 + ''; nativeBuildInputs = [ cmake ]; - buildInputs = [ lingeling btor2tools ]; + buildInputs = [ lingeling btor2tools gmp ]; cmakeFlags = - [ "-DSHARED=ON" + [ "-DBUILD_SHARED_LIBS=ON" "-DUSE_LINGELING=YES" - "-DBTOR2_INCLUDE_DIR=${btor2tools.dev}/include" - "-DBTOR2_LIBRARIES=${btor2tools.lib}/lib/libbtor2parser.so" - "-DLINGELING_INCLUDE_DIR=${lingeling.dev}/include" - "-DLINGELING_LIBRARIES=${lingeling.lib}/lib/liblgl.a" - ]; + "-DBtor2Tools_INCLUDE_DIR=${btor2tools.dev}/include" + "-DBtor2Tools_LIBRARIES=${btor2tools.lib}/lib/libbtor2parser.so" + ] ++ (lib.optional (gmp != null) "-DUSE_GMP=YES"); installPhase = '' mkdir -p $out/bin $lib/lib $dev/include @@ -39,13 +33,22 @@ stdenv.mkDerivation rec { cp -vr bin/* $out/bin cp -vr lib/* $lib/lib - rm -rf $out/bin/{examples,test} + rm -rf $out/bin/{examples,tests} + # we don't care about gtest related libs + rm -rf $lib/lib/libg* cd ../src find . -iname '*.h' -exec cp --parents '{}' $dev/include \; rm -rf $dev/include/tests ''; + checkInputs = [ python3 ]; + doCheck = true; + preCheck = '' + export LD_LIBRARY_PATH=$(readlink -f lib) + patchShebangs .. + ''; + outputs = [ "out" "dev" "lib" ]; meta = with stdenv.lib; {