install alternatives for go and gofmt binaries [release 1.14.7-2mamba;Sun Aug 16 2020]

This commit is contained in:
Silvan Calarco 2024-01-05 23:18:57 +01:00
parent d089f30f00
commit a53c5d4621
2 changed files with 45 additions and 35 deletions

View File

@ -1,4 +1,3 @@
# go # go
The Go programming language. The Go programming language.

79
go.spec
View File

@ -1,14 +1,12 @@
%define with_pie 1
Name: go Name: go
Version: 1.14.7 Version: 1.14.7
Release: 1mamba Release: 2mamba
Summary: The Go programming language Summary: The Go programming language
Group: Applications/Development Group: Applications/Development
Vendor: openmamba Vendor: openmamba
Distribution: openmamba Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it> Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://golang.org URL: https://golang.org
## GITSOURCE https://github.com/golang/go.git go1.10.1
Source: https://github.com/golang/go.git/go%{version}/go-%{version}.tar.bz2 Source: https://github.com/golang/go.git/go%{version}/go-%{version}.tar.bz2
Patch0: go-1.10.1-default-buildmode-pie.patch Patch0: go-1.10.1-default-buildmode-pie.patch
License: BSD License: BSD
@ -16,32 +14,23 @@ License: BSD
BuildRequires: glibc-devel BuildRequires: glibc-devel
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
BuildRequires: gcc-go >= 8.1.0 BuildRequires: gcc-go >= 8.1.0
Provides: go
Provides: go-pie Provides: go-pie
#%if "%{with_pie}" == "1" Obsoletes: go-pie
#Conflicts: go
#%else
#Conflicts: go-pie
#%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description %description
The Go programming language. The Go programming language.
%package pie # Fedora:
Group: Applications/Development # Don't alter timestamps of especially the .a files (or else go will rebuild later)
Summary: The Go programming language (with PIE enabled by default) # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
#% debug_package
%description pie %global __strip /bin/true
The Go programming language (with PIE enabled by default).
%debug_package
%prep %prep
%setup -q %setup -q
#%if "%{with_pie}" == "1" #-D -T
#%patch0 -p1 #:<< _EOF
#%endif
%define _use_internal_dependency_generator 0 %define _use_internal_dependency_generator 0
@ -61,17 +50,29 @@ _EOF
chmod +x %{_builddir}/go-%{version}/find_requires.sh chmod +x %{_builddir}/go-%{version}/find_requires.sh
%build %build
export GOPATH="`pwd`/" #:<< _EOF
export GOPATH="%{_builddir}/"
export GOROOT="$PWD"
export GOROOT_FINAL=%{_libdir}/go
export GO_LDFLAGS="-linkmode internal"
export CGO_ENABLED=1
export GOROOT="$GOPATH" # Use gcc-go as bootstrap compiler
export GOBIN="$GOROOT/bin" export GOROOT_BOOTSTRAP=/
sed -i "s|\$GOROOT_BOOTSTRAP/bin/go|/usr/bin/gcc-go|" src/make.bash src/make.rc
sed -i "s|/bin/go|/usr/bin/go|" src/cmd/dist/buildtool.go
cd "$GOPATH/src" # golang
#export GOROOT_BOOTSTRAP=%{_libdir}/go
cd src
./make.bash --no-clean -v ./make.bash --no-clean -v
cd ..
PATH="$PWD/bin:$PATH" go install -v -buildmode=shared std
PATH="$GOBIN:$PATH" go install -v -buildmode=shared std
%ifarch x86_64 %ifarch x86_64
PATH="$GOBIN:$PATH" go install -v -race std PATH="$PWD/bin:$PATH" go install -v -race std
%endif %endif
%install %install
@ -84,8 +85,6 @@ install -d %{buildroot}{%{_bindir},%{_libdir}/go,%{_docdir}/go}
cp -a bin pkg src lib misc %{buildroot}%{_libdir}/go cp -a bin pkg src lib misc %{buildroot}%{_libdir}/go
cp -r doc/* %{buildroot}%{_docdir}/go cp -r doc/* %{buildroot}%{_docdir}/go
ln -sf %{_libdir}/go/bin/go %{buildroot}%{_bindir}/go-pie
ln -sf %{_libdir}/go/bin/gofmt %{buildroot}%{_bindir}/gofmt-pie
ln -sf %{_docdir}/go %{buildroot}%{_libdir}/go/doc ln -sf %{_docdir}/go %{buildroot}%{_libdir}/go/doc
install -Dm644 LICENSE %{buildroot}%{_datadir}/licenses/go/LICENSE install -Dm644 LICENSE %{buildroot}%{_datadir}/licenses/go/LICENSE
@ -98,14 +97,23 @@ rm -rf %{buildroot}%{_libdir}/go/src/*.rc
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%if "%{with_pie}" == "1" %post
%files pie /usr/sbin/alternatives --install \
%else %{_bindir}/go go %{_libdir}/go/bin/go 50
/usr/sbin/alternatives --install \
%{_bindir}/gofmt gofmt %{_libdir}/go/bin/gofmt 50
:
%preun
# erase
if [ $1 -eq 0 ]; then
/usr/sbin/update-alternatives --remove go %{_libdir}/go/bin/go
/usr/sbin/update-alternatives --remove gofmt %{_libdir}/go/bin/gofmt
fi
:
%files %files
%endif
%defattr(-,root,root) %defattr(-,root,root)
%{_bindir}/go-pie
%{_bindir}/gofmt-pie
%dir %{_libdir}/go %dir %{_libdir}/go
%{_libdir}/go/* %{_libdir}/go/*
%dir %{_datadir}/doc/go %dir %{_datadir}/doc/go
@ -114,6 +122,9 @@ rm -rf %{buildroot}%{_libdir}/go/src/*.rc
#%doc README.md #%doc README.md
%changelog %changelog
* Sun Aug 16 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 1.14.7-2mamba
- install alternatives for go and gofmt binaries
* Fri Aug 07 2020 Automatic Build System <autodist@mambasoft.it> 1.14.7-1mamba * Fri Aug 07 2020 Automatic Build System <autodist@mambasoft.it> 1.14.7-1mamba
- automatic version update by autodist - automatic version update by autodist