Skip to content

Commit 9f58af0

Browse files
committed
refactor: unify DTK5/DTK6 build system
1. Replaced PROJECT_VERSION_MAJOR-based Qt version detection with explicit DTK5/DTK6 build option 2. Added DTK5 CMake option (default ON) to control DTK5 vs DTK6 builds 3. Updated DTK_VERSION calculation to use DTK_VERSION_MAJOR from build option instead of PROJECT_VERSION_MAJOR 4. Modified CMake logic to conditionally build wayland plugin only for DTK5 builds 5. Restructured debian/control to support both DTK5 and DTK6 packages with Build-Profiles 6. Added new dde-qt6xcb-plugin package for DTK6 builds 7. Implemented separate build directories (build-dtk5, build-dtk6) in debian/rules for parallel builds 8. Added build profile support (nodtk5, nodtk6) to control which packages are built 9. Updated package descriptions to clearly indicate DTK5/Qt5 vs DTK6/ Qt6 versions Log: Updated build system to support both DTK5 and DTK6 versions Influence: 1. Test building with default settings (DTK5=ON) to ensure DTK5 builds work 2. Test building with DTK5=OFF to verify DTK6 builds work correctly 3. Verify that wayland plugin is only built for DTK5 builds 4. Test package generation with different build profiles (nodtk5, nodtk6) 5. Verify that both dde-qt5xcb-plugin and dde-qt6xcb-plugin packages are created correctly 6. Test installation of both DTK5 and DTK6 packages on appropriate systems 7. Verify plugin paths are correct (Qt5 vs Qt6 plugin directories) refactor: 统一DTK5/DTK6构建系统 1. 将基于PROJECT_VERSION_MAJOR的Qt版本检测改为显式的DTK5/DTK6构建选项 2. 添加DTK5 CMake选项(默认开启)来控制DTK5与DTK6构建 3. 更新DTK_VERSION计算,使用构建选项中的DTK_VERSION_MAJOR而非 PROJECT_VERSION_MAJOR 4. 修改CMake逻辑,仅对DTK5构建有条件地构建wayland插件 5. 重构debian/control以支持带有Build-Profiles的DTK5和DTK6包 6. 为DTK6构建添加新的dde-qt6xcb-plugin包 7. 在debian/rules中实现独立的构建目录(build-dtk5, build-dtk6)用于并行 构建 8. 添加构建配置文件支持(nodtk5, nodtk6)来控制构建哪些包 9. 更新包描述以清晰标明DTK5/Qt5与DTK6/Qt6版本 Log: 更新构建系统以支持DTK5和DTK6版本 Influence: 1. 使用默认设置(DTK5=ON)测试构建,确保DTK5构建正常工作 2. 使用DTK5=OFF测试构建,验证DTK6构建正确工作 3. 验证wayland插件仅对DTK5构建进行构建 4. 使用不同的构建配置文件(nodtk5, nodtk6)测试包生成 5. 验证dde-qt5xcb-plugin和dde-qt6xcb-plugin包都正确创建 6. 在适当的系统上测试DTK5和DTK6包的安装 7. 验证插件路径正确(Qt5与Qt6插件目录)
1 parent da1e171 commit 9f58af0

File tree

4 files changed

+120
-26
lines changed

4 files changed

+120
-26
lines changed

CMakeLists.txt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
cmake_minimum_required(VERSION 3.13)
66

7-
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" DTK_FILE_VERSION)
8-
string(STRIP "${DTK_FILE_VERSION}" DTK_FILE_VERSION)
9-
set(DTK_VERSION "${DTK_FILE_VERSION}" CACHE STRING "define project version")
7+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FILE_VERSION)
8+
string(STRIP "${FILE_VERSION}" FILE_VERSION)
109

1110
project(qt5platform-plugins
12-
VERSION ${DTK_VERSION}
11+
VERSION ${FILE_VERSION}
1312
DESCRIPTION "DTK platform plugin module"
1413
HOMEPAGE_URL "https://github.com/linuxdeepin/qt5platform-plugins"
1514
LANGUAGES CXX C
@@ -22,15 +21,23 @@ endif ()
2221
include(GNUInstallDirs)
2322
include(CMakePackageConfigHelpers)
2423

25-
if("${PROJECT_VERSION_MAJOR}" STREQUAL "5")
26-
set(QT_VERSION_MAJOR "5")
27-
elseif("${PROJECT_VERSION_MAJOR}" STREQUAL "6")
28-
set(QT_VERSION_MAJOR "6")
29-
set(DTK_VERSION_MAJOR "6")
24+
# 引入 DTK5/DTK6 构建选项
25+
option(DTK5 "Build DTK5." ON)
26+
if(DTK5)
27+
set(DTK_VERSION_MAJOR "5")
28+
set(DTK_NAME_SUFFIX "") # DTK5 产品名称后缀为空
3029
else()
31-
message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.")
30+
set(DTK_VERSION_MAJOR "6")
31+
set(DTK_NAME_SUFFIX "6") # DTK6 产品名称后缀为 "6"
3232
endif()
33-
message(${PROJECT_VERSION_MAJOR})
33+
34+
set(DTK_VERSION_MINOR ${PROJECT_VERSION_MINOR})
35+
set(DTK_VERSION_PATCH ${PROJECT_VERSION_PATCH})
36+
set(DTK_VERSION "${DTK_VERSION_MAJOR}.${DTK_VERSION_MINOR}.${DTK_VERSION_PATCH}")
37+
# 官方约定:DTK5 使用 Qt5,DTK6 使用 Qt6
38+
set(QT_VERSION_MAJOR ${DTK_VERSION_MAJOR})
39+
40+
message(STATUS "Building DTK${DTK_VERSION_MAJOR} (Qt${QT_VERSION_MAJOR}) version: ${DTK_VERSION}")
3441

3542
set(CMAKE_INCLUDE_CURRENT_DIR ON)
3643
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -48,11 +55,10 @@ endif ()
4855
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/plugins/platforms)
4956

5057
add_subdirectory(xcb)
51-
if("${PROJECT_VERSION_MAJOR}" STREQUAL "5")
58+
if(DTK5)
5259
add_subdirectory(wayland)
5360
endif()
5461
if(BUILD_TESTING)
5562
enable_testing()
5663
add_subdirectory(tests)
5764
endif()
58-
message(${PROJECT_VERSION_MAJOR})

debian/control

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,71 @@ Source: dde-qt5platform-plugins
22
Section: devel
33
Priority: optional
44
Maintainer: Deepin Packages Builder <packages@deepin.com>
5-
Build-Depends: debhelper (>=9), qtbase5-dev, qtbase5-private-dev,
6-
pkg-config, libqt5x11extras5-dev, libxcb-xkb-dev, libxcb-render-util0-dev,
7-
libxcb-image0-dev, libxcb-icccm4-dev, libxcb-keysyms1-dev, libegl1-mesa-dev,
8-
libmtdev-dev, libxkbcommon-x11-dev, libdbus-1-dev, libqt5opengl5-dev,
9-
libudev-dev, libxrender-dev,libxi-dev, libsm-dev, libxcb-xinerama0-dev,
10-
libfontconfig1-dev, libglib2.0-dev, libxcb-damage0-dev,
11-
libxcb-composite0-dev, libcairo2-dev, libkf5wayland-dev, libdwayland-dev,
12-
qtwayland5-private-dev | libqt5waylandclient5-dev,
13-
libwayland-dev, libxcb-xinput-dev, libxcb-util-dev | libxcb-util0-dev,
14-
libx11-xcb-dev, libxcb-sync-dev, libxcb-randr0-dev, cmake, libgtest-dev, libgmock-dev, libdtkcommon-dev(>=5.6.16)
5+
Build-Depends: debhelper (>=9),
6+
cmake,
7+
pkg-config,
8+
libgtest-dev,
9+
libgmock-dev,
10+
libdtkcommon-dev(>=5.6.16),
11+
qtbase5-dev <!nodtk5>,
12+
qtbase5-private-dev <!nodtk5>,
13+
libqt5x11extras5-dev <!nodtk5>,
14+
libqt5opengl5-dev <!nodtk5>,
15+
qtwayland5-private-dev | libqt5waylandclient5-dev <!nodtk5>,
16+
qt6-base-dev <!nodtk6>,
17+
qt6-base-private-dev <!nodtk6>,
18+
libxcb-xkb-dev,
19+
libxcb-render-util0-dev,
20+
libxcb-image0-dev,
21+
libxcb-icccm4-dev,
22+
libxcb-keysyms1-dev,
23+
libegl1-mesa-dev,
24+
libmtdev-dev,
25+
libxkbcommon-x11-dev,
26+
libdbus-1-dev,
27+
libudev-dev,
28+
libxrender-dev,
29+
libxi-dev,
30+
libsm-dev,
31+
libxcb-xinerama0-dev,
32+
libfontconfig1-dev,
33+
libglib2.0-dev,
34+
libxcb-damage0-dev,
35+
libxcb-composite0-dev,
36+
libcairo2-dev,
37+
libkf5wayland-dev <!nodtk5>,
38+
libdwayland-dev <!nodtk5>,
39+
libwayland-dev,
40+
libxcb-xinput-dev,
41+
libxcb-util-dev | libxcb-util0-dev,
42+
libx11-xcb-dev,
43+
libxcb-sync-dev,
44+
libxcb-randr0-dev
1545
Standards-Version: 3.9.8
1646

47+
# DTK5 包
1748
Package: dde-qt5xcb-plugin
1849
Architecture: any
1950
Provides: libqt5dxcb-plugin
2051
Conflicts: libqt5dxcb-plugin, qt5dxcb-plugin
2152
Breaks:dde-qt5integration (<< 0.2.8.1)
2253
Replaces: qt5dxcb-plugin
2354
Depends: ${shlibs:Depends}, ${misc:Depends}
24-
Description: Qt platform plugins
55+
Build-Profiles: <!nodtk5>
56+
Description: Qt platform plugins (DTK5 with Qt5)
2557
Qt platform plugins for DDE.
2658

2759
Package: dde-qt5wayland-plugin
2860
Architecture: any
2961
Depends: ${shlibs:Depends}, ${misc:Depends}, qtwayland5
30-
Description: Qt platform plugins
62+
Build-Profiles: <!nodtk5>
63+
Description: Qt platform plugins (DTK5 with Qt5)
3164
Qt platform plugins for DDE.
65+
66+
# DTK6 包
67+
Package: dde-qt6xcb-plugin
68+
Architecture: any
69+
Depends: ${shlibs:Depends}, ${misc:Depends}
70+
Build-Profiles: <!nodtk6>
71+
Description: Qt platform plugins (DTK6 with Qt6)
72+
Qt platform plugins for DDE (Qt6 version).

debian/dde-qt6xcb-plugin.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usr/lib/*/qt6/plugins/platforms/libdxcb.so

debian/rules

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
11
#!/usr/bin/make -f
2+
DPKG_EXPORT_BUILDFLAGS = 1
3+
include /usr/share/dpkg/default.mk
24

35
# 安全编译参数
46
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
57
export DEB_CFLAGS_MAINT_APPEND = -Wall
68
export DEB_CXXFLAGS_MAINT_APPEND = -Wall
79
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-E
810

11+
# Build-Profiles 控制
12+
BUILD_DTK5 := $(if $(filter nodtk5,$(DEB_BUILD_PROFILES)),OFF,ON)
13+
BUILD_DTK6 := $(if $(filter nodtk6,$(DEB_BUILD_PROFILES)),OFF,ON)
14+
915
%:
10-
dh $@
16+
dh $@
17+
18+
override_dh_auto_configure:
19+
ifeq ($(BUILD_DTK5),ON)
20+
mkdir -p build-dtk5
21+
QT_SELECT=qt5 dh_auto_configure --builddirectory=build-dtk5 -- \
22+
$(DEB_CMAKE_EXTRA_FLAGS) \
23+
-DBUILD_TESTING=OFF \
24+
-DDTK5=ON
25+
endif
26+
ifeq ($(BUILD_DTK6),ON)
27+
mkdir -p build-dtk6
28+
dh_auto_configure --builddirectory=build-dtk6 -- \
29+
$(DEB_CMAKE_EXTRA_FLAGS) \
30+
-DBUILD_TESTING=OFF \
31+
-DDTK5=OFF
32+
endif
33+
34+
override_dh_auto_build:
35+
ifeq ($(BUILD_DTK5),ON)
36+
QT_SELECT=qt5 dh_auto_build --builddirectory=build-dtk5
37+
endif
38+
ifeq ($(BUILD_DTK6),ON)
39+
dh_auto_build --builddirectory=build-dtk6
40+
endif
41+
42+
override_dh_auto_install:
43+
ifeq ($(BUILD_DTK5),ON)
44+
QT_SELECT=qt5 dh_auto_install --builddirectory=build-dtk5
45+
endif
46+
ifeq ($(BUILD_DTK6),ON)
47+
dh_auto_install --builddirectory=build-dtk6
48+
endif
49+
50+
override_dh_auto_test:
51+
# 测试在 build 阶段已执行
1152

1253
override_dh_shlibdeps:
1354
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
55+
56+
override_dh_auto_clean:
57+
dh_auto_clean --builddirectory=build-dtk5
58+
dh_auto_clean --builddirectory=build-dtk6
59+
rm -rf build-dtk5 build-dtk6

0 commit comments

Comments
 (0)