Skip to content

WM-58: fix: preserve Debian build flags in CMake preset ci#1054

Closed
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/ci-preset-debian-build-flags
Closed

WM-58: fix: preserve Debian build flags in CMake preset ci#1054
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/ci-preset-debian-build-flags

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fixes GitHub Actions builds not using the correct CMake configuration (CI Build Config).

Changes

  1. Use $env{CFLAGS}/$env{CXXFLAGS} in ci preset to preserve dpkg-buildflags security flags instead of overriding them
  2. Change -Wno-stringop-overflow to -Wno-error=stringop-overflow in treeland/waylib ci presets
  3. Switch debian/rules to use --preset ci with --builddirectory=build for consistent builds
  4. Add -DCMAKE_BUILD_TYPE=None to qwlroots/waylib debian/rules to comply with Debian packaging policy
  5. Restore CMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) in qwlroots
  6. Bump qwlroots/waylib CMakePresets.json version 3 → 4 (required for $env{} macro support)
  7. Add -DWITH_SUBMODULE_QWLROOTS=OFF to waylib debian/rules for system qwlroots

Files Changed

  • CMakePresets.json — ci preset: $env{} macros, -Wno-error=stringop-overflow
  • debian/rules — use --preset ci --builddirectory=build, remove DEB_CFLAGS_MAINT_APPEND/DEB_CXXFLAGS_MAINT_APPEND
  • qwlroots/CMakePresets.json — version 3→4, $env{} macros
  • qwlroots/debian/rules--preset ci -DCMAKE_BUILD_TYPE=None -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) --builddirectory=build
  • waylib/CMakePresets.json — version 3→4, $env{} macros, -Wno-error=stringop-overflow
  • waylib/debian/rules--preset ci -DCMAKE_BUILD_TYPE=None -DWITH_SUBMODULE_QWLROOTS=OFF --builddirectory=build

Related: #WM-58

Summary by Sourcery

Align CMake CI presets and Debian packaging rules to use the shared ci preset while preserving Debian build flags and disabling the qwlroots submodule where appropriate.

Bug Fixes:

  • Ensure GitHub Actions Debian builds use the correct CMake CI configuration and Debian-provided security build flags instead of overriding them.

Enhancements:

  • Unify debian/rules across qwlroots and waylib to build via the ci CMake preset with explicit build directories and Debian-compliant CMAKE_BUILD_TYPE settings.
  • Relax string operation overflow diagnostics in CI by treating them as non-fatal warnings rather than errors in treeland/waylib presets.
  • Restore CMAKE_LIBRARY_PATH configuration for qwlroots to ensure correct multiarch library discovery and prefer system qwlroots over the submodule in waylib builds.
  • Upgrade CMakePresets schema versions to support environment macro usage and centralize qwlroots submodule disabling in packaging instead of CI workflow hacks.

CI:

  • Simplify waylib GitHub Actions workflows by removing inline edits to debian/rules, relying instead on packaging configuration for submodule control.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Aligns Debian packaging builds with the CI CMake preset while preserving dpkg-buildflags-derived compiler flags, updating presets to support env macros and Debian policy-compliant options, and simplifying GitHub Actions workflows now that waylib’s debian rules natively disable the qwlroots submodule.

Sequence diagram for Debian CI build using CMake ci preset and system qwlroots

sequenceDiagram
    actor GithubActions
    participant dpkg_buildpackage
    participant debian_rules_waylib
    participant cmake

    rect rgb(230,230,230)
    GithubActions->>dpkg_buildpackage: dpkg-buildpackage -uc -us -b
    dpkg_buildpackage->>debian_rules_waylib: run debian/rules
    alt before_PR
        GithubActions->>debian_rules_waylib: sed -i ... -DWITH_SUBMODULE_QWLROOTS=OFF
        debian_rules_waylib->>cmake: cmake -DCMAKE_INSTALL_PREFIX=/usr
        cmake-->>cmake: ignore dpkg-buildflags CFLAGS/CXXFLAGS
    else after_PR
        debian_rules_waylib->>cmake: cmake --preset ci --builddirectory=build 
        debian_rules_waylib->>cmake: -DCMAKE_BUILD_TYPE=None -DWITH_SUBMODULE_QWLROOTS=OFF
        cmake-->>cmake: use $env{CFLAGS} and $env{CXXFLAGS}
        cmake-->>cmake: use system qwlroots (WITH_SUBMODULE_QWLROOTS=OFF)
    end
    cmake-->>dpkg_buildpackage: build artifacts for Debian package
    end
Loading

File-Level Changes

Change Details Files
Preserve Debian dpkg-buildflags-derived CFLAGS/CXXFLAGS in the CI CMake preset instead of overriding them.
  • Update CI preset to reference $env{CFLAGS} and $env{CXXFLAGS} for compiler flags.
  • Remove hardcoded compiler flags that previously shadowed Debian’s build flags.
  • Ensure CI build configuration matches what dpkg-buildpackage expects for security flags.
CMakePresets.json
qwlroots/CMakePresets.json
waylib/CMakePresets.json
Adjust warning handling for stringop-overflow in CI presets to avoid breaking builds while still surfacing diagnostics.
  • Replace -Wno-stringop-overflow with -Wno-error=stringop-overflow in CI presets.
  • Keep stringop-overflow warnings visible but prevent them from being treated as hard errors in CI builds.
CMakePresets.json
waylib/CMakePresets.json
Standardize Debian rules to drive builds via the CMake ci preset with an explicit build directory and Debian-compliant options.
  • Switch debian/rules to call CMake via --preset ci instead of manual configuration.
  • Add --builddirectory=build so packaging builds are consistent and out-of-source.
  • Add -DCMAKE_BUILD_TYPE=None where required to comply with Debian policy.
  • Restore CMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) for qwlroots to ensure correct library discovery.
  • Add -DWITH_SUBMODULE_QWLROOTS=OFF in waylib debian/rules to use system qwlroots instead of the submodule.
debian/rules
qwlroots/debian/rules
waylib/debian/rules
Update CMake preset schema version to support environment variable macros used in CI builds.
  • Bump CMakePresets.json version from 3 to 4 in qwlroots and waylib.
  • Ensure the new presets schema supports $env{} macro usage for compiler flags.
qwlroots/CMakePresets.json
waylib/CMakePresets.json
Simplify GitHub Actions workflows now that waylib’s Debian rules natively disable the qwlroots submodule.
  • Remove sed-based modification of debian/rules in waylib-debian-build workflow.
  • Remove sed-based modification of debian/rules in waylib-deepin-build workflow.
  • Rely on -DWITH_SUBMODULE_QWLROOTS=OFF in waylib’s debian/rules for CI builds.
.github/workflows/waylib-debian-build.yml
.github/workflows/waylib-deepin-build.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-wm deepin-wm force-pushed the fix/ci-preset-debian-build-flags branch 2 times, most recently from 608e7ff to d3be173 Compare June 25, 2026 02:58
1. Use $env{CFLAGS}/$env{CXXFLAGS} in ci preset to preserve
   dpkg-buildflags security flags instead of overriding them
2. Change -Wno-stringop-overflow to -Wno-error=stringop-overflow
   in treeland/waylib ci presets (downgrade to non-fatal warning)
3. Switch debian/rules to use --preset ci for consistent builds
4. Add -DCMAKE_BUILD_TYPE=None to qwlroots/waylib debian/rules
   to comply with Debian packaging policy
5. Restore CMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) in qwlroots
6. Bump qwlroots/waylib CMakePresets.json version 3 -> 4
   (required for $env{} macro support)

Influence:
1. Verify deepin/debian build still passes with dpkg-buildflags
2. Verify archlinux CI build still passes with cmake --preset ci
3. Test that unused variable warnings are still caught as errors

fix: 保留 Debian 构建标志在 CMake preset ci 中

1. 在 ci preset 中使用 $env{CFLAGS}/$env{CXXFLAGS} 保留
   dpkg-buildflags 安全标志,而非覆盖它们
2. 在 treeland/waylib ci preset 中将 -Wno-stringop-overflow
   改为 -Wno-error=stringop-overflow(降级为非致命警告)
3. 切换 debian/rules 使用 --preset ci 以保持构建一致性
4. 在 qwlroots/waylib debian/rules 中添加
   -DCMAKE_BUILD_TYPE=None 以符合 Debian 打包策略
5. 在 qwlroots 中恢复 CMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
6. 将 qwlroots/waylib CMakePresets.json 版本从 3 升至 4
   ($env{} 宏支持所需最低版本)

Influence:
1. 验证 deepin/debian 构建仍能通过 dpkg-buildflags
2. 验证 archlinux CI 构建仍能通过 cmake --preset ci
3. 测试未使用变量警告仍作为错误被捕获
@deepin-wm deepin-wm force-pushed the fix/ci-preset-debian-build-flags branch from d3be173 to 2064275 Compare June 25, 2026 03:57
@deepin-bot

deepin-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.13
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1063

@zccrs zccrs marked this pull request as ready for review June 29, 2026 05:49

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.


# Build waylib with submodule disabled (use system qwlroots)
# Modify debian/rules to disable submodule
sed -i 's/-DCMAKE_INSTALL_PREFIX=\/usr/-DCMAKE_INSTALL_PREFIX=\/usr -DWITH_SUBMODULE_QWLROOTS=OFF/' debian/rules

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个为啥去掉了?跟我们本次的改动有关系吗

run: |
set -euxo pipefail
# Disable qwlroots submodule, use system-installed qwlroots package
sed -i 's/-DCMAKE_INSTALL_PREFIX=\/usr/-DCMAKE_INSTALL_PREFIX=\/usr -DWITH_SUBMODULE_QWLROOTS=OFF/' debian/rules

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@zccrs zccrs requested a review from wineee June 29, 2026 05:52
Comment thread debian/rules

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该动rules,这样会影响非github action的deb打包,本次目的只想改变github actioin的构建,我觉得可以用sed替换文件内容的方式进行

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他几个rules文件是一样的问题。

@zccrs

zccrs commented Jun 30, 2026

Copy link
Copy Markdown
Member

#1070 在这里完成了

@zccrs zccrs closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants