Merge pull request #103092 from Atemu/update/bear

bear: 2.4.2 -> 3.0.1
This commit is contained in:
Doron Behar 2020-11-09 01:11:13 +02:00 committed by GitHub
commit 4d79d20643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 47 deletions

View File

@ -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)

View File

@ -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";

View File

@ -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.

View File

@ -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";