23 stdenv.mkDerivation (finalAttrs: {
27 src = fetchFromGitHub {
30 rev = finalAttrs.version;
31 hash = "sha256-pwdjytP+kmTwozRl1Gd0jUqRs3wfvcYPqiQvVwa6s9c=";
53 # This patch is necessary to run tests in a separate phase. By default
54 # test targets are run with ALL, which is not what we want. This patch creates
55 # separate 'test' step targets for each cmake ExternalProject:
56 # - BearTest-test (functional lit tests)
57 # - BearSource-test (unit tests via gtest)
58 ./0001-exclude-tests-from-all.patch
71 # Build system and generated files concatenate install prefix and
72 # CMAKE_INSTALL_{BIN,LIB}DIR, which breaks if these are absolute paths.
73 "-DCMAKE_INSTALL_BINDIR=bin"
74 "-DCMAKE_INSTALL_LIBDIR=lib"
75 (lib.cmakeBool "ENABLE_UNIT_TESTS" finalAttrs.doCheck)
76 (lib.cmakeBool "ENABLE_FUNC_TESTS" finalAttrs.doCheck)
79 checkTarget = lib.concatStringsSep " " [
87 # Disable failing tests. The cause is not immediately clear.
88 LIT_FILTER_OUT = lib.concatStringsSep "|" [
89 "cases/compilation/output/config/filter_compilers.sh"
90 "cases/intercept/preload/posix/execvpe/success_to_resolve.c"
91 "cases/intercept/preload/posix/popen/success.c"
92 "cases/intercept/preload/posix/posix_spawnp/success_to_resolve.c"
93 "cases/intercept/preload/posix/system/success.c"
94 "cases/intercept/preload/shell_commands_intercepted_without_shebang.sh"
99 patchShebangs test/bin
101 # /usr/bin/env is used in test commands and embedded scripts.
102 find test -name '*.sh' \
103 -exec sed -ie 's|/usr/bin/env|${coreutils}/bin/env|g' {} +
106 # Functional tests use loopback networking.
107 __darwinAllowLocalNetworking = true;
110 description = "Tool that generates a compilation database for clang tooling";
111 mainProgram = "bear";
113 Note: the bear command is very useful to generate compilation commands
114 e.g. for YouCompleteMe. You just enter your development nix-shell
115 and run `bear make`. It's not perfect, but it gets a long way.
117 homepage = "https://github.com/rizsotto/Bear";
118 license = licenses.gpl3Plus;
119 platforms = platforms.unix;
120 maintainers = with maintainers; [ DieracDelta ];