File wps-office.spec of Package wps-office

%global debug_package %{nil}
%global __provides_exclude_from ^/opt/.*$
%global __requires_exclude ^lib(aeo|asound|atk|Qt|xsl|av|cef|curl|c\\+\\+|et|grid|icu|IRLAS|html|jde|js|k|libsafec|media|my|opencv|qing|paho|search|sqlite|ssl|sw|thrift|tiff|uof|v8|vbe|wp|xcb|xkb|xe).*$
%define program_version 11.1.0.11719
%undefine __find_provides
%undefine __find_requires
# Do not try autogenerate prereq/conflicts/obsoletes and check files
%undefine __check_files
%undefine __find_prereq
%undefine __find_conflicts
%undefine __find_obsoletes
# Something that need for rpm-4.1
%define _missing_doc_files_terminate_build 0


Name:           wps-office
Version:        %{program_version}
Release:        0%{?dist}
Summary:        WPS Office Suite
License:        SUSE-NonFree
Group:          Productivity/Office/Suite
URL:            http://wps-community.org/
Source0:        %{name}.rpm
Source1:        %{name}.rpmlintrc
Source2:        MTEXTRA.TTF
Source3:        mui.7z
Source4:        dicts.7z
Source5:        lang_list_community.json
BuildRequires:  bash
BuildRequires:  discord-canary
BuildRequires:  mozilla-nss 
BuildRequires:  chrpath
BuildRequires:  cpio
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  rpm
BuildRequires:  pkgconfig(harfbuzz)
BuildRequires:  webcore-fonts
BuildRequires:  7zip
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
Requires:       ibus-gtk4
Requires:       libtiff6
Requires:       libfreetype6
Requires:       webcore-fonts
Requires:       libc++abi1
Requires:	    libc++1
ExclusiveArch:  x86_64 aarch64

%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

%check

%build

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

# Use system libraries for better security and faster startup
for n in "libbz2.so*" "libc++.so*" "libc++abi.so*" "libcairo.so*" "libcrypto.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
    for t in f l
    do
        find %{buildroot} -type $t -name $n -exec rm -f {} \;
    done
done

# Fix invalid RPATH
# bad example: /build/data/rc_v11_qt5_linux_personal_20210730_branch/x64_N/wpsenv/qt/build_x64/qtbase/lib:/build/data/rc_v11_qt5_linux_personal_20210730_branch/x64_N/wpsenv/3rd/installed/x64-linux/lib
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}|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}" =~ "build/data" ]] && 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

cp %{SOURCE2} %{buildroot}/usr/share/fonts/wps-office/
mv %{buildroot}/opt/kingsoft/wps-office/office6/mui/lang_list/lang_list_community.json %{buildroot}/opt/kingsoft/wps-office/office6/mui/lang_list/lang_list_community.json.backup
cp %{SOURCE5} %{buildroot}/opt/kingsoft/wps-office/office6/mui/lang_list/
rm -rf %{buildroot}/opt/kingsoft/wps-office/office6/mui/en_US
rm -rf %{buildroot}/opt/kingsoft/wps-office/office6/mui/mn_CN
rm -rf %{buildroot}/opt/kingsoft/wps-office/office6/mui/ru_RU
rm -rf %{buildroot}/opt/kingsoft/wps-office/office6/mui/ug_CN
rm -rf %{buildroot}/opt/kingsoft/wps-office/office6/dicts/spellcheck/en_US
7z x %{SOURCE3}
7z x %{SOURCE4}
cp -r mui/* %{buildroot}/opt/kingsoft/wps-office/office6/mui
cp -r dicts/* %{buildroot}/opt/kingsoft/wps-office/office6/dicts/spellcheck


# Fix world-writable
find %{buildroot} -type f -perm 757 -exec chmod 644 {} \;

%fdupes -s %{buildroot}/opt/
%fdupes -s %{buildroot}/usr/share/icons/
%fdupes %{buildroot}/opt/kingsoft/wps-office/office6/mui

%files
%dir /opt/kingsoft
/opt/kingsoft/*
/usr/bin/*
/usr/share/applications/*
%dir /usr/share/desktop-directories
/usr/share/desktop-directories/*
%dir /usr/share/fonts/wps-office
/usr/share/fonts/wps-office/*
/usr/share/icons/hicolor/*/apps/*
/usr/share/icons/hicolor/*/mimetypes/*
/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
%config /etc/xdg/menus/applications-merged/*

%changelog



openSUSE Build Service is sponsored by