summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 115d0407d474b2675e0d4900427d146fe3c81839 (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
# Maintainer: skydrome <skydrome@i2pmail.org>
# Contributor: skydrome <skydrome@i2pmail.org>

# Compile a debug build?
_debug=n

# Compile from a specific commit?
_commit=HEAD
_branch=master

pkgname=rtorrent-pyro-git
pkgver=20191206
pkgrel=1
pkgdesc="Ncurses BitTorrent client based on libTorrent - rTorrent-git with Pyroscope patches"
url="https://github.com/pyroscope/rtorrent-ps"
license=('GPL2')
arch=('i686' 'x86_64' 'armv7h')
depends=('openssl' 'ncurses' 'curl' 'xmlrpc-c')
makedepends=('git')
optdepends=('ttf-dejavu: for utf8 glyphs'
            'python2: for pyroscope tools')
conflicts=('rtorrent' 'rtorrent-git' 'rtorrent-ps')
provides=('rtorrent')
replaces=('libtorrent-pyro-git')
install='pyroscope.install'
backup=('usr/share/doc/rtorrent/rtorrent.rc.sample')

[[ $_debug = 'n' ]] &&
    _debug='--disable-debug'
    BUILDENV+=(!check) ||
{
    _debug='--enable-extra-debug'
    depends+=('cppunit')
    options=(!strip)
}

_url='https://raw.githubusercontent.com/chros73/rtorrent-ps-ch/master/patches'
source=("git://github.com/rakshasa/rtorrent.git#branch=$_branch"
        "git://github.com/rakshasa/libtorrent.git#branch=$_branch"
        "https://github.com/skydrome/rtorrent/commit/c3697d3a82085194643e58e8ee06855e4d45a6dc.patch"
        "https://raw.githubusercontent.com/pyroscope/pyrocore/master/src/pyrocore/data/config/bash-completion"
        "$_url/backport_lt_all_01-partially_done_and_choke_group_fix.patch"
        "$_url/command_pyroscope.cc"
        "$_url/ui_pyroscope.cc"
        "$_url/ui_pyroscope.h"
        "rtorrent.rc.sample"
        "bootstrap.sh")

md5sums=('SKIP'
         'SKIP'
         '5d41e09f61e346a6c055e36c243f00b5'
         'efdb1a143d661dcda5a22e43bb28e36f'
         '2a8eb09877e81e3e72bd544c27b45dbb'
         'd68073da455851d628b587b852b4b54a'
         '5befaa2e705a550a6dcd7f397060df81'
         '0e9791d796e2185279d7f109b064576b'
         'ac6885720390a54fea906976eae84a9d'
         '9edae7ef267b47d2445a667e98f6ea2d')

pkgver() {
    cd rtorrent
    git log -1 --format="%cd" --date=short "$_commit" |tr -d -
}

prepare() {
    cd libtorrent

    for i in $srcdir/backport_lt*.patch; do
        msg "Patching $(basename $i)"
        patch -uNp1 -i "$i"
    done

    ./autogen.sh


    cd ../rtorrent

    sed -i configure.ac \
        -e "s:\\(AC_DEFINE(HAVE_CONFIG_H.*\\):\1\nAC_DEFINE(RT_HEX_VERSION, 0x000908, version checks):"
    sed -i src/ui/download_list.cc \
        -e "s:rTorrent \" VERSION:rTorrent-PS g$(git rev-parse --short $_commit) \" VERSION:"

    patch -uNp1 -i ../c3697d3a82085194643e58e8ee06855e4d45a6dc.patch

    for i in $srcdir/*.{cc,h}; do
        ln -sf "$i" src
    done

    ./autogen.sh
}

build() {
    #export CC=clang
    #export CXX=clang++
    export CXXFLAGS+=" -Wno-exceptions"
    export PKG_CONFIG_PATH="$srcdir/build/lib/pkgconfig"

    msg "Building libtorrent"
    cd libtorrent

    ./configure $_debug \
        --prefix=/build \
        --disable-shared --enable-static \
        --with-posix-fallocate
    make DESTDIR="$srcdir" install
    sed "s|^prefix=.*|prefix=$srcdir/build|" -i ../build/lib/pkgconfig/libtorrent.pc


    msg "Building rtorrent"
    cd ../rtorrent

    ./configure $_debug \
        --prefix=/usr \
        --with-xmlrpc-c
    make
}

check() {
    make -C rtorrent check ||true
}

package() {
    cd rtorrent
    make DESTDIR="$pkgdir" install

    install -Dm644 doc/faq.xml           "$pkgdir/usr/share/doc/rtorrent/faq.xml"
    install -Dm644 doc/old/rtorrent.1    "$pkgdir/usr/share/man/man1/rtorrent.1"
    install -Dm755 ../bootstrap.sh       "$pkgdir/usr/share/doc/rtorrent/bootstrap.sh"
    install -Dm644 ../rtorrent.rc.sample "$pkgdir/usr/share/doc/rtorrent/rtorrent.rc.sample"
    install -Dm644 ../bash-completion    "$pkgdir/usr/share/bash-completion/completions/pyrocore"
}