[fix] make Xfce optional with separate Linux deb packages, refs #106

This commit is contained in:
dijunkun
2026-10-08 14:43:58 +08:00
parent ec6fe8ea98
commit 9550731681
17 changed files with 256 additions and 64 deletions
+6 -4
View File
@@ -57,13 +57,13 @@ xmake r crossdesk
## Linux
Linux 构建支持 Ubuntu 20.04 及以上版本的 amd64 和 arm64。发布安装包以
Ubuntu 20.04/glibc 2.31 为兼容基线。以下依赖命令以 Ubuntu 20.04 为例;其他发行版或较新版本需按其软件源调整包名和工具链,复现 CI 可使用下文的构建镜像。先安装基础编译和无头运行依赖:
Ubuntu 20.04/glibc 2.31 为兼容基线。以下依赖命令以 Ubuntu 20.04 为例;其他发行版或较新版本需按其软件源调整包名和工具链,复现 CI 可使用下文的构建镜像。先安装基础编译依赖:
```bash
sudo apt-get update
sudo apt-get install -y \
git curl unzip build-essential gcc-10 g++-10 python3-pip \
pkg-config binutils dpkg-dev xvfb xfce4 dbus \
pkg-config binutils dpkg-dev \
libx11-dev libxext-dev libxrender-dev libxft-dev libxrandr-dev \
libxinerama-dev libxcursor-dev libxi-dev libxfixes-dev libxv-dev \
libxtst-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
@@ -119,7 +119,9 @@ xmake b -vy crossdesk
./apps/desktop/scripts/linux/pkg_arm64.sh 1.4.3
```
打包脚本会将 Slint 共享运行库安装到软件包私有目录 `/usr/lib/crossdesk`,无需用户另外安装 `libslint_cpp.so`。
每次打包从同一份编译产物生成普通版 `crossdesk-linux-<arch>-<version>.deb` 和虚拟桌面版 `crossdesk-virtual-desktop-xfce-linux-<arch>-<version>.deb`。两者都包含完整程序,只有后者强依赖 Xvfb、Xfce 和 D-Bus 会话工具;编译和打包本身不需要安装这些组件。源码运行时如需创建完整虚拟桌面,请按 [无头运行说明](HEADLESS.md) 准备可选依赖。项目构建镜像和 CI 可保留这些组件用于测试。
打包脚本会将 Slint 共享运行库安装到软件包私有目录 `/usr/lib/crossdesk`,无需用户另外安装 `libslint_cpp.so`。同目录的 `package-name` 标记由安装包管理,用于选择更新下载,不写入用户配置。
PipeWire 不属于强制运行时依赖:程序在运行时检测宿主系统的 PipeWire 0.3,
没有该运行库时仍可使用 X11(以及构建时启用的 DRM)捕获。
@@ -145,7 +147,7 @@ xmake r crossdesk
## 无 CUDA 环境下的开发支持
对于**未安装 CUDA 环境的 Linux 开发者,如果希望编译后的成果物拥有硬件编解码能力**,这里提供了预配置的 [Ubuntu 20.04 兼容构建镜像](https://hub.docker.com/r/crossdesk/ubuntu20.04)。该镜像内置必要的构建依赖,可生成兼容 glibc 2.31 的单一 Linux 安装包。
对于**未安装 CUDA 环境的 Linux 开发者,如果希望编译后的成果物拥有硬件编解码能力**,这里提供了预配置的 [Ubuntu 20.04 兼容构建镜像](https://hub.docker.com/r/crossdesk/ubuntu20.04)。该镜像内置必要的构建依赖,可生成兼容 glibc 2.31 的两种 Linux 安装包。
镜像版本和 amd64 / arm64 差异见 [构建镜像说明](../docker/linux-build/README.md)。以下 CUDA 示例适用于 amd64 镜像;进入容器、下载工程后执行:
+6 -4
View File
@@ -60,13 +60,13 @@ Linux builds support Ubuntu 20.04 or later on amd64 and arm64. Release packages
use Ubuntu 20.04/glibc 2.31 as their compatibility baseline. The dependency
commands below target Ubuntu 20.04; adapt package names and toolchains for
other distributions or newer versions, or use the build image below to
reproduce CI. Install the base build and headless runtime dependencies first:
reproduce CI. Install the base build dependencies first:
```bash
sudo apt-get update
sudo apt-get install -y \
git curl unzip build-essential gcc-10 g++-10 python3-pip \
pkg-config binutils dpkg-dev xvfb xfce4 dbus \
pkg-config binutils dpkg-dev \
libx11-dev libxext-dev libxrender-dev libxft-dev libxrandr-dev \
libxinerama-dev libxcursor-dev libxi-dev libxfixes-dev libxv-dev \
libxtst-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
@@ -127,7 +127,9 @@ Build a Debian package after compiling a release binary on the matching architec
./apps/desktop/scripts/linux/pkg_arm64.sh 1.4.3
```
The package scripts install the shared Slint runtime in the private `/usr/lib/crossdesk` directory, so users do not need to install `libslint_cpp.so` separately.
Each packaging run uses the same compiled application to create the standard `crossdesk-linux-<arch>-<version>.deb` and `crossdesk-virtual-desktop-xfce-linux-<arch>-<version>.deb`. Both contain the complete application; only the latter requires Xvfb, Xfce and D-Bus session tools. Building and packaging need none of these optional runtime components. To run a complete virtual desktop from source, install them as described in [headless operation](HEADLESS_EN.md). The build image and CI can retain them for testing.
The package scripts install the shared Slint runtime in the private `/usr/lib/crossdesk` directory, so users do not need to install `libslint_cpp.so` separately. The package-managed `package-name` file beside it identifies the update download variant without changing user settings.
PipeWire is not a mandatory runtime dependency. CrossDesk detects the host's
PipeWire 0.3 runtime dynamically and can still use X11 capture (and DRM when
enabled at build time) when it is unavailable.
@@ -154,7 +156,7 @@ xmake r crossdesk
## Development Without CUDA Environment
For **Linux developers who do not have a CUDA environment installed and want to enable hardware codec feature**, a preconfigured [Ubuntu 20.04 compatibility build image](https://hub.docker.com/r/crossdesk/ubuntu20.04) is provided.
This image contains the required build dependencies and produces a single Linux package compatible with the glibc 2.31 baseline.
This image contains the required build dependencies and produces both Linux package variants with the glibc 2.31 baseline.
See the [build image notes](../docker/linux-build/README.md) for image tags and architecture differences. The CUDA example below targets the amd64 image. Inside the container, download the project and run:
+4 -2
View File
@@ -90,9 +90,11 @@ settings set file_path /home/user/Received Files
## 创建独立虚拟桌面
Debian/Ubuntu 安装包将 Xvfb、Xfce 和 D-Bus 会话工具声明为强依赖,使用 APT 安装时会自动补齐,即使指定 `--no-install-recommends` 也不会跳过。源码直接运行时,需在开发环境中准备同样的运行依赖;项目构建镜像和 CI 已包含这些组件。
Debian/Ubuntu 的普通版 `crossdesk` 不依赖 Xvfb 或 Xfce,复用已有桌面无需额外安装它们。需要完整独立桌面时,可选择 `crossdesk-virtual-desktop-xfce` 安装包:它包含同一份 CrossDesk 程序,并通过 APT 强依赖安装 Xvfb、Xfce 和 D-Bus 会话工具(`--no-install-recommends` 也不会跳过)。这些组件由系统软件源提供,安装包不是完整的离线桌面环境。
原来没有图形会话,或者希望单独开一套桌面时,可启动独立 Xfce 会话。Ubuntu / Debian 示例(安装包用户无需重复安装依赖):
两个包只能安装一个。先退出 CrossDesk,使用 `sudo apt install ./所选安装包.deb` 升级或切换版本,再启动程序,原有用户配置会保留。安装与切换不会自动启动虚拟会话、修改默认桌面或删除此前安装的 Xfce。更新下载按已安装的包类型选择;若对应下载尚未发布或元数据不完整,会打开 Releases 列表供选择,不会自动改用另一种包。
原来没有图形会话,或者希望单独开一套桌面时,可启动独立 Xfce 会话。Ubuntu / Debian 示例(虚拟桌面版已包含这些依赖;普通版和源码运行用户按需安装):
```bash
sudo apt install xvfb xfce4 dbus
+4 -2
View File
@@ -89,9 +89,11 @@ The interactive console stays in the foreground regardless of the built-in daemo
## Create a separate virtual desktop
Debian/Ubuntu packages require Xvfb, Xfce and the D-Bus session tools through `Depends`. APT installs them even with `--no-install-recommends`. Source builds need the same runtime prerequisites in the development environment; the project build image and CI include them.
The standard Debian/Ubuntu package, `crossdesk`, does not depend on Xvfb or Xfce; reusing an existing desktop needs neither. For a complete independent desktop, choose `crossdesk-virtual-desktop-xfce`. It contains the same CrossDesk application and requires Xvfb, Xfce and D-Bus session tools through `Depends`, so APT installs them even with `--no-install-recommends`. These components come from the system repositories; the package is not a complete offline desktop environment.
For a host without a desktop session, or to start an independent Xfce session (package users do not need to reinstall the dependencies):
Install only one package. Exit CrossDesk, use `sudo apt install ./chosen-package.deb` to upgrade or switch variants, then restart the app; user settings are preserved. Installation and switching do not start a virtual session, change the default desktop or remove previously installed Xfce components. Update downloads retain the installed package type. If its download is missing or incomplete, the app opens the Releases list instead of selecting another package type.
For a host without a desktop session, or to start an independent Xfce session (the virtual desktop package already supplies the dependencies; standard-package and source-build users install them as needed):
```bash
sudo apt install xvfb xfce4 dbus