| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  | set (ASCIIDOC_MANS | 
					
						
							|  |  |  |   man1/wsjtx.1.txt
 | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  |   man1/wsprd.1.txt
 | 
					
						
							| 
									
										
										
										
											2014-09-05 18:36:10 +00:00
										 |  |  |   man1/jt65code.1.txt
 | 
					
						
							| 
									
										
										
										
											2015-03-04 13:21:41 +00:00
										 |  |  |   man1/rigctl-wsjtx.1.txt
 | 
					
						
							| 
									
										
										
										
											2014-09-25 14:45:36 +00:00
										 |  |  |   man1/rigctld-wsjtx.1.txt
 | 
					
						
							| 
									
										
										
										
											2019-01-22 20:23:17 +00:00
										 |  |  |   man1/rigctlcom-wsjtx.1.txt
 | 
					
						
							| 
									
										
										
										
											2015-06-05 13:44:52 +00:00
										 |  |  |   man1/message_aggregator.1.txt
 | 
					
						
							| 
									
										
										
										
											2015-11-26 18:53:24 +00:00
										 |  |  |   man1/udp_daemon.1.txt
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | find_program (A2X_EXECUTABLE NAMES a2x a2x.py)
 | 
					
						
							|  |  |  | if (NOT A2X_EXECUTABLE)
 | 
					
						
							| 
									
										
										
										
											2014-04-20 12:46:34 +00:00
										 |  |  |   if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
					
						
							| 
									
										
										
										
											2014-04-21 11:49:20 +00:00
										 |  |  |     message (SEND_ERROR "Failed to find a2x which is an optional requirement for non-debug | 
					
						
							| 
									
										
										
										
											2014-04-21 11:38:17 +00:00
										 |  |  | builds on *nix platforms.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You can choose to skip manpage generation and this error by setting
 | 
					
						
							|  |  |  | the CMake option WSJT_SKIP_MANPAGES to ON. This option is designed for
 | 
					
						
							| 
									
										
										
										
											2014-04-21 11:49:20 +00:00
										 |  |  | those that are building for their own use, package builders should not
 | 
					
						
							|  |  |  | opt to skip manpage generation since package building requires the
 | 
					
						
							| 
									
										
										
										
											2014-04-21 11:38:17 +00:00
										 |  |  | manpages.")
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-20 12:46:34 +00:00
										 |  |  |   else (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
					
						
							|  |  |  |     message (WARNING "Failed to find a2x skipping manpage generation.")
 | 
					
						
							|  |  |  |   endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  | endif ()
 | 
					
						
							|  |  |  | find_program (GZIP_EXECUTABLE NAMES gzip)
 | 
					
						
							|  |  |  | find_program (SED_EXECUTABLE NAMES sed)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | set (XSLTPROC_OPTS  | 
					
						
							|  |  |  |   "-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0"
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | set (A2X_OPTS | 
					
						
							|  |  |  |   --format=manpage
 | 
					
						
							|  |  |  |   --xsltproc-opts=${XSLTPROC_OPTS}
 | 
					
						
							|  |  |  |   --doctype=manpage
 | 
					
						
							|  |  |  |   --no-xmllint
 | 
					
						
							| 
									
										
										
										
											2015-06-05 11:33:56 +00:00
										 |  |  |   -a VERSION=${wsjtx_VERSION}
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | set (MANPAGES)
 | 
					
						
							| 
									
										
										
										
											2014-04-20 12:46:34 +00:00
										 |  |  | if (A2X_EXECUTABLE AND GZIP_EXECUTABLE AND SED_EXECUTABLE)
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |   foreach (f IN LISTS ASCIIDOC_MANS)
 | 
					
						
							|  |  |  |     get_filename_component (d "${f}" PATH)
 | 
					
						
							|  |  |  |     string (SUBSTRING "${d}" 3 -1 section)
 | 
					
						
							|  |  |  |     if (NOT section MATCHES "[1-9]")
 | 
					
						
							|  |  |  |       message (SEND_ERROR "Invalid man section ${section} in ${f}")
 | 
					
						
							|  |  |  |     endif (NOT section MATCHES "[1-9]")
 | 
					
						
							| 
									
										
										
										
											2014-10-09 04:15:01 +00:00
										 |  |  |     get_filename_component (filename "${f}" NAME)
 | 
					
						
							|  |  |  |     get_filename_component (filename_we "${f}" NAME_WE)
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |     set (f "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
 | 
					
						
							|  |  |  |     set (d "man/${d}")
 | 
					
						
							| 
									
										
										
										
											2014-10-09 04:15:01 +00:00
										 |  |  |     set (o "${d}/${filename_we}.${section}.gz")
 | 
					
						
							|  |  |  |     add_custom_command (OUTPUT "${o}" | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |       COMMAND ${CMAKE_COMMAND} ARGS -E make_directory "${d}"
 | 
					
						
							| 
									
										
										
										
											2014-10-09 04:15:01 +00:00
										 |  |  |       COMMAND ${CMAKE_COMMAND} ARGS -E copy "${f}" "${d}"
 | 
					
						
							|  |  |  |       COMMAND ${A2X_EXECUTABLE} ARGS ${A2X_OPTS} "${d}/${filename}"
 | 
					
						
							|  |  |  |       COMMAND ${CMAKE_COMMAND} ARGS -E remove "${d}/${filename}"
 | 
					
						
							| 
									
										
										
										
											2014-09-27 19:38:21 +00:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2014-10-11 16:20:49 +00:00
										 |  |  | # the following edit command is used to make the alias manpages
 | 
					
						
							|  |  |  | # compatible with Debian packaging rules when a2x generates alias
 | 
					
						
							|  |  |  | # pages baseed in the section directory instead of the man parent
 | 
					
						
							|  |  |  | # directory
 | 
					
						
							| 
									
										
										
										
											2014-09-27 19:38:21 +00:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2014-10-11 16:20:49 +00:00
										 |  |  |       COMMAND ${SED_EXECUTABLE} ARGS -e '/^.so [^\\/]*$$/s@.so @&man${section}\\/@' -i.orig "${d}/*.${section}"
 | 
					
						
							| 
									
										
										
										
											2014-04-20 12:46:34 +00:00
										 |  |  |       COMMAND ${GZIP_EXECUTABLE} ARGS -f9 "${d}/*.${section}"
 | 
					
						
							| 
									
										
										
										
											2014-10-09 04:15:01 +00:00
										 |  |  |       DEPENDS "${f}" "${previous_output}"
 | 
					
						
							|  |  |  |       COMMENT "Generating ${o}"
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |       )
 | 
					
						
							| 
									
										
										
										
											2014-10-09 04:15:01 +00:00
										 |  |  |     list (APPEND MANPAGES "${o}")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # use this as a dependency in the next iteration to serialize so
 | 
					
						
							|  |  |  |     # that gzips don't overlap in parallel builds
 | 
					
						
							|  |  |  |     set (previous_output "${o}")
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |   endforeach ()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   install ( | 
					
						
							| 
									
										
										
										
											2017-03-28 13:03:48 +00:00
										 |  |  |     DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man/
 | 
					
						
							|  |  |  |     DESTINATION ${CMAKE_INSTALL_MANDIR}
 | 
					
						
							| 
									
										
										
										
											2014-04-20 14:28:02 +00:00
										 |  |  |     PATTERN "*.orig" EXCLUDE
 | 
					
						
							| 
									
										
										
										
											2014-04-21 12:21:44 +00:00
										 |  |  |     #COMPONENT Runtime
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  |     )
 | 
					
						
							| 
									
										
										
										
											2014-04-20 12:46:34 +00:00
										 |  |  | endif (A2X_EXECUTABLE AND GZIP_EXECUTABLE AND SED_EXECUTABLE)
 | 
					
						
							| 
									
										
										
										
											2014-04-20 02:39:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | add_custom_target (manpages DEPENDS ${MANPAGES})
 |