%global _hardened_build 1
%define debug_package %{nil}

Name:		matterircd
Version:	0.19.4
Release:	1%{?dist}
Summary:	Connect to your mattermost or slack using your IRC-client of choice.
Group:		System/Library
License:	MIT
URL:		https://github.com/42wim/matterircd
Source0:	matterircd.service
BuildRequires:	golang


%description
Connect to your mattermost or slack using your IRC-client of choice. 


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


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


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


%post
%systemd_post matterircd.service


%preun
%systemd_preun matterircd.service


%postun
%systemd_postun matterircd.service


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


%changelog
