File linuxqq.spec of Package linuxqq

%global __provides_exclude_from ^lib(EGL|xcb).*$
%global __requires_exclude ^lib(EGL|xcb).*$
%global debug_package %{nil}
%define program_version 3.2.13
%define pkgrel 1
%define build_date 241104

Name:           linuxqq
Version:        %{program_version}
Release:        %{build_date}-%{?dist}-%{pkgrel}
License:        SUSE-NonFree
Group:          Productivity/Office/Suite
URL:            https://im.qq.com
Summary:        QQ
Source0:        %{name}.rpm
Source1:        %{name}.rpmlintrc
BuildRequires:  chrpath
BuildRequires:  cpio
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  rpm
%if 0%{?suse_version} || 0%{?fedora} || 0%{?mageia}
BuildRequires:  fdupes
%endif
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif

Recommends:  libuuid1
Recommends:  libnotify


ExclusiveArch:  x86_64

%description


%prep

%build

%install
# Extract rpm file
# -i: extract
# -d: create directory when necessary
# -m: preserve modification time
rpm2cpio %{SOURCE0} | cpio -idm -D %{buildroot}

rm -rf %{buildroot}/usr/lib/.build-id

%if 0%{?suse_version} || 0%{?fedora} || 0%{?mageia}
%fdupes -s %{buildroot}/opt/
%endif

# patch .desktop file
sed -i '3s!/opt/QQ/qq!linuxqq!' %{buildroot}/usr/share/applications/qq.desktop

# fix launcher
mkdir -p %{buildroot}%{_bindir}
echo -e '#!/usr/bin/env bash\nif [ -d ~/.config/QQ/crash_files ]; then rm -rf ~/.config/QQ/crash_files/*;fi\n/opt/QQ/qq "$@"' > %{buildroot}%{_bindir}/linuxqq
chmod 0755  %{buildroot}%{_bindir}/linuxqq
%if 0%{?suse_version} || 0%{?fedora} || 0%{?mageia}
%fdupes -s %{buildroot}/usr
%endif

%post

if [ $1 == 2 ];then
    echo "=============QQ NT==========="
    echo "==> Creating patch file for update: /opt/QQ/resources/app/app_launcher/nt.js"
    if [ -d "/opt/LiteLoaderQQNT" ]; then
        echo "LiteLoader found, you may need to reinstall it to patch linuxqq."
    fi
fi

%files
%{_bindir}/linuxqq
/opt/QQ/
%{_datadir}/applications/qq.desktop
%{_datadir}/icons/hicolor/512x512/apps/qq.png

%changelog

openSUSE Build Service is sponsored by