blob: 924a5ca57a0c20aed66ab4beaee91031c2dd0787 (
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
|
# Maintainer : Daniel Bermond <dbermond@archlinux.org>
pkgname=libtorrent-rasterbar-git
pkgver=1.2.3.r319.g9dfff3677
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=('x86_64')
license=('BSD')
makedepends=('git' 'cmake' 'boost' 'python2' 'python2-setuptools'
'python' 'python-setuptools')
optdepends=('boost-libs: for python bindings'
'python2: for python2 bindings'
'python: for python3 bindings')
provides=('libtorrent-rasterbar')
conflicts=('libtorrent-rasterbar')
source=('libtorrent-rasterbar'::'git+https://github.com/arvidn/libtorrent.git'
'git+https://github.com/arvidn/libsimulator.git'
'git+https://github.com/arvidn/try_signal.git')
sha256sums=('SKIP'
'SKIP'
'SKIP')
prepare() {
cd libtorrent-rasterbar
git submodule init
git config --local "submodule.simulation/libsimulator.url" "${srcdir}/libsimulator"
git config --local "submodule.deps/try_signal.url" "${srcdir}/try_signal"
git submodule update
}
pkgver() {
cd libtorrent-rasterbar
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/_/./g;s/^libtorrent\.//'
}
_build_common() {
local _pyver="$1"
printf '%s\n' "Building for python${_pyver%%.*}..."
# NOTE: needs -Dboost-python-module-name to specify the correct boost python cmake config file
# https://github.com/arvidn/libtorrent/blob/9dfff3677f1a7291e03febc4724511da5b6a89b9/bindings/python/CMakeLists.txt#L1-L8
cmake -B "build-py${_pyver%%.*}" -S libtorrent-rasterbar \
-DCMAKE_INSTALL_PREFIX:PATH='/usr' \
-DCMAKE_SKIP_RPATH:BOOL='YES' \
-Dbuild_examples:BOOL='ON' \
-Dbuild_tools:BOOL='ON' \
-Dpython-bindings:BOOL='ON' \
-Dboost-python-module-name='python' \
-DPYTHON_EXECUTABLE:FILEPATH="/usr/bin/python${_pyver}" \
-DPYTHON_INCLUDE_DIR:PATH="/usr/include/python${_pyver}" \
-DPYTHON_LIBRARY:FILEPATH="/usr/lib/libpython${_pyver}.so" \
-Wno-dev
make -C "build-py${_pyver%%.*}"
}
build() {
local _py2ver
local _pyver
_py2ver="$(python2 -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
_pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
_build_common "$_py2ver"
_build_common "$_pyver"
}
package() {
local _py2ver
local _pyver
_py2ver="$(python2 -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
_pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
make -C "build-py${_py2ver%%.*}" DESTDIR="$pkgdir" install
make -C "build-py${_pyver%%.*}" DESTDIR="$pkgdir" install
# binaries
local _bin
while read -r -d '' _bin
do
install -D -m755 "$_bin" -t "${pkgdir}/usr/bin"
done < <(find "build-py${_pyver%%.*}/examples" "build-py${_pyver%%.*}/tools" \
-maxdepth 1 -type f ! -name '*_test*' ! -name 'simple_client' \
! -name 'stats_counters' -executable -print0)
# license
install -D -m644 libtorrent-rasterbar/COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
|