File wps-office.spec of Package wps-office
%global debug_package %{nil}
%global _enable_debug_packages 0
%global _unpackaged_files_terminate_build 0
%global __provides_exclude_from ^/opt/.*$
%global __requires_exclude ^lib(aeo|asound|atk|Qt|xsl|av|cef|curl|c\\+\\+|et|EGL|grid|icu|IRLAS|html|jde|js|k|libsafec|media|my|opencv|qing|paho|pdfcore|pdfui|ppt|rpc|search|sqlite|ssl|sw|thrift|tiff|uof|v8|vbe|wp|xcb|xkb|xe).*$
%define program_version 12.1.0.17900
Name: wps-office
Version: %{program_version}
Release: 16.1
Summary: WPS Office Suite
License: SUSE-NonFree
Group: Productivity/Office/Suite
URL: http://wps-community.org/
Source0: %{name}.rpm
Source1: %{name}.rpmlintrc
BuildRequires: pkgconfig(harfbuzz)
BuildRequires: fdupes
#BuildRequires: update-desktop-files
Requires: libfreetype6
BuildRequires: (mozilla-nss or nss)
BuildRequires: bash
BuildRequires: chrpath
BuildRequires: cpio
BuildRequires: desktop-file-utils
BuildRequires: hicolor-icon-theme
BuildRequires: rpm
BuildRequires: (libvulkan1 or vulkan-loader)
%if 0%{?suse_version} || 0%{?fedora} || 0%{?mageia}
BuildRequires: fdupes
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
Requires: libc++abi1
Requires: libc++1
ExclusiveArch: x86_64
%description
WPS Office including Writer, Presentation
and Spreadsheets, is a powerful office suite, which is able to process
word file, produce wonderful slides, and analyze data as well. It is
deeply compatible with all of the latest Microsoft Office file formats.
It can easily open and read the documents created with Microsoft Office.
This is the Linux version, and it's now an BETA package.
Welcome to our website: http://wps-community.org
%prep
%build
%install
# Extract rpm file
rpm2cpio %{SOURCE0} | cpio -idm -D %{buildroot}
# Remove all debug files to prevent packaging issues
find %{buildroot} -type f -name '*.debug' -delete
find %{buildroot} -type d -path '*/debug' -exec rm -rf {} + 2>/dev/null || :
# Explicitly remove debug files in /usr/lib/debug
rm -rf %{buildroot}/usr/lib/debug
# Use system libraries
for n in "libbz2.so*" "libc++.so*" "libc++abi.so*" "libcairo.so*" "libdbus-1.so*" "libjpeg.so*" "libsmime3.so" "libnss3.so*" "libnssckbi.so*" "libnssdbm3.so*" "libnssutil3.so*" "libstdc++.so*" "libodbc.so*" "libodbccr.so*" "libodbcinst.so*" "libpng16.so*" "libSDL2.so*" "libSDL2-2.0.so*" "libswscale.so*" "libswresample.so*" "libtcmalloc_minimal.so*"
do
find %{buildroot} \( -type f -o -type l \) -name "$n" -delete
done
# Fix invalid RPATH
STRIP_FILE_LIST=$(find %{buildroot}/opt/ -type f -name "*.so*")" "$(find %{buildroot}/opt/kingsoft/wps-office/office*/ -maxdepth 1 -type f \( -name transerr -o -name et -o -name wpp -o -name wpspdf -o -name parsecloudfiletool -o -name wps -o -name promecefpluginhost \))
for f in ${STRIP_FILE_LIST}; do
RPATH_DIR_LIST=$(chrpath -l "${f}" 2>/dev/null | cut -d' ' -f2 | cut -d'=' -f2 | tr ':' '\n')
[ "${RPATH_DIR_LIST}" = "no" ] && continue
RPATH_DIR=""
for p in ${RPATH_DIR_LIST}; do
[ -z "${p}" ] && continue
[[ "${p}" =~ "build/data" ]] && continue
[ -z "${RPATH_DIR}" ] && RPATH_DIR=${p} || RPATH_DIR=${RPATH_DIR}":"${p}
done
[ -z "${RPATH_DIR}" ] && chrpath --delete "${f}" && continue
chrpath -r "${RPATH_DIR}" "${f}"
done
find %{buildroot} -type f -perm /u+w,g+w,o+w -exec chmod 644 {} \;
find %{buildroot}/usr/bin -type f -exec chmod 755 {} \;
find %{buildroot}/opt/kingsoft/wps-office/office*/ -maxdepth 1 -type f \( -name transerr -o -name et -o -name wpp -o -name wpspdf -o -name parsecloudfiletool -o -name wps -o -name promecefpluginhost \) -exec chmod 755 {} \;
%if 0%{?suse_version} || 0%{?fedora} || 0%{?mageia}
%fdupes -s %{buildroot}/opt/
%fdupes -s %{buildroot}/usr/share/icons/
%endif
%files
%defattr(-,root,root,-)
%dir /opt/kingsoft
/opt/kingsoft/*
%attr(755,root,root) /usr/bin/*
/usr/share/applications/*
%dir /usr/share/fonts/wps-office
/usr/share/fonts/wps-office/*
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/mimetypes/*
%exclude %{_datadir}/desktop-directories
%exclude %{_datadir}/icons/hicolor/20x20
%exclude %{_datadir}/icons/hicolor/40x40
/usr/share/mime/packages/*.xml
%dir /usr/share/templates
/usr/share/templates/*.desktop
%dir /usr/share/templates/.source
/usr/share/templates/.source/*
%dir /etc/xdg/menus
%dir /etc/xdg/menus/applications-merged
/etc/xdg/menus/applications-merged/*
%changelog
* Sun Jan 01 2023 Shubin Alex S. <shubinalex@example.com> - 12.1.0.17900-9.3
- Fixed debug packaging issues
- Disabled debug packages completely
- Fixed executable permissions for /usr/bin/wps and other binaries