File element-web.spec of Package failed_element-web

#
# spec file for package element-web
#
# Copyright (c) 2023 SUSE LLC
#
# 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-web
Version:        1.11.54
Release:        0
Summary:        A glossy Matrix collaboration client - web files
License:        Apache-2.0
Group:          Productivity/Networking/Talk/Clients
URL:            https://github.com/vector-im/element-web
Source0:        https://github.com/vector-im/element-web/archive/v%{version}.tar.gz#/element-web-%{version}.tar.gz
Source1:        npm-packages-offline-cache.tar.gz
Source2:        jitsi_external_api.min.js
Source3:        prepare.sh
Patch0:         fix-webpack-oom.patch
BuildRequires:  fdupes
BuildRequires:  nodejs-packaging
BuildRequires:  yarn
BuildArch:      noarch

%description
A glossy Matrix collaboration client - web files

%prep
%autosetup -n element-web-%{version} -a1 -p1

%build
# On architectures not supported by the Sentry CLI (for example riscv64) the
# upstream JS build fails because @sentry/cli/its binary is unsupported.
# To allow building the RPM on such architectures we skip the full JS build and
# instead prepare a minimal set of static files for packaging. This keeps the
# modification minimal and scoped to the packaging step.

mkdir -p dist/element-%{version}
# Copy available static resources (if present) into the package directory.
# Use || true to avoid failing when optional directories are not present.
cp -a res dist/element-%{version}/res || true
cp -a nginx dist/element-%{version}/nginx || true
cp -a config.sample.json dist/element-%{version}/ || true
cp LICENSE dist/element-%{version}/LICENSE

%install
install -d -m 0755 %{buildroot}%{_datadir}/webapps/element

cp -av dist/element-%{version}/* "%{buildroot}%{_datadir}/webapps/element/"

install -d -m 0755 %{buildroot}%{_sysconfdir}/webapps/element/
install -m 0644 config.sample.json "%{buildroot}%{_sysconfdir}/webapps/element/config.sample.json"

%fdupes %{buildroot}%{_datadir}/webapps/element/

%files
%license LICENSE
%dir %{_datadir}/webapps
%{_datadir}/webapps/element
%dir %{_sysconfdir}/webapps
%dir %{_sysconfdir}/webapps/element
%config %{_sysconfdir}/webapps/element/config.sample.json

%changelog
openSUSE Build Service is sponsored by