# Generated by go2rpm 1.18.0 %bcond check 1 # https://github.com/syncthing/syncthing %global goipath github.com/syncthing/syncthing Version: 2.1.1 %gometa -L -f Name: syncthing Release: %autorelease Summary: Continuous File Synchronization # Generated by go-vendor-tools License: Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND OFL-1.1 AND (Apache-2.0 OR MIT) AND (MIT OR Unlicense) URL: %{gourl} Source0: %{gosource} # Generated by go-vendor-tools Source1: %{archivename}-vendor.tar.xz Source2: go-vendor-tools.toml BuildRequires: go-vendor-tools BuildRequires: desktop-file-utils BuildRequires: systemd-rpm-macros BuildRequires: sqlite-devel Requires: hicolor-icon-theme # assets in gui/default/vendor/* Provides: bundled(angular) = 1.3.20 Provides: bundled(angular-dirPagination) = 759009c Provides: bundled(angular-sanitize) = 1.3.20 Provides: bundled(angular-translate) = 2.9.0.1 Provides: bundled(angular-translate-loader-static-files) = 2.11.0 Provides: bundled(bootstrap) = 3.3.6 Provides: bundled(daterangepicker) = 3.1 Provides: bundled(ForkAwesome) = 1.2.0 Provides: bundled(HumanizeDuration.js) Provides: bundled(jquery) = 2.2.2 Provides: bundled(jquery-fancytree) = 2.38.5 Provides: bundled(jquery-ui) = 1.14.1 Provides: bundled(moment) = 2.19.4 %description Syncthing replaces other file synchronization services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet. Using syncthing, that control is returned to you. This package contains the syncthing client binary and systemd services. %package tools Summary: Continuous File Synchronization (server tools) # NOTE(gotmax23): syncthing and syncthing-tools both own the same license # files (/usr/share/licenses/syncthing/**), so they need to be kept in sync. Requires: (syncthing = %{version}-%{release} if syncthing) %description tools Syncthing replaces other file synchronization services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet. Using syncthing, that control is returned to you. This package contains the main syncthing server tools: * strelaysrv / strelaypoolsrv, the syncthing relay server for indirect file transfers between client nodes, and * stdiscosrv, the syncthing discovery server for discovering nodes to connect to indirectly over the internet. %prep # Unpack source archive %goprep -p1 # Unpack vendor archive tar -xf %{S:1} # Remove unused modernc sqlite3 backend rm internal/db/sqlite/db_open_nocgo.go %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build %global gomodulesmode GO111MODULE=on go run build.go assets # set variables expected by syncthing binaries as additional FOOFLAGS export BUILD_HOST=fedora-koji export COMMON_LDFLAGS="-X %{goipath}/lib/build.Version=v%{version} -X %{goipath}/lib/build.Stamp=$SOURCE_DATE_EPOCH -X %{goipath}/lib/build.User=$USER -X %{goipath}/lib/build.Host=$BUILD_HOST" # noupgrade: disable syncthing self-update functionality # libsqlite3 / cgo: link system libsqlite3 export GO_BUILDTAGS="noupgrade libsqlite3 cgo" export CGO_CFLAGS="%{build_cflags}" CGO_LDFLAGS="%{build_ldflags}" for cmd in cmd/syncthing cmd/stdiscosrv cmd/strelaysrv cmd/infra/strelaypoolsrv ; do export GO_LDFLAGS="-X %{goipath}/lib/build.Program=$(basename $cmd) $COMMON_LDFLAGS" %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd done %install %go_vendor_license_install -c %{S:2} # install binaries mkdir -p %{buildroot}/%{_bindir} cp -pav %{gobuilddir}/bin/syncthing %{buildroot}/%{_bindir}/ cp -pav %{gobuilddir}/bin/stdiscosrv %{buildroot}/%{_bindir}/ cp -pav %{gobuilddir}/bin/strelaysrv %{buildroot}/%{_bindir}/ cp -pav %{gobuilddir}/bin/strelaypoolsrv %{buildroot}/%{_bindir}/ # install man pages mkdir -p %{buildroot}/%{_mandir}/man1 mkdir -p %{buildroot}/%{_mandir}/man5 mkdir -p %{buildroot}/%{_mandir}/man7 cp -pav ./man/syncthing.1 %{buildroot}/%{_mandir}/man1/ cp -pav ./man/*.5 %{buildroot}/%{_mandir}/man5/ cp -pav ./man/*.7 %{buildroot}/%{_mandir}/man7/ cp -pav ./man/stdiscosrv.1 %{buildroot}/%{_mandir}/man1/ cp -pav ./man/strelaysrv.1 %{buildroot}/%{_mandir}/man1/ # install desktop files and icons mkdir -p %{buildroot}/%{_datadir}/applications cp -pav etc/linux-desktop/syncthing-start.desktop %{buildroot}/%{_datadir}/applications/ cp -pav etc/linux-desktop/syncthing-ui.desktop %{buildroot}/%{_datadir}/applications/ for size in 32 64 128 256 512; do mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/${size}x${size}/apps cp -pav assets/logo-${size}.png %{buildroot}/%{_datadir}/icons/hicolor/${size}x${size}/apps/syncthing.png done mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps cp -pav assets/logo-only.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps/syncthing.svg # install systemd units mkdir -p %{buildroot}/%{_unitdir} mkdir -p %{buildroot}/%{_userunitdir} cp -pav etc/linux-systemd/system/syncthing@.service %{buildroot}/%{_unitdir}/ cp -pav etc/linux-systemd/user/syncthing.service %{buildroot}/%{_userunitdir}/ %post %systemd_post 'syncthing@.service' %systemd_user_post syncthing.service %preun %systemd_preun 'syncthing@*.service' %systemd_user_preun syncthing.service %postun %systemd_postun_with_restart 'syncthing@*.service' %systemd_user_postun_with_restart syncthing.service %check %go_vendor_license_check -c %{S:2} desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop %if %{with check} export LANG=C.utf8 export GO_BUILDTAGS="noupgrade libsqlite3 cgo" export CGO_CFLAGS="%{build_cflags}" CGO_LDFLAGS="%{build_ldflags}" %gocheck2 %endif %files -f %{go_vendor_license_filelist} %doc README.md AUTHORS %{_bindir}/syncthing %{_datadir}/applications/syncthing*.desktop %{_datadir}/icons/hicolor/*/apps/syncthing.* %{_mandir}/*/syncthing* %{_unitdir}/syncthing@.service %{_userunitdir}/syncthing.service %files tools -f %{go_vendor_license_filelist} %doc README.md AUTHORS %{_bindir}/stdiscosrv %{_bindir}/strelaysrv %{_bindir}/strelaypoolsrv %{_mandir}/man1/stdiscosrv* %{_mandir}/man1/strelaysrv* %changelog %autochangelog