CMake: Install the HTML guides.

Add a "FileInstall.cmake" module that installs files and directories.
Use it to install the chunked HTML guides.

Install the guides into CMAKE_INSTALL_FULL_DOCDIR. By default this is
/usr/local/share/doc/Wireshark. Define DOC_DIR to match.

Add explicit file and directory permissions to the default install
targets.

Remove the PDF install target.

Bug: 14258
Change-Id: I4712a4047a54627b7520b5bf5f191e0761d19606
Reviewed-on: https://code.wireshark.org/review/25737
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2018-02-11 14:34:04 -08:00 committed by Anders Broman
parent d1ce1baf63
commit 9cc4a3b967
5 changed files with 63 additions and 23 deletions

View File

@ -1415,11 +1415,6 @@ foreach(_plugin_src_dir ${PLUGIN_SRC_DIRS})
add_subdirectory( ${_plugin_src_dir} )
endforeach()
# Basedir where to install guides
set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
message(STATUS "docdir: ${DOC_DIR}")
if(ENABLE_PCAP_NG_DEFAULT)
set(PCAP_NG_DEFAULT 1)
endif()
@ -3049,6 +3044,10 @@ set_source_files_properties(
install(
FILES
${INSTALL_FILES}
PERMISSIONS
OWNER_WRITE OWNER_READ
GROUP_READ
WORLD_READ
DESTINATION
${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
)
@ -3113,12 +3112,16 @@ install(
install(
DIRECTORY
${INSTALL_DIRS}
DESTINATION
${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
FILE_PERMISSIONS
OWNER_WRITE OWNER_READ
GROUP_READ
WORLD_READ
DIRECTORY_PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
DESTINATION
${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
PATTERN ".git" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "Makefile.*" EXCLUDE
@ -3141,22 +3144,6 @@ install(
${CMAKE_INSTALL_MODULES_DIR}
)
if(DOC_DIR)
message(STATUS "Docdir install: ${DOC_DIR}")
INSTALL(
DIRECTORY
${CMAKE_BINARY_DIR}/docbook/
DIRECTORY_PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
DESTINATION
${DOC_DIR}/guides
FILES_MATCHING
PATTERN "*.pdf"
)
endif()
# Test suite wrapper
if(ENABLE_APPLICATION_BUNDLE)
set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run)

View File

@ -0,0 +1,33 @@
# FileInstall - Install files and directories separately from the
# "install" command.
#
# Usage:
# cmake -P /path/to/FileInstall.cmake [source ...] [destination]
# Params are
# cmake -P /path/to/hhc.cmake "/path/to/hhc.exe" project.hhp
math(EXPR _dest_idx "${CMAKE_ARGC} - 1")
set(_destination ${CMAKE_ARGV${_dest_idx}})
set(_sources)
math(EXPR _last_src "${CMAKE_ARGC} - 2")
foreach(_src_idx RANGE 3 ${_last_src})
set(_sources ${_sources} ${CMAKE_ARGV${_src_idx}})
endforeach(_src_idx)
if (_sources AND _destination)
message (STATUS "Installing ${_sources} to ${_destination}")
file (INSTALL ${_sources}
DESTINATION ${_destination}
FILE_PERMISSIONS
OWNER_WRITE OWNER_READ
GROUP_READ
WORLD_READ
DIRECTORY_PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
)
else()
message (FATAL_ERROR "Missing arguments. Sources: ${_sources}. Destination: ${_destination}.")
endif()

View File

@ -78,6 +78,7 @@ set(WSUG_TOOLS_HELP_COMMANDS
# being able to build our documentation.
set(WSUG_TOOLS_HELP_FILES)
set(WSUG_TOOLS_PHONY_DEPS)
set(GUIDE_INSTALL_DIRS)
# General help output
foreach(th_command ${WSUG_TOOLS_HELP_COMMANDS})
@ -424,6 +425,7 @@ if(ASCIIDOCTOR_EXECUTABLE AND XSLTPROC_EXECUTABLE)
)
set_docbook_target_properties(user_guide_html)
add_dependencies(user_guides user_guide_html)
list(APPEND GUIDE_INSTALL_DIRS ${CMAKE_CURRENT_BINARY_DIR}/wsug_html_chunked)
endif()
if(ASCIIDOCTOR_EXECUTABLE)
@ -475,6 +477,7 @@ if(ASCIIDOCTOR_EXECUTABLE AND XSLTPROC_EXECUTABLE)
)
set_docbook_target_properties(developer_guide_html)
add_dependencies(developer_guides developer_guide_html)
list(APPEND GUIDE_INSTALL_DIRS ${CMAKE_CURRENT_BINARY_DIR}/wsdg_html_chunked)
endif()
if(ASCIIDOCTOR_EXECUTABLE)
@ -501,6 +504,20 @@ if(WIN32 AND ASCIIDOCTOR_EXECUTABLE)
add_dependencies(developer_guides developer_guide_chm)
endif()
if (GUIDE_INSTALL_DIRS)
# The installation location and DOC_DIR in ui/help_url.c must
# match.
add_custom_target(install_guides
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_SOURCE_DIR}/cmake/modules/FileInstall.cmake
${GUIDE_INSTALL_DIRS}
${CMAKE_INSTALL_FULL_DOCDIR}
DEPENDS
user_guide_html developer_guide_html
)
set_docbook_target_properties(install_guides)
endif()
# release_notes: release-notes.html release-notes.txt
add_custom_target( release_notes_html DEPENDS release-notes.html )

View File

@ -107,6 +107,8 @@ if (HTML_HELP_COMPILER)
target_link_libraries(ui Htmlhelp.lib)
endif()
add_definitions(-DDOC_DIR="${CMAKE_INSTALL_FULL_DOCDIR}")
CHECKAPI(
NAME
ui-base

View File

@ -22,6 +22,7 @@
include $(top_srcdir)/Makefile.am.inc
# The installation location and DOC_DIR in ui/help_url.c must match.
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DDOC_DIR=\"$(docdir)\" \
$(GLIB_CFLAGS) $(PCAP_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) $(PORTAUDIO_INCLUDES)