From ebb63d8113696f998e1497ed7a36da793b811715 Mon Sep 17 00:00:00 2001 From: cos Date: Thu, 3 Apr 2025 17:34:11 +0200 Subject: [PATCH] build: add manpages Manual pages got removed from synergy in #7361. This commit brings them back. They are rudimentary and autogenerated using `help2man`, with only a message about finding the documentation at the wiki page added. Not much, but a lot better than nothing. Package names added to Continuous Integration are based on these web pages: https://archlinux.org/packages/extra/x86_64/help2man/ https://packages.debian.org/help2man https://packages.fedoraproject.org/pkgs/help2man/help2man/ https://software.opensuse.org/package/help2man --- .../actions/install-dependencies/action.yml | 9 +++---- REUSE.toml | 6 +++++ src/apps/CMakeLists.txt | 24 +++++++++++++++++++ src/apps/deskflow-client/CMakeLists.txt | 1 + src/apps/deskflow-core/CMakeLists.txt | 1 + src/apps/deskflow-gui/CMakeLists.txt | 15 ++++++++++++ .../deskflow-gui/deskflow.man.template.in | 9 +++++++ src/apps/deskflow-server/CMakeLists.txt | 1 + src/apps/res/manpage.txt | 5 ++++ 9 files changed, 67 insertions(+), 4 deletions(-) create mode 100755 src/apps/deskflow-gui/deskflow.man.template.in create mode 100644 src/apps/res/manpage.txt diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 579e4414c..0a4758051 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -39,25 +39,26 @@ runs: xorg-dev libx11-dev libxtst-dev libssl-dev \ libglib2.0-dev libxkbfile-dev qt6-base-dev qt6-tools-dev \ libgtk-3-dev libgtest-dev libgmock-dev \ - libei-dev libportal-dev libtomlplusplus-dev libcli11-dev -y >/dev/null + libei-dev libportal-dev libtomlplusplus-dev libcli11-dev \ + help2man -y >/dev/null elif [ ${{inputs.like}} == "fedora" ]; then dnf install -y cmake make ninja-build gcc-c++ \ rpm-build openssl-devel glib2-devel \ libXtst-devel libxkbfile-devel qt6-qtbase-devel qt6-qttools-devel \ gtk3-devel gtest-devel gmock-devel \ libei-devel libportal-devel tomlplusplus-devel \ - cli11-devel + cli11-devel help2man elif [ ${{inputs.like}} == "suse" ]; then zypper refresh zypper install -y --force-resolution \ cmake make ninja gcc-c++ rpm-build libopenssl-devel \ glib2-devel libXtst-devel libxkbfile-devel qt6-base-devel qt6-tools-devel gtk3-devel \ googletest-devel googlemock-devel libei-devel \ - libportal-devel tomlplusplus-devel cli11-devel + libportal-devel tomlplusplus-devel cli11-devel help2man elif [ ${{ inputs.like }} == "arch" ]; then pacman -Syu --noconfirm base-devel cmake ninja \ gcc openssl glib2 libxtst libxkbfile gtest libei libportal \ - qt6-base qt6-tools gtk3 tomlplusplus cli11 + qt6-base qt6-tools gtk3 tomlplusplus cli11 help2man else echo "Unknown like" fi diff --git a/REUSE.toml b/REUSE.toml index 71529aeef..0cd9398f6 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -145,6 +145,12 @@ precedence = "override" SPDX-FileCopyrightText = "Deskflow Developers" SPDX-License-Identifier = "MIT" +[[annotations]] +path = "src/apps/res/manpage.txt" +precedence = "override" +SPDX-FileCopyrightText = "Deskflow Developers" +SPDX-License-Identifier = "MIT" + [[annotations]] path = "src/apps/res/icons/deskflow-**/**/**/**.svg" precedence = "override" diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt index 5617f4078..03d5eb2c2 100644 --- a/src/apps/CMakeLists.txt +++ b/src/apps/CMakeLists.txt @@ -3,6 +3,30 @@ # SPDX-FileCopyrightText: 2009 - 2012 Nick Bolton # SPDX-License-Identifier: MIT +if(UNIX AND NOT APPLE) + find_program(HELP2MAN help2man) + if(NOT HELP2MAN) + message(STATUS "Man page tool (help2man) not found, man pages will not be generated") + endif() +endif() + +function(generate_app_man TARGET) + if(HELP2MAN) + add_custom_command( + TARGET ${target} POST_BUILD + COMMAND ${HELP2MAN} + --include ${CMAKE_SOURCE_DIR}/src/apps/res/manpage.txt + --no-info + $ + -o $/${target}.1 + ) + install( + FILES $/${target}.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 + ) + endif() +endfunction() + option(BUILD_UNIFIED "Build unified binary" OFF) if(BUILD_UNIFIED) add_subdirectory(deskflow-core) diff --git a/src/apps/deskflow-client/CMakeLists.txt b/src/apps/deskflow-client/CMakeLists.txt index 113082805..98620ddc9 100644 --- a/src/apps/deskflow-client/CMakeLists.txt +++ b/src/apps/deskflow-client/CMakeLists.txt @@ -45,6 +45,7 @@ if(APPLE) ) elseif(UNIX) install(TARGETS ${target} DESTINATION bin) + generate_app_man(${target}) elseif(WIN32) install( TARGETS ${target} diff --git a/src/apps/deskflow-core/CMakeLists.txt b/src/apps/deskflow-core/CMakeLists.txt index a598bf699..d10b551bd 100644 --- a/src/apps/deskflow-core/CMakeLists.txt +++ b/src/apps/deskflow-core/CMakeLists.txt @@ -40,6 +40,7 @@ if(APPLE) ) elseif(UNIX) install(TARGETS ${target} DESTINATION bin) + generate_app_man(${target}) elseif(WIN32) install( TARGETS ${target} diff --git a/src/apps/deskflow-gui/CMakeLists.txt b/src/apps/deskflow-gui/CMakeLists.txt index f66fa9624..01419d0f8 100644 --- a/src/apps/deskflow-gui/CMakeLists.txt +++ b/src/apps/deskflow-gui/CMakeLists.txt @@ -84,4 +84,19 @@ elseif(APPLE) install(TARGETS ${target} BUNDLE DESTINATION .) else() install(TARGETS ${target} DESTINATION bin) + if(HELP2MAN) + configure_file(deskflow.man.template.in ${CMAKE_CURRENT_BINARY_DIR}/${target}) + add_custom_command( + TARGET ${target} POST_BUILD + COMMAND ${HELP2MAN} + --version-string "${CMAKE_PROJECT_VERSION}" + --include ${CMAKE_SOURCE_DIR}/src/apps/res/manpage.txt + --no-info ${CMAKE_CURRENT_BINARY_DIR}/${target} + -o ${CMAKE_CURRENT_BINARY_DIR}/${target}.1 + ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 + ) + endif() endif() diff --git a/src/apps/deskflow-gui/deskflow.man.template.in b/src/apps/deskflow-gui/deskflow.man.template.in new file mode 100755 index 000000000..9e00b6f3a --- /dev/null +++ b/src/apps/deskflow-gui/deskflow.man.template.in @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: Deskflow Developers +# SPDX-License-Identifier: MIT +#!/bin/sh -eu + +if [ "$1" = '--help' ]; then +cat << EOM +@CMAKE_PROJECT_DESCRIPTION@. This is the GUI. It takes no arguments or options. +EOM +fi diff --git a/src/apps/deskflow-server/CMakeLists.txt b/src/apps/deskflow-server/CMakeLists.txt index 81f3fe2d1..9e48c12fb 100644 --- a/src/apps/deskflow-server/CMakeLists.txt +++ b/src/apps/deskflow-server/CMakeLists.txt @@ -45,6 +45,7 @@ if(APPLE) ) elseif(UNIX) install(TARGETS ${target} DESTINATION bin) + generate_app_man(${target}) elseif(WIN32) install( TARGETS ${target} diff --git a/src/apps/res/manpage.txt b/src/apps/res/manpage.txt new file mode 100644 index 000000000..a03a0715c --- /dev/null +++ b/src/apps/res/manpage.txt @@ -0,0 +1,5 @@ +[SEE ALSO] +deskflow(1), deskflow-client(1), deskflow-server(2) + +All documentation is on the web, so please point your browser at + and surf away.