feat: compile libtorrent locally

This commit is contained in:
Mogeko 2021-11-18 15:28:31 +00:00
parent 17e7c7a7fa
commit 87a1e93583
No known key found for this signature in database
GPG key ID: B35485A88F40AD2C
7 changed files with 43 additions and 23 deletions

View file

@ -17,14 +17,16 @@ jobs:
- name: Check version
id: check_ver
run: |
NEW_VER=$(curl -s "${ALPINE_PKG_URL}" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1)
RAW_VER=$(curl -s "${REPO_TAGS}" | grep -Po "release-(\d+\.){2}\d+\.zip" | head -1)
NEW_VER="${RAW_VER:8:5}-r0"
echo "::set-output name=new_ver::${NEW_VER}"
env:
ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox
REPO_TAGS: https://github.com/qbittorrent/qBittorrent/tags
build:
runs-on: ubuntu-latest
needs: check
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v2

3
.gitignore vendored
View file

@ -74,3 +74,6 @@ $RECYCLE.BIN/
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux
# Custom example dirs
example/config
!example/config/qBittorrent.conf

View file

@ -1,24 +1,44 @@
FROM alpine:edge as builder
FROM alpine:3.14 as libtorrent_builder
RUN apk add --no-cache boost-dev build-base clang qt5-qtbase-dev qt5-qttools-dev libtorrent-rasterbar-dev tar
RUN apk add --no-cache \
autoconf automake binutils boost-dev cppunit-dev libtool linux-headers ncurses-dev openssl-dev zlib-dev \
build-base clang tar
WORKDIR /workspace
ARG VERSION
ARG LIBTORRENT_VERSION
ADD https://github.com/arvidn/libtorrent/archive/refs/tags/v${LIBTORRENT_VERSION}.tar.gz /workspace
RUN tar -zxf v${LIBTORRENT_VERSION}.tar.gz -C . \
&& cd libtorrent-${LIBTORRENT_VERSION} \
&& ./autotool.sh \
&& ./configure CXXFLAGS="-std=c++14" --prefix=/workspace/pkg --with-libiconv \
&& CC=clang make -j$(nproc) \
&& make install-strip
ADD https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${VERSION}.tar.gz /workspace
FROM alpine:3.14 as qbittorrent_builder
RUN tar -zxf release-${VERSION}.tar.gz -C . \
&& mv qBittorrent-release-${VERSION}/* . \
&& ./configure --prefix=/workspace --disable-gui \
&& CC=clang make \
RUN apk add --no-cache \
boost-dev qt5-qtbase-dev qt5-qttools-dev \
build-base clang tar
WORKDIR /workspace
COPY --from=libtorrent_builder /workspace/pkg /usr
ARG QBITTORRENT_VERSION
ADD https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${QBITTORRENT_VERSION}.tar.gz /workspace
RUN tar -zxf release-${QBITTORRENT_VERSION}.tar.gz -C . \
&& cd qBittorrent-release-${QBITTORRENT_VERSION} \
&& ./configure --prefix=/workspace/pkg --disable-gui \
&& CC=clang make -j$(nproc) \
&& make install
FROM alpine:edge
FROM alpine:3.14
RUN apk add --no-cache busybox libcrypto3 libgcc libstdc++ libtorrent-rasterbar musl qt5-qtbase zlib
RUN apk add --no-cache busybox libgcc openssl qt5-qtbase zlib
COPY --from=builder /workspace/bin/qbittorrent-nox /usr/bin/qbittorrent-nox
COPY --from=libtorrent_builder /workspace/pkg /usr
COPY --from=qbittorrent_builder /workspace/pkg /usr
ADD --chown=1000:100 root /

View file

@ -1,6 +1,8 @@
LIBTORRENT_VERSION = 1.2.14
QBITTORRENT_VERSION = 4.3.8
CMD = /usr/bin/docker
IMAGE = mogeko/qbittorrent
VERSION = 4.3.8
PORT = 8080
CONF_DIR = $(shell pwd)/example/config
DL_DIR = $(shell pwd)/example/data
@ -11,7 +13,8 @@ all: build run
build:
@$(CMD) build . \
--build-arg VERSION=$(VERSION) \
--build-arg LIBTORRENT_VERSION=$(LIBTORRENT_VERSION) \
--build-arg QBITTORRENT_VERSION=$(QBITTORRENT_VERSION) \
--tag $(IMAGE)
run: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
@ -30,5 +33,3 @@ help: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
help:
@-$(CMD) run -it --name qbt-$(id) $(IMAGE) --help
@$(CMD) rm -f qbt-$(id)
rm: clean

View file

@ -1,2 +0,0 @@
[Stats]
AllStats=@Variant(\0\0\0\x1c\0\0\0\x2\0\0\0\x12\0\x41\0l\0l\0t\0i\0m\0\x65\0\x44\0L\0\0\0\x5\0\0\0\0\0\0\x1a\xb0\0\0\0\x12\0\x41\0l\0l\0t\0i\0m\0\x65\0U\0L\0\0\0\x5\0\0\0\0\0\0&\xb8)

View file

@ -1,2 +0,0 @@
{
}

View file

@ -1,2 +0,0 @@
{
}