Skip to content

Commit

Permalink
build X11 variant of deb packages
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanChain committed Jan 26, 2025
1 parent 265a0f3 commit e7e89ec
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 10 deletions.
52 changes: 46 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,48 @@ jobs:
name: "sane-break-macos"
path: ./release/*

build-deb:
name: Build (${{ matrix.distro }})
build-x11:
name: Build (X11)
if: |
startsWith(github.ref, 'refs/tags/') ||
!startsWith(github.event.head_commit.message, 'release')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake qt6-base-dev qt6-multimedia-dev libxss-dev
- name: Build Project
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DSANE_MAKE_DEB=1 ..
cmake --build . --parallel
- name: Packing
run: |
mkdir release
cd build
cpack
mv sane-break.deb ../release/sane-break-x11.deb
- name: Attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ./release/*

- name: Create Artifact
uses: actions/upload-artifact@v4
with:
name: "sane-break-x11"
path: ./release/*

build-wayland:
name: Build (Wayland, ${{ matrix.distro }})
if: |
startsWith(github.ref, 'refs/tags/') ||
!startsWith(github.event.head_commit.message, 'release')
Expand All @@ -162,7 +202,7 @@ jobs:
- name: Install additional dependencies
if: matrix.tag == 'trixie'
run: apt-get install -y layer-shell-qt
run: apt-get install -y liblayershellqtinterface-dev

- name: Build Project
run: |
Expand All @@ -176,7 +216,7 @@ jobs:
mkdir release
cd build
cpack
mv sane-break.deb ../release/sane-break-${{ matrix.distro }}-${{ matrix.tag }}.deb
mv sane-break.deb ../release/sane-break-wayland-${{ matrix.distro }}-${{ matrix.tag }}.deb
- name: Attestation
uses: actions/attest-build-provenance@v2
Expand All @@ -186,7 +226,7 @@ jobs:
- name: Create Artifact
uses: actions/upload-artifact@v4
with:
name: "sane-break-${{ matrix.distro }}-${{ matrix.tag }}"
name: "sane-break-wayland-${{ matrix.distro }}-${{ matrix.tag }}"
path: ./release/*

build-gnome:
Expand All @@ -210,7 +250,7 @@ jobs:

release:
runs-on: ubuntu-latest
needs: [build-macos, build-windows, build-deb]
needs: [build-macos, build-windows, build-wayland, build-x11]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
Expand Down
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(ENABLE_X11 ON)
message(STATUS "Enable X11 support")
else()
set(ENABLE_X11 OFF)
message(STATUS "X11 support not enabled due to missing dependencies:")
if(NOT X11_FOUND)
message(STATUS " X11 (missing)")
Expand All @@ -62,7 +63,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(STATUS " XSCRNSAVER (missing)")
endif()
endif()
if(DEFINED ENABLE_X11)
if(ENABLE_X11)
file(GLOB PROJECT_SOURCES_LINUX "src/linux/x11/*")
target_sources(sane-break PRIVATE ${PROJECT_SOURCES_LINUX})
target_link_libraries(sane-break PRIVATE ${X11_LIBRARIES})
Expand All @@ -76,6 +77,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(ENABLE_WAYLAND ON)
message(STATUS "Enable Wayland support")
else()
set(ENABLE_WAYLAND OFF)
message(STATUS "Wayland support not enabled due to missing dependencies:")
if (NOT WAYLAND_FOUND)
message(STATUS " Wayland Client (missing)")
Expand All @@ -87,7 +89,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(STATUS " Layer Shell Qt (missing)")
endif()
endif()
if(DEFINED ENABLE_WAYLAND)
if(ENABLE_WAYLAND)
file(GLOB PROJECT_SOURCES_LINUX "src/linux/wayland/*")
target_sources(sane-break PRIVATE ${PROJECT_SOURCES_LINUX})
# Files will generate after running build
Expand Down Expand Up @@ -143,10 +145,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND SANE_MAKE_DEB)
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/AllanChain/sane-break/")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A gentle break reminder that helps you avoid mindlessly skipping breaks")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Allan Chain")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "qt6-wayland(>=6.6)")
SET(DEBIAN_DEPENDENCY_LIST "")
if (ENABLE_WAYLAND)
list(APPEND DEBIAN_DEPENDENCY_LIST "qt6-wayland(>=6.6)")
endif()
if (ENABLE_X11)
list(APPEND DEBIAN_DEPENDENCY_LIST "libxss1(>=1.2.3)")
endif()
if(LayerShellQt_FOUND)
string(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ", liblayershellqtinterface (>=6.2)")
list(APPEND DEBIAN_DEPENDENCY_LIST "layer-shell-qt(>=6.2)")
endif()
list(JOIN DEBIAN_DEPENDENCY_LIST ", " CPACK_DEBIAN_PACKAGE_DEPENDS)
INCLUDE(CPack)
endif()

Expand Down

0 comments on commit e7e89ec

Please sign in to comment.