You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
2.3 KiB

%define mattermost_user mattermost
%define mattermost_group mattermost
%define mattermost_home /var/lib/mattermost
%define debug_package %{nil}
%define mp3wasmversion 0.1.6
Name: mattermost-plugin-voice
Version: 0.2.2
Release: 1%{?dist}
URL: https://github.com/streamer45/mattermost-plugin-voice
Summary: Plugin for Mattermost for Voice Messaging
License: MIT
BuildRequires: golang
Requires: mattermost
%description
%prep
%setup -q -T -c %{name}-%{version}
export GOPATH=`pwd`
wget https://github.com/streamer45/mp3rec-wasm/releases/download/v%{mp3wasmversion}/mp3enc-wasm-%{mp3wasmversion}.tar.gz
tar xvf mp3enc-wasm-%{mp3wasmversion}.tar.gz
mkdir -p src/github.com/mattermost/
cd src/github.com/mattermost/
git clone https://github.com/streamer45/mattermost-plugin-voice
cp ../../../mp3enc-wasm-%{mp3wasmversion}/recorder.js mattermost-plugin-voice/webapp/src/client/
%build
export GOPATH=`pwd`
export PATH="bin:"$PATH
export GO111MODULE=on
cd src/github.com/mattermost/mattermost-plugin-voice
go build -o manifest ./build/manifest
go mod download
go build -ldflags '-extldflags -s -w -buildid %{version}' -o plugin.exe ./server
pushd webapp
npm install
npm run build
popd
%install
mkdir -p %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/{server,webapp}/dist/
cp -rv src/github.com/mattermost/mattermost-plugin-voice/plugin.json %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/
sed 's/"executables": {/"executables": { "server\/dist\/plugin.exe"/' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/plugin.json
sed '/"darwin-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/plugin.json
sed '/"linux-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/plugin.json
sed '/"windows-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/plugin.json
cp -rv src/github.com/mattermost/mattermost-plugin-voice/plugin.exe %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/server/dist/
cp -rv src/github.com/mattermost/mattermost-plugin-voice/webapp/dist/main.js %{buildroot}%{mattermost_home}/plugins/com.mattermost.voice/webapp/dist/
%files
%{mattermost_home}/plugins/com.mattermost.voice/plugin.json
%{mattermost_home}/plugins/com.mattermost.voice/server/dist/plugin.exe
%{mattermost_home}/plugins/com.mattermost.voice/webapp/dist/main.js
%changelog