%define mattermost_user mattermost %define mattermost_group mattermost %define mattermost_home /var/lib/mattermost %define debug_package %{nil} Name: mattermost-plugin-autolink Version: 1.1.0 Release: 1%{?dist} URL: https://github.com/mattermost/mattermost-plugin-autolink/ Summary: Plugin for Mattermost Autolinking License: Apache BuildRequires: golang Requires: mattermost %description %prep %setup -q -T -c %{name}-%{version} export GOPATH=`pwd` go get -u -v github.com/pkg/errors mkdir -p src/github.com/mattermost/ cd src/github.com/mattermost/ git clone https://github.com/mattermost/mattermost-server git clone https://github.com/mattermost/mattermost-plugin-autolink %build export GOPATH=`pwd` export PATH="bin:"$PATH cd src/github.com/mattermost/mattermost-plugin-autolink pushd server go build -o plugin.exe popd %install mkdir -p %{buildroot}%{mattermost_home}/plugins/autolink/{server,webapp} cp -rv src/github.com/mattermost/mattermost-plugin-autolink/plugin.json %{buildroot}%{mattermost_home}/plugins/autolink/ sed 's/"executables": {/"executables": { "server\/plugin.exe"/' -i %{buildroot}%{mattermost_home}/plugins/autolink/plugin.json sed '/"darwin-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/autolink/plugin.json sed '/"linux-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/autolink/plugin.json sed '/"windows-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/autolink/plugin.json cp -rv src/github.com/mattermost/mattermost-plugin-autolink/server/plugin.exe %{buildroot}%{mattermost_home}/plugins/autolink/server/ %files %{mattermost_home}/plugins/autolink/plugin.json %{mattermost_home}/plugins/autolink/server/plugin.exe %changelog