- Add gccgo symlink, add go and gofmt as alternatives to support

parallel install of golang.  [bnc#1096677]

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gcc?expand=0&rev=88
This commit is contained in:
Richard Biener 2018-06-19 09:45:51 +00:00 committed by Git OBS Bridge
parent 6f9de66f2e
commit d8e58fb145
2 changed files with 34 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jun 13 07:13:07 UTC 2018 - rguenther@suse.com
- Add gccgo symlink, add go and gofmt as alternatives to support
parallel install of golang. [bnc#1096677]
-------------------------------------------------------------------
Tue Jun 5 10:19:50 UTC 2018 - rguenther@suse.com

View File

@ -345,6 +345,8 @@ License: GPL-3.0+
Group: Development/Languages/C and C++
Requires: gcc = %{version}
Requires: gcc%{gcc_version}-go
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description -n gcc-go
The system GNU Go Compiler.
@ -385,6 +387,7 @@ for program in \
g++ \
cpp \
gfortran \
gccgo \
%if %{build_ada}
gnat gnatbind gnatbl gnatchop gnatclean gnatfind gnatkr \
gnatlink gnatls gnatmake gnatname gnatprep gnatxref gprmake \
@ -393,12 +396,17 @@ for program in \
; do
ln -sf $program-%{gcc_suffix} $RPM_BUILD_ROOT%{_prefix}/bin/$program
done
# For go and gofmt use alternatives since they are shared with golang
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -sf %{_sysconfdir}/alternatives/go %{buildroot}%{_bindir}/go
ln -sf %{_sysconfdir}/alternatives/gofmt %{buildroot}%{_bindir}/gofmt
# Link section 1 manpages
for man1 in \
gcc gcov gcov-dump gcov-tool \
g++ \
cpp \
gfortran \
gccgo \
; do
ln -sf $man1-%{gcc_suffix}.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/$man1.1.gz
done
@ -426,6 +434,20 @@ cat > $RPM_BUILD_ROOT/$dir/defaults.spec <<EOF
%%{pie|fpic|fPIC|fpie|fPIE|no-pie|fno-pic|fno-PIC|fno-pie|fno-PIE|shared|static|nostdlib|nodefaultlibs|nostartfiles:;:-fPIE -pie}
EOF
%post -n gcc-go
# we don't want a BuildRequires on gccN-go but otherwise the install
# step of the build fails, so simply skip the script when gccN-go isn't there
if [ -f %{_bindir}/go-%{gcc_suffix} ] ; then
update-alternatives \
--install %{_bindir}/go go %{_bindir}/go-%{gcc_suffix} 100 \
--slave %{_bindir}/gofmt gofmt %{_bindir}/gofmt-%{gcc_suffix}
fi
%postun
if [ $1 -eq 0 ] ; then
update-alternatives --remove go %{_bindir}/go-%{gcc_suffix}
fi
%files
%defattr(-,root,root)
%{_prefix}/bin/gcc
@ -516,7 +538,12 @@ EOF
%files -n gcc-go
%defattr(-,root,root)
# empty - only for the dependency
%{_bindir}/gccgo
%{_bindir}/go
%{_bindir}/gofmt
%ghost %{_sysconfdir}/alternatives/go
%ghost %{_sysconfdir}/alternatives/gofmt
%doc %{_mandir}/man1/gccgo.1.gz
%if %{separate_bi32}