summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1d646206684fc6e4aa3869e4c3c0bdbd50b60b3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Maintainer: yifwon <wyf9661 [at] gmail.com>
pkgbase=wps-2023
pkgname=('wps-2023')
pkgver=12.1.0.17881
pkgrel=3
pkgdesc="WPS Office, is an office productivity suite."
arch=('x86_64')
url="https://linux.wps.cn"
license=('LicenseRef-WPS-EULA')
makedepends=(
  'tar')
depends=(
  'fontconfig' 'libxrender' 'xdg-utils' 'glu'
  'libpulse' 'libxss' 'sqlite' 'libtool' 'libtiff'
  'libxslt' 'freetype2')
optdepends=(
  'wps-office-fonts: FZ TTF fonts provided by wps office'
  'cups: for printing support'
  'libjpeg-turbo: JPEG image codec support'
  'libpng12: PNG image codec support'
  'ttf-wps-fonts: Symbol fonts required by wps-office'
  'ttf-ms-fonts: Microsft Fonts recommended for wps-office')
conflicts=('wps-office')
provides=('wps-office')
options=(!strip !zipman !debug)

# https://gitlab.com/cwittlut/wps-tsk/-/blob/main/tsk.sh?ref_type=heads by Ryan Tsien
# https://pastebin.com/29TeRUMj by Asuka Minato
_get_source_url() {
    url="https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2023/${pkgver##*.}/wps-office_${pkgver}_$1.deb"
    uri="${url#https://wps-linux-personal.wpscdn.cn}"
    secrityKey='7f8faaaa468174dc1c9cd62e5f218a5b'
    timestamp10=$(date '+%s')
    md5hash=$(echo -n "${secrityKey}${uri}${timestamp10}" | md5sum)
    url+="?t=${timestamp10}&k=${md5hash%% *}"
    echo "$url"
}

source_x86_64=("wps-office_${pkgver}_amd64.deb::$(_get_source_url amd64)")
sha1sums_x86_64=('ef71d43eaa06a6ffbad4f6307499b80f25478d42')

package(){
  xz -df data.tar.xz
  tar --no-same-owner -C "${pkgdir}" -xf data.tar --exclude './usr/share/fonts'\
  --exclude './usr/share/desktop-directories' ./opt/kingsoft ./usr

  cd "${pkgdir}"
  # use system lib
  rm opt/kingsoft/wps-office/office6/lib{jpeg,stdc++}.so*

  # fix python2 call
  sed -i "s/python -c 'import sys, urllib; print urllib\.unquote(sys\.argv\[1\])'/\
  python -c 'import sys, urllib.parse; print(urllib.parse.unquote(sys.argv[1]))'/" usr/bin/wps
}