diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/build-managers/bear')
3 files changed, 69 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/build-managers/bear/cmakepaths.patch b/nixpkgs/pkgs/development/tools/build-managers/bear/cmakepaths.patch new file mode 100644 index 000000000000..d237267078e6 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/bear/cmakepaths.patch @@ -0,0 +1,13 @@ +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/nixpkgs/pkgs/development/tools/build-managers/bear/default.nix b/nixpkgs/pkgs/development/tools/build-managers/bear/default.nix new file mode 100644 index 000000000000..51e8d12d3147 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/bear/default.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchFromGitHub, cmake, python }: + +stdenv.mkDerivation rec { + name = "bear-${version}"; + version = "2.3.13"; + + src = fetchFromGitHub { + owner = "rizsotto"; + repo = "Bear"; + rev = version; + sha256 = "0imvvs22gyr1v6ydgp5yn2nq8fb8llmz0ra1m733ikjaczl3jm7z"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ python ]; # just for shebang of bin/bear + + doCheck = false; # all fail + + patches = [ ./ignore_wrapper.patch ./cmakepaths.patch ]; + + meta = with stdenv.lib; { + description = "Tool that generates a compilation database for clang tooling"; + longDescription = '' + Note: the bear command is very useful to generate compilation commands + e.g. for YouCompleteMe. You just enter your development nix-shell + and run `bear make`. It's not perfect, but it gets a long way. + ''; + homepage = https://github.com/rizsotto/Bear; + license = licenses.gpl3Plus; + platforms = platforms.unix; + maintainers = [ maintainers.vcunat maintainers.babariviere ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch b/nixpkgs/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch new file mode 100644 index 000000000000..f70e3811f654 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch @@ -0,0 +1,23 @@ +--- Bear-2.3.11-src/bear/main.py.in 1970-01-01 01:00:01.000000000 +0100 ++++ Bear-2.3.11-src-patch/bear/main.py.in 1970-01-01 01:00:01.000000000 +0100 +@@ -49,6 +49,7 @@ + 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 +@@ -540,7 +541,11 @@ + any(pattern.match(cmd) for pattern in COMPILER_PATTERNS_CXX) + + if command: # not empty list will allow to index '0' and '1:' +- executable = os.path.basename(command[0]) # type: str ++ absolute_executable = os.path.realpath(find_executable(command[0])) ++ if 'wrapper' in absolute_executable: ++ return None ++ ++ executable = os.path.basename(absolute_executable) # type: str + parameters = command[1:] # type: List[str] + # 'wrapper' 'parameters' and + # 'wrapper' 'compiler' 'parameters' are valid. \ No newline at end of file |