%global _hardened_build 1
%define debug_package %{nil}

Name:		matterbridge
Version:	1.17.0
Release:	1%{?dist}
Summary:	Bridge to your chat channels
Group:		System/Library
License:	MIT
URL:		https://github.com/42wim/matterbridge
Source0:	matterbridge.service
BuildRequires:	golang


%description
Bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram,
rocket.chat, hipchat (via xmpp), steam, twitch, ssh-chat, zulip, whatsapp,
and matrix with REST API (mattermost not required!)


%prep
%setup -q -T -c %{name}-%{version}
export GOPATH=`pwd`
go get -u -v github.com/42wim/matterbridge


%build
export GOPATH=`pwd`
cd src/github.com/42wim/matterbridge
git checkout tags/v%{version}
go build -ldflags '-extldflags -s -w -buildid %{version}'


%install
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/matterbridge.service
install -p -D -m 0555 src/github.com/42wim/matterbridge/matterbridge %{buildroot}%{_bindir}/matterbridge
install -p -D -m 0644 src/github.com/42wim/matterbridge/matterbridge.toml.sample %{buildroot}%{_sysconfdir}/matterbridge/matterbridge.toml


%post
%systemd_post matterbridge.service


%preun
%systemd_preun matterbridge.service


%postun
%systemd_postun matterbridge.service


%files
%doc
%config(noreplace) %{_sysconfdir}/matterbridge/matterbridge.toml
%{_unitdir}/matterbridge.service
%{_bindir}/matterbridge


%changelog
