@@ -49,27 +49,36 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
4949 libusb-1.0-0-dev \
5050 libldap2-dev \
5151 libsasl2-dev \
52- ffmpeg \
53- libavcodec-dev \
54- libavformat-dev \
55- libavutil-dev \
56- libswscale-dev \
57- libavfilter-dev \
58- libavdevice-dev \
59- vainfo \
60- libva-dev \
61- libva-drm2 \
62- libva-x11-2 \
6352 libdrm-dev \
6453 mesa-va-drivers \
6554 mesa-vdpau-drivers \
6655 v4l-utils \
6756 libv4l-dev \
57+ && if [ ${TARGETARCH} != arm64 ]; then \
58+ apt-get install -y --no-install-recommends \
59+ ffmpeg \
60+ libavcodec-dev \
61+ libavformat-dev \
62+ libavutil-dev \
63+ libswscale-dev \
64+ libavfilter-dev \
65+ libavdevice-dev; \
66+ fi \
6867 && if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \
6968 apt-get install -y --no-install-recommends \
69+ vainfo \
70+ libva-dev \
71+ libva-drm2 \
72+ libva-x11-2 \
7073 intel-media-va-driver \
7174 i965-va-driver; \
7275 fi \
76+ && if [ ${TARGETARCH} = arm64 ]; then \
77+ apt-get install -y --no-install-recommends \
78+ ninja-build \
79+ zlib1g-dev \
80+ libswresample-dev; \
81+ fi \
7382 && apt clean \
7483 && rm -rf /var/lib/apt/lists/*
7584
@@ -94,12 +103,18 @@ RUN --security=insecure pip config set global.index-url https://pypi.tuna.tsingh
94103 pycparser pyelftools pyghmi pygments pyparsing pyotp qrcode requests \
95104 semantic-version setproctitle six spidev tabulate urllib3 wrapt xlib \
96105 yarl pyserial pyyaml zstandard supervisor pyfatfs pyserial python-periphery \
97- python-ldap python-pam pyrad pyudev pyusb luma.oled pyserial-asyncio
106+ python-ldap python-pam pyrad pyudev pyusb luma.oled pyserial-asyncio \
107+ && rm -rf /root/.cache/pip/* /tmp/pip-* \
108+ && if [ ${TARGETARCH} = arm ]; then \
109+ umount /root/.cargo 2>/dev/null || true \
110+ && rm -rf /root/.cargo /root/rustup-init.sh; \
111+ fi
98112
99- # 编译 python vedev库
113+ # 编译 python evdev库
100114RUN git clone --depth=1 https://github.com/gvalkov/python-evdev.git /tmp/python-evdev \
101115 && cd /tmp/python-evdev \
102- && python3 setup.py bdist_wheel --dist-dir /tmp/wheel/
116+ && python3 setup.py bdist_wheel --dist-dir /tmp/wheel/ \
117+ && rm -rf /tmp/python-evdev
103118
104119# 编译安装 libnice、libsrtp、libwebsockets 和 janus-gateway
105120RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libnice \
@@ -111,14 +126,14 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn
111126 && tar xf libsrtp-2.2.0.tar.gz \
112127 && cd libsrtp-2.2.0 \
113128 && ./configure --prefix=/usr --enable-openssl \
114- && make shared_library -j && make install \
129+ && make shared_library -j$(nproc) && make install \
115130 && cd /tmp \
116131 && rm -rf /tmp/libsrtp* \
117- && git clone --depth=1 https://libwebsockets.org/repo /libwebsockets /tmp/libwebsockets \
132+ && git clone --depth=1 https://github.com/warmcat /libwebsockets /tmp/libwebsockets \
118133 && cd /tmp/libwebsockets \
119134 && mkdir build && cd build \
120135 && cmake -DLWS_MAX_SMP=1 -DLWS_WITHOUT_EXTENSIONS=0 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" .. \
121- && make -j && make install \
136+ && make -j$(nproc) && make install \
122137 && cd /tmp \
123138 && rm -rf /tmp/libwebsockets \
124139 && git clone --depth=1 https://github.com/meetecho/janus-gateway.git /tmp/janus-gateway \
@@ -127,19 +142,40 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn
127142 && ./configure --enable-static --enable-websockets --enable-plugin-audiobridge \
128143 --disable-data-channels --disable-rabbitmq --disable-mqtt --disable-all-plugins \
129144 --disable-all-loggers --prefix=/usr \
130- && make -j && make install \
145+ && make -j$(nproc) && make install \
131146 && cd /tmp \
132147 && rm -rf /tmp/janus-gateway
133148
149+ # 编译 Rockchip MPP、RGA 和 FFmpeg(仅 arm64)
150+ RUN if [ ${TARGETARCH} = arm64 ]; then \
151+ git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git /tmp/rkmpp \
152+ && mkdir -p /tmp/rkmpp/rkmpp_build && cd /tmp/rkmpp/rkmpp_build \
153+ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF .. \
154+ && make -j$(nproc) \
155+ && make install \
156+ && git clone -b jellyfin-rga --depth=1 https://github.com/nyanmisaka/rk-mirrors.git /tmp/rkrga \
157+ && cd /tmp/ \
158+ && meson setup rkrga rkrga_build --prefix=/usr --libdir=lib --buildtype=release -Dcpp_args=-fpermissive -Dlibdrm=false -Dlibrga_demo=false \
159+ && meson configure rkrga_build > /dev/null \
160+ && ninja -C rkrga_build install \
161+ && git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git /tmp/ffmpeg-rockchip \
162+ && cd /tmp/ffmpeg-rockchip \
163+ && ./configure --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga \
164+ --enable-libv4l2 --enable-libx264 --enable-shared --disable-programs \
165+ --disable-doc --disable-htmlpages --disable-manpages --disable-network --disable-protocols \
166+ --disable-decoders --disable-debug --disable-alsa \
167+ && make -j$(nproc) \
168+ && make install \
169+ && rm -rf /tmp/rkmpp /tmp/rkrga /tmp/ffmpeg-rockchip; \
170+ fi
171+
134172# 编译 ustreamer
135- RUN echo "Building ustreamer with timestamp cache bust" \
136- && sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \
137- && TIMESTAMP=$(date +%s%N) \
138- && git clone --depth=1 https://github.com/mofeng-git/ustreamer /tmp/ustreamer-${TIMESTAMP} \
139- && make -j WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer-${TIMESTAMP} \
140- && /tmp/ustreamer-${TIMESTAMP}/ustreamer -v \
141- && cp /tmp/ustreamer-${TIMESTAMP}/python/dist/*.whl /tmp/wheel/ \
142- && mv /tmp/ustreamer-${TIMESTAMP} /tmp/ustreamer
173+ RUN sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \
174+ && git clone --depth=1 https://github.com/mofeng-git/ustreamer /tmp/ustreamer \
175+ && make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer \
176+ && /tmp/ustreamer/ustreamer -v \
177+ && /tmp/ustreamer/ustreamer-dump -v \
178+ && cp /tmp/ustreamer/python/dist/*.whl /tmp/wheel/
143179
144180# 复制必要的库文件
145181RUN mkdir /tmp/lib \
@@ -148,4 +184,11 @@ RUN mkdir /tmp/lib \
148184 libevent-*.so.* libjpeg.so.* libyuv.so.* libnice.so.* \
149185 /tmp/lib/ \
150186 && find /usr/lib -name "libsrtp2.so.*" -exec cp {} /tmp/lib/ \; \
151- && find /usr/lib -name "libwebsockets.so.*" -exec cp {} /tmp/lib/ \;
187+ && find /usr/lib -name "libwebsockets.so.*" -exec cp {} /tmp/lib/ \; \
188+ && if [ ${TARGETARCH} = arm64 ]; then \
189+ find /usr/lib -name "libav*.so.*" -exec cp {} /tmp/lib/ \; \
190+ && find /usr/lib -name "libsw*.so.*" -exec cp {} /tmp/lib/ \; \
191+ && find /usr/lib -name "libpostproc.so.*" -exec cp {} /tmp/lib/ \; \
192+ && find /usr/lib -name "librockchip*" -exec cp {} /tmp/lib/ \; \
193+ && find /usr/lib -name "librga.so.*" -exec cp {} /tmp/lib/ \; ; \
194+ fi
0 commit comments