2021-06-29 22:42:57 +02:00
#
# spec file for package element-desktop
#
2022-01-31 22:57:28 +01:00
# Copyright (c) 2022 SUSE LLC
2021-06-29 22:42:57 +02:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name : element-desktop
2022-10-12 11:08:51 +02:00
Version : 1.11.10
2021-06-29 22:42:57 +02:00
Release : 0
Summary : A glossy Matrix collaboration client - desktop
License : Apache-2.0
URL : https://github.com/vector-im/element-desktop
Source0 : https://github.com/vector-im/element-desktop/archive/v%{version} .tar.gz#/element-desktop-%{version}.tar.gz
Source1 : https://github.com/vector-im/element-web/archive/v%{version} .tar.gz#/element-web-%{version}.tar.gz
2022-03-17 17:02:09 +01:00
Source2 : npm-packages-offline-cache.tar.gz
2021-06-29 22:42:57 +02:00
Source3 : io.element.Element.desktop
Source4 : element-desktop.sh
2022-03-17 17:02:09 +01:00
Source5 : prepare.sh
BuildRequires : element-web = %{version}
2021-06-29 22:42:57 +02:00
BuildRequires : hicolor-icon-theme
2022-03-17 17:02:09 +01:00
BuildRequires : jq
BuildRequires : moreutils
BuildRequires : nodejs-electron-devel
BuildRequires : yarn
Requires : element-web = %{version}
2021-06-29 22:42:57 +02:00
Requires : nodejs-electron
2022-03-17 17:02:09 +01:00
#Element contains no native code
2021-06-29 22:42:57 +02:00
BuildArch : noarch
%description
A glossy Matrix collaboration client - desktop
%prep
%setup -q
2022-03-17 17:02:09 +01:00
SYSTEM_ELECTRON_VERSION=$(<%{_libdir} /electron/version)
jq -c '.build["electronVersion"]="' $SYSTEM_ELECTRON_VERSION'" | .build["electronDist"]="%{_libdir}/electron"' < package.json | sponge package.json
2022-03-18 16:42:34 +01:00
jq -c '.build["linux"]["target"]="dir"' < package.json | sponge package.json
cat package.json
jq '.piwik=false | .update_base_url=null' < element.io/release/config.json | sponge element.io/release/config.json
2021-06-29 22:42:57 +02:00
pwd
cd ..
pwd
ls -l
tar xvf %{SOURCE1}
cd element-desktop-%{version}
%build
2022-03-17 17:02:09 +01:00
echo 'yarn-offline-mirror "./npm-packages-offline-cache"' >> .yarnrc
echo 'nodedir %{_includedir}/electron' >> .yarnrc
tar xf %{SOURCE2}
ls ./npm-packages-offline-cache | head
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
2022-09-23 10:27:25 +02:00
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
2022-03-17 17:02:09 +01:00
yarn install --offline --pure-lockfile
2022-03-18 16:42:34 +01:00
#tar xf %%{SOURCE6}
2022-03-17 17:02:09 +01:00
export PATH=" $ P A T H : n o d e _ m o d u l e s / . b i n "
2022-03-18 16:42:34 +01:00
#export ELECTRON_BUILDER_CACHE="$(pwd)/electron-builder-offline-cache/"
2022-03-17 17:02:09 +01:00
#yarn run build:native
2022-10-05 23:09:11 +02:00
yarn run build:universal
2021-06-29 22:42:57 +02:00
%install
2022-03-17 17:02:09 +01:00
install -d %{buildroot} {%{_datadir} /element/,%{_sysconfdir} /webapps/element}
2021-06-29 22:42:57 +02:00
# Install the app content, replace the webapp with a symlink to the system package
2022-10-05 23:09:11 +02:00
cp -pr dist/linux-universal-unpacked/resources/* " %{buildroot} %{_datadir} / e l e m e n t / "
2022-03-17 17:02:09 +01:00
ln -s %{_datadir} /webapps/element " %{buildroot} %{_datadir} / e l e m e n t / w e b a p p "
2021-06-29 22:42:57 +02:00
# Config file
ln -s %{_sysconfdir} /element/config.json " %{buildroot} %{_sysconfdir} / w e b a p p s / e l e m e n t / c o n f i g . j s o n "
install -Dm644 element.io/release/config.json -t " %{buildroot} %{_sysconfdir} / e l e m e n t "
mkdir -p " %{buildroot} %{_datadir} / w e b a p p s / e l e m e n t / "
ln -s %{_sysconfdir} /webapps/element/config.json " %{buildroot} %{_datadir} / w e b a p p s / e l e m e n t / c o n f i g . j s o n " # moved here from element-web to make symlink check happy
# Required extras
install -Dm644 %{SOURCE3} -t " %{buildroot} %{_datadir} / a p p l i c a t i o n s / "
install -Dm755 %{SOURCE4} " %{buildroot} %{_bindir} / %{name} "
# Icons
install -Dm644 ../element-web-%{version} /res/themes/element/img/logos/element-logo.svg " %{buildroot} %{_datadir} / i c o n s / h i c o l o r / s c a l a b l e / a p p s / i o . e l e m e n t . E l e m e n t . s v g "
for i in 16 24 48 64 96 128 256 512; do
install -Dm644 build/icons/${i}x${i}.png " %{buildroot} %{_datadir} / i c o n s / h i c o l o r / $ { i } x $ { i } / a p p s / i o . e l e m e n t . E l e m e n t . p n g "
done
%files
%license LICENSE
%{_bindir} /%{name}
2022-03-17 17:02:09 +01:00
%{_datadir} /element/
2022-03-18 16:42:34 +01:00
%config %{_sysconfdir} /element/config.json
2022-03-17 17:02:09 +01:00
%config %{_sysconfdir} /webapps/element/config.json
2021-06-29 22:42:57 +02:00
%{_datadir} /webapps/element/config.json
%{_sysconfdir} /element/
%{_datadir} /applications/io.element.Element.desktop
%{_datadir} /icons/hicolor/scalable/apps/io.element.Element.svg
%{_datadir} /icons/hicolor/*/apps/io.element.Element.png
%changelog