2010-10-08 16:25:58 +02:00
#
2011-11-04 10:06:56 +01:00
# spec file for package go
#
2017-03-31 11:53:21 +02:00
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
2010-10-08 16:25:58 +02:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
2011-11-04 10:06:56 +01:00
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
2016-11-11 10:09:52 +01:00
# nodebuginfo
2011-11-04 10:06:56 +01:00
2012-02-08 10:24:23 +01:00
2016-11-11 10:09:52 +01:00
# 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
2016-11-04 10:36:35 +01:00
# By default use go and not gccgo
%define with_gccgo 0
2016-09-26 11:03:55 +02:00
# 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
2016-07-04 11:15:40 +02:00
# The fallback bootstrap method via go1.4 doesn't work
2016-08-31 12:36:41 +02:00
# for aarch64 nor ppc64le because go 1.4 did not support that architecture.
2017-03-31 17:16:59 +02:00
%ifarch aarch64 ppc64le ppc64 s390x
2016-07-04 11:15:40 +02:00
%define with_gccgo 1
2015-08-22 16:58:04 +02:00
%endif
2017-04-27 17:07:49 +02:00
%define go_api 1.8
2016-06-17 08:49:40 +02:00
# 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
2016-07-22 09:00:19 +02:00
%ifarch ppc64
%define with_shared 0
%endif
2016-06-17 08:49:40 +02:00
2010-10-08 16:25:58 +02:00
Name : go
2017-05-29 13:00:01 +02:00
Version : 1.8.3
2011-06-30 11:18:52 +02:00
Release : 0
2010-10-08 16:25:58 +02:00
Summary : A compiled, garbage-collected, concurrent programming language
2011-09-02 11:15:17 +02:00
License : BSD-3-Clause
2013-08-13 09:25:05 +02:00
Group : Development/Languages/Other
Url : http://golang.org
2017-05-24 13:06:00 +02:00
Source0 : http://golang.org/dl/go%{version} .src.tar.gz
2014-08-12 09:18:55 +02:00
Source1 : go-rpmlintrc
2011-02-17 11:34:25 +01:00
Source2 : go.sh
2016-01-02 18:32:39 +01:00
Source4 : README.SUSE
Source6 : go.gdbinit
2012-02-08 10:24:23 +01:00
# PATCH-FIX-OPENSUSE add -s flag to 'go install' (don't rebuild/install std libs)
2015-08-22 16:58:04 +02:00
Patch1 : go-1.5-build-dont-reinstall-stdlibs.patch
2012-04-02 05:00:41 +02:00
# 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
2013-10-18 15:05:09 +02:00
Patch2 : allow-binary-only-packages.patch
2013-05-15 05:38:25 +02:00
#PATCH-FIX-OPENSUSE use -x verbose build output for qemu-arm builders
2013-10-18 15:05:09 +02:00
Patch3 : verbose-build.patch
2012-09-05 06:10:28 +02:00
# PATCH-FIX-OPENSUSE BNC#776058
2015-08-22 16:58:04 +02:00
Patch4 : go-1.5-install-dont-reinstall-stdlibs.patch
2014-09-18 11:18:45 +02:00
# PATCH-FIX-OPENSUSE enable writing tools outside $GOROOT/pkg/tool for packaging
Patch5 : tools-packaging.patch
2014-10-23 03:40:13 +02:00
# armv6l needs this patch for our build system
# see https://groups.google.com/forum/#!topic/golang-nuts/MqKTX_XIOKE
Patch6 : armv6l.patch
2015-06-11 14:59:49 +02:00
# PATCH-FIX-OPENSUSE fix_certificates_lookup.patch fcastelli@suse.com -- this patch forces Go to look for certificates only in the openSUSE/SLE locations. It also fixes certificate loading on SLE11, see https://github.com/golang/go/issues/6391
# PATCH-FIX-SUSE fix_certificates_lookup.patch fcastelli@suse.com -- this patch forces Go to look for certificates only in the openSUSE/SLE locations. It also fixes certificate loading on SLE11, see https://github.com/golang/go/issues/6391
Patch7 : fix_certificates_lookup.patch
2015-08-22 16:58:04 +02:00
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - find /usr/bin/go-5 when bootstrapping with gcc5-go
2017-07-12 12:30:13 +02:00
Patch8 : gcc6-go.patch
2017-06-06 11:09:32 +02:00
Patch9 : gcc7-go.patch
2017-03-31 11:53:21 +02:00
# PATCH-FIX-OPENSUSE: Bump _MaxGomaxprocs to a larger number for NUMA machines.
Patch10 : runtime-bump-MaxGomaxprocs.patch
2010-10-08 16:25:58 +02:00
BuildRoot : %{_tmppath} /%{name} -%{version} -build
2015-08-22 16:58:04 +02:00
# boostrap
%if %{with_gccgo}
2017-07-12 12:30:13 +02:00
%ifnarch s390 s390x
2017-06-23 12:42:38 +02:00
BuildRequires : binutils-gold
%endif
2017-07-12 12:30:13 +02:00
%if 0%{?suse_version} == 1315
# SLE12 or Leap 42.x
BuildRequires : gcc6-go
2016-09-22 13:06:28 +02:00
%else
2017-07-12 12:30:13 +02:00
BuildRequires : gcc7-go
2016-09-22 13:06:28 +02:00
%endif
2015-08-22 16:58:04 +02:00
%else
2017-07-12 12:30:13 +02:00
# no gcc-go
2015-08-22 16:58:04 +02:00
BuildRequires : go1.4
%endif
2011-05-18 13:09:25 +02:00
BuildRequires : fdupes
2017-07-12 12:30:13 +02:00
BuildRequires : systemd
2017-05-24 13:06:00 +02:00
Recommends: go-doc = %{version}
2013-07-19 01:23:23 +02:00
#BNC#818502 debug edit tool of rpm fails on i586 builds
2016-06-17 08:49:40 +02:00
BuildRequires : bc
2017-07-12 12:30:13 +02:00
BuildRequires : rpm >= 4.11.1
2016-01-02 18:32:39 +01:00
# for go.gdbinit, directory ownership
BuildRequires : gdb
2015-08-22 16:58:04 +02:00
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
2014-09-18 11:18:45 +02:00
Requires : gcc
2017-05-24 13:06:00 +02:00
Provides : go = %{version}
Provides : go-devel = go%{version}
Provides : go-devel-static = go%{version}
2016-01-02 18:32:39 +01:00
Provides : golang(API) = %{go_api}
2017-05-24 13:06:00 +02:00
Obsoletes : go-devel < go%{version}
2015-03-07 16:24:28 +01:00
# go-vim/emacs were separate projects starting from 1.4
2015-03-19 11:21:17 +01:00
Obsoletes : go-emacs <= 1.3.3
Obsoletes : go-vim <= 1.3.3
2017-01-24 04:14:16 +01:00
ExclusiveArch : %ix86 x86_64 aarch64 ppc64 ppc64le s390x
2010-10-08 16:25:58 +02:00
%description
Go is an expressive, concurrent, garbage collected systems programming language
that is type safe and memory safe. It has pointers but no pointer arithmetic.
Go has fast builds, clean syntax, garbage collection, methods for any type, and
run-time reflection. It feels like a dynamic language but has the speed and
safety of a static language.
%package doc
2012-04-02 11:37:35 +02:00
Summary : Go documentation
2010-10-08 16:25:58 +02:00
Group : Documentation/Other
2017-05-24 13:06:00 +02:00
Requires : go = %{version}
Provides : go-doc = %{version}
2010-10-08 16:25:58 +02:00
%description doc
Go examples and documentation.
%prep
2017-05-24 13:06:00 +02:00
%setup -q -n go
2013-07-10 14:34:19 +02:00
%patch1 -p1
2013-10-18 15:05:09 +02:00
%patch2 -p1
2011-12-13 15:55:11 +01:00
%patch3 -p1
2012-04-02 05:00:41 +02:00
%patch4 -p1
2014-09-18 11:18:45 +02:00
%patch5 -p1
2014-10-23 03:40:13 +02:00
%ifarch armv6hl
%patch6 -p1
%endif
2015-06-11 11:47:42 +02:00
%patch7 -p1
2015-08-22 16:58:04 +02:00
%if %{with_gccgo}
2017-07-12 12:30:13 +02:00
%if 0%{?suse_version} == 1315
# SLE12 or Leap 42.x
2015-07-05 16:48:36 +02:00
%patch8 -p1
2017-07-12 12:30:13 +02:00
%else
%patch9 -p1
2015-08-22 16:58:04 +02:00
%endif
2016-09-22 13:06:28 +02:00
%endif
2017-03-31 11:53:21 +02:00
%patch10 -p1
2016-01-02 18:32:39 +01:00
cp %{SOURCE4} .
2010-10-08 16:25:58 +02:00
2011-10-06 13:06:36 +02:00
# setup go_arch (BSD-like scheme)
%ifarch %ix86
%define go_arch 386
%endif
%ifarch x86_64
%define go_arch amd64
%endif
2015-09-15 16:25:01 +02:00
%ifarch aarch64
%define go_arch arm64
%endif
2011-10-06 13:06:36 +02:00
%ifarch %arm
%define go_arch arm
%endif
2015-08-22 20:36:12 +02:00
%ifarch ppc64
%define go_arch ppc64
%endif
%ifarch ppc64le
%define go_arch ppc64le
%endif
2017-01-24 04:14:16 +01:00
%ifarch s390x
%define go_arch s390x
%endif
2011-10-06 13:06:36 +02:00
2010-10-08 16:25:58 +02:00
%build
2015-08-22 16:58:04 +02:00
%if %{with_gccgo}
export GOROOT_BOOTSTRAP=%{_prefix}
%else
export GOROOT_BOOTSTRAP=%{_libdir} /go1.4
%endif
2010-11-08 22:29:08 +01:00
export GOROOT=" ` p w d ` "
2017-05-24 13:06:00 +02:00
export GOROOT_FINAL=%{_libdir} /go/%{go_api}
2010-11-08 22:29:08 +01:00
export GOBIN=" $ G O R O O T / b i n "
2010-10-08 16:25:58 +02:00
mkdir -p " $ G O B I N "
2011-05-19 22:36:34 +02:00
cd src
2012-03-06 05:25:38 +01:00
HOST_EXTRA_CFLAGS=" %{optflags} - W n o - e r r o r " ./make.bash
2010-10-08 16:25:58 +02:00
2016-01-10 18:00:48 +01:00
cd ../
2013-05-15 05:38:25 +02:00
%ifarch x86_64
# Install race detection version of std libraries (amd64 only)
bin/go install -race std
2016-06-17 08:49:40 +02:00
%endif
2016-07-04 11:15:40 +02:00
2016-06-17 08:49:40 +02:00
%if %{with_shared}
bin/go install -buildmode=shared -linkshared std
2013-05-15 05:38:25 +02:00
%endif
2010-10-08 16:25:58 +02:00
%install
2017-05-24 13:06:00 +02:00
export GOROOT=" %{buildroot} %{_libdir} / g o / %{go_api} "
2015-08-22 16:58:04 +02:00
install -Dm644 %{SOURCE2} $GOROOT/bin/profile.d/go.sh
2017-05-24 13:06:00 +02:00
sed -i " s / \ $ g o _ a p i / %{go_api} / " $GOROOT/bin/profile.d/go.sh
2012-03-05 18:07:14 +01:00
2012-05-09 17:04:39 +02:00
# locations for third party libraries, see README-openSUSE for info about locations.
2017-05-24 13:06:00 +02:00
install -d %{buildroot} %{_datadir} /go/%{go_api} /contrib
2014-09-26 16:25:10 +02:00
install -d $GOROOT/contrib/pkg/linux_%{go_arch}
2017-05-24 13:06:00 +02:00
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
2015-08-22 16:58:04 +02:00
install -Dm644 README.SUSE $GOROOT/contrib/
2017-05-24 13:06:00 +02:00
ln -s %{_libdir} /go/%{go_api} /contrib/README.SUSE %{buildroot} %{_datadir} /go/%{go_api} /contrib/README.SUSE
2012-05-09 17:04:39 +02:00
2012-03-05 18:07:14 +01:00
# source files for go install, godoc, etc
2017-05-24 13:06:00 +02:00
install -d %{buildroot} %{_datadir} /go/%{go_api}
2012-03-06 05:25:38 +01:00
for ext in *.{go,c,h,s,S,py}; do
2017-05-24 13:06:00 +02:00
find src -name ${ext} -exec install -Dm644 \{\} %{buildroot} %{_datadir} /go/%{go_api} /\{\} \;
2011-02-17 11:34:25 +01:00
done
2015-08-11 19:46:20 +02:00
mkdir -p $GOROOT/src
2017-05-24 13:06:00 +02:00
for i in $(ls %{buildroot} /usr/share/go/%{go_api} /src);do
ln -s /usr/share/go/%{go_api} /src/$i $GOROOT/src/$i
2015-08-11 19:46:20 +02:00
done
2011-02-17 11:34:25 +01:00
2012-08-16 13:34:24 +02:00
# copy document templates, packages, obj libs and command utilities
2015-08-22 16:58:04 +02:00
mkdir -p $GOROOT/bin
2012-08-16 13:34:24 +02:00
mkdir -p $GOROOT/lib
2015-08-22 16:58:04 +02:00
# remove bootstrap
rm -rf pkg/bootstrap
2012-08-16 13:34:24 +02:00
mv pkg $GOROOT
2015-08-22 16:58:04 +02:00
mv bin/* $GOROOT/bin
2012-08-16 13:34:24 +02:00
rm -f %{buildroot} %{_bindir} /{hgpatch,quietgcc}
2017-05-24 13:06:00 +02:00
# gdbinit
install -Dm644 %{SOURCE6} $GOROOT/bin/gdbinit.d/go.gdb
%if "%{_lib}" == "lib64"
sed -i " s / l i b / l i b 6 4 / " $GOROOT/bin/gdbinit.d/go.gdb
sed -i " s / \ $ g o _ a p i / %{go_api} / " $GOROOT/bin/gdbinit.d/go.gdb
%endif
2015-08-22 16:58:04 +02:00
# update-alternatives
2017-05-24 13:06:00 +02:00
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
2015-08-22 16:58:04 +02:00
2011-05-21 14:19:45 +02:00
# documentation and examples
# fix documetation permissions (rpmlint warning)
find doc/ misc/ -type f -exec chmod 0644 '{}' \;
# remove unwanted arch-dependant binaries (rpmlint warning)
2011-06-30 11:18:52 +02:00
rm -rf misc/cgo/test/{_*,*.o,*.out,*.6,*.8}
2015-08-22 16:58:04 +02:00
# prepare go-doc
2017-05-24 13:06:00 +02:00
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}
2011-05-19 20:17:10 +02:00
2015-08-22 16:58:04 +02:00
%fdupes -s %{buildroot} %{_prefix}
2011-05-18 13:09:25 +02:00
2015-08-22 16:58:04 +02:00
%post
2017-05-24 13:06:00 +02:00
2015-08-22 16:58:04 +02:00
update-alternatives \
2017-05-24 13:06:00 +02:00
--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
2015-08-22 16:58:04 +02:00
%postun
if [ $1 -eq 0 ] ; then
2017-05-24 13:06:00 +02:00
update-alternatives --remove go %{_libdir} /go/%{go_api} /bin/go
2015-08-22 16:58:04 +02:00
fi
2010-10-08 16:25:58 +02:00
%files
%defattr (-,root,root,-)
2015-08-22 16:58:04 +02:00
%{_bindir} /go
%{_bindir} /gofmt
2017-05-24 13:06:00 +02:00
%{_libdir} /go
%{_libdir} /go/%{go_api}
%{_datadir} /go
%{_datadir} /go/%{go_api}
%ghost %{_sysconfdir} /profile.d/go.sh
%ghost %{_sysconfdir} /gdbinit.d/go.gdb
2015-08-22 16:58:04 +02:00
%ghost %{_sysconfdir} /alternatives/go
%ghost %{_sysconfdir} /alternatives/gofmt
%ghost %{_sysconfdir} /alternatives/go.sh
2017-05-24 13:06:00 +02:00
%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
%doc %{_docdir} /go/%{go_api} /go%{go_api} .txt
2010-10-08 16:25:58 +02:00
%files doc
%defattr (-,root,root,-)
2017-05-24 13:06:00 +02:00
%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} /*.html
%doc %{_docdir} /go/%{go_api} /*.css
%doc %{_docdir} /go/%{go_api} /*.png
2010-10-08 16:25:58 +02:00
%changelog