Files
bitcoin/cmake
merge-script 211e1053bf Merge bitcoin/bitcoin#32220: cmake: Get rid of undocumented BITCOIN_GENBUILD_NO_GIT environment variable
3142e5f8cf doc: Add release notes for #32220 (Hennadii Stepanov)
b71cd5c162 cmake: Skip using git when building from source tarball or as subproject (Hennadii Stepanov)
fe941938e8 cmake: Remove unnecessary `BITCOIN_GENBUILD_NO_GIT` environment variable (Hennadii Stepanov)
9a2cced23a cmake, refactor: Move `find_package(Git)` to `src/CMakeLists.txt` (Hennadii Stepanov)

Pull request description:

  In general, the Bitcoin Core build system attempts to fetch commit or tag details from git. This is handled by the [`cmake/script/GenerateBuildInfo.cmake`](https://github.com/bitcoin/bitcoin/blob/master/cmake/script/GenerateBuildInfo.cmake) script, which generates the [`src/bitcoin-build-info.h`](65dcbec756/src/clientversion.cpp (L26-L31)) header within the build tree.

  However, there are cases where the retrieved details may be incorrect—for example, when building from a source tarball or as a subproject within a git-aware project.

  In the Autotools-based build system, the `BITCOIN_GENBUILD_NO_GIT` environment variable was [introduced](https://github.com/bitcoin/bitcoin/pull/7522) in [v0.20.0](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.20.0.md) to address such scenarios:
  > The process for generating the source code release ("tarball") has changed in an effort to make it more complete, however, there are a few regressions in this release:
  > - Instead of running `make` simply, you should instead run `BITCOIN_GENBUILD_NO_GIT=1 make`.

  This PR automagically handles both of the aforementioned cases and removes the need for `BITCOIN_GENBUILD_NO_GIT`.

  The user is still able to configure the build with [`-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON`](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html) to disable git execution manually, for [reasons](https://github.com/bitcoin/bitcoin/pull/32220#issuecomment-2780115034) we don't know in advance.

  Closes https://github.com/bitcoin/bitcoin/issues/31999.

ACKs for top commit:
  maflcko:
    review ACK 3142e5f8cf 🥄
  fanquake:
    ACK 3142e5f8cf - tested a few different build scenarios (from Guix the tarball), they all seem to work as intended.

Tree-SHA512: 14995dc76fc680cff2bbc983d525125b39f49397e8ed94fffab29de505723a8e2f7f261c1a7ca88d98776755ccf63e59a32c476e112683f5cc1c016a7cfede94
2026-05-21 12:18:27 +01:00
..
2025-03-04 14:53:06 +00:00