Accepting request 250058 from home:cbosdonnat:branches:devel:languages:go

- Removed extra src folder in /usr/share/go/contrib: the goal is to
  transform this folder into a proper entry for GOPATH. This folder
  is now linked to %{_libdir}/go/contrib
- go requires gcc to build sources using cgo
- tools-packaging.patch: Allow building cover and vet tools in
  $GOROOT_TARGET/pkg/tool instead of $GOROOT/pkg/tool. This will
  allow building go tools as a separate package

OBS-URL: https://build.opensuse.org/request/show/250058
OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=194
This commit is contained in:
Marguerite Su 2014-09-18 09:18:45 +00:00 committed by Git OBS Bridge
parent 6753fc0786
commit dce2cfd4e4
4 changed files with 42 additions and 8 deletions

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Sep 16 15:15:20 UTC 2014 - cbosdonnat@suse.com
- Removed extra src folder in /usr/share/go/contrib: the goal is to
transform this folder into a proper entry for GOPATH. This folder
is now linked to %{_libdir}/go/contrib
- go requires gcc to build sources using cgo
- tools-packaging.patch: Allow building cover and vet tools in
$GOROOT_TARGET/pkg/tool instead of $GOROOT/pkg/tool. This will
allow building go tools as a separate package
-------------------------------------------------------------------
Tue Sep 9 14:56:06 UTC 2014 - i@marguerite.su

16
go.spec
View File

@ -28,7 +28,7 @@ Source0: http://golang.org/dl/go%{version}.src.tar.gz
Source1: go-rpmlintrc
Source2: go.sh
Source3: macros.go
Source6: go-wiki-gadget.xml
Source4: go-wiki-gadget.xml
Source5: README-openSUSE
# PATCH-FIX-OPENSUSE add -s flag to 'go install' (don't rebuild/install std libs)
Patch1: go-build-dont-reinstall-stdlibs.patch
@ -39,6 +39,8 @@ Patch2: allow-binary-only-packages.patch
Patch3: verbose-build.patch
# PATCH-FIX-OPENSUSE BNC#776058
Patch4: go-install-dont-reinstall-stdlibs.patch
# PATCH-FIX-OPENSUSE enable writing tools outside $GOROOT/pkg/tool for packaging
Patch5: tools-packaging.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: rpm
%if 0%{?suse_version} >= 1210
@ -53,6 +55,7 @@ Recommends: go-doc
BuildRequires: rpm >= 4.11.1
%endif
%endif
Requires: gcc
Provides: go-devel = %{name}%{version}
Provides: go-devel-static = %{name}%{version}
Obsoletes: go-devel < %{name}%{version}
@ -95,6 +98,7 @@ Emacs syntax highlighting scheme for the Go programming language.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
cp %{SOURCE5} .
# setup go_arch (BSD-like scheme)
@ -146,13 +150,13 @@ install -Dm644 misc/vim/ftdetect/gofiletype.vim %{buildroot}%{_datadir}/vim/site
# locations for third party libraries, see README-openSUSE for info about locations.
install -d %{buildroot}%{_libdir}/go/contrib/pkg/linux_%{go_arch}
install -d %{buildroot}%{_datadir}/go/contrib/src/pkg
install -d %{buildroot}%{_datadir}/go/contrib/src/cmd
install -d %{buildroot}%{_libdir}/go/contrib/cmd
install -d %{buildroot}%{_libdir}/go/contrib/src
install -Dm644 README-openSUSE %{buildroot}%{_libdir}/go/contrib/
ln -s %{_libdir}/go/contrib/README-openSUSE %{buildroot}%{_datadir}/go/contrib/README-openSUSE
install -d %{buildroot}%{_datadir}/go
ln -s %{_libdir}/go/contrib/ %{buildroot}%{_datadir}/go/
# source files for go install, godoc, etc
install -d %{buildroot}%{_datadir}/go
for ext in *.{go,c,h,s,S,py}; do
find src -name ${ext} -exec install -Dm644 \{\} %{buildroot}%{_datadir}/go/\{\} \;
done
@ -207,7 +211,7 @@ ln -s %{_datadir}/go/src/pkg/runtime/{cgocall,runtime}.h %{buildroot}%{_libdir}/
%endif
%{_datadir}/go/
%{_bindir}/go*
%{_libdir}/go/
%{_libdir}/go
# bash completion seems broken
#%%config %{_sysconfdir}/bash_completion.d/go.sh
%config %{_sysconfdir}/profile.d/go.sh

View File

@ -13,7 +13,7 @@
%go_sitedir %{_libdir}/go/pkg
%go_sitearch %{_libdir}/go/pkg/linux_%{go_arch}
%go_contribdir %{_libdir}/go/contrib/pkg/linux_%{go_arch}
%go_contribsrcdir %{_datadir}/go/contrib/src/pkg
%go_contribsrcdir %{_datadir}/go/contrib/src
%go_tooldir %{_datadir}/go/pkg/tool/linux_%{go_arch}
%go_exclusivearch \
@ -181,4 +181,4 @@ Requires: %{-n:%{-n*}}%{!-n:%{name}} = %{version} \
%{-r:Requires: %{-r*}} \
%description %{-n:-n %{-n*}-}doc \
This package provides API, examples and documentation \
for package %{name}.
for package %{name}.

19
tools-packaging.patch Normal file
View File

@ -0,0 +1,19 @@
Index: go/src/cmd/go/pkg.go
===================================================================
--- go.orig/src/cmd/go/pkg.go
+++ go/src/cmd/go/pkg.go
@@ -398,7 +398,13 @@ func (p *Package) load(stk *importStack,
if goTools[p.ImportPath] == toTool {
// This is for 'go tool'.
// Override all the usual logic and force it into the tool directory.
- p.target = filepath.Join(gorootPkg, "tool", full)
+ // If GOROOT_TARGET is set, then write to it for packaging purpose
+ gorootTarget := os.Getenv("GOROOT_TARGET")
+ if gorootTarget == "" {
+ p.target = filepath.Join(gorootPkg, "tool", full)
+ } else {
+ p.target = filepath.Join(gorootTarget, "pkg/tool", full)
+ }
}
if p.target != "" && buildContext.GOOS == "windows" {
p.target += ".exe"