diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-04-14 10:52:10 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-04-20 09:36:44 +0300 |
commit | 442424c93441f73065197457f64bcabc48cd3bec (patch) | |
tree | b44abe70deb0f16699b589c5fbf144c433ab6f59 /Makefile | |
parent | b5c262145ff16802504f081fc23c12b6f193ba1f (diff) |
Makefile: Add ability to add custom git patches
Now that we have a documented process for applying custom git patches,
lay the foundations for adding patches in our Makefile. Adding a patch
is as simple as appending another file to the new `GIT_PATCHES`
variable.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -90,6 +90,12 @@ ifeq (${Q},@) GIT_QUIET = --quiet endif +ifeq (${GIT_PATCHES},) + # Before adding custom patches, please read doc/PROCESS.md#Patching-git + # first to make sure your patches meet our acceptance criteria. + GIT_PATCHES += +endif + ifeq (${GIT_BUILD_OPTIONS},) # activate developer checks GIT_BUILD_OPTIONS += DEVELOPER=1 @@ -417,7 +423,7 @@ ${DEPENDENCY_DIR}: | ${BUILD_DIR} ${DEPENDENCY_DIR}/libgit2.version: dependency-version | ${DEPENDENCY_DIR} ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${LIBGIT2_VERSION} ${LIBGIT2_BUILD_OPTIONS}" ] || >$@ echo -n "${LIBGIT2_VERSION} ${LIBGIT2_BUILD_OPTIONS}" ${DEPENDENCY_DIR}/git.version: dependency-version | ${DEPENDENCY_DIR} - ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${GIT_VERSION} ${GIT_BUILD_OPTIONS}" ] || >$@ echo -n "${GIT_VERSION} ${GIT_BUILD_OPTIONS}" + ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${GIT_VERSION} ${GIT_BUILD_OPTIONS} ${GIT_PATCHES}" ] || >$@ echo -n "${GIT_VERSION} ${GIT_BUILD_OPTIONS} ${GIT_PATCHES}" ${TOOLS_DIR}/%.version: dependency-version | ${TOOLS_DIR} ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${TOOL_VERSION}" ] || >$@ echo -n "${TOOL_VERSION}" @@ -439,7 +445,11 @@ ${GIT_INSTALL_DIR}/bin/git: ${DEPENDENCY_DIR}/git.version ${Q}${GIT} -C "${GIT_SOURCE_DIR}" config remote.origin.url ${GIT_REPO_URL} ${Q}${GIT} -C "${GIT_SOURCE_DIR}" config remote.origin.tagOpt --no-tags ${Q}${GIT} -C "${GIT_SOURCE_DIR}" fetch --depth 1 ${GIT_QUIET} origin ${GIT_VERSION} + ${Q}${GIT} -C "${GIT_SOURCE_DIR}" reset --hard ${Q}${GIT} -C "${GIT_SOURCE_DIR}" checkout ${GIT_QUIET} --detach FETCH_HEAD +ifneq (${GIT_PATCHES},) + ${Q}${GIT} -C "${GIT_SOURCE_DIR}" apply $(addprefix "${SOURCE_DIR}"/_support/git-patches/,${GIT_PATCHES}) +endif ${Q}rm -rf ${GIT_INSTALL_DIR} ${Q}mkdir -p ${GIT_INSTALL_DIR} env -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C ${GIT_SOURCE_DIR} -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install |