[client,sdl] add manpage

This commit is contained in:
Armin Novak 2023-12-14 14:13:53 +01:00 committed by akallabeth
parent 07d7d35731
commit c064d54cb1
14 changed files with 254 additions and 55 deletions

View File

@ -17,7 +17,7 @@
cmake_minimum_required(VERSION 3.13)
project(sdl-client CXX)
project(sdl-freerdp CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -104,10 +104,8 @@ add_executable(${PROJECT_NAME}
${SRCS}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
OUTPUT_NAME "sdl-freerdp"
)
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Client/SDL")
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
add_subdirectory(man)

View File

@ -0,0 +1,6 @@
set(DEPS
sdl-freerdp-channels.1.xml
sdl-freerdp-examples.1.xml
sdl-freerdp-envvar.1.xml
)
generate_and_install_freerdp_man_from_xml(sdl-freerdp.1 ${DEPS})

View File

@ -0,0 +1,15 @@
<refsect1>
<title>Environment variables</title>
<variablelist>
<varlistentry>
<term>wlog environment variable</term>
<listitem>
<para>sdl-freerdp uses wLog as its log facility, you can refer to the
corresponding man page (wlog(7)) for more informations. Arguments passed
via the <replaceable>/log-level</replaceable> or <replaceable>/log-filters</replaceable>
have precedence over the environment variables.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,95 @@
<refsect1>
<title>Examples</title>
<variablelist>
<varlistentry>
<term><command>sdl-freerdp connection.rdp /p:Pwd123! /f</command></term>
<listitem>
<para>Connect in fullscreen mode using a stored configuration <replaceable>connection.rdp</replaceable> and the password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:USER /size:50%h /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>USER</replaceable> and a size of <replaceable>50 percent of the height</replaceable>. If width (w) is set instead of height (h) like /size:50%w. 50 percent of the width is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>CONTOSO\\JohnDoe</replaceable> and password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489</command></term>
<listitem>
<para>Connect to host <replaceable>192.168.1.100</replaceable> on port <replaceable>4489</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable>. The screen width is set to <replaceable>1366</replaceable> and the height to <replaceable>768</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100</command></term>
<listitem>
<para>Establish a connection to host <replaceable>192.168.1.100</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable> and connect to Hyper-V console (use port 2179, disable negotiation) with VMID <replaceable>C824F53E-95D2-46C6-9A18-23A5BB403532</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>+clipboard</command></term>
<listitem>
<para>Activate clipboard redirection</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/drive:home,/home/user</command></term>
<listitem>
<para>Activate drive redirection of <replaceable>/home/user</replaceable> as home drive</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/smartcard:&lt;device&gt;</command></term>
<listitem>
<para>Activate smartcard redirection for device <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/printer:&lt;device&gt;,&lt;driver&gt;</command></term>
<listitem>
<para>Activate printer redirection for printer <replaceable>device</replaceable> using driver <replaceable>driver</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/serial:&lt;device&gt;</command></term>
<listitem>
<para>Activate serial port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/parallel:&lt;device&gt;</command></term>
<listitem>
<para>Activate parallel port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/sound:sys:alsa</command></term>
<listitem>
<para>Activate audio output redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/microphone:sys:alsa</command></term>
<listitem>
<para>Activate audio input redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/multimedia:sys:alsa</command></term>
<listitem>
<para>Activate multimedia redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/usb:id,dev:054c:0268</command></term>
<listitem>
<para>Activate USB device redirection for the device identified by <replaceable>054c:0268</replaceable></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "freerdp-argument.1.xml">
<!ENTITY channels SYSTEM "sdl-freerdp-channels.1.xml">
<!ENTITY envvar SYSTEM "sdl-freerdp-envvar.1.xml">
<!ENTITY examples SYSTEM "sdl-freerdp-examples.1.xml">
]
>
<refentry>
<refentryinfo>
<date>@MAN_TODAY@</date>
<author>
<authorblurb><para>The FreeRDP Team</para></authorblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>sdl-freerdp</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">freerdp</refmiscinfo>
<refmiscinfo class="manual">sdl-freerdp</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>sdl-freerdp</application></refname>
<refpurpose>FreeRDP X11 client</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>@MAN_TODAY@</date>
</refsynopsisdivinfo>
<para>
<command>sdl-freerdp</command> [file] [options] [/v:server[:port]]
</para>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>@MAN_TODAY@</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>sdl-freerdp</command> is an X11 Remote Desktop Protocol (RDP)
client which is part of the FreeRDP project. An RDP server is built-in
to many editions of Windows. Alternative servers included xrdp and VRDP (VirtualBox).
</para>
</refsect1>
&syntax;
&channels;
&envvar;
&examples;
<refsect1>
<title>LINKS</title>
<para>
<ulink url="http://www.freerdp.com/">http://www.freerdp.com/</ulink>
</para>
</refsect1>
</refentry>

View File

@ -43,7 +43,6 @@ include(ConfigureRPATH)
find_package(X11 REQUIRED)
include(FindDocBookXSL)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../resources)
include_directories(${X11_INCLUDE_DIRS})
include_directories(${OPENSSL_INCLUDE_DIR})
@ -113,52 +112,7 @@ set(LIBS
${X11_LIBRARIES}
)
if(WITH_MANPAGES)
find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
if (NOT DOCBOOKXSL_FOUND)
message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
endif()
# We need the variable ${MAN_TODAY} to contain the current date in ISO
# format to replace it in the configure_file step.
include(today)
TODAY(MAN_TODAY)
configure_file(xfreerdp.1.xml.in xfreerdp.1.xml @ONLY IMMEDIATE)
# Compile the helper tool with default compiler settings.
# We need the include paths though.
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
set(GENERATE_INCLUDES "")
foreach(dir ${dirs})
set(GENERATE_INCLUDES ${GENERATE_INCLUDES} -I${dir})
endforeach(dir)
add_custom_command(OUTPUT xfreerdp.1
COMMAND ${CMAKE_C_COMPILER} ${GENERATE_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}/generate_argument_docbook.c
-o ${CMAKE_CURRENT_BINARY_DIR}/generate_argument_docbook
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/generate_argument_docbook
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-envvar.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${XSLTPROC_EXECUTABLE} ${DOCBOOKXSL_DIR}/manpages/docbook.xsl xfreerdp.1.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-envvar.1.xml)
add_custom_target(xfreerdp.manpage ALL
DEPENDS xfreerdp.1)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1 1)
endif(WITH_MANPAGES)
add_subdirectory(man)
find_package(X11 REQUIRED)
if(X11_XShm_FOUND)

View File

@ -0,0 +1,6 @@
set(DEPS
xfreerdp-channels.1.xml
xfreerdp-examples.1.xml
xfreerdp-envvar.1.xml
)
generate_and_install_freerdp_man_from_xml(xfreerdp.1 ${DEPS})

View File

View File

@ -2,7 +2,7 @@
<!DOCTYPE refentry
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "xfreerdp-argument.1.xml">
<!ENTITY syntax SYSTEM "freerdp-argument.1.xml">
<!ENTITY channels SYSTEM "xfreerdp-channels.1.xml">
<!ENTITY envvar SYSTEM "xfreerdp-envvar.1.xml">
<!ENTITY examples SYSTEM "xfreerdp-examples.1.xml">

View File

@ -3,7 +3,7 @@
#include <ctype.h>
#include <string.h>
#include "../common/cmdline.h"
#include "../cmdline.h"
#define TAG FREERDP_TAG("generate_argument_docbook")
LPSTR tr_esc_str(LPCSTR arg, bool format)
@ -172,7 +172,7 @@ int main(int argc, char* argv[])
{
size_t elements = sizeof(global_cmd_args) / sizeof(global_cmd_args[0]);
size_t x;
const char* fname = "xfreerdp-argument.1.xml";
const char* fname = "freerdp-argument.1.xml";
FILE* fp = NULL;
/* Open output file for writing, truncate if existing. */
fp = fopen(fname, "w");

View File

@ -1,7 +1,69 @@
include(GNUInstallDirs)
include(FindDocBookXSL)
function(install_freerdp_man manpage section)
if(WITH_MANPAGES)
install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section})
endif()
endfunction()
function(generate_and_install_freerdp_man_from_xml manpage dependencies)
if(WITH_MANPAGES)
find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
if (NOT DOCBOOKXSL_FOUND)
message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
endif()
# We need the variable ${MAN_TODAY} to contain the current date in ISO
# format to replace it in the configure_file step.
include(today)
TODAY(MAN_TODAY)
configure_file(${manpage}.xml.in ${manpage}.xml @ONLY IMMEDIATE)
# Compile the helper tool with default compiler settings.
# We need the include paths though.
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
set(GENERATE_INCLUDES "")
foreach(dir ${dirs})
set(GENERATE_INCLUDES ${GENERATE_INCLUDES} -I${dir})
endforeach(dir)
set(dep_SRC)
set(deb_BIN)
foreach(dep ${dependencies})
set(cur_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${dep})
set(cur_BIN ${CMAKE_CURRENT_BINARY_DIR}/${dep})
list(APPEND dep_SRC ${cur_SRC})
list(APPEND dep_BIN ${cur_BIN})
add_custom_command(
OUTPUT ${cur_BIN}
COMMAND ${CMAKE_COMMAND} -E copy ${cur_SRC} ${cur_BIN}
DEPENDS ${cur_SRC}
VERBATIM
)
endforeach()
add_custom_command(
OUTPUT ${manpage}
COMMAND ${CMAKE_C_COMPILER} ${GENERATE_INCLUDES}
${CMAKE_SOURCE_DIR}/client/common/man/generate_argument_docbook.c
-o ${CMAKE_CURRENT_BINARY_DIR}/generate_argument_docbook
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/generate_argument_docbook
COMMAND ${XSLTPROC_EXECUTABLE} ${DOCBOOKXSL_DIR}/manpages/docbook.xsl ${manpage}.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${manpage}.xml
${dep_BIN}
)
add_custom_target(
${manpage}.manpage ALL
DEPENDS
${manpage}
)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} 1)
endif()
endfunction()