go/macros.go
Sascha Peilicke cdcc1ad412 - Improve macros %go_make, %go_make_test and %go_make_install:
* Set TARGDIR and GOBIN all macros (bnc#735320)
  * Make sure %{buildroot}%{_bindir} exists in any case
- The above should simplify spec files for Go packages that use, .e.g.,
  'make tools' to install additional stuff (like binaries)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=101
2011-12-13 14:23:16 +00:00

27 lines
1.0 KiB
Go

# 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 \
install -d %{buildroot}%{_bindir} \
HOST_EXTRA_CFLAGS="%{optflags}" TARGDIR=%{buildroot}%{go_sitearch} GOBIN=%{buildroot}%{_bindir} gomake
%go_make_install %{go_make} install
%go_make_test %{go_make} test