Build libtorrent
Install docker
curl -fsSL
https://get.docker.com -o get-docker.sh sudo sh get-docker.sh https://docs.docker.com/engine/install/debian/
Pull base image
docker pull 80x86/libtorrent-rasterbar:1.2.6-alpine-3.11-arm64
Makedir
mkdir build && cd build
Dockerfile
touch Dockerfile
Write the following to Dockerfile
FROM 80x86/libtorrent-rasterbar:1.2.6-alpine-3.11-arm64
RUN BUILD_DATE=20200426-0115 \
&& LIBTORRENT_RASTERBAR_VER=1.2.6 \
&& VCS_REF=1a9f004 /bin/sh -c set -eux \
# && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk --update add --no-cache -t .build-deps boost-dev curl cmake g++ make openssl-dev \
&& mkdir /tmp/libtorrent-rasterbar \
# curl proxy: -x http://127.0.0.1:7070 \
&& curl -o/tmp/libtorrent-rasterbar/libtorrent-rasterbar.tar.gz -LZ "https://github.com/arvidn/libtorrent/releases/download/libtorrent-$(echo $LIBTORRENT_RASTERBAR_VER | tr . _)/libtorrent-rasterbar-${LIBTORRENT_RASTERBAR_VER}.tar.gz" \
&& tar -xzf /tmp/libtorrent-rasterbar/libtorrent-rasterbar.tar.gz -C/tmp/libtorrent-rasterbar \
&& cd /tmp/libtorrent-rasterbar/libtorrent-rasterbar-* \
&& sed -n 172p ./include/libtorrent/add_torrent_params.hpp \
&& sed -i 's/storage_mode_sparse/storage_mode_allocate/g' ./include/libtorrent/add_torrent_params.hpp \
&& sed -n 172p ./include/libtorrent/add_torrent_params.hpp \
&& sed -i 's/storage_mode_sparse/storage_mode_allocate/g' ./include/libtorrent/session_handle.hpp \
&& sed -i 's/storage_mode_sparse/storage_mode_allocate/g' ./include/libtorrent/torrent_status.hpp \
&& sed -i 's/storage_mode_sparse/storage_mode_allocate/g' ./src/read_resume_data.cpp \
&& sed -i 's/arg("storage_mode") = storage_mode_sparse/arg("storage_mode") = storage_mode_allocate/g' ./bindings/python/src/session.cpp \
&& cd /tmp/libtorrent-rasterbar/libtorrent-rasterbar-* \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR=lib .. \
&& make -j $((`nproc --all`+1)) install DESTDIR=/usr/local/libtorrent-rasterbar \
&& cd / \
&& apk del --purge .build-deps \
&& rm -rf /tmp/*' Prepare corss-architecture build environment
https://cloud.tencent.com/developer/article/1543689
Build
docker buildx build -t libtorrent:1.2.6-fallocate --platform=linux/arm64 -o type=docker .
Last updated