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 4.0.1
%define build_version 11
%ifarch x86_64
%define build_target amd64
%endif
%ifarch aarch64
%define build_target arm64
%endif
%define name_old wechat-uos
%define name_short wechat
%define pkgrel 1

Name:           wechat-beta
Version:        %{program_version}
Release:        %{build_version}.%{pkgrel}
Summary:        WeChat Beta for UOS
License:        SUSE-NonFree
Group:          Productivity/Office/Suite
URL:            https://linux.weixin.qq.com/
# Bind files like os-release to wechat-uos works.
Source0:        %{name}_%{program_version}.%{build_version}_%{build_target}.deb
# 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:  tar
BuildRequires:  gzip
BuildRequires:  binutils
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
Requires:       wechat
Provides:       Wechat==%{Version}.%{Release} 
ExclusiveArch:  x86_64 aarch64

%description
WeChat for Linux

%prep

%build

%install

ar vx %{S:0}

%__tar -xvf data.tar.xz
%if 0%{?suse_version}
%fdupes -s %{buildroot}
%endif

mkdir -p %{buildroot}/usr/{bin,share/applications,share/icons/hicolor/apps,share/doc}
mkdir -p %{buildroot}/opt

%__cp -rf %{_builddir}/opt/wechat %{buildroot}/opt/wechat

for i in {16,32,48,64,128};do mkdir -p %{_builddir}/usr/share/icons/hicolor/${i}x${i}/apps/ ;install -Dm755 %{_builddir}/usr/share/icons/hicolor/${i}x${i}/apps/wechat.png %{buildroot}/usr/share/icons/hicolor/${i}x${i}/apps/com.tencent.wechat.png;done

%__cp -rf %{_builddir}/usr/share/doc/wechat %{buildroot}/usr/share/doc/wechat

install -m644 %{_builddir}/usr/share/applications/wechat.desktop %{buildroot}/usr/share/applications/wechat.desktop

sed -i "s|Icon=/usr/share/icons/hicolor/256x256/apps/wechat.png|Icon=com.tencent.wechat|" %{buildroot}/usr/share/applications/wechat.desktop
echo 'StartupWMClass=wechat' >> %{buildroot}/usr/share/applications/wechat.desktop
echo 'Keywords=wechat;weixin;Wechat;we;' >> %{buildroot}/usr/share/applications/wechat.desktop

ln -s /opt/wechat/wechat %{buildroot}/%{_bindir}/wechat

# DISABLE RPath Check
export NO_BRP_CHECK_RPATH=true

%files
/usr/share/doc/wechat
%{_datadir}/applications/wechat.desktop
%{_datadir}/icons
/usr/bin/wechat
/opt/wechat

%changelog

openSUSE Build Service is sponsored by