From 3cf738ee907fc20d48e6ba9c59f46803e47d2064ec0f0567c3e13fcfa834d231 Mon Sep 17 00:00:00 2001 From: Jeff Kowalczyk Date: Mon, 17 Apr 2023 05:43:38 +0000 Subject: [PATCH] Accepting request 1079832 from home:jfkw:branches:devel:languages:go - Add subpackage go1.x-libstd for compiled shared object libstd.so. only on Tumbleweed at this time. * Main go1.x package included libstd.so in previous versions * Split libstd.so into subpackage that can be installed standalone * Continues the slimming down of main go1.x package by 40 Mb * Experimental and not recommended for general use, Go currently has no ABI * Upstream Go has not committed to support buildmode=shared long-term * Do not use in packaging, build static single binaries (the default) * Upstream Go go1.x binary releases do not include libstd.so * go1.x Suggests go1.x-libstd so not installed by default Recommends * go1.x-libstd does not Require: go1.x so can install standalone * Provides go-libstd unversioned package name * Fix build step -buildmode=shared std to omit -linkshared - Packaging improvements: * go1.x Suggests go1.x-doc so not installed by default Recommends * Use Group: Development/Languages/Go instead of Other * On Tumbleweed bootstrap with current default gcc13 and gccgo118 * On SLE-12 aarch64 ppc64le ppc64 remove overrides to bootstrap using go1.x package (%bcond_without gccgo). This is no longer needed on current SLE-12:Update and removing will consolidate the build configurations used. * Change source URLs to go.dev as per Go upstream OBS-URL: https://build.opensuse.org/request/show/1079832 OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go1.17?expand=0&rev=41 --- go1.17.changes | 38 +++++++++++++++++++++ go1.17.spec | 93 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 108 insertions(+), 23 deletions(-) diff --git a/go1.17.changes b/go1.17.changes index ab7d531..4aa98bd 100644 --- a/go1.17.changes +++ b/go1.17.changes @@ -1,3 +1,41 @@ +------------------------------------------------------------------- +Fri Apr 14 23:41:22 UTC 2023 - Jeff Kowalczyk + +- Build subpackage go1.x-libstd compiled shared object libstd.so + only on Tumbleweed at this time. + Refs jsc#PED-1962 + +------------------------------------------------------------------- +Fri Apr 14 23:20:06 UTC 2023 - Jeff Kowalczyk + +- Add subpackage go1.x-libstd for compiled shared object libstd.so. + Refs jsc#PED-1962 + * Main go1.x package included libstd.so in previous versions + * Split libstd.so into subpackage that can be installed standalone + * Continues the slimming down of main go1.x package by 40 Mb + * Experimental and not recommended for general use, Go currently has no ABI + * Upstream Go has not committed to support buildmode=shared long-term + * Do not use in packaging, build static single binaries (the default) + * Upstream Go go1.x binary releases do not include libstd.so + * go1.x Suggests go1.x-libstd so not installed by default Recommends + * go1.x-libstd does not Require: go1.x so can install standalone + * Provides go-libstd unversioned package name + * Fix build step -buildmode=shared std to omit -linkshared +- Packaging improvements: + * go1.x Suggests go1.x-doc so not installed by default Recommends + * Use Group: Development/Languages/Go instead of Other + +------------------------------------------------------------------- +Fri Apr 14 23:06:51 UTC 2023 - Jeff Kowalczyk + +- Improvements to go1.x packaging spec: + * On Tumbleweed bootstrap with current default gcc13 and gccgo118 + * On SLE-12 aarch64 ppc64le ppc64 remove overrides to bootstrap + using go1.x package (%bcond_without gccgo). This is no longer + needed on current SLE-12:Update and removing will consolidate + the build configurations used. + * Change source URLs to go.dev as per Go upstream + ------------------------------------------------------------------- Thu Apr 13 04:58:20 UTC 2023 - Martin Liška diff --git a/go1.17.spec b/go1.17.spec index 5f6225e..234a472 100644 --- a/go1.17.spec +++ b/go1.17.spec @@ -24,29 +24,25 @@ %undefine _build_create_debug %define __arch_install_post export NO_BRP_STRIP_DEBUG=true NO_BRP_AR=true -# Used to bootstrap go toolchain with specific existing package -%define go_bootstrap_version go1.16 - -# Used to bootstrap go toolchain using specific version of gcc-go +# Specify Go toolchain version used to bootstrap this package's Go toolchain +# go_bootstrap_version bootstrap go toolchain with specific existing go1.x package +# gcc_go_version bootstrap go toolchain with specific version of gcc-go %if 0%{?suse_version} > 1500 # openSUSE Tumbleweed +# Usually ahead of bootstrap version specified by upstream Go +# Use Tumbleweed default gccgo and N-1 go1.x for testing %define gcc_go_version 13 +%define go_bootstrap_version go1.16 %else +# Use gccgo and go1.x specified by upstream Go %define gcc_go_version 11 +%define go_bootstrap_version go1.16 %endif # Bootstrap go toolchain using existing go package go_bootstrap_version # To bootstrap using gccgo use '--with gccgo' %bcond_with gccgo -# Boostrapping using existing go package can fail on certain SLE-12 architectures -# Override here as needed -%if 0%{?suse_version} == 1315 -%ifarch aarch64 ppc64le ppc64 s390x -%bcond_without gccgo -%endif -%endif - # gccgo on ppc64le with default PIE enabled fails with: # error while loading shared libraries: # R_PPC64_ADDR16_HA re10143fb0c for symbol `' out of range @@ -58,9 +54,7 @@ #!BuildIgnore: gcc-PIE %endif -# Build go-race only on platforms where it's supported (both amd64 and aarch64 -# requires SLE15-or-later because of C++14, and ppc64le doesn't build at all -# on openSUSE yet). +# Build go-race only on platforms where C++14 is supported (SLE-15) %if 0%{?suse_version} >= 1500 || 0%{?sle_version} >= 150000 %define tsan_arch x86_64 aarch64 %else @@ -138,13 +132,15 @@ Version: 1.17.13 Release: 0 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 +Group: Development/Languages/Go +URL: https://go.dev/ +Source: https://go.dev/dl/go%{version}.src.tar.gz Source1: go-rpmlintrc Source4: README.SUSE Source6: go.gdbinit # We have to compile TSAN ourselves. boo#1052528 +# Preferred form when all arches share llvm race version +# Source100: llvm-%{tsan_commit}.tar.xz Source100: llvm-%{tsan_commit}.tar.xz # PATCH-FIX-OPENSUSE: https://go-review.googlesource.com/c/go/+/391115 Patch7: dont-force-gold-on-arm64.patch @@ -159,7 +155,11 @@ BuildRequires: gcc%{gcc_go_version}-go BuildRequires: %{go_bootstrap_version} %endif BuildRequires: fdupes -Recommends: %{name}-doc = %{version} +Suggests: %{name}-doc = %{version} +%if 0%{?suse_version} > 1500 +# openSUSE Tumbleweed +Suggests: %{name}-libstd = %{version} +%endif %ifarch %{tsan_arch} # Needed to compile compiler-rt/TSAN. BuildRequires: gcc-c++ @@ -189,7 +189,6 @@ safety of a static language. %package doc Summary: Go documentation Group: Documentation/Other -Requires: %{name} = %{version} Provides: go-doc = %{version} %description doc @@ -199,7 +198,7 @@ Go examples and documentation. # boo#1052528 %package race Summary: Go runtime race detector -Group: Development/Languages/Other +Group: Development/Languages/Go URL: https://compiler-rt.llvm.org/ Requires: %{name} = %{version} Supplements: %{name} = %{version} @@ -210,11 +209,25 @@ Go runtime race detector libraries. Install this package if you wish to use the -race option, in order to detect race conditions present in your Go programs. %endif +%if %{with_shared} +%if 0%{?suse_version} > 1500 +# openSUSE Tumbleweed +%package libstd +Summary: Go compiled shared library libstd.so +Group: Development/Languages/Go +Provides: go-libstd = %{version} + +%description libstd +Go standard library compiled to a dynamically loadable shared object libstd.so +%endif +%endif + %prep %ifarch %{tsan_arch} # compiler-rt (from LLVM) %setup -q -T -b 100 -n llvm-%{tsan_commit} %endif + # go %setup -q -n go %patch7 -p1 @@ -273,7 +286,25 @@ bin/go install -race std %endif %if %{with_shared} -bin/go install -buildmode=shared -linkshared std +%if 0%{?suse_version} > 1500 +# openSUSE Tumbleweed +# Compile Go standard library as a dynamically loaded shared object libstd.so +# for inclusion in a subpackage which can be installed standalone. +# Upstream Go binary releases do not ship a compiled libstd.so. +# Standard practice is to build Go binaries as a single executable. +# Upstream Go discussed removing this feature, opted to fix current support: +# Relevant upstream comments on: https://github.com/golang/go/issues/47788 +# +# -buildmode=shared +# Combine all the listed non-main packages into a single shared +# library that will be used when building with the -linkshared +# option. Packages named main are ignored. +# +# -linkshared +# build code that will be linked against shared libraries previously +# created with -buildmode=shared. +bin/go install -buildmode=shared std +%endif %endif %check @@ -396,8 +427,16 @@ fi %exclude %{_datadir}/go/%{go_label}/src/runtime/race/race_linux_%{go_arch}.syso %endif +# We don't include libstd.so in the main Go package. +%if %{with_shared} +%if 0%{?suse_version} > 1500 +# openSUSE Tumbleweed +# ./go/1.20/pkg/linux_amd64_dynlink/libstd.so +%exclude %{_libdir}/go/%{go_label}/pkg/linux_%{go_arch}_dynlink/libstd.so +%endif +%endif + %files doc -%defattr(-,root,root,-) %doc %{_docdir}/go/%{go_label}/*.html %ifarch %{tsan_arch} @@ -405,4 +444,12 @@ fi %{_datadir}/go/%{go_label}/src/runtime/race/race_linux_%{go_arch}.syso %endif +%if %{with_shared} +%if 0%{?suse_version} > 1500 +# openSUSE Tumbleweed +%files libstd +%{_libdir}/go/%{go_label}/pkg/linux_%{go_arch}_dynlink/libstd.so +%endif +%endif + %changelog