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