Makefile: Add ability to build git from official source distribution
In order to build git, we currently allow users to either use prebuilt binaries which we provide as part of our CI infrastructure, or to build git from sources. In order to build it from sources, we do require the host environment to have git preinstalled already given that we clone or fetch the git repository to disk. This works well enough for development environments, but does not work so well in others. Most importantly, downstream users which want to make use of our git distribution to e.g. build Docker images may not have a git version installed at all.
To fix the issue, this commit introduces the ability to build git from
official git sources via make git GIT_USE_SOURCES=YesPlease
. Instead
of using git to retrieve sources, we use curl(1) to fetch and extract
the archive from upstream. This removes the dependency on git to build
git itself, removing the chicken-and-egg problem.
One shortcoming of the current implementation is that it is not possible to arbitrarily switch between building git from a git repo and building it from a source archive. This should not be much of a problem though as they would typically be used in different contexts anyway.