summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 38cf0785ffa26f5287326d8740a603504f426db5 (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
# Maintainer: Jason <jsfaint@gmail.com>
# Contributor: Kuro <kurokarazu@gmail.com>
pkgname=kuaipan4uk
pkgver=2.0.0.5
pkgrel=2
pkgdesc="Kingsoft KuaiPan is one of the most popular cloud storage service in China. The aim of this project is to provide an easy-to-use KuaiPan client for UbuntuKylin and all Linux users."
arch=('i686' 'x86_64')
license=("GPL")
url="http://www.ubuntukylin.com/applications/showimg.php?lang=cn&id=21"
depends=('qt4' 'zlib' 'freetype2' 'libsm' 'libxrender' 'libxext' 'bzip2' 'icu' 'rtmpdump' 'crypto++' 'nss' 'libqxt')

if [ "$CARCH" = "i686" ]; then
    source="http://archive.ubuntukylin.com:10006/ubuntukylin/pool/main/k/kuaipan4uk/kuaipan4uk_2.0.0.5_i386.deb"
    md5sums='a0ab89a03317d75d9c2cf2baa884e679'
elif [ "$CARCH" = "x86_64" ]; then
    source="http://archive.ubuntukylin.com:10006/ubuntukylin/pool/main/k/kuaipan4uk/kuaipan4uk_2.0.0.5_amd64.deb"
    md5sums='bdc0c8fd53b22239f49b67c48aa31abc'
fi

#Check if libcurl exists
if ! [ -f ${pkgdir}/opt/ubuntukylin/${pkgname}/lib/libcurl.so.4.2.0 ]; then
    curl_ver="curl-7.23.1"
    source+=("http://curl.haxx.se/download/curl-7.23.1.tar.gz")
    md5sums+=('8e23151f569fb54afef093ac0695077d')
fi

build_libcurl()
{
    #Build libcurl
    cd ${srcdir}
    tar xf ${curl_ver}.tar.gz
    cd ${curl_ver}

    sed -i '105,107d' ./lib/cyassl.c
    sed -i 's/req_method = SSLv3_client_method()/return CURLE_SSL_CONNECT_ERROR/' ./lib/ssluse.c

    ./configure \
        --prefix=/ \
        --disable-ldap \
        --disable-ldaps \
        --enable-ipv6 \
        --enable-manual \
        --enable-versioned-symbols \
        --enable-threaded-resolver \
        --without-libidn \
        --with-random=/dev/urandom \
        --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
        --with-ssl \
        --with-nss

    make
}

install_libcurl()
{
    local dst_dir="${pkgdir}/opt/ubuntukylin/${pkgname}"

    #install libcurl
    cd ${srcdir}/${curl_ver}
    make DESTDIR="$dst_dir" install

    #Remove curl binary
    rm ${dst_dir}/bin/curl
    rm ${dst_dir}/bin/curl-config

    #Remove man page
    rm ${dst_dir}/share -rf

    #Remove header file, we don't need it
    rm -rf ${dst_dir}/include
    rm -rf ${dst_dir}lib/libcurl.a
    rm -rf ${dst_dir}/lib/libcurl.la
    rm -rf ${dst_dir}/lib/pkgconfig

    cd $dst_dir/lib
    ln -s libcurl.so.4.2.0 libcurl-nss.so.4
}

fix_boost_libs()
{
    local pkglib="${pkgdir}/opt/ubuntukylin/${pkgname}/lib"
    lib_list="libboost_filesystem.so libboost_iostreams.so libboost_regex.so libboost_system.so libboost_thread.so"

    cd ${pkglib}
    #Create symbolic links
    for i in ${lib_list}; do
        rm -f $i #Remove old symbolic link
        ln -s -f /usr/lib/${i} ${i}.1.54.0
    done
}

package()
{
    local pkglib="/opt/ubuntukylin/${pkgname}/lib"

    #Extract kuaipan4uk
    tar xf ${srcdir}/data.tar.xz -C ${pkgdir}/
    rm -f ${pkgdir}/usr/share/keyrings/kuaipan-archive-keyring.gpg
    #rm -f ${pkgdir}/etc/apt/sources.list.d/kuaipan.list
    #rmdir ${pkgdir}/etc/apt/sources.list.d
    #rmdir ${pkgdir}/etc/apt

    #Insert lib and run as kuaipan4uk_script
    sed -i '2iexport LD_LIBRARY_PATH='${pkglib}':$LD_LIBRARY_PATH' ${pkgdir}/opt/ubuntukylin/${pkgname}/bin/kuaipan4uk_script
    sed -i "s/bin\/kuaipan4uk/bin\/kuaipan4uk_script/g" ${pkgdir}/usr/share/applications/kuaipan4uk.desktop

    #Create symbolic link
    local libcrypto="/usr/lib/libcryptopp.so"
    if [[ -e ${libcrypto} ]]; then
        cd ${pkgdir}${pkglib}
        ln -s ${libcrypto} libcrypto++.so.9
    fi

    fix_boost_libs

    #make libcurl if not exists
    if [ -f ${pkglib}/libcurl.so.4.2.0 ]; then
        cd ${pkgdir}${pkglib}
        cp ${pkglib}/libcurl.so.4.2.0 .
        ln -s libcurl.so.4.2.0 libcurl-nss.so.4
        ln -s libcurl.so.4.2.0 libcurl.so
        ln -s libcurl.so.4.2.0 libcurl.so.4
    else
        build_libcurl
        install_libcurl
    fi

}