summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 15618eb10249f6e72fdfad16bd9700275c8e99e2 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Maintainer: Astro Benzene <universebenzene at sina dot com>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Ouyang Jun <ouyangjun1999@gmail.com>
# Contributor: Jove Yu <yushijun110 [at] gmail.com>
# Contributor: Ariel AxionL <axionl at aosc dot io>
# Contributor: v71
# Contributor: witt <1989161762 at qq dot com>

pkgbase=wps-office-cn
pkgname=('wps-office-cn' 'wps-office-mime-cn' 'wps-office-mui-zh-cn')
pkgver=12.1.0.17900
pkgrel=1
pkgdesc="Kingsoft Office (WPS Office) CN version - an office productivity suite"
#arch=('x86_64' 'aarch64')
arch=('x86_64')
license=('LicenseRef-WPS-EULA')
url="https://linux.wps.cn"
options=('!emptydirs')
#DLAGENTS=("https::/usr/bin/curl -e https://www.wps.cn/product/wpslinux -o %o %u")

# 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=("https://mirrors.163.com/ubuntukylin/pool/partner/wps-office_${pkgver}_amd64.deb")
source_x86_64=("wps-office_${pkgver}_amd64.deb::$(_get_source_url amd64)")
#source_aarch64=("wps-office_${pkgver}_arm64.deb::$(_get_source_url arm64)")
source=('fix-wps-python-parse.patch')
sha1sums=('f3713481edf04ffb08be8d24dce66554dd5a4f13')
sha1sums_x86_64=('a245fe88c25d0992fb6d2b1e37ba99dc15fe2a5f')

prepare() {
    bsdtar -xpf data.tar.xz

    cd "${srcdir}/usr/bin"
    sed -i 's|/opt/kingsoft/wps-office|/usr/lib|' *
    [[ "$CARCH" = "aarch64" ]] && sed -i '2a export LD_PRELOAD=/usr/lib/libfreetype.so' *

#   cd "${srcdir}/usr/share/icons/hicolor"
#   for _file in ./*; do
#       if [ -e ${_file}/mimetypes/wps-office2019-etmain.png ]; then
#           mkdir -p ${_file}/apps
#           cp -p ${_file}/mimetypes/wps-office2019* ${_file}/apps
#       fi
#   done

    cd "${srcdir}"
    patch -Np1 -i "${srcdir}/fix-wps-python-parse.patch"
}

package_wps-office-cn() {
    depends=('fontconfig' 'xorg-mkfontscale' 'libxrender' 'desktop-file-utils' 'shared-mime-info' 'xdg-utils' 'glu' 'sdl2' 'libpulse' 'hicolor-icon-theme' 'libxss' 'sqlite' 'libtool' 'libxslt' 'libjpeg-turbo')
    optdepends=('cups: for printing support'
                'libjpeg-turbo: JPEG image codec support'
                'pango: for complex (right-to-left) text support'
                'curl: An URL retrieval utility and library'
                'ttf-wps-fonts: Symbol fonts required by wps-office'
                'ttf-ms-fonts: Microsft Fonts recommended for wps-office'
                'wps-office-fonts: FZ TTF fonts provided by wps community'
                'wps-office-mime-cn: Use mime files provided by Kingsoft'
                'wps-office-mui-zh-cn: zh_CN support for WPS Office')
    install="${pkgname}.install"
    conflicts=('kingsoft-office' 'wps-office')
    provides=('wps-office')
    cd "${srcdir}/opt/kingsoft/wps-office/"

    install -d "${pkgdir}/usr/lib"
    cp -r office6 "${pkgdir}/usr/lib"
    # Fix for icu>=71.1
    rm "${pkgdir}/usr/lib/office6/libstdc++.so"*
    # Use system libjpeg
    rm "${pkgdir}/usr/lib/office6/libjpeg.so"*
    [[ "$CARCH" = "aarch64" ]] && rm "${pkgdir}"/usr/lib/office6/libfreetype.so*
    install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" office6/mui/default/*.html
    rm -r "${pkgdir}/usr/lib/office6/mui/en_US/resource/help"
    rm -r "${pkgdir}/usr/lib/office6/mui/zh_CN"

    install -d "${pkgdir}/usr/bin"
    cd "${srcdir}/usr/bin"
    install -m755 * "${pkgdir}/usr/bin"

    cd "${srcdir}/usr/share"

    install -d "${pkgdir}/usr/share/applications"
    cp -r applications/* "${pkgdir}/usr/share/applications"

    install -d "${pkgdir}/usr/share/desktop-directories"
    cp -r desktop-directories/* "${pkgdir}/usr/share/desktop-directories"

    install -d "${pkgdir}/usr/share/icons"
    cp -r icons/* "${pkgdir}/usr/share/icons"

    install -Dm644 -t "${pkgdir}/usr/share/fonts/wps-office" fonts/wps-office/*

    install -Dm644 -t "${pkgdir}/etc/xdg/menus/applications-merged" "${srcdir}/etc/xdg/menus/applications-merged/wps-office.menu"
}

package_wps-office-mui-zh-cn() {
    pkgdesc="Chinese (Simplified) mui package for WPS Office"
    arch=('any')
    cd "${srcdir}/opt/kingsoft/wps-office/office6/mui"

    install -d "${pkgdir}/usr/lib/office6/mui/en_US/resource"
    cp -r en_US/resource/help "${pkgdir}/usr/lib/office6/mui/en_US/resource"
    cp -r zh_CN "${pkgdir}/usr/lib/office6/mui"

    cd "${srcdir}/opt/kingsoft/wps-office/"
    install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" office6/mui/default/*.html
}

package_wps-office-mime-cn() {
    pkgdesc="Mime files provided by Kingsoft Office (WPS Office) cn version"
    arch=('any')
    depends=('shared-mime-info')
    conflicts=('wps-office-mime')
    provides=('wps-office-mime')
    cd "${srcdir}/usr/share"

    install -d "${pkgdir}/usr/share/mime"
    cp -r mime/* "${pkgdir}/usr/share/mime"

    cd "${srcdir}/opt/kingsoft/wps-office/"
    install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" office6/mui/default/*.html
}