-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sam#gemmi-win10
committed
Oct 17, 2023
1 parent
2736d72
commit 8b91e06
Showing
1 changed file
with
236 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
FROM infrastlabs/docker-headless:deb12-compile as stage-base | ||
|
||
###xrdp, xorgxrdp############################################### | ||
FROM stage-base as stage-xrdp | ||
ARG COMPILE_XRDP="yes" | ||
#0.9.5 > 0.9.16 > 0.9.19(thunar@gemmi-deb11卡死) | ||
# 0.9.16 > 0.9.23 #0.9.16@deb12: cc1-openssl3-warn-as-err | ||
ENV ver="0.9.23" | ||
# https://hub.fastgit.org/neutrinolabs/xrdp/wiki/Building-on-Debian-8 | ||
# configure: error: please install libfdk-aac-dev or fdk-aac-devel | ||
# --enable-tjpeg \ | ||
# ./configure --prefix=/usr/local/xrdp --enable-fuse --enable-mp3lame --enable-pixman;\ | ||
ADD src/arm /src/arm | ||
# RUN wget https://github.com/neutrinolabs/xrdp/releases/download/v${ver}/xrdp-${ver}.tar.gz; \ | ||
# deb12: CFLAGS='-Wno-format'>> -Wno-error; #CFLAGS='-Wno-error'; 无效 | ||
# 0.9.16>> 0.9.23 OK无warn; | ||
# 30.18 /usr/include/openssl/dh.h:204:28: note: declared here | ||
# 30.18 204 | OSSL_DEPRECATEDIN_3_0 void DH_free(DH *dh); | ||
# 30.18 | ^~~~~~~ | ||
# 30.33 cc1: all warnings being treated as errors | ||
RUN mkdir -p /usr/local/xrdp | ||
RUN test "yes" != "$COMPILE_XRDP" && exit 0 || echo doMake; \ | ||
tar -zxf /src/arm/xrdp-${ver}.tar.gz;\ | ||
cd xrdp-${ver};\ | ||
# c工程设置 | ||
# export CFLAGS="-Wno-error"; \ | ||
# c++工程设置 | ||
# export CXXFLAGS="-Wno-error"; \ | ||
./bootstrap;\ | ||
./configure \ | ||
--prefix=/usr/local/xrdp \ | ||
--enable-vsock \ | ||
--enable-fdkaac \ | ||
--enable-opus \ | ||
--enable-fuse \ | ||
--enable-mp3lame \ | ||
--enable-pixman \ | ||
CFLAGS='-Wno-format';\ | ||
make;\ | ||
make install;\ | ||
echo "finished!"; | ||
|
||
#####git clone; xorgxrdp with xrdp --prefix, testOK; | ||
# # gitee.com/g-system/xorgxrdp | ||
# RUN git clone --branch br-0214 https://gitee.com/g-system/xorgxrdp;\ | ||
# cd xorgxrdp;\ | ||
# ./bootstrap;\ | ||
# CPPFLAGS="-I/usr/local/xrdp/include" LDFLAGS="-L/usr/local/xrdp/lib" ./configure;\ | ||
# make;\ | ||
# sudo make install; | ||
|
||
###pulseaudio-module-xrdp############################################### | ||
# pulse-xrdp: git-latest | ||
FROM stage-base as stage-pulse | ||
ARG COMPILE_PULSE="yes" | ||
#### pulseaudio-module-xrdp >> pulseaudio ver: 10.0 | ||
# RUN git submodule update --init --recursive | ||
RUN mkdir -p /var/lib/xrdp-pulseaudio-installer; \ | ||
\ | ||
apt update && apt build-dep -q -y pulseaudio; \ | ||
cd /opt && apt source pulseaudio; pulseaudio --version; ls -lh; | ||
|
||
# /opt/pulseaudio-16.1+dfsg1 | ||
RUN \ | ||
apt.sh meson doxygen; \ | ||
\ | ||
pulseaudio=$(pulseaudio --version | awk '{print $2}'); \ | ||
cd /opt/pulseaudio-${pulseaudio}*dfsg* ; \ | ||
\ | ||
# ./configure | ||
meson build; \ | ||
# meson compile -C build; | ||
echo "finished!"; | ||
|
||
# RUN pulseaudio=$(pulseaudio --version); echo "pulseaudio: $pulseaudio" | ||
# hand copy: /opt/pulseaudio-1.11/config.h +src/pulsecore | ||
# https://github.com/neutrinolabs/pulseaudio-module-xrdp.git | ||
# https://gitee.com/g-system/pulseaudio-module-xrdp.git | ||
RUN test "yes" != "$COMPILE_PULSE" && exit 0 || echo doMake; \ | ||
cd /opt && git clone --branch v0.5 https://gitee.com/g-system/pulseaudio-module-xrdp.git && \ | ||
cd /opt/pulseaudio-module-xrdp ;\ | ||
pulseaudio=$(pulseaudio --version | awk '{print $2}'); \ | ||
echo "pulseaudio ver: $pulseaudio"; \ | ||
\ | ||
./bootstrap && ./configure PULSE_DIR="/opt/pulseaudio-${pulseaudio}+dfsg1"; \ | ||
cp -a /opt/pulseaudio-${pulseaudio}*dfsg*/build/config.h .; \ | ||
cp -a /opt/pulseaudio-${pulseaudio}*dfsg*/build/src/pulsecore/ .; \ | ||
make; \ | ||
\ | ||
cd /opt/pulseaudio-module-xrdp/src/.libs; \ | ||
install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so; \ | ||
echo "finished!"; | ||
|
||
|
||
###tigervnc############################################### | ||
# ref: https://github.com/abcdesktopio/tigervnc/blob/main/Dockerfile | ||
FROM stage-base as stage-tiger | ||
ARG COMPILE_TIGER="yes" | ||
|
||
# ins: dev, dep and sources | ||
# TODO: 版本不一定对得上..v1.12.0; 手动ct-compileImg: 未执行本步; | ||
# RUN apt update; \ | ||
# # 129 MB | ||
# apt build-dep -y tigervnc | ||
|
||
# deb12: Could NOT find X11 (missing: X11_X11_LIB) | ||
# X11_X11_LIB: +xorg-dev | ||
# +cmake | ||
# apt install -y libfltk1.3-dev ##Could NOT find FLTK (missing: FLTK_LIBRARIES FLTK_INCLUDE_DIR) | ||
# RUN apt.sh \ | ||
RUN apt update; apt install -y \ | ||
cmake libfltk1.3-dev libxi-dev libxshmfence-dev \ | ||
libxcb-dri3-0 \ | ||
libdrm-dev libxfont-dev mesa-common-dev \ | ||
libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev | ||
# xorg-dev | ||
|
||
# src | ||
ADD src/arm /src/arm | ||
WORKDIR /src/arm | ||
RUN mkdir -p /usr/local/tigervnc; \ | ||
\ | ||
mkdir -p /build; \ | ||
tar -zxf tigervnc-1.12.0.tar.gz -C /build/; \ | ||
tar -jxf xorg-server-1.20.7.tar.bz2 --strip-components=1 -C /build/tigervnc-1.12.0/unix/xserver/; \ | ||
\cp -a tigervnc-1.12.0-configuration_fixes-1.patch /build/; \ | ||
\ | ||
ls /build/tigervnc-1.12.0/unix/xserver/ | ||
|
||
# apply patch: tigervnc-1.12.0; xserver120 | ||
WORKDIR /build/tigervnc-1.12.0 | ||
# RUN \ | ||
# patch -Np1 -i ../tigervnc-1.12.0-configuration_fixes-1.patch; \ | ||
# cd unix/xserver && patch -Np1 -i ../xserver120.patch; | ||
|
||
#make vncpasswd, vncconfig, vncviewver, ... | ||
# err with armv7: | ||
# 0 16.95 CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): | ||
# 0 16.95 Could NOT find X11 (missing: X11_X11_LIB) ###ubt2004_armv7: 尝试go_vncpasswd | ||
# deb12: gitac_ERR; tenVM2下手动正常 | ||
# Dockerfile.compile2:148 | ||
# -------------------- | ||
# 147 | #0 16.95 Could NOT find X11 (missing: X11_X11_LIB) | ||
# | ||
# https://github.com/TigerVNC/tigervnc/issues/1534 | ||
# build the normal parts of TigerVNC first. | ||
# Xvnc-build-err: No rule to make target '../../../../common/network/libnetwork.la', needed by 'Xvnc'. Stop. | ||
RUN test "yes" != "$COMPILE_TIGER" && exit 0 || echo doMake; \ | ||
patch -Np1 -i ../tigervnc-1.12.0-configuration_fixes-1.patch; \ | ||
cd unix/xserver && patch -Np1 -i ../xserver120.patch; \ | ||
\ | ||
cd /build/tigervnc-1.12.0; \ | ||
# https://github.com/glfw/glfw/issues/1957 | ||
# export CMAKE_LIBRARY_ARCHITECTURE=x86_64-unknown-linux-gnu; \ | ||
# export CMAKE_LIBRARY_ARCHITECTURE=x86_64-linux-gnu; \ | ||
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr \ | ||
-DCMAKE_BUILD_TYPE=Release -DINSTALL_SYSTEMD_UNITS=OFF -Wno-dev . ; \ | ||
cat /build/tigervnc-1.12.0/CMakeFiles/CMakeError.log; \ | ||
make; | ||
|
||
# make XServer [plat x3: 构建耗时 52min] | ||
WORKDIR /build/tigervnc-1.12.0/unix/xserver | ||
# --disable-static | ||
# --enable-xvfb > --disable-xvfb #不生成xvfb | ||
# --enable-glx ##libgl1? 24M (drop-all-enabled: 还是有依赖) | ||
# | ||
# https://github.com/TigerVNC/tigervnc/issues/740 | ||
# deb12: --enable-dri3 >> --disable-dri3 | ||
# https://github.com/TigerVNC/tigervnc/blob/master/contrib/packages/rpm/el7/SPECS/tigervnc.spec#L164 | ||
# --disable-static > --enable-static \ #https://github.com/TigerVNC/tigervnc/issues/1534 #--enable-static无效(openssl_libcrypto.so.3) | ||
RUN test "yes" != "$COMPILE_TIGER" && exit 0 || echo doMake; \ | ||
autoreconf -fiv; \ | ||
CPPFLAGS="-I/usr/include/drm" \ | ||
./configure $XORG_CONFIG \ | ||
# build-nginx | ||
# --with-cc-opt="-static" \ | ||
# --with-ld-opt="-static" \ | ||
# --with-cpu-opt="generic" \ | ||
\ | ||
--prefix=/usr/local/tigervnc \ | ||
--disable-xwayland --disable-dmx \ | ||
--disable-xorg --disable-xnest --disable-xvfb \ | ||
--disable-xwin --disable-xephyr --disable-kdrive \ | ||
--disable-devel-docs --disable-config-hal --disable-config-udev \ | ||
--disable-unit-tests --disable-selective-werror \ | ||
--disable-dri --disable-dri3 --enable-dri2 \ | ||
--enable-glx \ | ||
# --enable-static \ | ||
--with-pic \ | ||
--without-dtrace ; \ | ||
# try1: CFLAGS="-static" LDFLAGS="-static" | ||
make; \ | ||
find /build/tigervnc-1.12.0/ |egrep Xvnc; \ | ||
find /build/tigervnc-1.12.0/ |egrep "libos|librfb|librdr|libnetwork|libunixcommon"; \ | ||
\ | ||
make install; \ | ||
find /usr/local/tigervnc; \ | ||
echo "finished!"; | ||
# vncpasswd | ||
# alter_try: https://github.com/KarpelesLab/vncpasswd #golang实现 | ||
# RUN cp /build/tigervnc-1.12.0/unix/vncpasswd/vncpasswd /usr/local/tigervnc/bin/ | ||
|
||
# https://github.com/TigerVNC/tigervnc/issues/800 | ||
# LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver :2 -localhost no | ||
# | ||
# swrast_dri.so # /usr/lib/dri/swrast_dri.so | ||
# ln -s /usr/lib/x86_64-linux-gnu/dri /usr/lib/dri | ||
|
||
|
||
###merge: xrdp, pulse, tigervnc############################################### | ||
# 11.9M | ||
# FROM scratch | ||
FROM debian:12-slim | ||
ARG TARGETPLATFORM | ||
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources; \ | ||
\ | ||
echo 'apt update -qq && apt install -yq --no-install-recommends $@ && apt clean && rm -rf /var/lib/apt/lists/*; ' > /usr/local/bin/apt.sh \ | ||
&& chmod +x /usr/local/bin/apt.sh | ||
WORKDIR /rootfs/usr/local/tigervnc/bin | ||
COPY --from=stage-xrdp /usr/local/xrdp /rootfs/usr/local/xrdp | ||
COPY --from=stage-pulse /var/lib/xrdp-pulseaudio-installer /rootfs/var/lib/xrdp-pulseaudio-installer | ||
COPY --from=stage-tiger /usr/local/tigervnc /rootfs/usr/local/tigervnc | ||
# test | ||
# deb12.out: libjpeg8@ubt2004 > libjpeg62-turbo | ||
# libjpeg62-turbo| error while loading shared libraries: libjpeg.so.62: cannot open shared object file | ||
# openssl| error while loading shared libraries: libcrypto.so.3: cannot open shared object file | ||
# try:binutils-x86-64-linux-gnu 6401 kB | ||
RUN apt.sh \ | ||
# --enable-xx ##还是需要libGL.so.1 | ||
libgl1 \ | ||
libunwind8 libpixman-1-0 libxfont2 \ | ||
libxau6 libxdmcp6 \ | ||
libjpeg62-turbo openssl | ||
# libcrypt1 | ||
RUN find /rootfs; | ||
RUN /rootfs/usr/local/tigervnc/bin/Xvnc -version |