From 51acdda61805c8965d408cf5d1e6c3800075bf8c Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 7 Nov 2020 16:25:28 +0100 Subject: [PATCH] bear: 2.4.2 -> 3.0.1 Bear has been completely redone, this is basically a new package --- .../build-managers/bear/cmakepaths.patch | 13 ------ .../tools/build-managers/bear/default.nix | 41 +++++++++++++++---- .../build-managers/bear/ignore_wrapper.patch | 27 ------------ .../bear/no-double-relative.patch | 14 +++++++ 4 files changed, 48 insertions(+), 47 deletions(-) delete mode 100644 pkgs/development/tools/build-managers/bear/cmakepaths.patch delete mode 100644 pkgs/development/tools/build-managers/bear/ignore_wrapper.patch create mode 100644 pkgs/development/tools/build-managers/bear/no-double-relative.patch diff --git a/pkgs/development/tools/build-managers/bear/cmakepaths.patch b/pkgs/development/tools/build-managers/bear/cmakepaths.patch deleted file mode 100644 index d237267078e6..000000000000 --- a/pkgs/development/tools/build-managers/bear/cmakepaths.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 04c5c58..429ca47 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -24,7 +24,7 @@ set(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Rogue") - - set(EAR_LIB_FILE ${CMAKE_SHARED_LIBRARY_PREFIX}ear${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(EAR_LIB_PATH "${CMAKE_INSTALL_LIBDIR}/bear") --set(DEFAULT_PRELOAD_FILE ${CMAKE_INSTALL_PREFIX}/${EAR_LIB_PATH}/${EAR_LIB_FILE} CACHE STRING "Default path to libear.") -+set(DEFAULT_PRELOAD_FILE ${EAR_LIB_PATH}/${EAR_LIB_FILE} CACHE STRING "Default path to libear.") - - add_subdirectory(libear) - add_subdirectory(bear) diff --git a/pkgs/development/tools/build-managers/bear/default.nix b/pkgs/development/tools/build-managers/bear/default.nix index bc7bb46cd5b9..cd5e508fbdd6 100644 --- a/pkgs/development/tools/build-managers/bear/default.nix +++ b/pkgs/development/tools/build-managers/bear/default.nix @@ -1,22 +1,49 @@ -{ stdenv, fetchFromGitHub, cmake, python3 }: +{ stdenv +, fetchFromGitHub +, cmake +, pkg-config +, grpc +, protobuf +, openssl +, nlohmann_json +, gtest +, fmt +, spdlog +, c-ares +, abseil-cpp +, zlib +}: stdenv.mkDerivation rec { pname = "bear"; - version = "2.4.2"; + version = "3.0.1"; src = fetchFromGitHub { owner = "rizsotto"; repo = pname; rev = version; - sha256 = "1w1kyjzvvy5lj16kn3yyf7iil2cqlfkszi8kvagql7f5h5l6w9b1"; + sha256 = "02vzlm48ywf6s3fly19j94k11dqx94x8pgmkq1ylx3z3d1y3b5zb"; }; - nativeBuildInputs = [ cmake ]; - buildInputs = [ python3 ]; # just for shebang of bin/bear + nativeBuildInputs = [ cmake pkg-config ]; - doCheck = false; # all fail + buildInputs = [ + grpc + protobuf + openssl + nlohmann_json + gtest + fmt + spdlog + c-ares + abseil-cpp + zlib + ]; - patches = [ ./ignore_wrapper.patch ./cmakepaths.patch ]; + patches = [ + # Default libexec would be set to /nix/store/*-bear//nix/store/*-bear/libexec/... + ./no-double-relative.patch + ]; meta = with stdenv.lib; { description = "Tool that generates a compilation database for clang tooling"; diff --git a/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch b/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch deleted file mode 100644 index 8effc723bbab..000000000000 --- a/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/bear/main.py.in -+++ b/bear/main.py.in -@@ -49,6 +49,7 @@ import tempfile - import shutil - import contextlib - import logging -+from distutils.spawn import find_executable - - # Map of ignored compiler option for the creation of a compilation database. - # This map is used in _split_command method, which classifies the parameters -@@ -569,7 +570,15 @@ class Compilation: - (compiler, language, rest of the command) otherwise """ - - if command: # not empty list will allow to index '0' and '1:' -- executable = os.path.basename(command[0]) # type: str -+ executable_file = find_executable(command[0]) -+ if executable_file: -+ absolute_executable = os.path.realpath(executable_file) -+ # Ignore Nix wrappers. -+ if 'wrapper' in absolute_executable: -+ return None -+ executable = os.path.basename(absolute_executable) -+ else: -+ executable = os.path.basename(command[0]) - parameters = command[1:] # type: List[str] - # 'wrapper' 'parameters' and - # 'wrapper' 'compiler' 'parameters' are valid. \ No newline at end of file diff --git a/pkgs/development/tools/build-managers/bear/no-double-relative.patch b/pkgs/development/tools/build-managers/bear/no-double-relative.patch new file mode 100644 index 000000000000..0184bdfd6ba7 --- /dev/null +++ b/pkgs/development/tools/build-managers/bear/no-double-relative.patch @@ -0,0 +1,14 @@ +diff --git a/source/config.h.in b/source/config.h.in +index 2ca8853..2564c63 100644 +--- a/source/config.h.in ++++ b/source/config.h.in +@@ -65,6 +65,6 @@ constexpr char VERSION[] = "@CMAKE_PROJECT_VERSION@"; + + constexpr char CITNAMES_DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/citnames"; + constexpr char INTERCEPT_DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/intercept"; +-constexpr char LIBRARY_DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@exec@CMAKE_SHARED_LIBRARY_SUFFIX@"; +-constexpr char EXECUTOR_DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/er"; +-constexpr char WRAPPER_DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/wrapper.d"; ++constexpr char LIBRARY_DEFAULT_PATH[] = "@CMAKE_INSTALL_LIBEXECDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@exec@CMAKE_SHARED_LIBRARY_SUFFIX@"; ++constexpr char EXECUTOR_DEFAULT_PATH[] = "@CMAKE_INSTALL_LIBEXECDIR@/er"; ++constexpr char WRAPPER_DEFAULT_PATH[] = "@CMAKE_INSTALL_LIBEXECDIR@/wrapper.d";