# Template file for 'wps-office'
pkgname=wps-office
version=11.1.0.11723
revision=1
archs="x86_64"
short_desc="Linux office suite with similar appearance to MS Office"
maintainer="mobinmob <mobinmob@disroot.org>"
# The old Kingsoft WPS Community License has disappeared from the
# site. There is an EULA in the archive which is instaled as license
# and a non-downloadable EULA which is accesible from inside the program:
# https://www.wps.com/eula?distsrc=2021help&lang=en_US&version=11.1.0.10920
license="custom:EULA"
homepage="https://www.wps.com/"
changelog="https://www.wps.com/whatsnew/linux/"
checksum=db81e5244ae435e31fa2aa833c3ce3b667b4a3b0aa3b7bd948ebdd7fb736f2da
allow_unknown_shlibs=yes
nodebug=yes
nostrip=yes
restricted=yes
conflicts="EternalTerminal>=0"
repository=nonfree

_disturl=http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${version##*.}
_distTar="${pkgname}-${version}.XA-1.x86_64.rpm"
distfiles="${_disturl}/${_distTar}"


do_install() {
	cp -R ${wrksrc}/* ${DESTDIR}
}

post_install() {

	# Clean up:
	# Delete everything under /etc. It contains cron, logrotate and autostart
	# configuration for the update check and a seperate menu category for the
	# wps programs that does not work.
	rm -rf ${DESTDIR}/etc

	# Delete postinst and prerm scripts
	rm -rf ${DESTDIR}/opt/kingsoft/wps-office/INSTALL

	# Install license
	vlicense ${DESTDIR}/opt/kingsoft/wps-office/office6/mui/default/EULA_linux.html

	# Install privacy notice as documentation
	vdoc ${DESTDIR}/opt/kingsoft/wps-office/office6/mui/default/Privacy_Linux.html

	# Install third-party licenses
	vlicense ${DESTDIR}/opt/kingsoft/wps-office/office6/thirdpartylegalnotices.txt

	# Qt4
	rm -f ${DESTDIR}/opt/kingsoft/wps-office/office6/librpc{et,wps,wpp}api.so
	# systemd
	rm -f ${DESTDIR}/opt/kingsoft/wps-office/office6/libdbus-1.so*

	# stdlibc++
	rm -f ${DESTDIR}/opt/kingsoft/wps-office/office6/libstdc++.so.6
	rm -f ${DESTDIR}/opt/kingsoft/wps-office/office6/libstdc++.so.6.0.28
}
