%define mattermost_user mattermost %define mattermost_group mattermost %define mattermost_home /var/lib/mattermost %define debug_package %{nil} Name: mattermost-plugin-gitlab Version: 1.0.0 Release: 1%{?dist} URL: https://github.com/mattermost/mattermost-plugin-gitlab Summary: Plugin for Mattermost and GitLab License: Apache BuildRequires: golang Requires: mattermost %description %prep %setup -q -T -c %{name}-%{version} export GOPATH=`pwd` mkdir -p src/github.com/mattermost/ cd src/github.com/mattermost/ git clone https://github.com/mattermost/mattermost-plugin-gitlab %build export GOPATH=`pwd` export PATH="bin:"$PATH export GO111MODULE=on cd src/github.com/mattermost/mattermost-plugin-gitlab git checkout tags/v%{version} # server go mod download go build -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o plugin.exe ./server # webapp pushd webapp npm install npm run build popd %install mkdir -p %{buildroot}%{mattermost_home}/plugins/gitlab/{server,webapp}/dist/ cp -rv src/github.com/mattermost/mattermost-plugin-gitlab/plugin.json %{buildroot}%{mattermost_home}/plugins/gitlab/ sed 's/"executables": {/"executables": { "server\/dist\/plugin.exe"/' -i %{buildroot}%{mattermost_home}/plugins/gitlab/plugin.json sed '/"darwin-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/gitlab/plugin.json sed '/"linux-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/gitlab/plugin.json sed '/"windows-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/gitlab/plugin.json cp -rv src/github.com/mattermost/mattermost-plugin-gitlab/plugin.exe %{buildroot}%{mattermost_home}/plugins/gitlab/server/dist/ cp -rv src/github.com/mattermost/mattermost-plugin-gitlab/webapp/dist/main.js %{buildroot}%{mattermost_home}/plugins/gitlab/webapp/dist/ cp -rv src/github.com/mattermost/mattermost-plugin-gitlab/assets %{buildroot}%{mattermost_home}/plugins/gitlab/ %files %{mattermost_home}/plugins/gitlab/assets/profile.png %{mattermost_home}/plugins/gitlab/plugin.json %{mattermost_home}/plugins/gitlab/server/dist/plugin.exe %{mattermost_home}/plugins/gitlab/webapp/dist/main.js %changelog