From: <ai...@us...> - 2013-08-19 18:37:33
|
Revision: 12487 http://sourceforge.net/p/plplot/code/12487 Author: airwin Date: 2013-08-19 18:37:30 +0000 (Mon, 19 Aug 2013) Log Message: ----------- More changes to improve (i.e., make less obfuscated/more modular) the build system for the documentation in preparation for implementing XML backend tools. Tested by Alan W. Irwin <ai...@us...> using scripts/generate_website.sh (which includes using the -DBUILD_DOC=ON cmake option and the prebuild_dist www-install-base, and www-install targets, but which does not test the -DPREBUILT_DOC=ON case). Modified Paths: -------------- trunk/cmake/modules/docbook.cmake trunk/doc/docbook/src/CMakeLists.txt Modified: trunk/cmake/modules/docbook.cmake =================================================================== --- trunk/cmake/modules/docbook.cmake 2013-08-18 05:56:52 UTC (rev 12486) +++ trunk/cmake/modules/docbook.cmake 2013-08-19 18:37:30 UTC (rev 12487) @@ -141,10 +141,10 @@ if(NOT DVIPS) message(STATUS "WARNING: dvips not found") endif(NOT DVIPS) - # Use include style here since FindUnixCommands is a simple module and - # clearly not meant to be an official FindXXX module. - include(FindUnixCommands) - find_program(MKDIR mkdir) + find_program(GZIP gzip) + if(NOT GZIP) + message(STATUS "WARNING: gzip not found") + endif(NOT GZIP) # These DSSSL stylesheets needed for SGML/DSSSL builds. set(DSSSL_DTD_PUBID "-//James Clark//DTD DSSSL Style Sheet//EN") @@ -241,21 +241,16 @@ endif(DOCBOOK_XML_BACKEND) endif(BUILD_DOC) +# The "BASE" variables needed for www/documentation.php.in configuration and +# in doc/docbook/src/CMakeLists.txt. +# The "MANIFEST" variables needed in top-level CMakeLists.txt and +# in doc/docbook/src/CMakeLists.txt. if(BUILD_DOC OR PREBUILT_DOC) set(BASE "${PACKAGE}-${VERSION}") - - set(HTML_MANIFEST "HTML-MANIFEST") - set(BASE_HTML "${PACKAGE}-html-${VERSION}") - - if(NOT DEFINED HTML_EXT) - set(HTML_EXT "html") - endif(NOT DEFINED HTML_EXT) - set(INFO_MANIFEST "INFO-MANIFEST") set(BASE_INFO "${PACKAGE}-info-${VERSION}") - set(MAN_MANIFEST "MAN-MANIFEST") set(BASE_MAN "${PACKAGE}-man-${VERSION}") - - set(MANVOL "3plplot") + set(HTML_MANIFEST "HTML-MANIFEST") + set(BASE_HTML "${PACKAGE}-html-${VERSION}") endif(BUILD_DOC OR PREBUILT_DOC) Modified: trunk/doc/docbook/src/CMakeLists.txt =================================================================== --- trunk/doc/docbook/src/CMakeLists.txt 2013-08-18 05:56:52 UTC (rev 12486) +++ trunk/doc/docbook/src/CMakeLists.txt 2013-08-19 18:37:30 UTC (rev 12487) @@ -20,100 +20,111 @@ # along with PLplot; if not, write to the Free Software set(BINDIR ${CMAKE_CURRENT_SOURCE_DIR}/../bin) +set(PLPLOTDOC plplotdoc) +if(NOT DEFINED HTML_EXT) + set(HTML_EXT "html") +endif(NOT DEFINED HTML_EXT) +set(MANVOL "3plplot") foreach(suffix info html print) set(inline_entities ${CMAKE_CURRENT_SOURCE_DIR}/inline-${suffix}.ent) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/plplotdoc.xml.in - ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-${suffix}.xml + ${CMAKE_CURRENT_SOURCE_DIR}/${PLPLOTDOC}.xml.in + ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-${suffix}.xml ) endforeach(suffix info html print) set( -SOURCE_FILES -${CMAKE_CURRENT_SOURCE_DIR}/ada.xml -${CMAKE_CURRENT_SOURCE_DIR}/advanced.xml -${CMAKE_CURRENT_SOURCE_DIR}/api.xml -${CMAKE_CURRENT_SOURCE_DIR}/api-c.xml -${CMAKE_CURRENT_SOURCE_DIR}/api-compat.xml -${CMAKE_CURRENT_SOURCE_DIR}/api-fortran77.xml -${CMAKE_CURRENT_SOURCE_DIR}/api-fortran95.xml -${CMAKE_CURRENT_SOURCE_DIR}/api-internal.xml -${CMAKE_CURRENT_SOURCE_DIR}/api-obsolete.xml -${CMAKE_CURRENT_SOURCE_DIR}/bibliography.xml -${CMAKE_CURRENT_SOURCE_DIR}/c.xml -${CMAKE_CURRENT_SOURCE_DIR}/deploying.xml -${CMAKE_CURRENT_SOURCE_DIR}/fortran77.xml -${CMAKE_CURRENT_SOURCE_DIR}/fortran95.xml -${CMAKE_CURRENT_SOURCE_DIR}/cplus.xml -${CMAKE_CURRENT_SOURCE_DIR}/drivers.xml -${CMAKE_CURRENT_SOURCE_DIR}/gui.xml -${CMAKE_CURRENT_SOURCE_DIR}/intro.xml -${CMAKE_CURRENT_SOURCE_DIR}/libraries.xml -${CMAKE_CURRENT_SOURCE_DIR}/ocaml.xml -${CMAKE_CURRENT_SOURCE_DIR}/os_notes.xml -${CMAKE_CURRENT_SOURCE_DIR}/perl.xml -${CMAKE_CURRENT_SOURCE_DIR}/python.xml -${CMAKE_CURRENT_SOURCE_DIR}/simple.xml -${CMAKE_CURRENT_SOURCE_DIR}/tcl.xml -${CMAKE_CURRENT_SOURCE_DIR}/wish.xml -${CMAKE_CURRENT_SOURCE_DIR}/math.ent -) + SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/ada.xml + ${CMAKE_CURRENT_SOURCE_DIR}/advanced.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api-c.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api-compat.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api-fortran77.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api-fortran95.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api-internal.xml + ${CMAKE_CURRENT_SOURCE_DIR}/api-obsolete.xml + ${CMAKE_CURRENT_SOURCE_DIR}/bibliography.xml + ${CMAKE_CURRENT_SOURCE_DIR}/c.xml + ${CMAKE_CURRENT_SOURCE_DIR}/deploying.xml + ${CMAKE_CURRENT_SOURCE_DIR}/fortran77.xml + ${CMAKE_CURRENT_SOURCE_DIR}/fortran95.xml + ${CMAKE_CURRENT_SOURCE_DIR}/cplus.xml + ${CMAKE_CURRENT_SOURCE_DIR}/drivers.xml + ${CMAKE_CURRENT_SOURCE_DIR}/gui.xml + ${CMAKE_CURRENT_SOURCE_DIR}/intro.xml + ${CMAKE_CURRENT_SOURCE_DIR}/libraries.xml + ${CMAKE_CURRENT_SOURCE_DIR}/ocaml.xml + ${CMAKE_CURRENT_SOURCE_DIR}/os_notes.xml + ${CMAKE_CURRENT_SOURCE_DIR}/perl.xml + ${CMAKE_CURRENT_SOURCE_DIR}/python.xml + ${CMAKE_CURRENT_SOURCE_DIR}/simple.xml + ${CMAKE_CURRENT_SOURCE_DIR}/tcl.xml + ${CMAKE_CURRENT_SOURCE_DIR}/wish.xml + ${CMAKE_CURRENT_SOURCE_DIR}/math.ent + ) execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/jadetex.cfg ${CMAKE_CURRENT_BINARY_DIR}/jadetex.cfg -) + ) if( -PREBUILT_DOC -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} -) + PREBUILT_DOC + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} + ) + + # Copy pre-built documentation (whose filenames are contained in the + # files "static_built_files", ${INFO_MANIFEST}, ${MAN_MANIFEST}, and + # ${HTML_MANIFEST}) in the source tree to the build tree just as if + # it had been created there by the alternative BUILD_DOC=ON case. if(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") add_custom_target(copy_prebuiltdoc ALL) else(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - COMMAND cp - `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}` - ${CMAKE_BINARY_DIR}/doc/docbook/src - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/doc/docbook/src - ) + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + COMMAND cp + `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}` + ${CMAKE_BINARY_DIR}/doc/docbook/src + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/doc/docbook/src + ) add_custom_target( - copy_prebuiltdoc ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - ) + copy_prebuiltdoc ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + ) endif(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") - + if(ONSGMLS) set(VALIDATE_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/validate.out) # Custom target for validating xml file add_custom_target(validate - COMMAND ${ONSGMLS} ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-html.xml > ${VALIDATE_OUTPUT} - ) + COMMAND ${ONSGMLS} ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-html.xml > ${VALIDATE_OUTPUT} + ) add_dependencies(validate copy_prebuiltdoc) endif(ONSGMLS) else( -PREBUILT_DOC -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} -) + PREBUILT_DOC + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} + ) # Include this file in what is copied back from build tree to source tree # for the custom top-level prebuild_dist target. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - "static_built_files\n" - ) + "static_built_files\n" + ) - # The following files are defined as entities in plplotdoc.xml and are + # The following files are defined as entities in the various forms + # of the configured ${PLPLOTDOC}-*.xml files and are # used to help build the documentation. Of course, these files are # required for validation as well. # N.B. if PERL_FOUND is false, then BUILD_DOC is false. @@ -168,273 +179,332 @@ set(VALIDATE_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/validate.out) add_custom_target(validate - COMMAND ${ONSGMLS} ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-html.xml > ${VALIDATE_OUTPUT} - ) + COMMAND ${ONSGMLS} ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-html.xml > ${VALIDATE_OUTPUT} + ) add_dependencies(validate - docbook_plplot-symbols_txt - docbook_plplot-structs_txt - ) + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) else(ONSGMLS) add_custom_target(validate - ${CMAKE_COMMAND} -E echo "Unable to validate xml file - missing dependencies" - ) + ${CMAKE_COMMAND} -E echo "Unable to validate xml file - missing dependencies" + ) endif(ONSGMLS) # N.B. if PERL_FOUND is false, then BUILD_DOC is false. if(BUILD_DOC) - set(STYLESHEET_HTML plplotdoc-html.dsl) - set(STYLESHEET_PRINT plplotdoc-print.dsl) - set(STYLESHEET_HTML_IN ${STYLESHEET_HTML}.in) - set(STYLESHEET_PRINT_IN ${STYLESHEET_PRINT}.in) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${STYLESHEET_HTML_IN} - ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_HTML} - ) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${STYLESHEET_PRINT_IN} - ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} - ) + if(BUILD_INFO) + # Custom commands for building info version of documentation + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-clean.xml + COMMAND ${PERL_EXECUTABLE} + ${BINDIR}/info-clean.pl ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-info.xml > ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-clean.xml + DEPENDS + ${SOURCE_FILES} + ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-info.xml + ${CMAKE_CURRENT_SOURCE_DIR}/inline-info.ent + ) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/pdftex.map.in - ${CMAKE_CURRENT_BINARY_DIR}/pdftex.map - ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.txml + COMMAND ${CMAKE_COMMAND} -E echo "Note that no information is lost when \"too deep\" warning messages indicate" + COMMAND ${CMAKE_COMMAND} -E echo "where flat organization has replaced hierarchical organization." + COMMAND ${DB2X_XSLTPROC} + -s texi -o ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.txml ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-clean.xml + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-clean.xml + VERBATIM + ) - # Custom commands for building print version of documentation - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex - COMMAND ${OPENJADE} -b utf-8 - ${SGML_CATALOGS} -d ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} - -t tex -o ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex - ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-print.xml - DEPENDS - ${SOURCE_FILES} - ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-print.xml - ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} - ${CMAKE_CURRENT_SOURCE_DIR}/inline-print.ent - ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi + COMMAND ${DB2X_TEXIXML} --encoding=utf-8 ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.txml + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi_sed + COMMAND sed "s?The PLplot Plotting Library: (${PLPLOTDOC})?PLplot: (${PLPLOTDOC})?" < ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi > ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi_sed + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi + COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi_sed ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.txml + VERBATIM + ) - # Following approach used in our ABS, use shell commands to recurse - # ${PDFJADETEX} ${BASE}.jadetex five times or until the *.aux file that is - # produced doesn't change. - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.pdf - COMMAND ${PDFJADETEX} ${BASE}.jadetex - COMMAND - if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-pdf.aux \; - ${PDFJADETEX} ${BASE}.jadetex \; - fi - COMMAND - if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-pdf.aux \; - ${PDFJADETEX} ${BASE}.jadetex \; - fi - COMMAND - if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-pdf.aux \; - ${PDFJADETEX} ${BASE}.jadetex \; - fi - COMMAND - if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-pdf.aux \; - ${PDFJADETEX} ${BASE}.jadetex \; - fi - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex - ${CMAKE_CURRENT_SOURCE_DIR}/jadetex.cfg - ${CMAKE_CURRENT_BINARY_DIR}/pdftex.map - ) + set(INFO_TMPDIR ${CMAKE_CURRENT_BINARY_DIR}/info) - # Following approach used in our ABS, use shell commands to recurse - # ${JADETEX} ${BASE}.jadetex five times or until the *.aux file that is - # produced doesn't change. - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi - COMMAND ${JADETEX} ${BASE}.jadetex - COMMAND - if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-dvi.aux \; - ${JADETEX} ${BASE}.jadetex \; - fi - COMMAND - if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-dvi.aux \; - ${JADETEX} ${BASE}.jadetex \; - fi - COMMAND - if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-dvi.aux \; - ${JADETEX} ${BASE}.jadetex \; - fi - COMMAND - if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then - cp -pf ${BASE}.aux prior-dvi.aux \; - ${JADETEX} ${BASE}.jadetex \; - fi - # dependence on ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.pdf simply - # to serialize for parallel build case since both custom commands use - # the same *.aux files. - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex - ${CMAKE_CURRENT_SOURCE_DIR}/jadetex.cfg - ${CMAKE_CURRENT_BINARY_DIR}/pdftex.map - ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.pdf - ) + file(MAKE_DIRECTORY ${INFO_TMPDIR}) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.ps.gz - COMMAND ${DVIPS} ${BASE}.dvi - COMMAND ${GZIP} -f ${BASE}.ps - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi - ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} + COMMAND ${CMAKE_COMMAND} + -E remove -f ${INFO_TMPDIR}/* + COMMAND ${MAKEINFO} + --force -o ${INFO_TMPDIR}/${PLPLOTDOC}.info ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi + COMMAND ${CMAKE_COMMAND} + -E chdir ${INFO_TMPDIR} ls |cat > ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} + COMMAND mv + ${INFO_TMPDIR}/* ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}.texi + COMMAND rmdir ${INFO_TMPDIR} + ) - if(BUILD_PRINT) add_custom_target( - print ALL - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.pdf - ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.ps.gz - ) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - "${BASE}.jadetex\n" - "${BASE}.dvi\n" - "${BASE}.ps.gz\n" - "${BASE}.pdf\n" - ) + info ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} + ) # These files used for more than one target. Therefore must # use target dependencies rather than file dependencies to build # them. Otherwise, parallel builds won't work. - add_dependencies(print - docbook_plplot-symbols_txt - docbook_plplot-structs_txt + add_dependencies(info + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) + else(BUILD_INFO) + add_custom_target( + info ALL + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} + ) + endif(BUILD_INFO) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + "${INFO_MANIFEST}\n" ) - endif(BUILD_PRINT) - # Custom commands for building info version of documentation - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-clean.xml - COMMAND ${PERL_EXECUTABLE} - ${BINDIR}/info-clean.pl ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-info.xml > ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-clean.xml - DEPENDS - ${SOURCE_FILES} - ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-info.xml - ${CMAKE_CURRENT_SOURCE_DIR}/inline-info.ent - ) + if(BUILD_MAN) + # Custom commands for building man version of documentation - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.txml - COMMAND ${DB2X_XSLTPROC} - -s texi -o ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.txml ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-clean.xml - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-clean.xml - ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} + COMMAND ${PERL_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/../bin/api2man.pl ${PLPLOTDOC}-info.xml ${CMAKE_CURRENT_SOURCE_DIR}/api.xml ${MANVOL} > ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-info.xml + ${CMAKE_CURRENT_SOURCE_DIR}/inline-info.ent + ${CMAKE_CURRENT_SOURCE_DIR}/api.xml + ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi - COMMAND ${DB2X_TEXIXML} --encoding=utf-8 ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.txml - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi_raw - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi - COMMAND sed "s?The PLplot Plotting Library: (plplotdoc)?PLplot: (plplotdoc)?" < ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi_raw > ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.txml - VERBATIM - ) + add_custom_target( + man ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} + ) + else(BUILD_MAN) + add_custom_target( + man ALL + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} + ) + endif(BUILD_MAN) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + "${MAN_MANIFEST}\n" + ) - set(INFO_TMPDIR ${CMAKE_CURRENT_BINARY_DIR}/info) + if(BUILD_HTML) + # Custom commands for building html version of documentation - file(MAKE_DIRECTORY ${INFO_TMPDIR}) + set(STYLESHEET_HTML ${PLPLOTDOC}-html.dsl) + set(STYLESHEET_HTML_IN ${STYLESHEET_HTML}.in) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/${STYLESHEET_HTML_IN} + ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_HTML} + ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST} + COMMAND ${OPENJADE} -b utf-8 + ${SGML_CATALOGS} -d ${STYLESHEET_HTML} -t sgml ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-html.xml + COMMAND ${PERL_EXECUTABLE} + -pi -e 's/&\#13;//g' `cat ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST}` + DEPENDS + ${SOURCE_FILES} + ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-html.xml + ${CMAKE_CURRENT_SOURCE_DIR}/inline-html.ent + ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} - COMMAND ${CMAKE_COMMAND} - -E remove -f ${INFO_TMPDIR}/* - COMMAND ${MAKEINFO} - --force -o ${INFO_TMPDIR}/plplotdoc.info ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi - COMMAND ${CMAKE_COMMAND} - -E chdir ${INFO_TMPDIR} ls |cat > ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST} - COMMAND mv - ${INFO_TMPDIR}/* ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc.texi - COMMAND rmdir ${INFO_TMPDIR} - ) - - if(BUILD_INFO) add_custom_target( - info ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${INFO_MANIFEST}) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - "plplotdoc-clean.xml\n" - "plplotdoc.txml\n" - "plplotdoc.texi\n" - "${INFO_MANIFEST}\n" - ) + html ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST} + ) # These files used for more than one target. Therefore must # use target dependencies rather than file dependencies to build # them. Otherwise, parallel builds won't work. - add_dependencies(info - docbook_plplot-symbols_txt - docbook_plplot-structs_txt + add_dependencies(html + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) + else(BUILD_HTML) + add_custom_target( + html ALL + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST} + ) + endif(BUILD_HTML) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + "${HTML_MANIFEST}\n" ) - endif(BUILD_INFO) - # Custom commands for building man version of documentation + if(BUILD_PRINT) + set(STYLESHEET_PRINT ${PLPLOTDOC}-print.dsl) + set(STYLESHEET_PRINT_IN ${STYLESHEET_PRINT}.in) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} - COMMAND ${PERL_EXECUTABLE} - ${CMAKE_CURRENT_BINARY_DIR}/../bin/api2man.pl plplotdoc-info.xml ${CMAKE_CURRENT_SOURCE_DIR}/api.xml ${MANVOL} > ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST} - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-info.xml - ${CMAKE_CURRENT_SOURCE_DIR}/inline-info.ent - ${CMAKE_CURRENT_SOURCE_DIR}/api.xml - ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/${STYLESHEET_PRINT_IN} + ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} + ) - if(BUILD_MAN) - add_custom_target( - man ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MAN_MANIFEST}) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - "${MAN_MANIFEST}\n" - ) - endif(BUILD_MAN) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/pdftex.map.in + ${CMAKE_CURRENT_BINARY_DIR}/pdftex.map + ) - # Custom commands for building html version of documentation + # Custom commands for building print version of documentation + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex + COMMAND ${OPENJADE} -b utf-8 + ${SGML_CATALOGS} -d ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} + -t tex -o ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex + ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml + DEPENDS + ${SOURCE_FILES} + ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml + ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} + ${CMAKE_CURRENT_SOURCE_DIR}/inline-print.ent + ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST} - COMMAND ${OPENJADE} -b utf-8 - ${SGML_CATALOGS} -d ${STYLESHEET_HTML} -t sgml ${XML_DECL} ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-html.xml - COMMAND ${PERL_EXECUTABLE} - -pi -e 's/&\#13;//g' `cat ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST}` - DEPENDS - ${SOURCE_FILES} - ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-html.xml - ${CMAKE_CURRENT_SOURCE_DIR}/inline-html.ent - ) + # Following approach used in our ABS, use shell commands to recurse + # ${PDFJADETEX} ${BASE}.jadetex five times or until the *.aux file that is + # produced doesn't change. + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.pdf + COMMAND ${PDFJADETEX} ${BASE}.jadetex + COMMAND + if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-pdf.aux \; + ${PDFJADETEX} ${BASE}.jadetex \; + fi + COMMAND + if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-pdf.aux \; + ${PDFJADETEX} ${BASE}.jadetex \; + fi + COMMAND + if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-pdf.aux \; + ${PDFJADETEX} ${BASE}.jadetex \; + fi + COMMAND + if ! cmp ${BASE}.aux prior-pdf.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-pdf.aux \; + ${PDFJADETEX} ${BASE}.jadetex \; + fi + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex + ${CMAKE_CURRENT_SOURCE_DIR}/jadetex.cfg + ${CMAKE_CURRENT_BINARY_DIR}/pdftex.map + ) - if(BUILD_HTML) + # Following approach used in our ABS, use shell commands to recurse + # ${JADETEX} ${BASE}.jadetex five times or until the *.aux file that is + # produced doesn't change. + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi + COMMAND ${JADETEX} ${BASE}.jadetex + COMMAND + if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-dvi.aux \; + ${JADETEX} ${BASE}.jadetex \; + fi + COMMAND + if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-dvi.aux \; + ${JADETEX} ${BASE}.jadetex \; + fi + COMMAND + if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-dvi.aux \; + ${JADETEX} ${BASE}.jadetex \; + fi + COMMAND + if ! cmp ${BASE}.aux prior-dvi.aux 2>/dev/null \; then + cp -pf ${BASE}.aux prior-dvi.aux \; + ${JADETEX} ${BASE}.jadetex \; + fi + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.jadetex + ${CMAKE_CURRENT_SOURCE_DIR}/jadetex.cfg + ${CMAKE_CURRENT_BINARY_DIR}/pdftex.map + ) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.ps.gz + COMMAND ${DVIPS} ${BASE}.dvi + COMMAND ${GZIP} -f ${BASE}.ps + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi + ) + add_custom_target( - html ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${HTML_MANIFEST}) + dvi_target ALL + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi + ) + # These files used for more than one target. Therefore must + # use target dependencies rather than file dependencies to build + # them. Otherwise, parallel builds won't work. + add_dependencies(dvi_target + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files - "${HTML_MANIFEST}\n" - ) + "${BASE}.dvi\n" + ) + add_custom_target( + ps_target ALL + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.ps.gz + ) # These files used for more than one target. Therefore must # use target dependencies rather than file dependencies to build # them. Otherwise, parallel builds won't work. - add_dependencies(html - docbook_plplot-symbols_txt - docbook_plplot-structs_txt - ) - endif(BUILD_HTML) + add_dependencies(ps_target + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) + + # dvi_target must complete before ps_target is executed for parallel builds. + add_dependencies(ps_target dvi_target) + + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + "${BASE}.ps.gz\n" + ) + add_custom_target( + pdf_target ALL + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.pdf + ) + # These files used for more than one target. Therefore must + # use target dependencies rather than file dependencies to build + # them. Otherwise, parallel builds won't work. + add_dependencies(pdf_target + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) + + # dvi_target must complete before pdf_target is executed for parallel builds. + add_dependencies(pdf_target dvi_target) + + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + "${BASE}.pdf\n" + ) + add_custom_target( + print ALL + ) + add_dependencies(print dvi_target ps_target pdf_target) + + endif(BUILD_PRINT) endif(BUILD_DOC) endif( -PREBUILT_DOC -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} -AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} -) + PREBUILT_DOC + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} + ) ########### install files ############### @@ -481,18 +551,18 @@ endif(BUILD_INFO OR PREBUILT_DOC) # Everything below here has to do with the custom target www-install -if(BUILD_INFO OR PREBUILT_DOC) - if(WWW_USER) - set(TARBALL tarball.tgz) - set(HTML_TARBALL ${BASE_HTML}.tar.gz) - set(INFO_TARBALL ${BASE_INFO}.tar.gz) - set(MAN_TARBALL ${BASE_MAN}.tar.gz) +if((BUILD_DOC OR PREBUILT_DOC) AND (WWW_USER AND WWW_GROUP AND WWW_HOST AND WWW_DIR)) - set(WWW_USERAT ${WWW_USER}@) - set(RCP_PREFIX ${WWW_USERAT}${WWW_HOST}:) - set(RSH_COMMAND ${RSH} ${WWW_USERAT}${WWW_HOST}) + set(TARBALL tarball.tgz) + set(HTML_TARBALL ${BASE_HTML}.tar.gz) + set(INFO_TARBALL ${BASE_INFO}.tar.gz) + set(MAN_TARBALL ${BASE_MAN}.tar.gz) - add_custom_command( + set(WWW_USERAT ${WWW_USER}@) + set(RCP_PREFIX ${WWW_USERAT}${WWW_HOST}:) + set(RSH_COMMAND ${RSH} ${WWW_USERAT}${WWW_HOST}) + + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${HTML_TARBALL} COMMAND rm -rf ${BASE_HTML} COMMAND mkdir ${BASE_HTML} @@ -503,7 +573,7 @@ DEPENDS ${HTML_MANIFEST} ${CMAKE_CURRENT_SOURCE_DIR}/stylesheet.css ) - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${INFO_TARBALL} COMMAND rm -rf ${BASE_INFO} COMMAND mkdir ${BASE_INFO} @@ -513,7 +583,7 @@ DEPENDS ${INFO_MANIFEST} ) - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MAN_TARBALL} COMMAND rm -rf ${BASE_MAN} COMMAND mkdir ${BASE_MAN} @@ -523,7 +593,7 @@ DEPENDS ${MAN_MANIFEST} ) - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL} COMMAND tar cfz ${TARBALL} ${HTML_TARBALL} @@ -543,12 +613,14 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../COPYING ) - add_custom_target(www-uninstall COMMAND ${RSH_COMMAND} rm -rf ${WWW_DIR}/htdocs/docbook-manual) + add_custom_target(www-uninstall + COMMAND ${RSH_COMMAND} rm -rf ${WWW_DIR}/htdocs/docbook-manual + ) - add_custom_target( + add_custom_target( www-install COMMAND ${RSH_COMMAND} mkdir -p ${WWW_DIR}/htdocs/docbook-manual - COMMAND ${RCP} ${TARBALL} ${RCP_PREFIX}${WWW_DIR}/htdocs/docbook-manual + COMMAND ${RCP} ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL} ${RCP_PREFIX}${WWW_DIR}/htdocs/docbook-manual COMMAND ${RSH_COMMAND} tar xfz ${WWW_DIR}/htdocs/docbook-manual/${TARBALL} -C ${WWW_DIR}/htdocs/docbook-manual COMMAND ${RSH_COMMAND} tar xfz ${WWW_DIR}/htdocs/docbook-manual/${HTML_TARBALL} -C ${WWW_DIR}/htdocs/docbook-manual COMMAND ${RSH_COMMAND} chgrp -R ${WWW_GROUP} ${WWW_DIR}/htdocs/docbook-manual @@ -558,28 +630,27 @@ ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL} ) - if( + if( + PREBUILT_DOC + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} + ) + add_dependencies(www-install copy_prebuiltdoc www-uninstall) + else( + PREBUILT_DOC + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} + AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} + ) + add_dependencies(www-install www-uninstall) + endif( PREBUILT_DOC AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} ) - add_dependencies(www-install copy_prebuiltdoc www-uninstall) - else( - PREBUILT_DOC - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} - ) - add_dependencies(www-install www-uninstall) - endif( - PREBUILT_DOC - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/static_built_files - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${INFO_MANIFEST} - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_MANIFEST} - AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_MANIFEST} - ) - endif(WWW_USER) -endif(BUILD_INFO OR PREBUILT_DOC) +endif((BUILD_DOC OR PREBUILT_DOC) AND (WWW_USER AND WWW_GROUP AND WWW_HOST AND WWW_DIR)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |