element/element.spec

125 lines
3.2 KiB
RPMSpec

# To avoid out of memory error
%define _build_pkgcheck_set %{nil}
%define debug_package %{nil}
%define oname riot-desktop
%define _riotdir /opt/element
%define __noautoreqfiles /opt/riot/resources
%define __noautoreq 'libffmpeg.so*|libnode.so*'
Summary: Client for the decentralized and secure protocol Matrix
Name: element
Version: 1.7.1
Release: 1
License: ASL 2.0
Group: Networking/Instant messaging
URL: http://riot.im/
Source0: https://github.com/vector-im/%{oname}/archive/v%{version}/%{oname}-%{version}.tar.gz
BuildRequires: yarn
BuildRequires: nodejs
BuildRequires: git-core
BuildRequires: npm
BuildRequires: curl
BuildRequires: imagemagick
%ifarch i386 i486 i586 i686 x86
BuildRequires: nodejs-rimraf
%endif
AutoProv: no
Provides: riot == %{version}
%description
Element (oldname Riot) is a decentralized, secure messaging client for
collaborative group communication. Element's core architecture is an
implementation of the Matrix protocol.
Element is more than a messaging app. Riot is a shared workspace for the web.
Element is a place to connect with teams. Riot is a place to to collaborate,
to work, to discuss your current projects.
Element removes the barriers between apps, allowing you to connect teams and
functionality like never before.
Element is free. Element is secure.
%files
%{_bindir}/%{name}*
%{_datadir}/applications/%{name}*.desktop
%{_iconsdir}/hicolor/*/apps/%{name}.*
%{_riotdir}/*
#----------------------------------------------------------------------------
%prep
#setup -qn %{oname}-%{version} -a 1
%setup -qn %{oname}-%{version}
%build
#mv config.sample.json config.json
yarn && yarn clean
yarn run fetch --noverify --cfgdir ''
%ifarch x86_64
%define linuxunpacked dist/linux-unpacked
node_modules/.bin/electron-builder -l --x64 --dir
%else
%define linuxunpacked dist/linux-ia32-unpacked
node_modules/.bin/electron-builder -l --ia32 --dir
%endif
%install
mkdir -p %{buildroot}%{_riotdir}
cp -a %{linuxunpacked}/* %{buildroot}%{_riotdir}
# install binary wrapper
mkdir -p %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/%{name} << EOF
#!/bin/bash
cd %{_riotdir}
./element-desktop
EOF
cat > %{buildroot}%{_bindir}/%{name}-tor << EOF
#!/bin/bash
cd %{_riotdir}
./element-desktop --proxy-server="socks5://127.0.0.1:9050" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE myproxy"
EOF
chmod 755 %{buildroot}%{_bindir}/%{name}*
# install menu entry
mkdir -p %{buildroot}%{_datadir}/applications/
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=Element
Comment=Client for the decentralized and secure protocol Matrix
Exec=%{name}
Icon=%{name}
Terminal=false
Type=Application
StartupNotify=true
Categories=Network;InstantMessaging;
EOF
cat > %{buildroot}%{_datadir}/applications/%{name}-tor.desktop << EOF
[Desktop Entry]
Name=Element-tor
Comment=Client for the decentralized and secure protocol Matrix over Tor
Exec=%{name}-tor
Icon=%{name}
Terminal=false
Type=Application
StartupNotify=true
Categories=Network;InstantMessaging;
EOF
# install menu icons
pushd res/img
for N in 16 22 24 32 48 128 256;
do
install -d %{buildroot}%{_iconsdir}/hicolor/${N}x${N}/apps
convert -resize ${N}x${N} element.png %{buildroot}%{_iconsdir}/hicolor/${N}x${N}/apps/%{name}.png
done
popd