SHA256
1
0
forked from pool/restic

Accepting request 564009 from home:cyphar:restic

- Switch away from using build.go, and instead manually build with "go". This
  allows us to build with the older Go compilers present in Leap, as well as to
  build the binary as PIC and dynamic.
- Add generated man pages.
- In order to build with older Go compilers, add a patch.
  + restic-switch-to-pre-1.8-sort.Stable-API.patch

OBS-URL: https://build.opensuse.org/request/show/564009
OBS-URL: https://build.opensuse.org/package/show/Archiving/restic?expand=0&rev=2
This commit is contained in:
2018-01-13 16:47:05 +00:00
committed by Git OBS Bridge
parent 9bcff744a3
commit cfbdb3f10f
3 changed files with 79 additions and 8 deletions

View File

@@ -14,37 +14,52 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# nodebuginfo
%define import_path github.com/restic/restic
Name: restic
Version: 0.8.1
Release: 0
License: BSD-2-Clause
Summary: Fast, secure, efficient backup program
Url: https://restic.github.io/
Group: Productivity/Backup
Url: https://restic.net/
Group: Productivity/Archiving/Backup
Source0: https://github.com/restic/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/restic/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
Source2: %{name}.keyring
BuildRequires: golang(API) = 1.8
# PATCH-FIX-OPENSUSE: Revert to using pre-1.8 Go APIs so we can build on Leap 42.x.
Patch1: restic-switch-to-pre-1.8-sort.Stable-API.patch
BuildRequires: golang(API) >= 1.6
BuildRequires: golang-packaging
BuildRequires: python-Sphinx
%description
restic is a backup program that is fast, efficient and secure.
%prep
%setup -q
%patch1 -p1
%build
make %{?_smp_mflags}
make -C doc
# Set up GOPATH.
export GOPATH="$GOPATH:$HOME/go"
mkdir -p $HOME/go/src/%{import_path}
cp -rT $PWD $HOME/go/src/%{import_path}
# Build restic. We don't use build.go because it builds statically and also has
# weird golang version requirements for no good reason.
go build -o %{name} -buildmode=pie \
-ldflags "-s -w -X main.version=%{version}" \
%{import_path}/cmd/restic
%install
install -D -m 0755 restic %{buildroot}%{_bindir}/restic
install -D -m0755 %{name} %{buildroot}%{_bindir}/%{name}
install -d %{buildroot}%{_mandir}/man1
./%{name} generate --man %{buildroot}%{_mandir}/man1
%files
%defattr(-,root,root)
%doc *.md *.rst LICENSE
%doc doc/
%{_bindir}/restic
%{_mandir}/man1/restic*.1*