Accepting request 559142 from home:jordimassaguerpla:branch:d_l_g:meta_go

OBS-URL: https://build.opensuse.org/request/show/559142
OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=304
This commit is contained in:
Thomas Hipp 2017-12-22 09:22:22 +00:00 committed by Git OBS Bridge
parent 37b368d465
commit a35d18e75e
19 changed files with 19 additions and 872 deletions

1
README Normal file
View File

@ -0,0 +1 @@
This is just a dummy package to pull the default go for the current distribution.

View File

@ -1,120 +0,0 @@
Updated: 05.05.2012
Authors: Graham Anderson, <graham@andtech.eu>
PROJECT DETAILS
---------------
OBS: https://build.opensuse.org/project/show?project=devel:languages:go
Maintainers: Sascha Peilicke (saschpe),
Graham Anderson (andtecheu)
Wiki: http://en.opensuse.org/Go
http://en.opensuse.org/openSUSE:Packaging_Go
GENERAL NOTES
-------------
Go toolchain environmental variables are configured via go.sh, which is
installed to /etc/profile.d/go.sh
Packaging guidelines and an RPM spec file recipe for packaging third party Go
libraries can be found on the openSUSE wiki:
http://en.opensuse.org/openSUSE:Packaging_Go
The openSUSE go package uses the standard Go distribution toolchain, with a
a small patchset to modify a few of the toolchain commands to suit our
environment and packaging needs.
This means that many of the standard go toolchain commands are not inside a
users PATH, but rather are invoked and used via the "go" command. Should you
wish to script or manually use the commands, the install location on a 64 bit
system is /usr/lib64/go/pkg/tool/linux_amd64
The "go" tool, the "godoc" document server are inside a users PATH.
We currently don't support the gccgo implementation, this is not for
any other reason than contributer and maintainer time constraints.
GO DOCUMENTATION
----------------
As of yet, there are no man pages for the standard Go distribution toolchain,
please see the documentation provided by the "godoc" command. Man pages are
slated to be included in the release in future.
One of the diffs from the maintained patchset adds the distro specific doc and
source file locations of the *-doc RPM packages to the virtual filesystem of
the "godoc" documentation server. That is to say, as long as packages follow
the Go packaging guidelines, API and other documentation should always be
available via the godoc server if the packages "doc" RPM is installed.
PACKAGE INSTALL LOCATIONS
-------------------------
Go standard library packages are installed to a location in $GOROOT, which is
defined as /usr/lib64/go on 64bit systems.
Third party package binaries are installed to the default system wide
$GOPATH entry. On 64bit systems the location /usr/lib64/go/contrib is used.
This is specified in the macros.go RPM macro definition file that is part of
the main Go package and is used for packaging most third party Go libraries.
The reasons binary packages are installed to a GOPATH entry instead of GOROOT
are mainly to do with how the Go toolchain prioritises and behaves with
packages installed to the same location as the Go std library.
By installing third party packages to a system-wide GOPATH entry location,
we can ensure that no packages clobber the standard library namespace or file
tree. Additionally we can support binary only packages, which as of Go 1.1
will only be supported outside of the $GOROOT.
There are additional benefits to this location; such as allowing users and
developers to prioritise linking from their own user defined GOPATH, which
defaults to $HOME/go configured via /etc/profile.d/go.sh config. This has
particular benefit for development workflows.
For Go 1.1 and beyond, building and linking with binary only pacakges will
only be supported with the following caveat. Package source code must not
exist in the same GOPATH segment as the binary package .a archive file.
If both the binary archive (.a) and the package source are installed to the
same GOPATH segment, then the "go build" or "go install" command will
prioritise building the software using package sources before using package
binary archives. A side effect of this is that is actually possible to have
source code only third party packages.
To summarise the priority of binary package linking and building:
1. Any source files or binary packages in $GOROOT are considered first. Any
binary packages in $GOROOT that are considered "stale" by the build tools
are ignored in favour of the package source.
2. $GOPATH is considered next for import statements. GOPATH is a colon
delimited list of paths. GOPATH segments are examined by the build tools
in a FIFO manner, left to right.
Both a system wide and a user GOPATH segment are configured by default,
the user GOPATH segment takes priority over the system segment to allow
flexibility for development workflows.
The default user GOPATH is:
GOPATH=$HOME/go:$GOROOT/contrib
The default root user GOPATH is:
GOPATH=$GOROOT/contrib
3. For Go < 1.1, If both the source and binary archive is available for a
package import in the same GOPATH segment, the binary archive will take
precedence and will be linked during compilation.
For Go >= 1.1 If the package source is avaiable in the GOPATH segment, it
will always be used in preference to the binary

View File

@ -1,14 +0,0 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">https://git.llvm.org/git/compiler-rt.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<!-- [boo#1052528] Always make sure this is kept up to date with src/runtime/race/README. -->
<param name="versionformat">g%H</param>
<param name="revision">68e1532492f9b3fce0e9024f3c31411105965b11</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">compiler-rt-*.tar</param>
<param name="compression">xz</param>
</service>
</services>

View File

@ -1,13 +0,0 @@
Index: go/src/cmd/go/internal/load/pkg.go
===================================================================
--- go.orig/src/cmd/go/internal/load/pkg.go
+++ go/src/cmd/go/internal/load/pkg.go
@@ -414,7 +414,7 @@ func LoadImport(path, srcDir string, par
// Not vendoring, or we already found the vendored path.
buildMode |= build.IgnoreVendor
}
- bp, err := cfg.BuildContext.Import(path, srcDir, buildMode)
+ bp, err := cfg.BuildContext.Import(path, srcDir, build.AllowBinary|buildMode)
bp.ImportPath = importPath
if cfg.GOBIN != "" {
bp.BinDir = cfg.GOBIN

View File

@ -1,13 +0,0 @@
diff --git a/src/runtime/os_linux_generic.go b/src/runtime/os_linux_generic.go
index a16d140..8351ffb 100644
--- a/src/runtime/os_linux_generic.go
+++ b/src/runtime/os_linux_generic.go
@@ -11,7 +11,7 @@ package runtime
const (
_SS_DISABLE = 2
- _NSIG = 65
+ _NSIG = 64
_SI_USER = 0
_SIG_BLOCK = 0
_SIG_UNBLOCK = 1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f1432b2663f123f5124b353dbc68ce8e0a29ee6196cda3561dc9a94b37287fe3
size 1395408

View File

@ -1,105 +0,0 @@
From 8a5e425a68de4d2c80ff00a97bbcb3722a4716da Mon Sep 17 00:00:00 2001
From: Kostya Serebryany <kcc@google.com>
Date: Thu, 13 Jul 2017 21:59:01 +0000
Subject: [PATCH] Fix sanitizer build against latest glibc
Summary:
libsanitizer doesn't build against latest glibc anymore, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066 for details.
One of the changes is that stack_t changed from typedef struct sigaltstack { ... } stack_t; to typedef struct { ... } stack_t; for conformance reasons.
And the other change is that the glibc internal __need_res_state macro is now ignored, so when doing
```
#define __need_res_state
#include <resolv.h>
```
the effect is now the same as just
```
#include <resolv.h>
```
and thus one doesn't get just the
```
struct __res_state { ... };
```
definition, but newly also the
```
extern struct __res_state *__res_state(void) __attribute__ ((__const__));
```
prototype. So __res_state is no longer a type, but a function.
Reviewers: kcc, ygribov
Reviewed By: kcc
Subscribers: kubamracek
Differential Revision: https://reviews.llvm.org/D35246
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307969 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/sanitizer_common/sanitizer_linux.cc | 3 +--
lib/sanitizer_common/sanitizer_linux.h | 4 +---
lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +-
lib/tsan/rtl/tsan_platform_linux.cc | 2 +-
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
index a79a2a155..8c3c1e5d6 100644
--- a/lib/sanitizer_common/sanitizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_linux.cc
@@ -629,8 +629,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
}
#endif
-uptr internal_sigaltstack(const struct sigaltstack *ss,
- struct sigaltstack *oss) {
+uptr internal_sigaltstack(const void *ss, void *oss) {
return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
}
diff --git a/lib/sanitizer_common/sanitizer_linux.h b/lib/sanitizer_common/sanitizer_linux.h
index ee336f7dd..11cad6b80 100644
--- a/lib/sanitizer_common/sanitizer_linux.h
+++ b/lib/sanitizer_common/sanitizer_linux.h
@@ -21,7 +21,6 @@
#include "sanitizer_platform_limits_posix.h"
struct link_map; // Opaque type returned by dlopen().
-struct sigaltstack;
namespace __sanitizer {
// Dirent structure for getdents(). Note that this structure is different from
@@ -30,8 +29,7 @@ struct linux_dirent;
// Syscall wrappers.
uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
- struct sigaltstack* oss);
+uptr internal_sigaltstack(const void* ss, void* oss);
uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
__sanitizer_sigset_t *oldset);
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 03f73ae88..d7fa5f645 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -287,7 +287,7 @@ static int TracerThread(void* argument) {
// Alternate stack for signal handling.
InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
- struct sigaltstack handler_stack;
+ stack_t handler_stack;
internal_memset(&handler_stack, 0, sizeof(handler_stack));
handler_stack.ss_sp = handler_stack_memory.data();
handler_stack.ss_size = kHandlerStackSize;
diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc
index 0ba01babe..ead1e5704 100644
--- a/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
@@ -286,7 +286,7 @@ void InitializePlatform() {
int ExtractResolvFDs(void *state, int *fds, int nfd) {
#if SANITIZER_LINUX && !SANITIZER_ANDROID
int cnt = 0;
- __res_state *statp = (__res_state*)state;
+ struct __res_state *statp = (struct __res_state*)state;
for (int i = 0; i < MAXNS && cnt < nfd; i++) {
if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
fds[cnt++] = statp->_u._ext.nssocks[i];

View File

@ -1,67 +0,0 @@
Index: go/src/cmd/dist/buildtool.go
===================================================================
--- go.orig/src/cmd/dist/buildtool.go
+++ go/src/cmd/dist/buildtool.go
@@ -164,7 +164,7 @@ func bootstrapBuildTools() {
// Use the math_big_pure_go build tag to disable the assembly in math/big
// which may contain unsupported instructions.
cmd := []string{
- pathf("%s/bin/go", goroot_bootstrap),
+ pathf("%s/bin/go-6", goroot_bootstrap),
"install",
"-gcflags=-l",
"-tags=math_big_pure_go",
Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -41,7 +41,7 @@
# This is used by cgo. Default is CC.
#
# CXX_FOR_TARGET: Command line to run to compile C++ code for GOARCH.
-# This is used by cgo. Default is CXX, or, if that is not set,
+# This is used by cgo. Default is CXX, or, if that is not set,
# "g++" or "clang++".
#
# FC: Command line to run to compile Fortran code for GOARCH.
@@ -120,8 +120,8 @@ echo '##### Building Go bootstrap tool.'
echo cmd/dist
export GOROOT="$(cd .. && pwd)"
GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
- echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
+if [ ! -x "$GOROOT_BOOTSTRAP/bin/go-6" ]; then
+ echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go-6." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
exit 1
fi
@@ -131,7 +131,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
exit 1
fi
rm -f cmd/dist/dist
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go-6" build -o cmd/dist/dist ./cmd/dist
# -e doesn't propagate out of eval, so check success by hand.
eval $(./cmd/dist/dist env -p || echo FAIL=true)
Index: go/src/make.rc
===================================================================
--- go.orig/src/make.rc
+++ go/src/make.rc
@@ -46,13 +46,13 @@ echo cmd/dist
GOROOT = `{cd .. && pwd}
if(! ~ $#GOROOT_BOOTSTRAP 1)
GOROOT_BOOTSTRAP = $home/go1.4
-if(! test -x $GOROOT_BOOTSTRAP/bin/go){
- echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go.' >[1=2]
+if(! test -x $GOROOT_BOOTSTRAP/bin/go-6){
+ echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go-6.' >[1=2]
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2]
exit bootstrap
}
rm -f cmd/dist/dist
-GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist
+GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go-6 build -o cmd/dist/dist ./cmd/dist
eval `{./cmd/dist/dist env -9}
echo

View File

@ -1,67 +0,0 @@
Index: go/src/cmd/dist/buildtool.go
===================================================================
--- go.orig/src/cmd/dist/buildtool.go
+++ go/src/cmd/dist/buildtool.go
@@ -164,7 +164,7 @@ func bootstrapBuildTools() {
// Use the math_big_pure_go build tag to disable the assembly in math/big
// which may contain unsupported instructions.
cmd := []string{
- pathf("%s/bin/go", goroot_bootstrap),
+ pathf("%s/bin/go-7", goroot_bootstrap),
"install",
"-gcflags=-l",
"-tags=math_big_pure_go",
Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -41,7 +41,7 @@
# This is used by cgo. Default is CC.
#
# CXX_FOR_TARGET: Command line to run to compile C++ code for GOARCH.
-# This is used by cgo. Default is CXX, or, if that is not set,
+# This is used by cgo. Default is CXX, or, if that is not set,
# "g++" or "clang++".
#
# FC: Command line to run to compile Fortran code for GOARCH.
@@ -120,8 +120,8 @@ echo '##### Building Go bootstrap tool.'
echo cmd/dist
export GOROOT="$(cd .. && pwd)"
GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
- echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
+if [ ! -x "$GOROOT_BOOTSTRAP/bin/go-7" ]; then
+ echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go-7." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
exit 1
fi
@@ -131,7 +131,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
exit 1
fi
rm -f cmd/dist/dist
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go-7" build -o cmd/dist/dist ./cmd/dist
# -e doesn't propagate out of eval, so check success by hand.
eval $(./cmd/dist/dist env -p || echo FAIL=true)
Index: go/src/make.rc
===================================================================
--- go.orig/src/make.rc
+++ go/src/make.rc
@@ -46,13 +46,13 @@ echo cmd/dist
GOROOT = `{cd .. && pwd}
if(! ~ $#GOROOT_BOOTSTRAP 1)
GOROOT_BOOTSTRAP = $home/go1.4
-if(! test -x $GOROOT_BOOTSTRAP/bin/go){
- echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go.' >[1=2]
+if(! test -x $GOROOT_BOOTSTRAP/bin/go-7){
+ echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go-7.' >[1=2]
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2]
exit bootstrap
}
rm -f cmd/dist/dist
-GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist
+GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go-7 build -o cmd/dist/dist ./cmd/dist
eval `{./cmd/dist/dist env -9}
echo

View File

@ -1,37 +0,0 @@
Index: go/src/cmd/go/internal/work/build.go
===================================================================
--- go.orig/src/cmd/go/internal/work/build.go
+++ go/src/cmd/go/internal/work/build.go
@@ -203,6 +203,8 @@ func init() {
// addBuildFlags adds the flags common to the build, clean, get,
// install, list, run, and test commands.
func AddBuildFlags(cmd *base.Command) {
+ // OPENSUSE
+ cmd.Flag.BoolVar(&cfg.BuildS, "s", false, "")
cmd.Flag.BoolVar(&cfg.BuildA, "a", false, "")
cmd.Flag.BoolVar(&cfg.BuildN, "n", false, "")
cmd.Flag.IntVar(&cfg.BuildP, "p", cfg.BuildP, "")
@@ -1571,6 +1573,11 @@ func (b *Builder) linkShared(a *Action)
// BuildInstallFunc is the action for installing a single package or executable.
func BuildInstallFunc(b *Builder, a *Action) (err error) {
+ // OPENSUSE
+ if cfg.BuildS && (a.Package.Standard || a.Package.ImportPath == "cmd/cgo") {
+ return nil
+ }
+
defer func() {
if err != nil && err != errPrintedOutput {
err = fmt.Errorf("go install %s: %v", a.Package.ImportPath, err)
Index: go/src/cmd/go/internal/cfg/cfg.go
===================================================================
--- go.orig/src/cmd/go/internal/cfg/cfg.go
+++ go/src/cmd/go/internal/cfg/cfg.go
@@ -18,6 +18,7 @@ import (
// These are general "build flags" used by build and other commands.
var (
+ BuildS bool // OPENSUSE -s (for packaging only)
BuildA bool // -a flag
BuildBuildmode string // -buildmode flag
BuildContext = build.Default

View File

@ -1,18 +0,0 @@
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index 07aa3ff..3f4836b 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -1457,6 +1457,13 @@ func isStale(p *Package) (bool, string) {
return false, "standard package in Go release distribution"
}
+ // openSUSE bnc#776058
+ // Only root user can reinstall a std library from a dependancy, all other
+ // users should *never* have to do this.
+ if os.Getuid() != 0 && p.Standard {
+ return false, "only root can reinstall a std library from a dependency"
+ }
+
// Time-based staleness.
built := fi.ModTime()

View File

@ -1,9 +0,0 @@
addFilter("binaryinfo-readelf-failed") # go binaries are suposedly ELF-compliant
addFilter("statically-linked-binary") # go doesn't yet support dynamic linking
# .syso files are special. Note that while they are architecture-dependent,
# they are named to avoid conflicts (and we make sure of that in the RPM
# through go_arch).
addFilter("unstripped-binary-or-object.*\.syso$")
addFilter("arch-dependent-file-in-usr-share.*\.syso$")
addFilter("W: position-independent-executable-suggested")

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Dec 21 11:51:19 UTC 2017 - jmassaguerpla@suse.com
- Make go be a metapackage
-------------------------------------------------------------------
Thu Oct 26 13:53:05 UTC 2017 - thipp@suse.de

View File

@ -1 +0,0 @@
add-auto-load-safe-path /usr/lib/go/$go_api/src/runtime/runtime-gdb.py

40
go.sh
View File

@ -1,40 +0,0 @@
# go toolchain env paths
export GOOS="linux"
case "$(uname -m)" in
*86)
export GOARCH=386
libdir=lib
;;
aarch64)
export GOARCH=arm64
libdir=lib64
;;
x86_64)
export GOARCH=amd64
libdir=lib64
;;
ppc64)
export GOARCH=ppc64
libdir=lib64
;;
ppc64le)
export GOARCH=ppc64le
libdir=lib64
;;
arm*)
export GOARCH=arm
libdir=lib
;;
s390x)
export GOARCH=s390x
libdir=lib64
;;
esac
export GOROOT=/usr/$libdir/go/$go_api
export GOBIN=/usr/bin
export GOPATH=/usr/share/go/$go_api/contrib
if [ `id -u` != 0 ]; then
export GOPATH=$HOME/go:/usr/share/go/$go_api/contrib
unset GOBIN
fi

334
go.spec
View File

@ -16,139 +16,23 @@
#
# nodebuginfo
# strip will cause Go's .a archives to become invalid because strip appears to
# reassemble the archive incorrectly. This is a known issue upstream
# (https://github.com/golang/go/issues/17890), but we have to deal with it in
# the meantime.
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
# By default use go and not gccgo
%define with_gccgo 0
# The fallback boostrap method via go1.4 does not work for Factory because
# of a known bug with binutils 2.27 https://github.com/golang/go/issues/16906.
# Leap will work but we don't have go1.4 in there.
%if 0%{?suse_version} > 1320
# openSUSE Factory
%define with_gccgo 1
%else
%if 0%{?suse_version} == 1315 && 0%{?is_opensuse}
# openSUSE Leap
%define with_gccgo 1
%endif
%endif
# The fallback bootstrap method via go1.4 doesn't work
# for aarch64 nor ppc64le because go 1.4 did not support that architecture.
%ifarch aarch64 ppc64le ppc64 s390x
%define with_gccgo 1
%endif
# By default we don't include tsan. It's only supported on amd64.
%define tsan_arch x86_64
# Go has precompiled versions of LLVM's compiler-rt inside their source code.
# We cannot ship pre-compiled binaries so we have to recompile said source,
# however they vendor specific commits from upstream. This value comes from
# src/runtime/race/README (and we verify that it matches in check).
# See boo#1052528 for more details.
%define tsan_commit 68e1532492f9b3fce0e9024f3c31411105965b11
%define go_api 1.9
# shared library support
%define shared_supported %(echo "%{go_api} >= 1.5" | bc -l)
%if %{shared_supported}
%if %{with_gccgo}
%define with_shared 1
%else
%ifarch %ix86 %arm x86_64 aarch64
%define with_shared 1
%else
%define with_shared 0
%endif
%endif
%else
%define with_shared 0
%endif
%ifarch ppc64
%define with_shared 0
%endif
%define short_version 1.9
Name: go
Version: 1.9.2
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: A compiled, garbage-collected, concurrent programming language
License: BSD-3-Clause
Group: Development/Languages/Other
Url: http://golang.org
Source: http://golang.org/dl/go%{version}.src.tar.gz
Source1: go-rpmlintrc
Source2: go.sh
Source4: README.SUSE
Source6: go.gdbinit
# We have to compile TSAN ourselves. boo#1052528
Source100: compiler-rt-g%{tsan_commit}.tar.xz
# PATCH-FIX-OPENSUSE add -s flag to 'go install' (don't rebuild/install std libs)
Patch1: go-1.5-build-dont-reinstall-stdlibs.patch
# PATCH-FIX-OPENSUSE re-enable build binary only packages (we are binary distro)
# see http://code.google.com/p/go/issues/detail?id=2775 & also issue 3268
Patch2: allow-binary-only-packages.patch
#PATCH-FIX-OPENSUSE use -x verbose build output for qemu-arm builders
Patch3: verbose-build.patch
# PATCH-FIX-OPENSUSE BNC#776058
Patch4: go-1.5-install-dont-reinstall-stdlibs.patch
# PATCH-FIX-OPENSUSE enable writing tools outside $GOROOT/pkg/tool for packaging
Patch5: tools-packaging.patch
# armv6l needs this patch for our build system
# see https://groups.google.com/forum/#!topic/golang-nuts/MqKTX_XIOKE
Patch6: armv6l.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - find /usr/bin/go-5 when bootstrapping with gcc5-go
Patch8: gcc6-go.patch
Patch9: gcc7-go.patch
# PATCH-FIX-UPSTREAM (compiler-rt): Fix sanitizer build against latest glibc
Patch100: fix-sanitizer-build-against-latest-glibc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# boostrap
%if %{with_gccgo}
%ifnarch s390 s390x
BuildRequires: binutils-gold
%endif
%if 0%{?suse_version} == 1315
# SLE12 or Leap 42.x
BuildRequires: gcc6-go
%else
BuildRequires: gcc7-go
%endif
%else
# no gcc-go
BuildRequires: go1.4
%endif
BuildRequires: fdupes
BuildRequires: systemd
Source: README
Recommends: go-doc = %{version}
%ifarch %{tsan_arch}
# Needed to compile compiler-rt/TSAN.
BuildRequires: gcc-c++
%endif
#BNC#818502 debug edit tool of rpm fails on i586 builds
BuildRequires: bc
BuildRequires: rpm >= 4.11.1
# for go.gdbinit, directory ownership
BuildRequires: gdb
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires: gcc
Provides: go = %{version}
Provides: go-devel = go%{version}
Provides: go-devel-static = go%{version}
Provides: golang(API) = %{go_api}
Obsoletes: go-devel < go%{version}
# go-vim/emacs were separate projects starting from 1.4
Obsoletes: go-emacs <= 1.3.3
Obsoletes: go-vim <= 1.3.3
ExclusiveArch: %ix86 x86_64 aarch64 ppc64 ppc64le s390x
Requires: go%{short_version}
%description
Go is an expressive, concurrent, garbage collected systems programming language
@ -162,6 +46,7 @@ Summary: Go documentation
License: BSD-3-Clause
Group: Documentation/Other
Requires: go = %{version}
Requires: go%{short_version}-doc
Provides: go-doc = %{version}
%description doc
@ -177,6 +62,7 @@ Url: https://compiler-rt.llvm.org/
Requires: go = %{version}
Supplements: go
ExclusiveArch: %{tsan_arch}
Requires: go%{short_version}-race
%description race
Go runtime race detector libraries. Install this package if you wish to use the
@ -184,222 +70,28 @@ Go runtime race detector libraries. Install this package if you wish to use the
%endif
%prep
%ifarch %{tsan_arch}
# compiler-rt
%setup -q -T -b 100 -n compiler-rt-g%{tsan_commit}
%patch100 -p1
%endif
# go
%setup -q -n go
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%ifarch armv6hl
%patch6 -p1
%endif
%if %{with_gccgo}
%if 0%{?suse_version} == 1315
# SLE12 or Leap 42.x
%patch8 -p1
%else
%patch9 -p1
%endif
%endif
cp %{SOURCE4} .
# setup go_arch (BSD-like scheme)
%ifarch %ix86
%define go_arch 386
%endif
%ifarch x86_64
%define go_arch amd64
%endif
%ifarch aarch64
%define go_arch arm64
%endif
%ifarch %arm
%define go_arch arm
%endif
%ifarch ppc64
%define go_arch ppc64
%endif
%ifarch ppc64le
%define go_arch ppc64le
%endif
%ifarch s390x
%define go_arch s390x
%endif
%build
# Remove the pre-included .sysos, to avoid shipping things we didn't compile
# (which is against the openSUSE guidelines for packaging).
find . -type f -name '*.syso' -exec rm -vf {} \;
# First, compile LLVM's TSAN, and replace the built-in with it. We can only do
# this for amd64.
%ifarch %{tsan_arch}
pushd ../compiler-rt*/lib/tsan/go
./buildgo.sh
popd
cp ../compiler-rt*/lib/tsan/go/race_linux_%{go_arch}.syso src/runtime/race/race_linux_%{go_arch}.syso
%endif
# Now, compile Go.
%if %{with_gccgo}
export GOROOT_BOOTSTRAP=%{_prefix}
%else
export GOROOT_BOOTSTRAP=%{_libdir}/go1.4
%endif
export GOROOT="`pwd`"
export GOROOT_FINAL=%{_libdir}/go/%{go_api}
export GOBIN="$GOROOT/bin"
mkdir -p "$GOBIN"
cd src
HOST_EXTRA_CFLAGS="%{optflags} -Wno-error" ./make.bash
cd ../
%ifarch %{tsan_arch}
# Install TSAN-friendly version of the std libraries.
bin/go install -race std
%endif
%if %{with_shared}
bin/go install -buildmode=shared -linkshared std
%endif
%check
%ifarch %{tsan_arch}
# Make sure that we have the right TSAN checked out.
grep "%{tsan_commit}" src/runtime/race/README
%endif
%install
export GOROOT="%{buildroot}%{_libdir}/go/%{go_api}"
install -Dm644 %{SOURCE2} $GOROOT/bin/profile.d/go.sh
sed -i "s/\$go_api/%{go_api}/" $GOROOT/bin/profile.d/go.sh
# locations for third party libraries, see README-openSUSE for info about locations.
install -d %{buildroot}%{_datadir}/go/%{go_api}/contrib
install -d $GOROOT/contrib/pkg/linux_%{go_arch}
ln -s %{_libdir}/go/%{go_api}/contrib/pkg/ %{buildroot}%{_datadir}/go/%{go_api}/contrib/pkg
install -d %{buildroot}%{_datadir}/go/%{go_api}/contrib/cmd
install -d %{buildroot}%{_datadir}/go/%{go_api}/contrib/src
ln -s %{_datadir}/go/%{go_api}/contrib/src/ %{buildroot}%{_libdir}/go/%{go_api}/contrib/src
install -Dm644 README.SUSE $GOROOT/contrib/
ln -s %{_libdir}/go/%{go_api}/contrib/README.SUSE %{buildroot}%{_datadir}/go/%{go_api}/contrib/README.SUSE
# source files for go install, godoc, etc
install -d %{buildroot}%{_datadir}/go/%{go_api}
for ext in *.{go,c,h,s,S,py,syso}; do
find src -name ${ext} -exec install -Dm644 \{\} %{buildroot}%{_datadir}/go/%{go_api}/\{\} \;
done
mkdir -p $GOROOT/src
for i in $(ls %{buildroot}/usr/share/go/%{go_api}/src);do
ln -s /usr/share/go/%{go_api}/src/$i $GOROOT/src/$i
done
# add lib files that are needed (such as the timezone database).
install -d $GOROOT/lib
find lib -type f -exec install -D -m644 {} $GOROOT/{} \;
# copy document templates, packages, obj libs and command utilities
mkdir -p $GOROOT/bin
# remove bootstrap
rm -rf pkg/bootstrap
mv pkg $GOROOT
mv bin/* $GOROOT/bin
rm -f %{buildroot}%{_bindir}/{hgpatch,quietgcc}
# gdbinit
install -Dm644 %{SOURCE6} $GOROOT/bin/gdbinit.d/go.gdb
%if "%{_lib}" == "lib64"
sed -i "s/lib/lib64/" $GOROOT/bin/gdbinit.d/go.gdb
sed -i "s/\$go_api/%{go_api}/" $GOROOT/bin/gdbinit.d/go.gdb
install -D -m 0644 %{S:0} %{buildroot}/usr/share/doc/packages/go/README
install -D -m 0644 %{S:0} %{buildroot}/usr/share/doc/packages/go-doc/README
%ifarch %{tsan_arch}
install -D -m 0644 %{S:0} %{buildroot}/usr/share/doc/packages/go-race/README
%endif
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
mkdir -p %{buildroot}%{_sysconfdir}/gdbinit.d
touch %{buildroot}%{_sysconfdir}/alternatives/{go,gofmt,go.sh,go.gdb}
ln -sf %{_sysconfdir}/alternatives/go %{buildroot}%{_bindir}/go
ln -sf %{_sysconfdir}/alternatives/gofmt %{buildroot}%{_bindir}/gofmt
ln -sf %{_sysconfdir}/alternatives/go.sh %{buildroot}%{_sysconfdir}/profile.d/go.sh
ln -sf %{_sysconfdir}/alternatives/go.gdb %{buildroot}%{_sysconfdir}/gdbinit.d/go.gdb
# documentation and examples
# fix documetation permissions (rpmlint warning)
find doc/ misc/ -type f -exec chmod 0644 '{}' \;
# remove unwanted arch-dependant binaries (rpmlint warning)
rm -rf misc/cgo/test/{_*,*.o,*.out,*.6,*.8}
# prepare go-doc
mkdir -p %{buildroot}%{_docdir}/go/%{go_api}
cp -r AUTHORS CONTRIBUTORS CONTRIBUTING.md LICENSE PATENTS README.md README.SUSE %{buildroot}%{_docdir}/go/%{go_api}
cp -r doc/* %{buildroot}%{_docdir}/go/%{go_api}
%fdupes -s %{buildroot}%{_prefix}
%post
update-alternatives \
--install %{_bindir}/go go %{_libdir}/go/%{go_api}/bin/go 30 \
--slave %{_bindir}/gofmt gofmt %{_libdir}/go/%{go_api}/bin/gofmt \
--slave %{_sysconfdir}/gdbinit.d/go.gdb go.gdb %{_libdir}/go/%{go_api}/bin/gdbinit.d/go.gdb \
--slave %{_sysconfdir}/profile.d/go.sh go.sh %{_libdir}/go/%{go_api}/bin/profile.d/go.sh
%postun
if [ $1 -eq 0 ] ; then
update-alternatives --remove go %{_libdir}/go/%{go_api}/bin/go
fi
%files
%defattr(-,root,root,-)
%{_bindir}/go
%{_bindir}/gofmt
%{_libdir}/go
%{_libdir}/go/%{go_api}
%{_datadir}/go
%{_datadir}/go/%{go_api}
%config %{_sysconfdir}/profile.d/go.sh
%config %{_sysconfdir}/gdbinit.d/go.gdb
%ghost %{_sysconfdir}/alternatives/go
%ghost %{_sysconfdir}/alternatives/gofmt
%ghost %{_sysconfdir}/alternatives/go.sh
%ghost %{_sysconfdir}/alternatives/go.gdb
%dir %{_docdir}/go
%dir %{_docdir}/go/%{go_api}
%doc %{_docdir}/go/%{go_api}/AUTHORS
%doc %{_docdir}/go/%{go_api}/CONTRIBUTORS
%doc %{_docdir}/go/%{go_api}/CONTRIBUTING.md
%doc %{_docdir}/go/%{go_api}/LICENSE
%doc %{_docdir}/go/%{go_api}/PATENTS
%doc %{_docdir}/go/%{go_api}/README.md
%doc %{_docdir}/go/%{go_api}/README.SUSE
# We don't include TSAN in the main Go package.
%ifarch %{tsan_arch}
%exclude %{_datadir}/go/%{go_api}/src/runtime/race/race_linux_%{go_arch}.syso
%endif
%doc /usr/share/doc/packages/go/
%files doc
%defattr(-,root,root,-)
%doc %{_docdir}/go/%{go_api}/codewalk
%doc %{_docdir}/go/%{go_api}/articles
%doc %{_docdir}/go/%{go_api}/progs
%doc %{_docdir}/go/%{go_api}/play
%doc %{_docdir}/go/%{go_api}/gopher
%doc %{_docdir}/go/%{go_api}/devel
%doc %{_docdir}/go/%{go_api}/editors
%doc %{_docdir}/go/%{go_api}/*.html
%doc %{_docdir}/go/%{go_api}/*.css
%doc %{_docdir}/go/%{go_api}/*.png
%doc /usr/share/doc/packages/go-doc/
%ifarch %{tsan_arch}
%files race
%doc /usr/share/doc/packages/go-race/
%defattr(-,root,root,-)
%{_datadir}/go/%{go_api}/src/runtime/race/race_linux_%{go_arch}.syso
%endif
%changelog

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:665f184bf8ac89986cfd5a4460736976f60b57df6b320ad71ad4cef53bb143dc
size 16383591

View File

@ -1,19 +0,0 @@
Index: go/src/cmd/go/internal/load/pkg.go
===================================================================
--- go.orig/src/cmd/go/internal/load/pkg.go
+++ go/src/cmd/go/internal/load/pkg.go
@@ -912,7 +912,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.Internal.Target = filepath.Join(cfg.GOROOTpkg, "tool", full)
+ // If GOROOT_TARGET is set, then write to it for packaging purpose
+ gorootTarget := os.Getenv("GOROOT_TARGET")
+ if gorootTarget == "" {
+ p.Internal.Target = filepath.Join(cfg.GOROOTpkg, "tool", full)
+ } else {
+ p.Internal.Target = filepath.Join(gorootTarget, "pkg/tool", full)
+ }
}
if p.Internal.Target != "" && cfg.BuildContext.GOOS == "windows" {
p.Internal.Target += ".exe"

View File

@ -1,22 +0,0 @@
Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -167,7 +167,7 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
# CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
# use the host compiler, CC, from `cmd/dist/dist env` instead.
CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
- "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+ "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
fi
@@ -175,7 +175,7 @@ echo "##### Building packages and comman
old_bin_files=$(cd $GOROOT/bin && echo *)
-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
# Check that there are no new files in $GOROOT/bin other than go and gofmt
# and $GOOS_$GOARCH (a directory used when cross-compiling).