percona-toolkit/go-build.patch
Marcus Rueckert ca7a5a1963 - enable golang based tools
1. package is no longer noarch
  2. added go-build.patch
  3. add BR for golang tools

OBS-URL: https://build.opensuse.org/package/show/server:database/percona-toolkit?expand=0&rev=79
2021-10-05 02:37:06 +00:00

30 lines
1.3 KiB
Diff

Index: percona-toolkit-3.3.1/src/go/Makefile
===================================================================
--- percona-toolkit-3.3.1.orig/src/go/Makefile
+++ percona-toolkit-3.3.1/src/go/Makefile
@@ -14,9 +14,9 @@ FILES = $(shell find . -type f -name '*.
PREFIX=$(shell pwd)
TOP_DIR=$(shell git rev-parse --show-toplevel)
-BIN_DIR=$(shell git rev-parse --show-toplevel)/bin
-SRC_DIR=$(shell git rev-parse --show-toplevel)/src/go
-LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.GoVersion=${GOVERSION} -X main.Commit=${COMMIT} -s -w"
+BIN_DIR=$(TOP_DIR)/bin
+SRC_DIR=$(TOP_DIR)/src/go
+LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.GoVersion=${GOVERSION} -X main.Commit=${COMMIT} -w"
TEST_PSMDB_VERSION?=4.0
TEST_MONGODB_FLAVOR?=percona/percona-server-mongodb
@@ -111,6 +111,11 @@ env-down: env ## Clean-up MongoDB doc
docker-compose down -v
rm .env
+linux: ## Build Mongo tools for linux-amd64
+ echo "Building linux binaries in ${BIN_DIR}"
+ $(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
+ $(foreach pkg,$(pkgs),go build -mod=vendor -buildmode=pie -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
+
linux-amd64: ## Build Mongo tools for linux-amd64
@echo "Building linux/amd64 binaries in ${BIN_DIR}"
@cd ${TOP_DIR} && go get ./...