# Copyright (c) 2015 Jakub Cajka <jcajka@redhat.com>, Jan Chaloupka <jchaloup@redhat.com>
# This file is distributed under the terms of GNU GPL license version 3, or
# any later version.
# This file contains macros for building projects in golang for packages
# with golang compiler or gcc-go compiler based on an architecture.
# Define commands for building
# BUILD_ID can be generated for golang build no matter of debuginfo
%gobuild(o:) \
%ifnarch ppc64 \
go build -buildmode pie -compiler gc -tags=rpm_crashtraceback -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\
%else \
go build -compiler gc -tags=rpm_crashtraceback -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\
%endif \
# Define commands for testing
%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**};