Almost working out-of-tree builds for the documentation,
authorJörg Mayer <jmayer@loplof.de>
Thu, 25 Feb 2010 12:30:44 +0000 (12:30 -0000)
committerJörg Mayer <jmayer@loplof.de>
Thu, 25 Feb 2010 12:30:44 +0000 (12:30 -0000)
with a few hacks right now:
- The tip.png, warning.png and note.png images are missing from the
  pdfs and I have no idea how to tell fop how to find them.
- Disabling/enabling building the guides via option currently doesn't
  work (probably too many macros :-), so comment out the subdir instead.
- Right now, in order to build the devleopers guide we need to do the
  following in the source docbook directory:
  touch wsdg_graphics/toolbar/dummy.dummy

Apart from these: The build works with a pristine docbook dir
(svn status --no-ignore).

svn path=/trunk/; revision=32004

CMakeLists.txt
cmake/modules/FindFOP.cmake
cmake/modules/FindPOD.cmake
cmake/modules/FindXMLLINT.cmake
cmake/modules/FindXSLTPROC.cmake
docbook/CMakeLists.txt

index 5f59791808107fb8f1a40e6e98db2d51b35e1727..ff34f23a9b3a8e15d9c31d1027f7c9f0a4f4e358 100644 (file)
@@ -24,6 +24,7 @@
 project(Wireshark C)
 
 cmake_minimum_required(VERSION 2.6)
+set(CMAKE_BACKWARDS_COMPATIBILITY 2.6)
 
 #Where to find local cmake scripts
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
@@ -69,10 +70,11 @@ option(AUTOGEN_pidl      "Autogenerate pidl dissectors" OFF)
 option(DISABLE_WERROR   "Do not treat Warnings as errors" OFF)
 option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC (disables -Werror)" OFF)
 option(ENABLE_AIRPCAP   "Enable Airpcap support" ON)
+# todo
 option(ENABLE_STATIC     "Build a static version of Wireshark (not yet working)" OFF)
 option(ENABLE_PLUGINS    "Build with plugins" ON)
 # todo
-option(ENABLE_GUIDES     "Build Guides (not yet implemented)" OFF)
+option(ENABLE_GUIDES     "Build Guides" ON)
 
 option(ENABLE_ADNS       "Build with adns support" ON)
 option(ENABLE_PCRE       "Build with pcre support" ON)
@@ -355,9 +357,12 @@ add_subdirectory( wiretap )
 add_subdirectory( wsutil )
 
 if(ENABLE_GUIDES)
-       add_subdirectory( docbook )
+#      FIXME: Disabling the build via option currently doesn't work
+#      add_subdirectory( docbook )
 endif()
 
+find_package(POD)
+
 #Platform specific
 if(UNIX)
        set(WS_VAR_IMPORT "extern")
@@ -805,8 +810,6 @@ ADD_CUSTOM_COMMAND(
                tshark
 )
 
-find_package(POD)
-
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
index 1ec136149b50b06e12113cad5fe1f997e245303f..6383ad829d590516c6a9dab5c41faf723d299b45 100644 (file)
@@ -21,5 +21,9 @@ FIND_PROGRAM(FOP_EXECUTABLE
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(FOP DEFAULT_MSG FOP_EXECUTABLE)
 
+IF(${FOP_EXECUTABLE})
+       SET(FOP_OPTS -Xmx256m)
+       SET(FOP_EXECUTABLE FOP_OPTS=${FOP_OPTS} JAVA_OPTS=${FOP_OPTS} ${FOP_EXECUTABLE})
+ENDIF()
 MARK_AS_ADVANCED(FOP_EXECUTABLE)
 
index 63e3112fadb1b729aa5a3e127e19cdc282811208..59d8d81b3c79f603b02de69d21f5024f63d5e28d 100644 (file)
@@ -32,7 +32,7 @@ FIND_PROGRAM(POD2HTML_EXECUTABLE
 # handle the QUIETLY and REQUIRED arguments and set POD2HTML_FOUND to TRUE if
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(POD2HTML DEFAULT_MSG POD2MAN_EXECUTABLE POD2HTML_EXECUTABLE)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(POD DEFAULT_MSG POD2MAN_EXECUTABLE POD2HTML_EXECUTABLE)
 
 MARK_AS_ADVANCED(
        POD2MAN_EXECUTABLE
index f5ac6459e2ebe5191cfce90a83b82213fb3e4501..583868050afd3c59192671978df8628faf76b0d5 100644 (file)
@@ -25,24 +25,25 @@ MARK_AS_ADVANCED(XMLLINT_EXECUTABLE)
 
 # Validate XML
 MACRO(VALIDATE_XML _validated _sources)
-    message(STATUS "Source(s): ${${_sources}}")
     # FIXME: How do I extract the first element of a variable containing a
     # list of values? Isn't there a "cleaner" solution?
-    FOREACH(_source ${${_sources}})
+    # Oh, and I have no idea why I can't directly use _source instead of
+    # having to introduce _tmpsource.
+    FOREACH(_tmpsource ${${_sources}})
+       set(_source ${_tmpsource})
        BREAK()
     ENDFOREACH()
     ADD_CUSTOM_COMMAND(
-        OUTPUT
-          ${CMAKE_CURRENT_BINARY_DIR}/${_validated}
-        COMMAND ${XMLLINT_EXECUTABLE}
+       OUTPUT
+           ${_validated}
+       COMMAND ${XMLLINT_EXECUTABLE}
+         --path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src"
          --valid
          --noout
-         --path "${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_SOURCE_DIR}"
-          ${_source}
-        COMMAND touch
-          ${CMAKE_CURRENT_BINARY_DIR}/${_validated}
-        DEPENDS
-          ${_source}
-         svn_version.xml
+         ${_source}
+       COMMAND touch
+         ${_validated}
+       DEPENDS
+         ${${_sources}}
     )
 ENDMACRO(VALIDATE_XML)
index 1d18832da0c3cf6901726df103a2260d2f4f2f51..fbbb200ed4ea0cf768c3dcfaddf54053942e25cd 100644 (file)
@@ -25,91 +25,109 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XSLTPROC DEFAULT_MSG XSLTPROC_EXECUTABLE)
 
 MARK_AS_ADVANCED(XSLTPROC_EXECUTABLE)
 
+# Translate xml to html
 #XML2HTML(
-#       wsug.validated
-#       wsug_html/user-guide.html
-#       single-page
-#       wsug_html
-#       WSUG_SOURCE
-#       WSUG_GFX_SOURCE
+#        wsug.validated
+#        wsug_html/user-guide.html or wsub_html/index.html
+#        single-page or chunked
+#        WSUG_FILES
+#        WSUG_GRAPHICS
 #)
-
-# Translate xml to html
 MACRO(XML2HTML _validated _output _mode _xmlsources _gfxsources)
-    MESSAGE(STATUS "XML source(s): ${${_xmlsources}}")
-    MESSAGE(STATUS "GFX source(s): ${${_gfxsources}}")
-    
+    FOREACH(_tmpgfx ${${_gfxsources}})
+        set(_gfx ${_tmpgfx})
+        BREAK()
+    ENDFOREACH()
+    GET_FILENAME_COMPONENT(_GFXDIR ${_gfx} PATH)
     GET_FILENAME_COMPONENT(_OUTDIR ${_output} PATH)
+    SET(_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/${_OUTDIR})
+
     IF(${_mode} STREQUAL "chunked")
+       SET(_STYLESHEET "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl")
     ELSE() # single-page
+       SET(_STYLESHEET "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl")
     ENDIF()
 
+    # FIXME: How do I extract the first element of a variable containing a
+    # list of values? Isn't there a "cleaner" solution?
+    # Oh, and I have no idea why I can't directly use _source instead of
+    # having to introduce _tmpsource.
+    FOREACH(_tmpsource ${${_xmlsources}})
+        set(_source ${_tmpsource})
+        BREAK()
+    ENDFOREACH()
+
     ADD_CUSTOM_COMMAND(
         OUTPUT
             ${_output}
-        COMMAND
-            cmake -E make_directory ${_OUTDIR}
-        COMMAND
-            cmake -E copy ${${_gfxsources}} ${_OUTDIR}
-        COMMAND
-            cmake -E copy ws.css ${_OUTDIR}
+       # Fixme: find out about subdirs (i.e. toolbar) automatically 
+       #   so this works for wsdg as well.
+        COMMAND cmake
+           -E make_directory ${_OUTDIR}/${_GFXDIR}/toolbar
+        COMMAND cp
+           ${CMAKE_CURRENT_SOURCE_DIR}/${_GFXDIR}/*.* ${_OUTDIR}/${_GFXDIR}/
+        COMMAND cp
+           ${CMAKE_CURRENT_SOURCE_DIR}/${_GFXDIR}/toolbar/*.* ${_OUTDIR}/${_GFXDIR}/toolbar/
+        COMMAND cmake
+           -E copy ${CMAKE_CURRENT_SOURCE_DIR}/ws.css ${_OUTDIR}
+       COMMAND ${XSLTPROC_EXECUTABLE}
+           --path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src"
+           --stringparam base.dir ${_OUTDIR}/
+           --stringparam use.id.as.filename 1
+           --stringparam admon.graphics 1
+           --stringparam admon.graphics.path ${_GFXDIR}/
+           --stringparam section.autolabel 1
+           --stringparam section.label.includes.component.label 1
+           --stringparam html.stylesheet ws.css
+           --nonet
+            --output ${_output}
+           ${_STYLESHEET}
+           ${_source}
+       COMMAND chmod
+           -R og+rX ${_OUTDIR}
         DEPENDS
+           ${_validated}
             ${${_xmlsources}}
             ${${_gfxsources}}
     )
-#        mkdir -p wsug_html/wsug_graphics/toolbar
-#        cp wsug_graphics/*.* wsug_html/wsug_graphics
-#        cp wsug_graphics/toolbar/* wsug_html/wsug_graphics/toolbar
-#        cp ws.css wsug_html
-
-#        mkdir -p wsug_html_chunked/wsug_graphics/toolbar
-#        cp wsug_graphics/*.* wsug_html_chunked/wsug_graphics
-#        cp wsug_graphics/toolbar/* wsug_html_chunked/wsug_graphics/toolbar
-#        cp ws.css wsug_html_chunked
 ENDMACRO(XML2HTML)
 
-#wsug_html/user-guide.html: $(WSUG_SOURCE)
-#        @ echo --- WSUG - HTML SINGLE PAGE ---
-#        mkdir -p wsug_html/wsug_graphics/toolbar
-#        cp wsug_graphics/*.* wsug_html/wsug_graphics
-#        cp wsug_graphics/toolbar/* wsug_html/wsug_graphics/toolbar
-#        cp ws.css wsug_html
-#        $(XSLTPROC) --stringparam base.dir wsug_html/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< > $@
-#        -chmod -R og+rX wsug_html
-#
-
-#wsug_html_chunked/index.html: $(WSUG_SOURCE)
-#        @ echo --- WSUG - HTML CHUNKED ---
-#        mkdir -p wsug_html_chunked/wsug_graphics/toolbar
-#        cp wsug_graphics/*.* wsug_html_chunked/wsug_graphics
-#        cp wsug_graphics/toolbar/* wsug_html_chunked/wsug_graphics/toolbar
-#        cp ws.css wsug_html_chunked
-#        $(XSLTPROC) --stringparam base.dir wsug_html_chunked/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl $<
-#        -chmod -R og+rX wsug_html_chunked
 
 #XML2PDF(
-#       WSUG_SOURCE
-#       custom_layer_pdf.xsl
-#       A4
-#)
-#
-#XML2PDF(
-#       WSUG_SOURCE
-#       custom_layer_pdf.xsl
-#       letter
+#      user-guide-a4.fo or user-guide-us.fo
+#      WSUG_SOURCE
+#      custom_layer_pdf.xsl
+#      A4 or letter
 #)
+MACRO(XML2PDF _output _sources _stylesheet _paper)
+    # FIXME: How do I extract the first element of a variable containing a
+    # list of values? Isn't there a "cleaner" solution?
+    # Oh, and I have no idea why I can't directly use _source instead of
+    # having to introduce _tmpsource.
+    FOREACH(_tmpsource ${${_sources}})
+        set(_source ${_tmpsource})
+        BREAK()
+    ENDFOREACH()
 
-#user-guide-us.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl
-#ifdef FOP
-#        @ echo --- WSUG - PDF US PAPER ---
-#        $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
-#endif
-#
-## create pdf file (through XSL-FO), portrait pages on A4 paper
-## you will get lot's of errors, but that's ok
-#user-guide-a4.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl
-#ifdef FOP
-#        @ echo --- WSUG - PDF A4 PAPER ---
-#        $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
-#endif
+    ADD_CUSTOM_COMMAND(
+        OUTPUT
+            ${_output}
+       COMMAND ${XSLTPROC_EXECUTABLE}
+           --path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src"
+           --stringparam paper.type ${_paper}
+           --nonet
+           --output ${_output}.fo
+           ${_stylesheet}
+           ${_source}
+       # FIXME: The images for tip, warning and note (and maybe more of those)
+       #   are not found by fop. I have no idea why "system" images don't work
+       #   the way other images work.
+       COMMAND ${FOP_EXECUTABLE}
+           ${_output}.fo
+           ${_output}
+       DEPENDS
+           ${${_sources}}
+           ${_stylesheet}
+    )
+ENDMACRO(XML2PDF)
 
index 4d549027c29e1062513e3d8fa943f5e8a4a710ae..d46f97beca3f7464756020c7e75dab033b20b284 100644 (file)
@@ -233,7 +233,7 @@ set(WSLUA_MODULES
        ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_util.c
 )
 
-find_package( FOP )
+find_package( FOP ) # Call before XSLTPROC
 find_package( LYNX )
 find_package( XSLTPROC )
 find_package( XMLLINT )
@@ -248,13 +248,13 @@ ADD_CUSTOM_COMMAND(
 )
 
 add_custom_target(
-       guides ALL
+       user_guides ALL
        DEPENDS
-               wsug.validated
-#              wsug_html_chunked
-#              user-guide.html
-#              user-guide-a4.pdf
-#              user-guide-us.pdf
+               wsluarm
+               wsug_html_chunked/index.html
+               wsug_html/user-guide.html
+               user-guide-a4.pdf
+               user-guide-us.pdf
 )
 
 VALIDATE_XML(
@@ -266,43 +266,84 @@ XML2HTML(
        wsug.validated
        wsug_html/user-guide.html
        single-page
-       WSUG_FILES
+       WSUG_SOURCE
        WSUG_GRAPHICS
 )
 
-#XML2HTML(
-#      wsug.validated
-#      wsug_html_chunked/index.html
-#      chunked
-#      wsug_html_chunked
-#      WSUG_FILES
-#      WSUG_GRAPHICS
-#)
-#
-#XML2PDF(
-#      WSUG_SOURCE
-#      custom_layer_pdf.xsl
-#      A4
-#)
-#
-#XML2PDF(
-#      WSUG_SOURCE
-#      custom_layer_pdf.xsl
-#      letter
-#)
+XML2HTML(
+       wsug.validated
+       wsug_html_chunked/index.html
+       chunked
+       WSUG_SOURCE
+       WSUG_GRAPHICS
+)
+
+XML2PDF(
+       user-guide-a4.pdf
+       WSUG_SOURCE
+       custom_layer_pdf.xsl
+       A4
+)
 
-# wsdg: wsdg_html_chunked developer-guide.html developer-guide-a4.pdf developer-guide-us.pdf
+XML2PDF(
+       user-guide-us.pdf
+       WSUG_SOURCE
+       custom_layer_pdf.xsl
+       letter
+)
 
-# ...
+add_custom_target(
+       developer_guides ALL
+       DEPENDS
+               wsluarm
+               wsdg_html_chunked/index.html
+               wsdg_html/developer-guide.html
+               developer-guide-a4.pdf
+               developer-guide-us.pdf
+)
 
-# release_notes: release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf
+VALIDATE_XML(
+       wsdg.validated
+       WSDG_SOURCE
+)
+
+XML2HTML(
+       wsdg.validated
+       wsdg_html/developer-guide.html
+       single-page
+       WSDG_SOURCE
+       WSDG_GRAPHICS
+)
+
+XML2HTML(
+       wsdg.validated
+       wsdg_html_chunked/index.html
+       chunked
+       WSDG_SOURCE
+       WSDG_GRAPHICS
+)
+
+XML2PDF(
+       developer-guide-a4.pdf
+       WSDG_SOURCE
+       custom_layer_pdf.xsl
+       A4
+)
 
-# ...
+XML2PDF(
+       developer-guide-us.pdf
+       WSDG_SOURCE
+       custom_layer_pdf.xsl
+       letter
+)
+
+# release_notes: release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf
 
 # wsluarm
 ADD_CUSTOM_COMMAND(
        OUTPUT
          wsluarm
+       COMMAND cmake -E make_directory wsluarm_src
        COMMAND ${PERL_EXECUTABLE}
          ${CMAKE_CURRENT_SOURCE_DIR}/make-wsluarm.pl
          ${WSLUA_MODULES}
@@ -312,51 +353,4 @@ ADD_CUSTOM_COMMAND(
          ${CMAKE_CURRENT_SOURCE_DIR}/make-wsluarm.pl
          ${WSLUA_MODULES}
 )
-# ...
-
-
-# make-taps.pl depends on the current working directory
-# to find the dissector files (contents of taps file
-# depend on this actually, so just changing the paths
-# in these lists won't help).
-#ADD_CUSTOM_COMMAND(
-#    OUTPUT
-#      ${CMAKE_CURRENT_BINARY_DIR}/taps_wslua.c
-#      ${CMAKE_CURRENT_BINARY_DIR}/taps.txt
-#    COMMAND ${PERL_EXECUTABLE}
-#      ${CMAKE_CURRENT_SOURCE_DIR}/make-taps.pl
-#      ${CMAKE_CURRENT_SOURCE_DIR}/taps
-#      ${CMAKE_CURRENT_BINARY_DIR}/taps_wslua.c
-#      ${CMAKE_CURRENT_BINARY_DIR}/taps.txt
-#    WORKING_DIRECTORY
-#      ${CMAKE_CURRENT_SOURCE_DIR}
-#    DEPENDS
-#      ${CMAKE_CURRENT_SOURCE_DIR}/taps
-#      ${CMAKE_CURRENT_SOURCE_DIR}/make-taps.pl
-#      # Only here to add dependencies for the taps "source"files
-#      ${WSLUA_TAPS_USED}
-#)
-
-#ADD_CUSTOM_COMMAND(
-#    OUTPUT
-#      declare_wslua.h
-#      register_wslua.c
-#    COMMAND ${PERL_EXECUTABLE}
-#      ${CMAKE_CURRENT_SOURCE_DIR}/make-reg.pl
-#      ${WSLUA_MODULES}
-#    DEPENDS
-#      ${CMAKE_CURRENT_SOURCE_DIR}/make-reg.pl
-#      ${WSLUA_MODULES}
-#      # ${CMAKE_CURRENT_BINARY_DIR}/taps_wslua.c
-#)
-#
-
-#install(
-#    FILES
-#      console.lua
-#      dtd_gen.lua
-#      ${CMAKE_CURRENT_BINARY_DIR}/init.lua
-#    DESTINATION
-#      ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
-#)