* Gzip and install man pages

This commit is contained in:
Félix C. Morency 2008-06-16 18:59:49 -07:00 committed by Julien Danjou
parent d3a93645d6
commit b14a18c781
2 changed files with 30 additions and 8 deletions

View File

@ -78,24 +78,37 @@ SET( AWE_MAN_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/awesome.1.txt
${CMAKE_CURRENT_SOURCE_DIR}/awesome-client.1.txt
${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.5.txt
)
SET( AWE_MAN1_NAME ${CMAKE_CURRENT_BINARY_DIR}/awesome.1.gz
${CMAKE_CURRENT_BINARY_DIR}/awesome-client.1.gz )
SET( AWE_MAN5_NAME ${CMAKE_CURRENT_BINARY_DIR}/awesomerc.5.gz )
IF( AWESOME_GENERATE_MAN )
FOREACH( txtfile ${AWE_MAN_SRCS})
STRING( REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile} )
STRING( REGEX REPLACE ".xml\$" "" manfile ${xmlfile} )
STRING( REGEX REPLACE ".xml\$" ".gz" gzipman ${xmlfile} )
STRING( REPLACE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} gzipman ${gzipman} )
STRING( REGEX REPLACE ".gz\$" "" manfile ${gzipman} )
ADD_CUSTOM_COMMAND( OUTPUT ${xmlfile}
COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} ${txtfile}
DEPENDS ${txtfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
ADD_CUSTOM_COMMAND( OUTPUT ${manfile}
COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
DEPENDS ${xmlfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
SET( AWE_MAN_FILES ${AWE_MAN_FILES} ${manfile} )
ADD_CUSTOM_COMMAND( OUTPUT ${gzipman}
COMMAND ${GZIP_EXECUTABLE} -f ${manfile}
DEPENDS ${manfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
SET( AWE_MAN_FILES ${AWE_MAN_FILES} ${gzipman} )
ENDFOREACH( txtfile)
ADD_CUSTOM_TARGET( man ALL DEPENDS ${AWE_MAN_FILES} )
ADD_CUSTOM_TARGET( man ALL DEPENDS ${AWE_MAN_FILES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
ENDIF( AWESOME_GENERATE_MAN )
ADD_EXECUTABLE( ${PROJECT_AWE_NAME} ${AWE_SRCS} )
@ -125,6 +138,14 @@ INSTALL( FILES ${AWE_CONF_FILES}
DESTINATION ${AWESOME_CONF_PATH}
)
INSTALL( FILES ${AWE_MAN1_NAME}
DESTINATION ${AWESOME_MAN1_PATH}
)
INSTALL( FILES ${AWE_MAN5_NAME}
DESTINATION ${AWESOME_MAN5_PATH}
)
INSTALL( DIRECTORY ${AWE_ICON_PATH}
DESTINATION ${AWESOME_ICON_PATH}
)

View File

@ -81,12 +81,11 @@ ENDIF ( DOXYGEN_EXECUTABLE )
# Check for programs needed for man pages
FIND_PROGRAM( ASCIIDOC_EXECUTABLE asciidoc )
FIND_PROGRAM( XMLTO_EXECUTABLE xmlto )
FIND_PROGRAM( GZIP_EXECUTABLE gzip )
IF( ASCIIDOC_EXECUTABLE )
IF( XMLTO_EXECUTABLE )
IF( ASCIIDOC_EXECUTABLE AND XMLTO_EXECUTABLE AND GZIP_EXECUTABLE )
SET( AWESOME_GENERATE_MAN TRUE )
ENDIF( XMLTO_EXECUTABLE )
ENDIF( ASCIIDOC_EXECUTABLE )
ENDIF( ASCIIDOC_EXECUTABLE AND XMLTO_EXECUTABLE AND GZIP_EXECUTABLE )
# Set awesome informations and path
SET( AWESOME_VERSION_INTERNAL devel )
@ -99,6 +98,8 @@ SET( AWESOME_SHARE ${CMAKE_INSTALL_PREFIX}/share )
SET( AWESOME_LUA_LIB_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib )
SET( AWESOME_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/icons )
SET( AWESOME_CONF_PATH ${AWESOME_ETC}/${PROJECT_AWE_NAME} )
SET( AWESOME_MAN1_PATH /usr/share/man/man1 )
SET( AWESOME_MAN5_PATH /usr/share/man/man5 )
# Configure awesome config.h from template
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in