aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 98e01270367f616ae78e39e4e227027eafad940b (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
# Maintainer: Hao Zhang <hao [AT] hao-zhang.com>
# Contributor: Bian Jiaping <ssbianjp [AT] gmail.com>
# Contributor: Jove Yu <yushijun110 [AT] gmail.com>
# Contributor: csslayer <wengxt [AT] gmail.com>
# Contributor: Felix Yan <felixonmars [AT] gmail.com>

pkgname=fcitx-sogoupinyin
pkgver=4.2.1.145
filename=${pkgname:6}_${pkgver}_amd64.deb
pkgrel=1
pkgdesc="Sogou Pinyin for Linux"
arch=("x86_64")
url="https://shurufa.sogou.com/linux"
license=("custom")
depends=("fcitx" "opencc" "libidn11" "lsb-release" "xorg-xprop" "qt5-declarative"
         "qt5-svg" "fcitx-qt5" "libxss" "gsettings-qt")
sha256sum="3111af17a6abddd80b856aa9c1f579a137d69f3d735ead936ddb6e5f08b59f3b"

prepare(){
    msg "Retrieving sources..."
    if [[ -f $startdir/$filename ]]; then
        msg2 "$(gettext "Found %s")" "$filename"
    else
        msg2 "$(gettext "Downloading %s...")" "$filename"
        curl -s $url | grep -o "https://[0-9a-z:\/\._-]*/$filename" | xargs curl -o $startdir/$filename
    fi
    ln -s $startdir/$filename
    msg "Validating source files with sha256sums..."
    printf '    %s ... ' "$filename" >&2
    if [[ $sha256sum = $(sha256sum $filename | cut -d' ' -f1) ]]; then
        printf '%s\n' "$(gettext "Passed")" >&2
    else
        printf '%s\n' "$(gettext "FAILED")" >&2
        error "$(gettext "One or more files did not pass the validity check!")"
        exit 1
    fi
    msg "Extracting sources..."
    msg2 "Extracting $filename with bsdtar"
    bsdtar -xf $filename
}

package(){
    cd $srcdir

    tar -xJvf data.tar.xz -C "$pkgdir"

    mv "$pkgdir"/usr/lib/*-linux-gnu/fcitx "$pkgdir"/usr/lib/
    rmdir "$pkgdir"/usr/lib/*-linux-gnu

    find $pkgdir/opt/sogoupinyin/files/{.license,share} -type d -exec chmod 755 {} \;
    find $pkgdir/opt/sogoupinyin/files/{.license,share} -type f -exec chmod 644 {} \;
    
    rm -rf $pkgdir/opt/sogoupinyin/files/lib/qt5
    rm $pkgdir/opt/sogoupinyin/files/bin/qt.conf
}