diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-30 14:38:41 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-01 10:15:29 +0300 |
commit | 1facc49c15d71bf1dd85e15f5b097dc5c8358852 (patch) | |
tree | 56766a4e0b3845ebebd4e4ab31a7b536c73501c5 | |
parent | 4bfe8e844e53595d7f115332d0fd6acc18e84a27 (diff) |
Makefile: Always build Go binaries with a build ID
We have recently introduced support for generating build IDs in Gitaly.
The biggest downside of this support is that we're forced to build all
binaries with separate commands, which is quite a lot slower by default
than when we built all commands with a single execution of the Go
compiler. Because of this we have added a fallback case that allows
developers to skip generation of the build ID so that local development
isn't significiantly slowed down.
Unfortunately, we now have another nail in the coffin for building all
binaries with a single command: we need to be able to specify separate
Go build tags per Go executable. This becomes unworkable though in the
case where we build them all in one go.
Luckily though, Gitaly's Makefile has recently also dropped the
`.NOPARALLEL` special target. With this target gone, we can parallelize
compilation of the different Go binaries via make(1) itself. This brings
us back most of the performance we would loose when we build binaries
with separate invocations of the compiler.
So let's drop the workaround which allowed developers to skip generating
the build ID. Instead, they should simply ask make(1) to parallelize
compilation via the `-j` flag. This change both simplifies our Makefile
and at the same time paves the way for per-binary Go tags.
-rw-r--r-- | Makefile | 12 |
1 files changed, 1 insertions, 11 deletions
@@ -43,9 +43,6 @@ INSTALL_DEST_DIR := ${DESTDIR}${bindir} ## The prefix where Git will be installed to. GIT_PREFIX ?= ${GIT_DEFAULT_PREFIX} -## Skip generation of the GNU build ID if set to speed up builds. -WITHOUT_BUILD_ID ?= - # Tools GIT := $(shell command -v git) GOIMPORTS := ${TOOLS_DIR}/goimports @@ -269,13 +266,7 @@ help: .PHONY: build ## Build Go binaries and install required Ruby Gems. -build: ${SOURCE_DIR}/.ruby-bundle -ifdef WITHOUT_BUILD_ID - go install -ldflags '${GO_LDFLAGS}' -tags "${GO_BUILD_TAGS}" $(addprefix ${GITALY_PACKAGE}/cmd/, ${GITALY_EXECUTABLES}) -endif - -ifndef WITHOUT_BUILD_ID -build: ${GITALY_EXECUTABLES} +build: ${SOURCE_DIR}/.ruby-bundle ${GITALY_EXECUTABLES} gitaly-git2go-v14: libgit2 @@ -291,7 +282,6 @@ ${GITALY_EXECUTABLES}: ${Q}GO_BUILD_ID=$$( go tool buildid $(addprefix ${BUILD_DIR}/bin/, $@) || openssl rand -hex 32 ) && \ GNU_BUILD_ID=$$( echo $$GO_BUILD_ID | sha1sum | cut -d' ' -f1 ) && \ go install -ldflags '${GO_LDFLAGS}'" -B 0x$$GNU_BUILD_ID" -tags "${GO_BUILD_TAGS}" $(addprefix ${GITALY_PACKAGE}/cmd/, $@) -endif .PHONY: install ## Install Gitaly binaries. The target directory can be modified by setting PREFIX and DESTDIR. |