From cf4ea4c86b2023e3d1f9fa54b9e1dcf2fc27ef3d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 4 Jul 2017 16:00:13 -0400 Subject: [PATCH] Make asciidoc (and man pages) optional And remove it from the build --- .build.yml | 1 - .travis.yml | 1 - CMake/Manpage.cmake | 56 +++++++++++++++++++++-------------------- sway/CMakeLists.txt | 12 +++++---- sway/handlers.c | 8 ++++++ swaygrab/CMakeLists.txt | 4 ++- swaylock/CMakeLists.txt | 4 ++- swaymsg/CMakeLists.txt | 4 ++- 8 files changed, 53 insertions(+), 37 deletions(-) diff --git a/.build.yml b/.build.yml index 161c796a5..9c9e8adb5 100644 --- a/.build.yml +++ b/.build.yml @@ -10,7 +10,6 @@ packages: - cairo - wayland - gdk-pixbuf2 - - asciidoc sources: - https://git.sr.ht/~sircmpwn/sway tasks: diff --git a/.travis.yml b/.travis.yml index 2bb17d40d..696347657 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ arch: packages: - cmake - xorg-server-xwayland - - asciidoc - json-c - wayland - xcb-util-image diff --git a/CMake/Manpage.cmake b/CMake/Manpage.cmake index d9780bc41..cc04d710f 100644 --- a/CMake/Manpage.cmake +++ b/CMake/Manpage.cmake @@ -1,31 +1,33 @@ -find_package(A2X REQUIRED) +find_package(A2X) -add_custom_target(man ALL) +if (A2X_FOUND) + add_custom_target(man ALL) -function(add_manpage name section) - add_custom_command( - OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} - COMMAND ${A2X_COMMAND} - --no-xmllint - --doctype manpage - --format manpage - -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt - COMMENT Generating manpage for ${name}.${section} - ) + function(add_manpage name section) + add_custom_command( + OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + COMMAND ${A2X_COMMAND} + --no-xmllint + --doctype manpage + --format manpage + -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt + COMMENT Generating manpage for ${name}.${section} + ) - add_custom_target(man-${name}.${section} - DEPENDS - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} - ) - add_dependencies(man - man-${name}.${section} - ) + add_custom_target(man-${name}.${section} + DEPENDS + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + ) + add_dependencies(man + man-${name}.${section} + ) - install( - FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} - DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section} - COMPONENT documentation - ) -endfunction() + install( + FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section} + COMPONENT documentation + ) + endfunction() +endif() diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt index 981f8a071..bf0b2e7fe 100644 --- a/sway/CMakeLists.txt +++ b/sway/CMakeLists.txt @@ -93,8 +93,10 @@ endfunction() add_config(config config sway) add_config(00-defaults security.d/00-defaults sway/security.d) -add_manpage(sway 1) -add_manpage(sway 5) -add_manpage(sway-input 5) -add_manpage(sway-bar 5) -add_manpage(sway-security 7) +if (A2X_FOUND) + add_manpage(sway 1) + add_manpage(sway 5) + add_manpage(sway-input 5) + add_manpage(sway-bar 5) + add_manpage(sway-security 7) +endif() diff --git a/sway/handlers.c b/sway/handlers.c index 39261e3d0..052789ca9 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -1084,8 +1084,16 @@ bool handle_pointer_scroll(wlc_handle view, uint32_t time, const struct wlc_modi return EVENT_PASSTHROUGH; } +static void clip_test_cb(void *data, const char *type, int fd) { + const char *str = data; + write(fd, str, strlen(str)); + close(fd); +} + static void handle_wlc_ready(void) { sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); + const char *type = "text/plain;charset=utf-8"; + wlc_set_selection("test", &type, 1, &clip_test_cb); // Execute commands until there are none left config->active = true; while (config->cmd_queue->length) { diff --git a/swaygrab/CMakeLists.txt b/swaygrab/CMakeLists.txt index a5e91e9cd..42806caed 100644 --- a/swaygrab/CMakeLists.txt +++ b/swaygrab/CMakeLists.txt @@ -23,4 +23,6 @@ install( COMPONENT runtime ) -add_manpage(swaygrab 1) +if (A2X_FOUND) + add_manpage(swaygrab 1) +endif() diff --git a/swaylock/CMakeLists.txt b/swaylock/CMakeLists.txt index 4aec6424b..90b54a727 100644 --- a/swaylock/CMakeLists.txt +++ b/swaylock/CMakeLists.txt @@ -46,4 +46,6 @@ install( COMPONENT data ) -add_manpage(swaylock 1) +if (A2X_FOUND) + add_manpage(swaylock 1) +endif() diff --git a/swaymsg/CMakeLists.txt b/swaymsg/CMakeLists.txt index f23919b88..b428a409f 100644 --- a/swaymsg/CMakeLists.txt +++ b/swaymsg/CMakeLists.txt @@ -18,4 +18,6 @@ install( COMPONENT runtime ) -add_manpage(swaymsg 1) +if (A2X_FOUND) + add_manpage(swaymsg 1) +endif()