summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6dbff271f755efba917a223a96c411f2ff489536 (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
# Maintainer : Daniel Bermond < gmail-com: danielbermond >

pkgname=libtorrent-rasterbar-git
pkgver=1.2.RC2.r32.g3e582100d
pkgrel=1
pkgdesc='A C++ BitTorrent library that aims to be a good alternative to all the other implementations around (git version)'
url='https://www.rasterbar.com/products/libtorrent/'
arch=('i686' 'x86_64')
license=('BSD')
depends=('boost-libs')
makedepends=('git' 'boost' 'python2' 'python')
optdepends=('python2: for python2 bindings'
            'python: for python3 bindings')
provides=('libtorrent-rasterbar')
conflicts=('libtorrent-rasterbar')
source=('libtorrent-rasterbar'::'git+https://github.com/arvidn/libtorrent.git')
sha256sums=('SKIP')

prepare() {
    cd libtorrent-rasterbar
    
    mkdir -p py2 py3
    
    # avoid depending on newer processors
    sed -i 's/-msse4.2//' configure.ac
    
    ./autotool.sh
}

pkgver() {
    cd libtorrent-rasterbar
    
    # git, tags available
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/_/./g;s/^libtorrent\.//'
}

_build() {
    cd "${srcdir}/libtorrent-rasterbar/py${1}"
    
    printf '%s\n' "Building for python${1}..."
    
    # FS#50745
    [ "$1" -eq '2' ] && local _boost='boost_python'
    [ "$1" -eq '3' ] && local _boost='boost_python3'
    
    # force C++11 mode (needed by qBittorrent)
    # https://github.com/qbittorrent/qBittorrent/issues/5265#issuecomment-220007436
    export CXXFLAGS="${CXXFLAGS} -std=c++11"
    
    export PYTHON="/usr/bin/python${1}"
    
    ../configure \
        --prefix='/usr' \
        --enable-python-binding \
        --enable-examples \
        --disable-static \
        --with-libiconv \
        --with-boost-python="${_boost}"
        
    make
}

build() {
    _build 2
    _build 3
}

package() {
    cd libtorrent-rasterbar
    
    make -C py2 DESTDIR="$pkgdir" install
    make -C py3 DESTDIR="$pkgdir" install
    
    # license
    install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    
    # remove most example binaries
    rm "$pkgdir"/usr/bin/{*_test,*_tester,simple_client,stats_counters}
}