go/macros.go

25 lines
1014 B
Go
Raw Normal View History

# Macros for Go module building.
#
# Copyright (c) 2011 Sascha Peilicke <saschpe@gmx.de>
#
%go_ver %(LC_ALL=C rpm -q --qf '%%{epoch}:%%{version}\\n' go | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
%go_arch GOARCH
%go_dir %{_libdir}/go
%go_sitedir %{_libdir}/go/pkg
%go_sitearch %{_libdir}/go/pkg/linux_%{go_arch}
%go_requires %(echo '%*' | LC_ALL=C xargs -r rpm -q --qf 'Requires: %%{name} >= %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
%go_provides \
Provides: %{name}-devel = %{version} \
Provides: %{name}-devel-static = %{version}
%go_disable_brp_strip_static_archive \
%define __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib/rpm/[^/]*/?brp-strip-static-archive %{__strip}!!g')
%go_make HOST_EXTRA_CFLAGS="%{optflags}" gomake
%go_make_install HOST_EXTRA_CFLAGS="%{optflags}" TARGDIR=%{buildroot}%{go_sitearch} gomake install
%go_make_test HOST_EXTRA_CFLAGS="%{optflags}" gomake test