From 31f18a19e5e6211c426b94638015f8f4b31f2ff2 Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Mon, 17 Nov 2025 15:07:07 +0800 Subject: [PATCH] feat: add reproducible build flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added CMAKE_SKIP_BUILD_RPATH=ON flag to DEB_CMAKE_EXTRA_FLAGS for reproducible builds This change ensures that build paths are not embedded in binaries, making builds more deterministic The flag is passed to dh_auto_configure command to apply during CMake configuration This improves package reproducibility across different build environments Influence: 1. Verify that builds produce identical binaries when built in different directories 2. Test that RPATH is not embedded in compiled binaries 3. Check that package functionality remains unchanged 4. Validate build process completes successfully with the new flag feat: 添加可重复编译参数 在DEB_CMAKE_EXTRA_FLAGS中添加CMAKE_SKIP_BUILD_RPATH=ON标志以实现可重复 编译 此更改确保构建路径不会嵌入到二进制文件中,使构建更加确定性 该标志通过dh_auto_configure命令传递给CMake配置过程 这提高了在不同构建环境中软件包的可重复性 Influence: 1. 验证在不同目录中构建时是否产生相同的二进制文件 2. 测试编译后的二进制文件中是否未嵌入RPATH 3. 检查软件包功能是否保持不变 4. 验证构建过程在使用新标志后能否成功完成 --- debian/rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 3e4c312..d3ecf0a 100755 --- a/debian/rules +++ b/debian/rules @@ -9,6 +9,9 @@ export DEB_CFLAGS_MAINT_APPEND = -Wall export DEB_CXXFLAGS_MAINT_APPEND = -Wall export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-E +# reproducible编译参数 +DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON + DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) VERSION = $(DEB_VERSION_UPSTREAM) @@ -20,7 +23,7 @@ BUILD_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0- dh $@ override_dh_auto_configure: - dh_auto_configure -- -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=ON -DBUILD_VERSION=$(BUILD_VER) -DDTK_VERSION=$(PACK_VER) + dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS) -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=ON -DBUILD_VERSION=$(BUILD_VER) -DDTK_VERSION=$(PACK_VER) override_dh_makeshlibs: dh_makeshlibs -V "libdtk6declarative (>= $(shell echo $(VERSION) | cut -d '.' -f 1,2,3))"