summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1204f965d1b6cb20b1d91b24155d761365aa34ee (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
57
58
59
60
61
62
63
64
65
# Maintainer: yifwon <wyf9661 [at] gmail.com>
pkgbase=wps-office-2019
pkgname=('wps-office-2019')
_main_ver=11.1.0
_sub_ver=11723
pkgver=${_main_ver}.${_sub_ver}
pkgrel=1
pkgdesc="WPS Office, is an office productivity suite."
arch=('x86_64' 'aarch64')
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/Linux2019/$3/wps-office_$2.$3_$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 ${_main_ver} ${_sub_ver} )")
source_aarch64=("wps-office_${pkgver}_arm64.deb::$(_get_source_url arm64 ${_main_ver} 11720)")
sha1sums_x86_64=('7ef522d02341ad2904e6d97024c19dff6fb92d2c')
sha1sums_aarch64=('ca96c97ed2721b7329eb3a7a8c9058c8007f1ec6')

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*
  [[ "$CARCH" = "aarch64" ]] && rm opt/kingsoft/wps-office/office6/addons/cef/libm.so*

  # fix libtiff.so.5 deps
  ln -s /usr/lib/libtiff.so.6 opt/kingsoft/wps-office/office6/libtiff.so.5

  # 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
}