-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (69 loc) · 2.66 KB
/
Copy pathDockerfile
File metadata and controls
73 lines (69 loc) · 2.66 KB
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
# Instructions on building libtorrent:
# https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst
FROM alpine:3.24.0@sha256:a2d49ea686c2adfe3c992e47dc3b5e7fa6e6b5055609400dc2acaeb241c829f4
ARG VERSION=2.1.[0-9]\\+
SHELL ["/bin/ash", "-euo", "pipefail", "-c"]
# Build libtorrent-rasterbar-dev
# hadolint ignore=DL3003,DL3018,SC2086
RUN apk --update add --no-cache boost-python3 libgcc libstdc++ openssl python3 && \
apk --update add --no-cache --virtual build-dependencies boost-dev cmake coreutils g++ gcc git jq py3-setuptools python3-dev openssl-dev samurai && \
# Checkout from source
cd "$(mktemp -d)" && \
git clone --branch "$( \
wget -qO - https://api.github.com/repos/arvidn/libtorrent/tags?per_page=100 | jq -r '.[].name' | \
awk '{print $1" "$1}' | \
# Get rid of prefixes
sed 's/^libtorrent[^0-9]//i' | \
sed 's/^v//i' | \
# Use periods for major.minor.patch
sed 's/[^a-zA-Z0-9.]\([0-9]\+.* .*\)/.\1/g' | \
sed 's/[^a-zA-Z0-9.]\([0-9]\+.* .*\)/.\1/g' | \
# Make sure patch version exists
sed 's/^\([0-9]\+\.[0-9]\+\)\([^0-9.].\+\)/\1.0\2/' | \
# Get the right version
sort --version-sort --key=1,1 | \
grep "${VERSION}" | \
# Ignore pre-releases (release candidates, betas, etc.)
grep -viE -- '-(rc|alpha|beta)' | \
tail -1 | \
awk '{print $2}' \
)" --depth 1 https://github.com/arvidn/libtorrent.git && \
cd libtorrent && \
git clean --force && \
git submodule update --depth=1 --init --recursive && \
# Build shared libraries
mkdir build-shared && \
cd build-shared && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
# https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst#building-with-cmake
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-Dpython-bindings=ON \
-Dpython-egg-info=ON \
-Dpython-install-system-dir=ON \
.. && \
ninja "-j$(nproc)" && \
ninja install && \
cd .. && \
# Build static libraries
mkdir build-static && \
cd build-static && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
# https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst#building-with-cmake
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DBUILD_SHARED_LIBS=OFF \
.. && \
ninja "-j$(nproc)" && \
ninja install && \
cd .. && \
# Remove temp files
cd && \
apk del --purge build-dependencies && \
rm -rf /tmp/*