fix(build): detect Qt6 availability when os-version is missing#289
Conversation
When /etc/os-version does not exist, MAJOR_VERSION defaults to 99, which incorrectly selects Qt6 due to 99 > 20 being true. Add a pkg-config check for Qt6Core to determine actual Qt6 availability, preventing build failures on systems without Qt6 installed. 当 /etc/os-version 不存在时,MAJOR_VERSION 默认为 99, 由于 99 > 20 为真会错误地选择 Qt6。 新增通过 pkg-config 检测 Qt6Core 是否实际安装的逻辑, 避免在未安装 Qt6 的系统上构建失败。 Influence: 1. 修复了 /etc/os-version 缺失时 Qt 版本选择错误的问题 2. 确保在没有 Qt6 的环境中正确回退到 Qt5 构建
|
Warning
|
deepin pr auto review这段代码是对 以下是对该代码片段的详细审查意见,涵盖语法逻辑、代码质量、代码性能和代码安全性: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全性
5. 改进建议尽管代码已经不错,但为了更健壮,可以考虑以下几点优化: 优化建议 1:简化 Shell 逻辑(减少 Shell 调用次数)目前的代码调用了一次 修改前: HAS_QT6 := $(shell pkg-config --exists Qt6Core 2>/dev/null && echo yes || echo no)
ifeq ($(HAS_QT6),yes)
USE_QT6 := yes
else
USE_QT6 := no
endif修改后: # 直接将结果赋值给 USE_QT6
USE_QT6 := $(shell pkg-config --exists Qt6Core 2>/dev/null && echo yes || echo no)解释:既然 优化建议 2:处理
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs, liyigang1 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
When /etc/os-version does not exist, MAJOR_VERSION defaults to 99, which incorrectly selects Qt6 due to 99 > 20 being true. Add a pkg-config check for Qt6Core to determine actual Qt6 availability, preventing build failures on systems without Qt6 installed.
当 /etc/os-version 不存在时,MAJOR_VERSION 默认为 99,
由于 99 > 20 为真会错误地选择 Qt6。
新增通过 pkg-config 检测 Qt6Core 是否实际安装的逻辑,
避免在未安装 Qt6 的系统上构建失败。
Influence: