File wechat-beta.spec of Package wechat-beta

#
# spec file for package wechat-uos
#
# Copyright (c) 2024 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/
#
%global debug_package %{nil}
%global __provides_exclude_from ^(/opt/wechat-beta/.*|/usr/lib/wechat-uos/.*\\.so.*)$
%define program_version 1.0.0
%define build_version 242
%ifarch x86_64
%define build_target amd64
%endif
%ifarch aarch64
%define build_target arm64
%endif
%define name_old wechat-uos
%define name_short wechat

Name:           wechat-beta
Version:        %{program_version}
Release:        %{build_version}
Summary:        WeChat Beta for UOS
License:        SUSE-NonFree
Group:          Productivity/Office/Suite
URL:            https://weixin.qq.com
# Bind files like os-release to wechat-uos works.
Source0:        %{name}_%{program_version}.%{build_version}_%{build_target}.rpm
Source1:        wechat.sh
# We need the license key from uos to make wechat-uos works.
#
# from https://aur.archlinux.org/packages/com.tencent.weixin
Source2:        license.tar.gz
Source3:        libdevices.tar.gz
Source4:        wechat-beta.rpmlintrc
Source5:        wechat.desktop
AutoReqProv:    no
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  cpio
BuildRequires:  rpm
BuildRequires:  chrpath
BuildRequires:  fdupes
Requires:       lsb-release
# libdrm2 is required for cef to play drm objects
Requires:       libdrm2
# lsb provides `/etc/lsb-release` which is needed
Requires:       lsb
Requires:       bubblewrap
Requires:       libbz2-1
Requires:       libopenssl1_1
ExclusiveArch:  x86_64 aarch64

%description
WeChat for UOS

%prep

%build

%install

rpm2cpio %{S:0} | cpio -idm -D %{buildroot}
%__tar -zxvf %{S:2}
%__tar -xvf %{S:3}
%if 0%{?suse_version}
%fdupes -s %{buildroot}/opt/
%endif

mkdir -p %{buildroot}%{_datadir}/{applications,icons,%{name_old}}
mkdir -p %{buildroot}/usr/lib/%{name_old}/license
mkdir -p %{buildroot}/usr/lib/license

install -Dm755 %{S:1} %{buildroot}%{_bindir}/%{name}
cp -rf %{buildroot}/opt/%{name}/icons/* %{buildroot}%{_datadir}/icons/.

cp -rf license/* %{buildroot}%{_datadir}/%{name_old}/.
cp -rf libuosdevicea.so %{buildroot}/usr/lib/%{name_old}/license/libuosdevicea.so
chmod 644 %{buildroot}/usr/lib/%{name_old}/license/libuosdevicea.so

install -Dm644 %{S:5} %{buildroot}%{_datadir}/applications/%{name}.desktop

# clean up

rm -rf %{buildroot}{%{_bindir}/wechat,%{_datadir}/applications/wechat.desktop}

# DISABLE RPath Check
export NO_BRP_CHECK_RPATH=true

%files
%{_datadir}/wechat-uos
%{_datadir}/applications/wechat-beta.desktop
%{_datadir}/icons
/usr/bin/wechat-beta
/usr/lib/wechat-uos
/usr/lib/license
/opt/wechat-beta

%changelog

openSUSE Build Service is sponsored by