499fb9c
# Generate devel rpm
499fb9c
%global with_devel 1
499fb9c
499fb9c
# Build project from bundled dependencies
499fb9c
%if 0%{?rhel}
499fb9c
%global with_bundled 1
499fb9c
%else
499fb9c
%global with_bundled 0
499fb9c
%endif
499fb9c
499fb9c
# Build with debug info rpm
499fb9c
%global with_debug 1
499fb9c
499fb9c
# Run tests in check section
499fb9c
%global with_check 1
499fb9c
499fb9c
# Generate unit-test rpm
499fb9c
%global with_unit_test 1
499fb9c
499fb9c
# Build server tools
499fb9c
%global with_tools 1
499fb9c
499fb9c
499fb9c
%if 0%{?with_debug}
499fb9c
%global _dwz_low_mem_die_limit 0
499fb9c
%else
499fb9c
%global debug_package   %{nil}
499fb9c
%endif
499fb9c
499fb9c
%global provider        github
499fb9c
%global provider_tld    com
499fb9c
%global project         syncthing
499fb9c
%global repo            syncthing
499fb9c
%global long_name       golang-%{provider}-%{project}-%{repo}
499fb9c
# https://github.com/syncthing/syncthing
499fb9c
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
499fb9c
%global import_path     %{provider_prefix}
499fb9c
%global commit          1fc2ab444b3a3bf2ab1e2e2a9e5f1f4987103b00
499fb9c
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
499fb9c
499fb9c
# commit 1fc2ab444b3a3bf2ab1e2e2a9e5f1f4987103b00 == version 0.14.35
499fb9c
499fb9c
499fb9c
Name:           syncthing
499fb9c
Summary:        Continuous File Synchronization
499fb9c
Version:        0.14.35
499fb9c
Release:        2%{?dist}
499fb9c
499fb9c
# syncthing (MPLv2.0) bundles angular (MIT), bootstrap (MIT), and font-awesome (MIT/OFL)
499fb9c
License:        MPLv2.0 and MIT and OFL
499fb9c
499fb9c
URL:            https://syncthing.net
499fb9c
Source0:        https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-source-v%{version}.tar.gz
499fb9c
499fb9c
# Patch build.go script so go build doesn't install deps
499fb9c
# and produces debug-enabled binaries for rpm
499fb9c
Patch0:         00-go-build-flags.patch
499fb9c
499fb9c
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
499fb9c
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
499fb9c
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
499fb9c
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
499fb9c
499fb9c
BuildRequires:  systemd
499fb9c
%{?systemd_requires}
499fb9c
499fb9c
%if ! 0%{?with_bundled}
499fb9c
BuildRequires:  golang(github.com/AudriusButkevicius/go-nat-pmp)
499fb9c
BuildRequires:  golang(github.com/AudriusButkevicius/pfilter)
499fb9c
BuildRequires:  golang(github.com/bkaradzic/go-lz4)
499fb9c
BuildRequires:  golang(github.com/calmh/du)
499fb9c
BuildRequires:  golang(github.com/calmh/luhn)
499fb9c
BuildRequires:  golang(github.com/calmh/xdr)
499fb9c
BuildRequires:  golang(github.com/ccding/go-stun/stun)
499fb9c
BuildRequires:  golang(github.com/chmduquesne/rollinghash/adler32)
499fb9c
BuildRequires:  golang(github.com/gobwas/glob)
499fb9c
BuildRequires:  golang(github.com/gogo/protobuf/gogoproto)
499fb9c
BuildRequires:  golang(github.com/gogo/protobuf/proto)
499fb9c
BuildRequires:  golang(github.com/jackpal/gateway)
499fb9c
BuildRequires:  golang(github.com/kardianos/osext)
499fb9c
BuildRequires:  golang(github.com/minio/sha256-simd)
499fb9c
BuildRequires:  golang(github.com/rcrowley/go-metrics)
499fb9c
BuildRequires:  golang(github.com/sasha-s/go-deadlock)
499fb9c
BuildRequires:  golang(github.com/syndtr/goleveldb/leveldb)
499fb9c
BuildRequires:  golang(github.com/syndtr/goleveldb/leveldb/errors)
499fb9c
BuildRequires:  golang(github.com/syndtr/goleveldb/leveldb/iterator)
499fb9c
BuildRequires:  golang(github.com/syndtr/goleveldb/leveldb/opt)
499fb9c
BuildRequires:  golang(github.com/syndtr/goleveldb/leveldb/storage)
499fb9c
BuildRequires:  golang(github.com/syndtr/goleveldb/leveldb/util)
499fb9c
BuildRequires:  golang(github.com/thejerf/suture)
499fb9c
BuildRequires:  golang(github.com/vitrun/qart)
499fb9c
BuildRequires:  golang(github.com/xtaci/kcp-go)
499fb9c
BuildRequires:  golang(github.com/xtaci/smux)
499fb9c
BuildRequires:  golang(golang.org/x/net/context)
499fb9c
BuildRequires:  golang(golang.org/x/net/ipv4)
499fb9c
BuildRequires:  golang(golang.org/x/net/ipv6)
499fb9c
BuildRequires:  golang(golang.org/x/net/proxy)
499fb9c
BuildRequires:  golang(golang.org/x/text/unicode/norm)
499fb9c
BuildRequires:  golang(golang.org/x/time/rate)
499fb9c
%endif
499fb9c
499fb9c
Provides:       %{long_name} = %{version}-%{release}
499fb9c
499fb9c
Provides:       bundled(angular) = 1.2.9
499fb9c
Provides:       bundled(angular-dirPagination) = 759009c
499fb9c
Provides:       bundled(angular-translate) = 2.9.0.1
499fb9c
Provides:       bundled(angular-translate-loader-static-files) = 2.11.0
499fb9c
Provides:       bundled(bootstrap) = 3.3.5
499fb9c
Provides:       bundled(font-awesome) = 4.5.0
499fb9c
Provides:       bundled(jquery) = 2.2.2
499fb9c
499fb9c
499fb9c
%description
499fb9c
Syncthing replaces other file synchronization services with something
499fb9c
open, trustworthy and decentralized. Your data is your data alone and
499fb9c
you deserve to choose where it is stored, if it is shared with some
499fb9c
third party and how it's transmitted over the Internet.
499fb9c
499fb9c
Using syncthing, that control is returned to you.
499fb9c
499fb9c
499fb9c
%if 0%{?with_devel}
499fb9c
%package        devel
499fb9c
Summary:        Continuous File Synchronization (development files)
499fb9c
Provides:       %{long_name}-devel = %{version}-%{release}
499fb9c
BuildArch:      noarch
499fb9c
499fb9c
Requires:       golang(github.com/AudriusButkevicius/go-nat-pmp)
499fb9c
Requires:       golang(github.com/AudriusButkevicius/pfilter)
499fb9c
Requires:       golang(github.com/bkaradzic/go-lz4)
499fb9c
Requires:       golang(github.com/calmh/du)
499fb9c
Requires:       golang(github.com/calmh/luhn)
499fb9c
Requires:       golang(github.com/calmh/xdr)
499fb9c
Requires:       golang(github.com/ccding/go-stun/stun)
499fb9c
Requires:       golang(github.com/chmduquesne/rollinghash/adler32)
499fb9c
Requires:       golang(github.com/gobwas/glob)
499fb9c
Requires:       golang(github.com/gogo/protobuf/gogoproto)
499fb9c
Requires:       golang(github.com/gogo/protobuf/proto)
499fb9c
Requires:       golang(github.com/jackpal/gateway)
499fb9c
Requires:       golang(github.com/kardianos/osext)
499fb9c
Requires:       golang(github.com/minio/sha256-simd)
499fb9c
Requires:       golang(github.com/rcrowley/go-metrics)
499fb9c
Requires:       golang(github.com/sasha-s/go-deadlock)
499fb9c
Requires:       golang(github.com/syndtr/goleveldb/leveldb)
499fb9c
Requires:       golang(github.com/syndtr/goleveldb/leveldb/errors)
499fb9c
Requires:       golang(github.com/syndtr/goleveldb/leveldb/iterator)
499fb9c
Requires:       golang(github.com/syndtr/goleveldb/leveldb/opt)
499fb9c
Requires:       golang(github.com/syndtr/goleveldb/leveldb/storage)
499fb9c
Requires:       golang(github.com/syndtr/goleveldb/leveldb/util)
499fb9c
Requires:       golang(github.com/thejerf/suture)
499fb9c
Requires:       golang(github.com/vitrun/qart)
499fb9c
Requires:       golang(github.com/xtaci/kcp-go)
499fb9c
Requires:       golang(github.com/xtaci/smux)
499fb9c
Requires:       golang(golang.org/x/net/context)
499fb9c
Requires:       golang(golang.org/x/net/ipv4)
499fb9c
Requires:       golang(golang.org/x/net/ipv6)
499fb9c
Requires:       golang(golang.org/x/net/proxy)
499fb9c
Requires:       golang(golang.org/x/text/unicode/norm)
499fb9c
Requires:       golang(golang.org/x/time/rate)
499fb9c
499fb9c
Provides:       golang(%{import_path}/lib/auto) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/beacon) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/config) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/connections) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/db) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/dialer) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/discover) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/events) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/fs) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/ignore) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/logger) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/model) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/nat) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/osutil) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/pmp) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/protocol) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/rand) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/rc) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/relay/client) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/relay/protocol) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/scanner) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/sha256) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/signature) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/stats) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/sync) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/tlsutil) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/upgrade) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/upnp) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/util) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/versioner) = %{version}-%{release}
499fb9c
Provides:       golang(%{import_path}/lib/weakhash) = %{version}-%{release}
499fb9c
499fb9c
%if 0%{?with_bundled}
499fb9c
Provides:       bundled(golang(github.com/AudriusButkevicius/cli)) = 7f561c78b5a4aad858d9fd550c92b5da6d55efbb
499fb9c
Provides:       bundled(golang(github.com/AudriusButkevicius/go-nat-pmp)) = 452c97607362b2ab5a7839b8d1704f0396b640ca
499fb9c
Provides:       bundled(golang(github.com/AudriusButkevicius/pfilter)) = 09b3cfdd04de89f0196caecb0b335d7149a6593a
499fb9c
Provides:       bundled(golang(github.com/bkaradzic/go-lz4)) = 7224d8d8f27ef618c0a95f1ae69dbb0488abc33a
499fb9c
Provides:       bundled(golang(github.com/calmh/du)) = dd9dc2043353249b2910b29dcfd6f6d4e64f39be
499fb9c
Provides:       bundled(golang(github.com/calmh/luhn)) = 0c8388ff95fa92d4094011e5a04fc99dea3d1632
499fb9c
Provides:       bundled(golang(github.com/calmh/xdr)) = 08e072f9cb164f943a92eb59f90f3abc64ac6e8f
499fb9c
Provides:       bundled(golang(github.com/ccding/go-stun/stun)) = 04a4eed61c57ecc9903f8983d1d2c17b88d2e9e1
499fb9c
Provides:       bundled(golang(github.com/chmduquesne/rollinghash)) = 043b8fdecc9816f0011a056f6d92f9a091ab63dd
499fb9c
Provides:       bundled(golang(github.com/cznic/b)) = aaaa43c92e509a827e63540510bc94c3003ef2e1
499fb9c
Provides:       bundled(golang(github.com/cznic/fileutil)) = 90cf820aafe8f7df39416fdbb932029ff99bd1ab
499fb9c
Provides:       bundled(golang(github.com/cznic/internal/buffer)) = e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c
499fb9c
Provides:       bundled(golang(github.com/cznic/internal/file)) = e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c
499fb9c
Provides:       bundled(golang(github.com/cznic/internal/slice)) = e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c
499fb9c
Provides:       bundled(golang(github.com/cznic/lldb)) = bea8611dd5c407f3c5eab9f9c68e887a27dc6f0e
499fb9c
Provides:       bundled(golang(github.com/cznic/mathutil)) = 1447ad269d64ca91aa8d7079baa40b6fc8b965e7
499fb9c
Provides:       bundled(golang(github.com/cznic/ql)) = bd2055c7674ac80c520815dfe85082844cd246d4
499fb9c
Provides:       bundled(golang(github.com/cznic/sortutil)) = 4c7342852e65c2088c981288f2c5610d10b9f7f4
499fb9c
Provides:       bundled(golang(github.com/cznic/strutil)) = 43a89592ed56c227c7fdb1fcaf7d1d08be02ec54
499fb9c
Provides:       bundled(golang(github.com/cznic/zappy)) = 2533cb5b45cc6c07421468ce262899ddc9d53fb7
499fb9c
Provides:       bundled(golang(github.com/d4l3k/messagediff)) = 2fe2a1d40db6c23619ae5bcc8f80a5b43c40581b
499fb9c
Provides:       bundled(golang(github.com/edsrzf/mmap-go)) = 0bce6a6887123b67a60366d2c9fe2dfb74289d2e
499fb9c
Provides:       bundled(golang(github.com/gobwas/glob)) = 51eb1ee00b6d931c66d229ceeb7c31b985563420
499fb9c
Provides:       bundled(golang(github.com/gogo/protobuf)) = efccd33a0c20aa078705571d5ddbfa14c8395a63
499fb9c
Provides:       bundled(golang(github.com/golang/groupcache/lru)) = 72d04f9fcdec7d3821820cc4a6f150eae553639a
499fb9c
Provides:       bundled(golang(github.com/golang/protobuf/proto)) = 2bba0603135d7d7f5cb73b2125beeda19c09f4ef
499fb9c
Provides:       bundled(golang(github.com/golang/protobuf/ptypes/any)) = 2bba0603135d7d7f5cb73b2125beeda19c09f4ef
499fb9c
Provides:       bundled(golang(github.com/golang/snappy)) = 553a641470496b2327abcac10b36396bd98e45c9
499fb9c
Provides:       bundled(golang(github.com/jackpal/gateway)) = 5795ac81146e01d3fab7bcf21c043c3d6a32b006
499fb9c
Provides:       bundled(golang(github.com/kardianos/osext)) = 9d302b58e975387d0b4d9be876622c86cefe64be
499fb9c
Provides:       bundled(golang(github.com/klauspost/cpuid)) = 09cded8978dc9e80714c4d85b0322337b0a1e5e0
499fb9c
Provides:       bundled(golang(github.com/klauspost/reedsolomon)) = 5abf0ee302ccf4834e84f63ff74eca3e8b88e4e2
499fb9c
Provides:       bundled(golang(github.com/lib/pq)) = 2704adc878c21e1329f46f6e56a1c387d788ff94
499fb9c
Provides:       bundled(golang(github.com/minio/sha256-simd)) = 6124d070eb4e7001c244b6ccc282620a5dce44a0
499fb9c
Provides:       bundled(golang(github.com/onsi/ginkgo)) = 77a8c1e5c40d6bb6c5eb4dd4bdce9763564f6298
499fb9c
Provides:       bundled(golang(github.com/onsi/gomega)) = 334b8f472b3af5d541c5642701c1e29e2126f486
499fb9c
Provides:       bundled(golang(github.com/oschwald/geoip2-golang)) = 0fd242da7906550802871efe101abfdb1cc550a8
499fb9c
Provides:       bundled(golang(github.com/oschwald/maxminddb-golang)) = 697da8075d2061aa8ed639346443f5d3e8c80b30
499fb9c
Provides:       bundled(golang(github.com/petermattis/goid)) = caab6446a35a918488a0f52d4b0bd088a60f3511
499fb9c
Provides:       bundled(golang(github.com/pkg/errors)) = ff09b135c25aae272398c51a07235b90a75aa4f0
499fb9c
Provides:       bundled(golang(github.com/rcrowley/go-metrics)) = 1f30fe9094a513ce4c700b9a54458bbb0c96996c
499fb9c
Provides:       bundled(golang(github.com/remyoudompheng/bigfft)) = a8e77ddfb93284b9d58881f597c820a2875af336
499fb9c
Provides:       bundled(golang(github.com/sasha-s/go-deadlock)) = 341000892f3dd25f440e6231e8533eb3688ed7ec
499fb9c
Provides:       bundled(golang(github.com/stathat/go)) = 74669b9f388d9d788c97399a0824adbfee78400e
499fb9c
Provides:       bundled(golang(github.com/syndtr/goleveldb/leveldb)) = 3c5717caf1475fd25964109a0fc640bd150fce43
499fb9c
Provides:       bundled(golang(github.com/thejerf/suture)) = 0ac47afae95ad5bc5184ed346bc945168e883f5d
499fb9c
Provides:       bundled(golang(github.com/vitrun/qart/coding)) = bf64b92db6b05651d6c25a3dabf2d543b360c0aa
499fb9c
Provides:       bundled(golang(github.com/vitrun/qart/gf256)) = bf64b92db6b05651d6c25a3dabf2d543b360c0aa
499fb9c
Provides:       bundled(golang(github.com/vitrun/qart/qr)) = bf64b92db6b05651d6c25a3dabf2d543b360c0aa
499fb9c
Provides:       bundled(golang(github.com/xtaci/kcp-go)) = 0b0731ef3f184a8985edcb4ca26a4b0598c6dc1a
499fb9c
Provides:       bundled(golang(github.com/xtaci/smux)) = 0f6b9aaecaaf354357adc7def9239011ad276776
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/bcrypt)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/blowfish)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/cast5)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/pbkdf2)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/salsa20)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/tea)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/twofish)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/crypto/xtea)) = c78caca803c95773f48a844d3dcab04b9bc4d6dd
499fb9c
Provides:       bundled(golang(golang.org/x/net/bpf)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/net/context)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/net/internal/iana)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/net/internal/netreflect)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/net/ipv4)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/net/ipv6)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/net/proxy)) = ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d
499fb9c
Provides:       bundled(golang(golang.org/x/sys/unix)) = f3918c30c5c2cb527c0b071a27c35120a6c0719a
499fb9c
Provides:       bundled(golang(golang.org/x/sys/windows)) = 493114f68206f85e7e333beccfabc11e98cba8dd
499fb9c
Provides:       bundled(golang(golang.org/x/text/internal/gen)) = f4b4367115ec2de254587813edaa901bc1c723a8
499fb9c
Provides:       bundled(golang(golang.org/x/text/internal/triegen)) = f4b4367115ec2de254587813edaa901bc1c723a8
499fb9c
Provides:       bundled(golang(golang.org/x/text/internal/ucd)) = f4b4367115ec2de254587813edaa901bc1c723a8
499fb9c
Provides:       bundled(golang(golang.org/x/text/transform)) = f4b4367115ec2de254587813edaa901bc1c723a8
499fb9c
Provides:       bundled(golang(golang.org/x/text/unicode/cldr)) = f4b4367115ec2de254587813edaa901bc1c723a8
499fb9c
Provides:       bundled(golang(golang.org/x/text/unicode/norm)) = f4b4367115ec2de254587813edaa901bc1c723a8
499fb9c
Provides:       bundled(golang(golang.org/x/time/rate)) = f51c12702a4d776e4c1fa9b0fabab841babae631
499fb9c
Provides:       bundled(golang(gopkg.in/yaml.v2)) = a3f3340b5840cee44f372bddb5880fcbc419b46a
499fb9c
%endif
499fb9c
499fb9c
%description    devel
499fb9c
Syncthing replaces other file synchronization services with something
499fb9c
open, trustworthy and decentralized. Your data is your data alone and
499fb9c
you deserve to choose where it is stored, if it is shared with some
499fb9c
third party and how it's transmitted over the Internet.
499fb9c
499fb9c
Using syncthing, that control is returned to you.
499fb9c
499fb9c
This package contains the syncthing source files, which are needed as
499fb9c
dependency for building packages using syncthing.
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%if 0%{?with_unit_test} && 0%{?with_devel}
499fb9c
%package        unit-test-devel
499fb9c
Summary:        Continuous File Synchronization (unit tests)
499fb9c
Provides:       %{long_name}-unit-test-devel = %{version}-%{release}
499fb9c
499fb9c
# test subpackage tests code from devel subpackage
499fb9c
Requires:       %{name}-devel = %{version}-%{release}
499fb9c
499fb9c
%if 0%{?with_check} && ! 0%{?with_bundled}
499fb9c
BuildRequires:  golang(github.com/d4l3k/messagediff)
499fb9c
%endif
499fb9c
499fb9c
Requires:       golang(github.com/d4l3k/messagediff)
499fb9c
499fb9c
%description    unit-test-devel
499fb9c
Syncthing replaces other file synchronization services with something
499fb9c
open, trustworthy and decentralized. Your data is your data alone and
499fb9c
you deserve to choose where it is stored, if it is shared with some
499fb9c
third party and how it's transmitted over the Internet.
499fb9c
499fb9c
Using syncthing, that control is returned to you.
499fb9c
499fb9c
This package contains the unit tests for syncthing.
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%if 0%{?with_tools}
499fb9c
%package        tools
499fb9c
Summary:        Continuous File Synchronization (server tools)
499fb9c
499fb9c
%if ! 0%{?with_bundled}
499fb9c
BuildRequires:  golang(github.com/AudriusButkevicius/cli)
499fb9c
BuildRequires:  golang(github.com/cznic/ql)
499fb9c
BuildRequires:  golang(github.com/golang/groupcache/lru)
499fb9c
BuildRequires:  golang(github.com/lib/pq)
499fb9c
BuildRequires:  golang(github.com/oschwald/geoip2-golang)
499fb9c
%endif
499fb9c
499fb9c
%description    tools
499fb9c
Syncthing replaces other file synchronization services with something
499fb9c
open, trustworthy and decentralized. Your data is your data alone and
499fb9c
you deserve to choose where it is stored, if it is shared with some
499fb9c
third party and how it's transmitted over the Internet.
499fb9c
499fb9c
Using syncthing, that control is returned to you.
499fb9c
499fb9c
This package contains the syncthing server tools.
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%prep
499fb9c
%setup -q -n syncthing
499fb9c
%patch0 -p1
499fb9c
499fb9c
499fb9c
%build
499fb9c
%if ! 0%{?with_bundled}
499fb9c
# remove bundled libraries
499fb9c
rm -r vendor
499fb9c
%endif
499fb9c
499fb9c
# Replace usage of "context" package (go 1.7+ only) with the old
499fb9c
# "golang.org/x/net/context" package if only an old compiler is available
499fb9c
%if 0%{?fedora} == 24 || 0%{?rhel}
499fb9c
sed -i 's/"context"/"golang.org\/x\/net\/context"/' cmd/syncthing/*.go lib/*/*.go
499fb9c
%endif
499fb9c
499fb9c
# prepare build environment
499fb9c
mkdir -p ./_build/src/%{provider}.%{provider_tld}/%{project}
499fb9c
499fb9c
TOP=$(pwd)
499fb9c
pushd _build/src/%{provider}.%{provider_tld}/%{project}
499fb9c
ln -s $TOP ./syncthing
499fb9c
popd
499fb9c
499fb9c
export GOPATH=$(pwd)/_build:%{gopath}
499fb9c
export BUILDDIR=$(pwd)/_build/src/%{import_path}
499fb9c
499fb9c
# set BUILD_HOST variable so syncthing knows where it was built
499fb9c
export BUILD_HOST=fedora-koji
499fb9c
499fb9c
# run builds in appropriate directory
499fb9c
pushd $BUILDDIR
499fb9c
499fb9c
head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n' > build_id
499fb9c
go run build.go -no-upgrade build syncthing
499fb9c
499fb9c
%if 0%{?with_tools}
499fb9c
head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n' > build_id
499fb9c
go run build.go -no-upgrade build stdiscosrv
499fb9c
499fb9c
head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n' > build_id
499fb9c
go run build.go -no-upgrade build strelaysrv
499fb9c
499fb9c
head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n' > build_id
499fb9c
go run build.go -no-upgrade build strelaypoolsrv
499fb9c
%endif
499fb9c
499fb9c
popd
499fb9c
499fb9c
# remove build script so it doesn't get picked up later
499fb9c
%if 0%{?with_devel}
499fb9c
rm build.go
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%install
499fb9c
# install binaries
499fb9c
mkdir -p %{buildroot}/%{_bindir}
499fb9c
499fb9c
cp -pav ./syncthing %{buildroot}/%{_bindir}/
499fb9c
499fb9c
%if 0%{?with_tools}
499fb9c
cp -pav ./stdiscosrv %{buildroot}/%{_bindir}/
499fb9c
cp -pav ./strelaysrv %{buildroot}/%{_bindir}/
499fb9c
cp -pav ./strelaypoolsrv %{buildroot}/%{_bindir}/
499fb9c
%endif
499fb9c
499fb9c
# install man pages
499fb9c
mkdir -p %{buildroot}/%{_mandir}/man1
499fb9c
mkdir -p %{buildroot}/%{_mandir}/man5
499fb9c
mkdir -p %{buildroot}/%{_mandir}/man7
499fb9c
499fb9c
cp -pav ./man/syncthing.1 %{buildroot}/%{_mandir}/man1/
499fb9c
cp -pav ./man/*.5 %{buildroot}/%{_mandir}/man5/
499fb9c
cp -pav ./man/*.7 %{buildroot}/%{_mandir}/man7/
499fb9c
499fb9c
%if 0%{?with_tools}
499fb9c
cp -pav ./man/stdiscosrv.1 %{buildroot}/%{_mandir}/man1/
499fb9c
cp -pav ./man/strelaysrv.1 %{buildroot}/%{_mandir}/man1/
499fb9c
%endif
499fb9c
499fb9c
# install systemd units
499fb9c
mkdir -p %{buildroot}/%{_unitdir}
499fb9c
mkdir -p %{buildroot}/%{_userunitdir}
499fb9c
499fb9c
cp -pav etc/linux-systemd/system/syncthing@.service %{buildroot}/%{_unitdir}/
499fb9c
cp -pav etc/linux-systemd/system/syncthing-resume.service %{buildroot}/%{_unitdir}/
499fb9c
cp -pav etc/linux-systemd/user/syncthing.service %{buildroot}/%{_userunitdir}/
499fb9c
499fb9c
# install systemd preset disabling the service per default
499fb9c
mkdir -p %{buildroot}/%{_prefix}/lib/systemd/user-preset
499fb9c
echo "disable syncthing*" > %{buildroot}/%{_prefix}/lib/systemd/user-preset/90-syncthing.preset
499fb9c
499fb9c
499fb9c
# Unmark source files as executable
499fb9c
for i in $(find -name "*.go" -executable -print); do chmod a-x $i; done
499fb9c
499fb9c
499fb9c
# source codes for building projects
499fb9c
%if 0%{?with_devel}
499fb9c
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
499fb9c
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
499fb9c
499fb9c
# find all *.go but no *_test.go files and generate devel.file-list
499fb9c
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" | grep -v "vendor") ; do
499fb9c
    dirprefix=$(dirname $file)
499fb9c
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
499fb9c
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
499fb9c
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
499fb9c
499fb9c
    while [ "$dirprefix" != "." ]; do
499fb9c
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
499fb9c
        dirprefix=$(dirname $dirprefix)
499fb9c
    done
499fb9c
done
499fb9c
%endif
499fb9c
499fb9c
# testing files for this project
499fb9c
%if 0%{?with_unit_test} && 0%{?with_devel}
499fb9c
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
499fb9c
499fb9c
# find all *_test.go files and generate unit-test-devel.file-list
499fb9c
for file in $(find . -iname "*_test.go" | grep -v "vendor") ; do
499fb9c
    dirprefix=$(dirname $file)
499fb9c
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
499fb9c
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
499fb9c
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
499fb9c
499fb9c
    while [ "$dirprefix" != "." ]; do
499fb9c
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
499fb9c
        dirprefix=$(dirname $dirprefix)
499fb9c
    done
499fb9c
done
499fb9c
499fb9c
# add test data for unit test subpackage
499fb9c
cp -pavr cmd/syncthing/testdata %{buildroot}/%{gopath}/src/%{import_path}/cmd/syncthing/
499fb9c
echo "%%{gopath}/src/%%{import_path}/cmd/syncthing/testdata" >> unit-test-devel.file-list
499fb9c
499fb9c
cp -pavr test/h* %{buildroot}/%{gopath}/src/%{import_path}/test/
499fb9c
499fb9c
cp -pavr lib/config/testdata %{buildroot}/%{gopath}/src/%{import_path}/lib/config/
499fb9c
echo "%%{gopath}/src/%%{import_path}/lib/config/testdata" >> unit-test-devel.file-list
499fb9c
499fb9c
cp -pavr lib/db/testdata %{buildroot}/%{gopath}/src/%{import_path}/lib/db/
499fb9c
echo "%%{gopath}/src/%%{import_path}/lib/db/testdata" >> unit-test-devel.file-list
499fb9c
499fb9c
cp -pavr lib/ignore/testdata %{buildroot}/%{gopath}/src/%{import_path}/lib/ignore/
499fb9c
echo "%%{gopath}/src/%%{import_path}/lib/ignore/testdata" >> unit-test-devel.file-list
499fb9c
499fb9c
cp -pavr lib/model/testdata %{buildroot}/%{gopath}/src/%{import_path}/lib/model/
499fb9c
echo "%%{gopath}/src/%%{import_path}/lib/model/testdata" >> unit-test-devel.file-list
499fb9c
499fb9c
cp -pavr lib/scanner/testdata %{buildroot}/%{gopath}/src/%{import_path}/lib/scanner/
499fb9c
echo "%%{gopath}/src/%%{import_path}/lib/scanner/testdata" >> unit-test-devel.file-list
499fb9c
499fb9c
cp -pavr lib/versioner/_external_test %{buildroot}/%{gopath}/src/%{import_path}/lib/versioner/
499fb9c
echo "%%{gopath}/src/%%{import_path}/lib/versioner/_external_test" >> unit-test-devel.file-list
499fb9c
%endif
499fb9c
499fb9c
%if 0%{?with_devel}
499fb9c
sort -u -o devel.file-list devel.file-list
499fb9c
%endif
499fb9c
499fb9c
%if 0%{?with_unit_test}
499fb9c
sort -u -o unit-test-devel.file-list unit-test-devel.file-list
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%check
499fb9c
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
499fb9c
%if ! 0%{?with_bundled}
499fb9c
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
499fb9c
%else
499fb9c
# Since we aren't packaging up the vendor directory we need to link
499fb9c
# back to it somehow. Hack it up so that we can add the vendor
499fb9c
# directory from BUILD dir as a gopath to be searched when executing
499fb9c
# tests from the BUILDROOT dir.
499fb9c
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
499fb9c
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
499fb9c
%endif
499fb9c
499fb9c
%if ! 0%{?gotest:1}
499fb9c
%global gotest go test
499fb9c
%endif
499fb9c
499fb9c
%gotest %{import_path}/cmd/syncthing
499fb9c
%gotest %{import_path}/lib/auto
499fb9c
%gotest %{import_path}/lib/beacon
499fb9c
%gotest %{import_path}/lib/config
499fb9c
%gotest %{import_path}/lib/connections
499fb9c
%gotest %{import_path}/lib/db
499fb9c
%gotest %{import_path}/lib/dialer
499fb9c
%gotest %{import_path}/lib/discover
499fb9c
%gotest %{import_path}/lib/events
499fb9c
%gotest %{import_path}/lib/fs
499fb9c
%gotest %{import_path}/lib/ignore
499fb9c
%gotest %{import_path}/lib/logger
499fb9c
%gotest %{import_path}/lib/model
499fb9c
%gotest %{import_path}/lib/nat
499fb9c
%gotest %{import_path}/lib/osutil
499fb9c
%gotest %{import_path}/lib/pmp
499fb9c
%gotest %{import_path}/lib/protocol
499fb9c
%gotest %{import_path}/lib/rand
499fb9c
%gotest %{import_path}/lib/relay/client
499fb9c
%gotest %{import_path}/lib/relay/protocol
499fb9c
%gotest %{import_path}/lib/scanner
499fb9c
%gotest %{import_path}/lib/signature
499fb9c
%gotest %{import_path}/lib/stats
499fb9c
%gotest %{import_path}/lib/sync
499fb9c
%gotest %{import_path}/lib/tlsutil
499fb9c
%gotest %{import_path}/lib/upgrade
499fb9c
%gotest %{import_path}/lib/upnp
499fb9c
%gotest %{import_path}/lib/util
499fb9c
%gotest %{import_path}/lib/versioner
499fb9c
%gotest %{import_path}/lib/weakhash
499fb9c
499fb9c
# Clean up after the tests
499fb9c
rm %{buildroot}/%{gopath}/src/%{import_path}/lib/model/testdata/empty
499fb9c
rm -r %{buildroot}/%{gopath}/src/%{import_path}/test/h*/
499fb9c
499fb9c
find %{buildroot}/%{gopath}/src/%{import_path}/ -name ".gitignore" -print -delete
499fb9c
find %{buildroot}/%{gopath}/src/%{import_path}/ -name ".stignore" -print -delete
499fb9c
find %{buildroot}/%{gopath}/src/%{import_path}/ -name ".stfolder" -print -delete
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%post
499fb9c
%systemd_post 'syncthing@*.service'
499fb9c
%systemd_user_post syncthing.service
499fb9c
499fb9c
%preun
499fb9c
%systemd_preun 'syncthing@*.service'
499fb9c
%systemd_user_preun syncthing.service
499fb9c
499fb9c
%postun
499fb9c
%systemd_postun_with_restart 'syncthing@*.service'
499fb9c
%systemd_user_postun_with_restart syncthing.service
499fb9c
499fb9c
499fb9c
#define license tag if not already defined
499fb9c
%{!?_licensedir:%global license %doc}
499fb9c
499fb9c
499fb9c
%files
499fb9c
%license LICENSE
499fb9c
%doc README.md AUTHORS
499fb9c
499fb9c
%{_bindir}/syncthing
499fb9c
499fb9c
%{_mandir}/*/syncthing*
499fb9c
499fb9c
%{_unitdir}/syncthing@.service
499fb9c
%{_unitdir}/syncthing-resume.service
499fb9c
%{_userunitdir}/syncthing.service
499fb9c
499fb9c
%{_prefix}/lib/systemd/user-preset/90-syncthing.preset
499fb9c
499fb9c
499fb9c
%if 0%{?with_tools}
499fb9c
%files tools
499fb9c
%license LICENSE
499fb9c
%doc README.md AUTHORS
499fb9c
499fb9c
%{_bindir}/stdiscosrv
499fb9c
%{_bindir}/strelaysrv
499fb9c
%{_bindir}/strelaypoolsrv
499fb9c
499fb9c
%{_mandir}/man1/stdiscosrv*
499fb9c
%{_mandir}/man1/strelaysrv*
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%if 0%{?with_devel}
499fb9c
%files devel -f devel.file-list
499fb9c
%license LICENSE
499fb9c
%doc README.md AUTHORS
499fb9c
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%if 0%{?with_unit_test} && 0%{?with_devel}
499fb9c
%files unit-test-devel -f unit-test-devel.file-list
499fb9c
%license LICENSE
499fb9c
%doc README.md AUTHORS
499fb9c
%endif
499fb9c
499fb9c
499fb9c
%changelog
499fb9c
* Wed Aug 09 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.35-2
499fb9c
- Add Provides for bundled JS libraries and adapt License tag.
499fb9c
499fb9c
* Tue Aug 08 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.35-1
499fb9c
- Update to version 0.14.35.
499fb9c
499fb9c
* Tue Aug 08 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.34-1
499fb9c
- Update to version 0.14.34.
499fb9c
499fb9c
* Sat Aug 05 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.33-3
499fb9c
- Add another missing ldflags argument.
499fb9c
499fb9c
* Tue Aug 01 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.33-2
499fb9c
- Adapt patched build script to use the correct LDFLAGS.
499fb9c
499fb9c
* Tue Jul 25 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.33-1
499fb9c
- Update to version 0.14.33.
499fb9c
499fb9c
* Tue Jul 11 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.32-1
499fb9c
- Update to version 0.14.32.
499fb9c
499fb9c
* Tue Jun 27 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.31-1
499fb9c
- Update to version 0.14.31.
499fb9c
499fb9c
* Tue Jun 13 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.30-1
499fb9c
- Update to version 0.14.30.
499fb9c
499fb9c
* Tue May 30 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.29-1
499fb9c
- Update to version 0.14.29.
499fb9c
499fb9c
* Tue May 16 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.28-1
499fb9c
- Update to version 0.14.28.
499fb9c
499fb9c
* Tue Apr 25 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.27-1
499fb9c
- Update to version 0.14.27.
499fb9c
499fb9c
* Fri Apr 07 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.26-1
499fb9c
- Update to version 0.14.26.
499fb9c
499fb9c
* Tue Mar 21 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.25-1
499fb9c
- Update to version 0.14.25.
499fb9c
499fb9c
* Tue Mar 07 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.24-1
499fb9c
- Update to version 0.14.24.
499fb9c
499fb9c
* Tue Feb 28 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.23-2
499fb9c
- Clean up spec file, remove bundled libs on fedora, add man pages.
499fb9c
499fb9c
* Tue Feb 07 2017 Fabio Valentini <decathorpe@gmail.com> - 0.14.23-1
499fb9c
- First package for fedora.
499fb9c