920ea39
%bcond_with bootstrap
636bf2b
636bf2b
# temporarily ignore test failures in riscv64
636bf2b
%ifarch riscv64
636bf2b
%bcond_without ignore_tests
636bf2b
%else
636bf2b
%bcond_with ignore_tests
636bf2b
%endif
636bf2b
c56eb06
# build ids are not currently generated:
c56eb06
# https://code.google.com/p/go/issues/detail?id=5238
c56eb06
#
c56eb06
# also, debuginfo extraction currently fails with
c56eb06
# "Failed to write file: invalid section alignment"
c56eb06
%global debug_package %{nil}
c56eb06
cc50719
# we are shipping the full contents of src in the data subpackage, which
cc50719
# contains binary-like things (ELF data for tests, etc)
cc50719
%global _binaries_in_noarch_packages_terminate_build 0
cc50719
cc50719
# Do not check any files in doc or src for requires
Vincent Batts be393a2
%global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$
cc50719
03e9b35
# Don't alter timestamps of especially the .a files (or else go will rebuild later)
03e9b35
# Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
03e9b35
%global __strip /bin/true
03e9b35
Adam Miller b77f6c7
# rpmbuild magic to keep from having meta dependency on libc.so.6
Adam Miller b77f6c7
%define _use_internal_dependency_generator 0
Adam Miller b77f6c7
%define __find_requires %{nil}
Adam Miller b77f6c7
%global __spec_install_post /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot  \
Adam Miller b77f6c7
  /usr/lib/rpm/brp-compress
Adam Miller b77f6c7
d36359a
%global golibdir %{_libdir}/golang
d36359a
50defcc
# This macro may not always be defined, ensure it is
50defcc
%{!?gopath: %global gopath %{_datadir}/gocode}
50defcc
c524af8
# Golang build options.
c524af8
d40cd88
# Build golang using external/internal(close to cgo disabled) linking.
636bf2b
%ifarch %{ix86} x86_64 ppc64le %{arm} aarch64 s390x riscv64
c524af8
%global external_linker 1
c524af8
%else
c524af8
%global external_linker 0
c524af8
%endif
c524af8
c524af8
# Build golang with cgo enabled/disabled(later equals more or less to internal linking).
636bf2b
%ifarch %{ix86} x86_64 ppc64le %{arm} aarch64 s390x riscv64
c524af8
%global cgo_enabled 1
c524af8
%else
c524af8
%global cgo_enabled 0
c524af8
%endif
c524af8
c524af8
# Use golang/gcc-go as bootstrap compiler
920ea39
%if %{with bootstrap}
d83d513
%global golang_bootstrap 0
920ea39
%else
920ea39
%global golang_bootstrap 1
1344685
%endif
c524af8
d40cd88
# Controls what ever we fail on failed tests
315b776
%if %{with ignore_tests}
c524af8
%global fail_on_tests 0
315b776
%else
315b776
%global fail_on_tests 1
c524af8
%endif
c524af8
c524af8
# Build golang shared objects for stdlib
d40cd88
%ifarch %{ix86} x86_64 ppc64le %{arm} aarch64
c524af8
%global shared 1
c524af8
%else
c524af8
%global shared 0
c524af8
%endif
c524af8
b881112
# Pre build std lib with -race enabled
f7c0afe
# Disabled due to 1.20 new cache usage, see 1.20 upstream release notes
b881112
%global race 0
b881112
c524af8
# Fedora GOROOT
Vincent Batts be393a2
%global goroot          /usr/lib/%{name}
c524af8
Vincent Batts be393a2
%ifarch x86_64
Vincent Batts be393a2
%global gohostarch  amd64
Vincent Batts be393a2
%endif
Vincent Batts be393a2
%ifarch %{ix86}
Vincent Batts be393a2
%global gohostarch  386
Vincent Batts be393a2
%endif
Vincent Batts be393a2
%ifarch %{arm}
Vincent Batts be393a2
%global gohostarch  arm
Vincent Batts be393a2
%endif
b869aad
%ifarch aarch64
b869aad
%global gohostarch  arm64
b869aad
%endif
c524af8
%ifarch ppc64
c524af8
%global gohostarch  ppc64
c524af8
%endif
c524af8
%ifarch ppc64le
c524af8
%global gohostarch  ppc64le
c524af8
%endif
d36359a
%ifarch s390x
d36359a
%global gohostarch  s390x
d36359a
%endif
636bf2b
%ifarch riscv64
636bf2b
%global gohostarch  riscv64
636bf2b
%endif
Vincent Batts be393a2
6460391
# Comment out go_prerelease and go_patch as needed
180e181
%global go_api 1.22
Packit a0ae3bc
#global go_prerelease rc2
Packit 420573b
%global go_patch 2
6460391
6460391
%global go_version %{go_api}%{?go_patch:.%{go_patch}}%{?go_prerelease:~%{go_prerelease}}
6460391
%global go_source %{go_api}%{?go_patch:.%{go_patch}}%{?go_prerelease}
7a55310
 
Vincent Batts 7025cc8
Name:           golang
07b554f
Version:        %{go_version}
d97cfae
Release:        %autorelease
Vincent Batts 7025cc8
Summary:        The Go Programming Language
c524af8
# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
5ccb908
License:        BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
6460391
URL:            https://go.dev
6460391
Source0:        https://go.dev/dl/go%{go_source}.src.tar.gz
b881112
# make possible to override default traceback level at build time by setting build tag rpm_crashtraceback
b881112
Source1:        fedora.go
8d165df
c524af8
# The compiler is written in Go. Needs go(1.4+) compiler for build.
c524af8
%if !%{golang_bootstrap}
c524af8
BuildRequires:  gcc-go >= 5
c524af8
%else
8d165df
BuildRequires:  golang > 1.4
c524af8
%endif
1a6adea
%if 0%{?rhel} > 6 || 0%{?fedora} > 0
19dca7f
BuildRequires:  hostname
1a6adea
%else
1a6adea
BuildRequires:  net-tools
3cb3b22
%endif
c524af8
# for tests
3fe4f3f
BuildRequires:  pcre2-devel, glibc-static, perl-interpreter, procps-ng
Vincent Batts c91e9b6
Vincent Batts 77cba21
Provides:       go = %{version}-%{release}
4bc73c7
8b7777d
# Bundled/Vendored provides generated by bundled-deps.sh based on the in tree module data
180e181
Provides: bundled(golang(github.com/google/pprof)) = 0.0.0.20230811205829.9131a7e9cc17
180e181
Provides: bundled(golang(github.com/ianlancetaylor/demangle)) = 0.0.0.20230524184225.eabc099b10ab
180e181
Provides: bundled(golang(golang.org/x/arch)) = 0.6.0
180e181
Provides: bundled(golang(golang.org/x/crypto)) = 0.16.1.0.20231129163542.152cdb1503eb
180e181
Provides: bundled(golang(golang.org/x/mod)) = 0.14.0
180e181
Provides: bundled(golang(golang.org/x/net)) = 0.19.0
180e181
Provides: bundled(golang(golang.org/x/sync)) = 0.5.0
180e181
Provides: bundled(golang(golang.org/x/sys)) = 0.15.0
180e181
Provides: bundled(golang(golang.org/x/term)) = 0.15.0
180e181
Provides: bundled(golang(golang.org/x/text)) = 0.14.0
180e181
Provides: bundled(golang(golang.org/x/tools)) = 0.16.2.0.20231218185909.83bceaf2424d
4bc73c7
Packit a0ae3bc
d40cd88
Requires:       %{name}-bin = %{version}-%{release}
8d165df
Requires:       %{name}-src = %{version}-%{release}
3a84733
Requires:       go-filesystem
Vincent Batts 77cba21
aa53b9e
Patch1:         0001-Modify-go.env.patch
3fe4f3f
Patch4:         0004-cmd-link-use-gold-on-ARM-ARM64-only-if-gold-is-avail.patch
Packit a0ae3bc
Patch5:		0005-Skip-TestCrashDumpsAllThreads.patch
315b776
Vincent Batts d8b5074
# Having documentation separate was broken
Vincent Batts 7025cc8
Obsoletes:      %{name}-docs < 1.1-4
c56eb06
467dc85
# RPM can't handle symlink -> dir with subpackages, so merge back
Vincent Batts 7025cc8
Obsoletes:      %{name}-data < 1.1.1-4
c56eb06
a8686d8
# go1.4 deprecates a few packages
a8686d8
Obsoletes:      %{name}-vim < 1.4
a8686d8
Obsoletes:      emacs-%{name} < 1.4
a8686d8
36f1c8b
# We stopped building the golang-race subpackage, so we need to to maintain the
36f1c8b
# update path.
36f1c8b
Obsoletes:      golang-race < 1.20~rc3-2
36f1c8b
Vincent Batts be393a2
# These are the only RHEL/Fedora architectures that we compile this package for
1344685
ExclusiveArch:  %{golang_arches}
c56eb06
Vincent Batts 7025cc8
Source100:      golang-gdbinit
c9b9b2a
cc50719
%description
c56eb06
%{summary}.
c56eb06
8d165df
%package       docs
8d165df
Summary:       Golang compiler docs
8d165df
Requires:      %{name} = %{version}-%{release}
8d165df
BuildArch:     noarch
8d165df
Obsoletes:     %{name}-docs < 1.1-4
8d165df
8d165df
%description   docs
8d165df
%{summary}.
8d165df
8d165df
%package       misc
8d165df
Summary:       Golang compiler miscellaneous sources
8d165df
Requires:      %{name} = %{version}-%{release}
8d165df
BuildArch:     noarch
8d165df
8d165df
%description   misc
8d165df
%{summary}.
8d165df
8d165df
%package       tests
8d165df
Summary:       Golang compiler tests for stdlib
8d165df
Requires:      %{name} = %{version}-%{release}
8d165df
BuildArch:     noarch
8d165df
8d165df
%description   tests
8d165df
%{summary}.
c56eb06
Vincent Batts be393a2
%package        src
Vincent Batts be393a2
Summary:        Golang compiler source tree
Vincent Batts ab9b265
BuildArch:      noarch
Vincent Batts be393a2
%description    src
Vincent Batts be393a2
%{summary}
Vincent Batts be393a2
8d165df
%package        bin
8d165df
Summary:        Golang core compiler tools
50defcc
# Some distributions refer to this package by this name
50defcc
Provides:       %{name}-go = %{version}-%{release}
Vincent Batts be393a2
Requires:       go = %{version}-%{release}
8d165df
# Pre-go1.5, all arches had to be bootstrapped individually, before usable, and
8d165df
# env variables to compile for the target os-arch.
8d165df
# Now the host compiler needs only the GOOS and GOARCH environment variables
8d165df
# set to compile for the target os-arch.
8d165df
Obsoletes:      %{name}-pkg-bin-linux-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-bin-linux-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-bin-linux-arm < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-linux-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-linux-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-linux-arm < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-darwin-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-darwin-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-windows-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-windows-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-plan9-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-plan9-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-freebsd-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-freebsd-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-freebsd-arm < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-netbsd-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-netbsd-amd64 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-netbsd-arm < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-openbsd-386 < 1.4.99
8d165df
Obsoletes:      %{name}-pkg-openbsd-amd64 < 1.4.99
Vincent Batts be393a2
6896a58
Obsoletes:      golang-vet < 0-12.1
6896a58
Obsoletes:      golang-cover < 0-12.1
6896a58
Vincent Batts be393a2
Requires(post): %{_sbindir}/update-alternatives
ff7ebd7
Requires(preun): %{_sbindir}/update-alternatives
Vincent Batts be393a2
Vincent Batts be393a2
# We strip the meta dependency, but go does require glibc.
Vincent Batts be393a2
# This is an odd issue, still looking for a better fix.
Vincent Batts be393a2
Requires:       glibc
Vincent Batts fa7c581
Requires:       gcc
1f08860
%if 0%{?rhel} && 0%{?rhel} < 8
1f08860
Requires:       git, subversion, mercurial
1f08860
%else
ef14b33
Recommends:     git, subversion, mercurial
1f08860
%endif
8d165df
%description    bin
Vincent Batts be393a2
%{summary}
Vincent Batts be393a2
7e281b5
# Workaround old RPM bug of symlink-replaced-with-dir failure
5863470
%pretrans -p <lua>
c9b9b2a
for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
Vincent Batts be393a2
  path = "%{goroot}/" .. d
c9b9b2a
  if posix.stat(path, "type") == "link" then
c9b9b2a
    os.remove(path)
c9b9b2a
    posix.mkdir(path)
c9b9b2a
  end
5863470
end
7e281b5
c524af8
%if %{shared}
418a760
%package        shared
418a760
Summary:        Golang shared object libraries
418a760
418a760
%description    shared
418a760
%{summary}.
418a760
%endif
7e281b5
b881112
%if %{race}
b881112
%package        race
b881112
Summary:        Golang std library with -race enabled
b881112
b881112
Requires:       %{name} = %{version}-%{release}
b881112
b881112
%description    race
b881112
%{summary}
b881112
%endif
b881112
c56eb06
%prep
50defcc
%autosetup -p1 -n go
315b776
b881112
cp %{SOURCE1} ./src/runtime/
b881112
c56eb06
%build
672b8a1
# print out system information
672b8a1
uname -a
672b8a1
cat /proc/cpuinfo
672b8a1
cat /proc/meminfo
672b8a1
c524af8
# bootstrap compiler GOROOT
c524af8
%if !%{golang_bootstrap}
c524af8
export GOROOT_BOOTSTRAP=/
c524af8
%else
8d165df
export GOROOT_BOOTSTRAP=%{goroot}
c524af8
%endif
8d165df
c56eb06
# set up final install location
Vincent Batts be393a2
export GOROOT_FINAL=%{goroot}
c56eb06
Vincent Batts be393a2
export GOHOSTOS=linux
Vincent Batts be393a2
export GOHOSTARCH=%{gohostarch}
Vincent Batts be393a2
Vincent Batts be393a2
pushd src
8d165df
# use our gcc options for this build, but store gcc as default for compiler
c524af8
export CFLAGS="$RPM_OPT_FLAGS"
c524af8
export LDFLAGS="$RPM_LD_FLAGS"
c524af8
export CC="gcc"
c524af8
export CC_FOR_TARGET="gcc"
c524af8
export GOOS=linux
c524af8
export GOARCH=%{gohostarch}
c524af8
%if !%{external_linker}
c524af8
export GO_LDFLAGS="-linkmode internal"
c524af8
%endif
c524af8
%if !%{cgo_enabled}
c524af8
export CGO_ENABLED=0
c524af8
%endif
03f41c1
./make.bash -v
Vincent Batts be393a2
popd
c56eb06
c524af8
# build shared std lib
c524af8
%if %{shared}
4bc73c7
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared -v -x std
418a760
%endif
9297305
b881112
%if %{race}
d37b3b5
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race -v -x std
b881112
%endif
b881112
c56eb06
%install
1f03484
echo "== 1 =="
c56eb06
rm -rf $RPM_BUILD_ROOT
f1f6f5d
# remove GC build cache
f1f6f5d
rm -rf pkg/obj/go-build/*
c56eb06
c56eb06
# create the top level directories
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_bindir}
Vincent Batts be393a2
mkdir -p $RPM_BUILD_ROOT%{goroot}
c56eb06
c9b9b2a
# install everything into libdir (until symlink problems are fixed)
c9b9b2a
# https://code.google.com/p/go/issues/detail?id=5830
e1a400a
cp -apv api bin doc lib pkg src misc test go.env VERSION \
Vincent Batts be393a2
   $RPM_BUILD_ROOT%{goroot}
1f03484
echo "== 2 =="
Vincent Batts dd6f77a
# bz1099206
Vincent Batts dd6f77a
find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \;
Vincent Batts b025cc2
# and level out all the built archives
Vincent Batts b025cc2
touch $RPM_BUILD_ROOT%{goroot}/pkg
Vincent Batts b025cc2
find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \;
Vincent Batts b025cc2
# generate the spec file ownership of this source tree and packages
Vincent Batts b025cc2
cwd=$(pwd)
Vincent Batts b025cc2
src_list=$cwd/go-src.list
8d165df
pkg_list=$cwd/go-pkg.list
418a760
shared_list=$cwd/go-shared.list
b881112
race_list=$cwd/go-race.list
8d165df
misc_list=$cwd/go-misc.list
8d165df
docs_list=$cwd/go-docs.list
8d165df
tests_list=$cwd/go-tests.list
b881112
rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
b881112
touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
Vincent Batts b025cc2
pushd $RPM_BUILD_ROOT%{goroot}
1f03484
  echo "== 3 =="
d40cd88
    find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list
749ec62
    find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $src_list
8d165df
b881112
    find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
b881112
    find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%{goroot}/%p\n' >> $pkg_list
8d165df
d40cd88
    find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
d40cd88
    find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
8d165df
d40cd88
    find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
d40cd88
    find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
8d165df
c524af8
%if %{shared}
1f03484
echo "== 4 =="
d36359a
    mkdir -p %{buildroot}/%{_libdir}/
d36359a
    mkdir -p %{buildroot}/%{golibdir}/
d36359a
    for file in $(find .  -iname "*.so" ); do
d36359a
        chmod 755 $file
d36359a
        mv  $file %{buildroot}/%{golibdir}
d36359a
        pushd $(dirname $file)
d36359a
        ln -fs %{golibdir}/$(basename $file) $(basename $file)
d36359a
        popd
d36359a
        echo "%%{goroot}/$file" >> $shared_list
d36359a
        echo "%%{golibdir}/$(basename $file)" >> $shared_list
d36359a
    done
d36359a
    
bc69b83
    find pkg/*_dynlink/ -type d -printf '%%%dir %{goroot}/%p\n' >> $shared_list
bc69b83
    find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
418a760
%endif
418a760
1f03484
echo "== 5 =="
1f03484
b881112
%if %{race}
b881112
    find pkg/*_race/ -type d -printf '%%%dir %{goroot}/%p\n' >> $race_list
b881112
    find pkg/*_race/ ! -type d -printf '%{goroot}/%p\n' >> $race_list
b881112
%endif
d40cd88
    find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
d40cd88
    find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
d40cd88
    find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
749ec62
    find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $tests_list
d40cd88
    # this is only the zoneinfo.zip
d40cd88
    find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
d40cd88
    find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
Vincent Batts b025cc2
popd
1f03484
echo "== 6 =="
c56eb06
# remove the doc Makefile
Vincent Batts be393a2
rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile
Vincent Batts be393a2
Vincent Batts be393a2
# put binaries to bindir, linked to the arch we're building,
d40cd88
# leave the arch independent pieces in {goroot}
Vincent Batts be393a2
mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}
8d165df
ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go
8d165df
ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt
Vincent Batts be393a2
Vincent Batts 8081f33
# ensure these exist and are owned
0134196
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com
0134196
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org
0134196
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p
0134196
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x
1f03484
echo "== 7 =="
Vincent Batts 6109664
# make sure these files exist and point to alternatives
Vincent Batts 6109664
rm -f $RPM_BUILD_ROOT%{_bindir}/go
Vincent Batts 6109664
ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go
Vincent Batts 6109664
rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt
Vincent Batts 6109664
ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
Vincent Batts be393a2
c9b9b2a
# gdbinit
c9b9b2a
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
Vincent Batts 3a4853b
cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb
7e281b5
1f03484
echo "== END OF INSTALL =="
1f03484
Vincent Batts b025cc2
%check
Vincent Batts b025cc2
export GOROOT=$(pwd -P)
8d165df
export PATH="$GOROOT"/bin:"$PATH"
Vincent Batts b025cc2
cd src
c524af8
c524af8
export CC="gcc"
c524af8
export CFLAGS="$RPM_OPT_FLAGS"
c524af8
export LDFLAGS="$RPM_LD_FLAGS"
c524af8
%if !%{external_linker}
c524af8
export GO_LDFLAGS="-linkmode internal"
c524af8
%endif
c524af8
%if !%{cgo_enabled} || !%{external_linker}
c524af8
export CGO_ENABLED=0
c524af8
%endif
ea99eba
# workaround for https://github.com/golang/go/issues/39466 until it gests fixed
92b3f87
# Commented until the patch is ready, this workaround suggested in the link above
0cb15e5
# doesn't work properly
132cf34
#ifarch aarch64
0cb15e5
#export CGO_CFLAGS="-mno-outline-atomics"
132cf34
#endif
d40cd88
d40cd88
# make sure to not timeout
d40cd88
export GO_TEST_TIMEOUT_SCALE=2
d40cd88
c524af8
%if %{fail_on_tests}
c524af8
./run.bash --no-rebuild -v -v -v -k
c524af8
%else
c524af8
./run.bash --no-rebuild -v -v -v -k || :
c524af8
%endif
8d165df
cd ..
Vincent Batts be393a2
Vincent Batts b025cc2
8d165df
%post bin
Vincent Batts be393a2
%{_sbindir}/update-alternatives --install %{_bindir}/go \
d40cd88
    go %{goroot}/bin/go 90 \
d40cd88
    --slave %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt
Vincent Batts be393a2
8d165df
%preun bin
Vincent Batts be393a2
if [ $1 = 0 ]; then
d40cd88
    %{_sbindir}/update-alternatives --remove go %{goroot}/bin/go
Vincent Batts be393a2
fi
c56eb06
Vincent Batts 74686a2
c56eb06
%files
50defcc
%license LICENSE PATENTS
Vincent Batts fa7c581
# VERSION has to be present in the GOROOT, for `go install std` to work
Vincent Batts fa7c581
%doc %{goroot}/VERSION
8d165df
%dir %{goroot}/doc
c56eb06
c9b9b2a
# go files
Vincent Batts 8081f33
%dir %{goroot}
50defcc
%{goroot}/api/
50defcc
%{goroot}/lib/time/
c9b9b2a
Vincent Batts 8081f33
# ensure directory ownership, so they are cleaned up if empty
Vincent Batts 8081f33
%dir %{gopath}
Vincent Batts 8081f33
%dir %{gopath}/src
Vincent Batts 8081f33
%dir %{gopath}/src/github.com/
Vincent Batts 8081f33
%dir %{gopath}/src/bitbucket.org/
Vincent Batts 8081f33
%dir %{gopath}/src/code.google.com/
Vincent Batts 8081f33
%dir %{gopath}/src/code.google.com/p/
0134196
%dir %{gopath}/src/golang.org
0134196
%dir %{gopath}/src/golang.org/x
Vincent Batts 8081f33
c56eb06
c9b9b2a
# gdbinit (for gdb debugging)
c9b9b2a
%{_sysconfdir}/gdbinit.d
c56eb06
50defcc
%files src -f go-src.list
20cd634
50defcc
%files docs -f go-docs.list
Vincent Batts be393a2
50defcc
%files misc -f go-misc.list
Vincent Batts be393a2
50defcc
%files tests -f go-tests.list
Vincent Batts be393a2
50defcc
%files bin -f go-pkg.list
Vincent Batts 4620c48
%{_bindir}/go
Vincent Batts 4620c48
%{_bindir}/gofmt
50defcc
%{goroot}/bin/linux_%{gohostarch}/go
50defcc
%{goroot}/bin/linux_%{gohostarch}/gofmt
e1a400a
%{goroot}/go.env
Vincent Batts be393a2
c524af8
%if %{shared}
50defcc
%files shared -f go-shared.list
418a760
%endif
Adam Miller b77f6c7
b881112
%if %{race}
50defcc
%files race -f go-race.list
b881112
%endif
b881112
c56eb06
%changelog
d97cfae
%autochangelog