# Description: WPS Office for Linux # URL: https://linux.wps.com/ # Maintainer: Petar Petrov, slackalaxy at gmail dot com # Depends on: double-conversion gtk libelogind libsdl2 libtiff44 nss qt4 qt5 xorg-libxscrnsave name=wps-office version=11.1.0.11698.XA release=1 source=(https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${version:7:-3}/${name}_${version}_amd64.deb desktop.tar.xz) build() { ar -x $SRC/${name}_${version}_amd64.deb tar xvf data.tar.xz # The handbook says packages should not place stuff in /opt mkdir -p $PKG/usr/lib/$name cp -a $SRC/opt/kingsoft/$name/office6 $PKG/usr/lib/$name mkdir -p $PKG/usr/{bin,share} cp -a $SRC/usr/bin $PKG/usr # Fix paths accordingly sed -i "s:/opt/kingsoft/$name:/usr/lib/$name:g" $PKG/usr/bin/* # Thanks to NixOS (https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/office/wpsoffice/default.nix) # distribution is missing libkappessframework.so, so remove the following dead libraries rm -r $PKG/usr/lib/$name/office6/addons/pdfbatchcompression # use GTK (try to...) # https://wiki.archlinux.org/title/WPS_Office sed -i 's:gOpt=:gOpt="-style=gtk+":g' $PKG/usr/bin/* sed -i 's:#gOptExt=-multiply:export GTK2_RC_FILES=/usr/share/themes/Raleigh/gtk-2.0/gtkrc:' $PKG/usr/bin/* # Do not use WPS file icons, however leave WPS' mimetypes just in case cp -a $SRC/usr/share/{mime,icons} $PKG/usr/share # writer mimetype icons wri=( doc dot wps wpt wpss wpso ) for w in ${wri[@]}; do sed -i "s:wps-office-$w:x-office-document:g" $PKG/usr/share/mime/packages/wps-office-wps.xml done # spreadsheet mimetype icons spr=( xls xlt et ett ets eto ) for s in ${spr[@]}; do sed -i "s:wps-office-$s:x-office-spreadsheet:g" $PKG/usr/share/mime/packages/wps-office-et.xml done # presentations mimetype icons pre=( ppt pot dps dpt dpss dpso ) for p in ${pre[@]}; do sed -i "s:wps-office-$p:x-office-presentation:g" $PKG/usr/share/mime/packages/wps-office-wpp.xml done # Move app desktop icons to their proper place icosize=( 16x16 24x24 32x32 48x48 64x64 96x96 128x128 256x256 512x512 ) for size in ${icosize[@]}; do mkdir -p $PKG/usr/share/icons/hicolor/$size/apps mv $PKG/usr/share/icons/hicolor/$size/mimetypes/wps-office2019-* $PKG/usr/share/icons/hicolor/$size/apps done # Use our desktop entries mkdir -p $PKG/usr/share/applications cp -a $SRC/desktop/*.desktop $PKG/usr/share/applications mkdir -p $PKG/etc/revdep.d cd $PKG/usr/lib/$name/office6 # https://stackoverflow.com/questions/539583/how-do-i-recursively-list-all-directories-at-a-location-breadth-first find . -type d | perl -lne 'print tr:/::, " $_"' | sort -n | cut -d' ' -f2 > $PKG/etc/revdep.d/$name sed -i "s:\.:/usr/lib/wps-office/office6:g" $PKG/etc/revdep.d/$name find $PKG/ -name "*README*" -delete # trick it to think we have systemd ln -s /usr/lib/libelogind/libelogind.so libsystemd.so.0 }