File zoom.spec of Package zoom

%global debug_package %{nil}
%global __provides_exclude_from ^/opt/.*$
%global __requires_exclude_from ^/opt/.*$
%define program_version 5.9.3.1911

Name:           zoom
Version:        %{program_version}
Release:        0%{?dist}
Summary:        Cloud Meetings
License:        SUSE-NonFree
Group:          Productivity/Networking/Other
URL:            https://www.zoom.us/
Source0:        %{name}.rpm
BuildRequires:  bash
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

ExclusiveArch:  x86_64

%description
Zoom Cloud Meetings
Zoom brings people together to connect and get more done in a frictionless, secure video environment. Our easy, reliable, and innovative video-first solutions provide video meetings and chat, with additional options for webinars and phone service.
 .
Zoom is the leading unified communications platform and helps individuals, schools, healthcare professionals and enterprises stay connected. Visit blog.zoom.us and follow @zoom_us.
 .
By installing this app, you agree to our Terms of Service (https://zoom.us/terms) and Privacy Statement (https://zoom.us/privacy).

%prep

%build

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

# X-GNOME-SingleWindow=true
find %{buildroot}%{_datadir} -iname %{name}.desktop -exec sed -i -e "\$aX-GNOME-SingleWindow=true" {} \;

# Fix invalid RPATH
# bad example: /opt/Qt5.12.10/5.12.10/gcc_64/lib
STRIP_FILE_LIST=$(find %{buildroot}/opt/ -type f -name "*.so*")" "$(find %{buildroot}/opt/zoom/ -maxdepth 1 -type f -name zoom -o -name zopen)

for f in ${STRIP_FILE_LIST}
do
    RPATH_DIR_LIST=$(chrpath -l ${f}|cut -d' ' -f2|cut -d'=' -f2|tr ':' '\n')
# No RPATH
    [ "${RPATH_DIR_LIST}" = "no" ] && continue
    RPATH_DIR=""

    for p in ${RPATH_DIR_LIST}
    do
        [ -z "${p}" ] && continue
        [[ "${p}" =~ "gcc_64" ]] && continue
        [[ "${p}" =~ "home/qt" ]] && continue
        [ -z "${RPATH_DIR}" ] && RPATH_DIR=${p} || RPATH_DIR=${RPATH_DIR}":"${p}
    done
# Remove invalid RPATH
    [ -z "${RPATH_DIR}" ] && chrpath --delete ${f} && continue
    chrpath -r "${RPATH_DIR}" ${f}
done

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

%files
%dir /opt/%{name}
/opt/%{name}/*
%{_bindir}/*
%{_datadir}/applications/*
%dir %{_datadir}/doc/%{name}
%{_datadir}/mime/packages/*
%{_datadir}/pixmaps/*

%changelog
openSUSE Build Service is sponsored by