Adds support for Lua struct library so one can pack/unpack binary structures
[metze/wireshark/wip.git] / docbook / CMakeLists.txt
1 # CMakeLists.txt
2 #
3 # $Id$
4 #
5 # Wireshark - Network traffic analyzer
6 # By Gerald Combs <gerald@wireshark.org>
7 # Copyright 1998 Gerald Combs
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License
11 # as published by the Free Software Foundation; either version 2
12 # of the License, or (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #
23
24 find_package( FOP ) # Call before XSLTPROC
25 find_package( LYNX )
26 find_package( XSLTPROC )
27 find_package( XMLLINT )
28 find_package( ASCIIDOC )
29
30 set(WSUG_FILES
31         wsug_src/WSUG_app_files.xml
32         wsug_src/WSUG_app_howitworks.xml
33         wsug_src/WSUG_app_messages.xml
34         wsug_src/WSUG_app_protocols.xml
35         wsug_src/WSUG_app_tools.xml
36         wsug_src/WSUG_chapter_advanced.xml
37         wsug_src/WSUG_chapter_build_install.xml
38         wsug_src/WSUG_chapter_capture.xml
39         wsug_src/WSUG_chapter_customize.xml
40         wsug_src/WSUG_chapter_introduction.xml
41         wsug_src/WSUG_chapter_io.xml
42         wsug_src/WSUG_chapter_statistics.xml
43         wsug_src/WSUG_chapter_telephony.xml
44         wsug_src/WSUG_chapter_troubleshoot.xml
45         wsug_src/WSUG_chapter_use.xml
46         wsug_src/WSUG_chapter_work.xml
47         wsug_src/WSUG_meta_info.xml
48         wsug_src/WSUG_preface.xml
49         wsluarm.xml
50         ws.css
51 )
52
53 set(WSUG_GRAPHICS
54         wsug_graphics/ws-analyze-menu.png
55         wsug_graphics/ws-bytes-pane-tabs.png
56         wsug_graphics/ws-bytes-pane.png
57         wsug_graphics/ws-capture-info.png
58         wsug_graphics/ws-capture-interfaces.png
59         wsug_graphics/ws-capture-interfaces-win32.png
60         wsug_graphics/ws-capture-menu.png
61         wsug_graphics/ws-capture-options.png
62         wsug_graphics/ws-capture-options-remote-capture.png
63         wsug_graphics/ws-capture-options-remote-interface.png
64         wsug_graphics/ws-capture-options-remote-settings.png
65         wsug_graphics/ws-capture-preferences.png
66         wsug_graphics/ws-choose-color-rule.png
67         wsug_graphics/ws-coloring-fields.png
68         wsug_graphics/ws-coloring-rules-dialog.png
69         wsug_graphics/ws-column-header-popup-menu.png
70         wsug_graphics/ws-decode-as-show.png
71         wsug_graphics/ws-decode-as.png
72         wsug_graphics/ws-column-header-popup-menu.png
73         wsug_graphics/ws-details-pane-popup-menu.png
74         wsug_graphics/ws-details-pane.png
75         wsug_graphics/ws-display-filter-tcp.png
76         wsug_graphics/ws-edit-color-rule-dialog.png
77         wsug_graphics/ws-edit-menu.png
78         wsug_graphics/ws-enabled-protocols.png
79         wsug_graphics/ws-expert-colored-tree.png
80         wsug_graphics/ws-expert-column.png
81         wsug_graphics/ws-expert-infos.png
82         wsug_graphics/ws-export-objects.png
83         wsug_graphics/ws-export-pdml.png
84         wsug_graphics/ws-export-plain.png
85         wsug_graphics/ws-export-ps.png
86         wsug_graphics/ws-export-psml.png
87         wsug_graphics/ws-export-selected.png
88         wsug_graphics/ws-file-import.png
89         wsug_graphics/ws-file-menu.png
90         wsug_graphics/ws-file-set-dialog.png
91         wsug_graphics/ws-filter-add-expression.png
92         wsug_graphics/ws-filter-toolbar.png
93         wsug_graphics/ws-filters.png
94         wsug_graphics/ws-find-packet.png
95         wsug_graphics/ws-follow-stream.png
96         wsug_graphics/ws-go-menu.png
97         wsug_graphics/ws-goto-packet.png
98         wsug_graphics/ws-gui-colors-preferences.png
99         wsug_graphics/ws-gui-columns-preferences.png
100         wsug_graphics/ws-gui-config-profiles.png
101         wsug_graphics/ws-gui-font-preferences.png
102         wsug_graphics/ws-gui-layout-preferences.png
103         wsug_graphics/ws-gui-preferences.png
104         wsug_graphics/ws-help-menu.png
105         wsug_graphics/ws-internals-menu.png
106         wsug_graphics/ws-list-pane.png
107         wsug_graphics/ws-logo.png
108         wsug_graphics/ws-main-toolbar.png
109         wsug_graphics/ws-main.png
110         wsug_graphics/ws-menu.png
111         wsug_graphics/ws-merge-gtk20.png
112         wsug_graphics/ws-merge-gtk24.png
113         wsug_graphics/ws-merge-win32.png
114         wsug_graphics/ws-nameresolution-preferences.png
115         wsug_graphics/ws-open-gtk20.png
116         wsug_graphics/ws-open-gtk24.png
117         wsug_graphics/ws-open-win32.png
118         wsug_graphics/ws-packet-format.png
119         wsug_graphics/ws-packet-pane-popup-menu.png
120         wsug_graphics/ws-packet-range.png
121         wsug_graphics/ws-packet-selected.png
122         wsug_graphics/ws-packet-sep-win.png
123         wsug_graphics/ws-print.png
124         wsug_graphics/ws-printing-preferences.png
125         wsug_graphics/ws-save-as-gtk20.png
126         wsug_graphics/ws-save-as-gtk24.png
127         wsug_graphics/ws-save-as-win32.png
128         wsug_graphics/ws-statistics-menu.png
129         wsug_graphics/ws-stats-conversations.png
130         wsug_graphics/ws-stats-endpoints.png
131         wsug_graphics/ws-stats-hierarchy.png
132         wsug_graphics/ws-stats-iographs.png
133         wsug_graphics/ws-stats-srt-dcerpc-filter.png
134         wsug_graphics/ws-stats-srt-dcerpc.png
135         wsug_graphics/ws-stats-summary.png
136         wsug_graphics/ws-stats-lte-mac-traffic.png
137         wsug_graphics/ws-stats-lte-rlc-traffic.png
138         wsug_graphics/ws-stats-wlan-traffic.png
139         wsug_graphics/ws-statusbar-empty.png
140         wsug_graphics/ws-statusbar-loaded.png
141         wsug_graphics/ws-statusbar-selected.png
142         wsug_graphics/ws-telephony-menu.png
143         wsug_graphics/ws-time-reference.png
144         wsug_graphics/ws-tools-menu.png
145         wsug_graphics/ws-view-menu.png
146         wsug_graphics/note.png
147         wsug_graphics/tip.png
148         wsug_graphics/warning.png
149         wsug_graphics/toolbar/autoscroll_24.png
150         wsug_graphics/toolbar/capture_filter_24.png
151         wsug_graphics/toolbar/capture_interfaces_24.png
152         wsug_graphics/toolbar/capture_options_24.png
153         wsug_graphics/toolbar/capture_restart_24.png
154         wsug_graphics/toolbar/capture_start_24.png
155         wsug_graphics/toolbar/capture_stop_24.png
156         wsug_graphics/toolbar/colorize_24.png
157         wsug_graphics/toolbar/display_filter_24.png
158         wsug_graphics/toolbar/resize_columns_24.png
159         wsug_graphics/toolbar/stock_add_24.png
160         wsug_graphics/toolbar/stock_apply_20.png
161         wsug_graphics/toolbar/stock_bottom_24.png
162         wsug_graphics/toolbar/stock_clear_24.png
163         wsug_graphics/toolbar/stock_close_24.png
164         wsug_graphics/toolbar/stock_colorselector_24.png
165         wsug_graphics/toolbar/stock_help_24.png
166         wsug_graphics/toolbar/stock_jump_to_24.png
167         wsug_graphics/toolbar/stock_left_arrow_24.png
168         wsug_graphics/toolbar/stock_open_24.png
169         wsug_graphics/toolbar/stock_preferences_24.png
170         wsug_graphics/toolbar/stock_print_24.png
171         wsug_graphics/toolbar/stock_properties_24.png
172         wsug_graphics/toolbar/stock_refresh_24.png
173         wsug_graphics/toolbar/stock_right_arrow_24.png
174         wsug_graphics/toolbar/stock_save_24.png
175         wsug_graphics/toolbar/stock_save_as_24.png
176         wsug_graphics/toolbar/stock_search_24.png
177         wsug_graphics/toolbar/stock_stop_24.png
178         wsug_graphics/toolbar/stock_top_24.png
179         wsug_graphics/toolbar/stock_zoom_1_24.png
180         wsug_graphics/toolbar/stock_zoom_in_24.png
181         wsug_graphics/toolbar/stock_zoom_out_24.png
182 )
183
184 set(WSDG_FILES
185         wsdg_src/WSDG_chapter_build_intro.asciidoc
186         wsdg_src/WSDG_chapter_capture.asciidoc
187         wsdg_src/WSDG_chapter_dissection.asciidoc
188         wsdg_src/WSDG_chapter_env_intro.asciidoc
189         wsdg_src/WSDG_chapter_libraries.asciidoc
190         wsdg_src/WSDG_chapter_quick_setup.asciidoc
191         wsdg_src/WSDG_chapter_sources.asciidoc
192         wsdg_src/WSDG_chapter_tools.asciidoc
193         wsdg_src/WSDG_chapter_userinterface.asciidoc
194         wsdg_src/WSDG_chapter_works.asciidoc
195         wsdg_src/WSDG_preface.asciidoc
196         ws.css
197 )
198
199 set(WSDG_GRAPHICS
200         wsdg_graphics/ws-capture-sync.dia
201         wsdg_graphics/ws-capture-sync.png
202         wsdg_graphics/ws-capture_internals.dia
203         wsdg_graphics/ws-capture_internals.png
204         wsdg_graphics/ws-function-blocks.dia
205         wsdg_graphics/ws-function-blocks.png
206         wsdg_graphics/ws-logo.png
207         wsdg_graphics/note.png
208         wsdg_graphics/tip.png
209         wsdg_graphics/warning.png
210 )
211
212 # user-guide.xml must be first in the list
213 set(WSUG_SOURCE
214         user-guide.xml
215         git_version.xml
216         wsluarm
217         ${WSUG_FILES}
218         ${WSUG_GRAPHICS}
219 )
220
221 MACRO( ASCIIDOC2DOCBOOK _asciidocsource _conffile )
222         GET_FILENAME_COMPONENT( _source_base_name ${_asciidocsource} NAME_WE )
223         set( A2X_HTML_OPTS --stylesheet=ws.css )
224         set( _output_xml ${_source_base_name}.xml )
225         set( _output_dbk ${_source_base_name}.dbk )
226         ADD_CUSTOM_TARGET(${_output_xml}
227                 # XXX - Output to a specific directory, e.g. wsdg_generated_src
228                 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
229                 COMMAND ${A2X_EXECUTABLE}
230                         --verbose
231                         --attribute=docinfo
232                         --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
233                         --asciidoc-opts="--conf-file=${CMAKE_CURRENT_SOURCE_DIR}/${_conffile}"
234                         --no-xmllint
235                         --format=docbook
236                         --fop
237                         ${A2X_HTML_OPTS}
238                         ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
239                 DEPENDS
240                         ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
241                         ${CMAKE_CURRENT_SOURCE_DIR}/${_conffile}
242                         ${WSDG_GENERATED_FILES}
243         )
244 ENDMACRO()
245
246 ASCIIDOC2DOCBOOK( developer-guide.asciidoc asciidoc.conf )
247
248 SET( WSDG_GENERATED_FILES )
249 # Convert an AsciiDoc document to a DocBook chapter
250 # Used for chapter-by-chapter conversion from DocBook to AsciiDoc.
251 # Can be removed after the User's Guide is converted.
252 # .asciidoc -> whole book (.dbk) -> chapter (.xml)
253 MACRO( ASCIIDOC2CHAPTER _asciidocsource _conffile )
254         GET_FILENAME_COMPONENT( _source_base_name ${_asciidocsource} NAME_WE )
255         set( A2X_HTML_OPTS --stylesheet=ws.css )
256         set( _output_xml ${_source_base_name}.xml )
257         set( _output_dbk ${_source_base_name}.dbk )
258         ADD_CUSTOM_TARGET(${_output_xml}
259                 # XXX - Output to a specific directory, e.g. wsdg_generated_src
260                 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
261                 COMMAND ${A2X_EXECUTABLE}
262                         --verbose
263                         --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
264                         --asciidoc-opts="--conf-file=${CMAKE_CURRENT_SOURCE_DIR}/${_conffile}"
265                         --no-xmllint
266                         --fop
267                         --format=docbook --doctype=book
268                         ${A2X_HTML_OPTS}
269                         ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
270                 COMMAND mv
271                         ${_output_xml}
272                         ${_output_dbk}
273                 COMMAND ${XMLLINT_EXECUTABLE}
274                         --xpath '//chapter | //preface'
275                         ${_output_dbk}
276                         > ${_output_xml}
277                 DEPENDS
278                         ${_outptudir}
279         ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
280         ${CMAKE_CURRENT_SOURCE_DIR}/${_conffile}
281         )
282 LIST( APPEND WSDG_GENERATED_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_output_xml} )
283 ENDMACRO()
284
285 #FOREACH(ASCIIDOCFILE ${WSDG_ASCIIDOC_FILES})
286 #       ASCIIDOC2CHAPTER(
287 #               ${ASCIIDOCFILE}
288 #               asciidoc.conf
289 #       )
290 #ENDFOREACH()
291
292 #ADD_CUSTOM_TARGET( wsdg_generated_src DEPENDS ${WSDG_GENERATED_FILES} )
293
294 # developer-guide.xml must be first in the list
295 set(WSDG_SOURCE
296         developer-guide.xml
297         git_version.xml
298         ${WSDG_FILES}
299         ${WSDG_GRAPHICS}
300 )
301
302 set(WSLUA_MODULES
303         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_dumper.c
304         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_field.c
305         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_gui.c
306         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_int64.c
307         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_listener.c
308         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_pinfo.c
309         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_proto.c
310         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_tree.c
311         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_tvb.c
312         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_util.c
313         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_int64.c
314         ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_struct.c
315 )
316
317 ADD_CUSTOM_COMMAND(
318         OUTPUT
319                 git_version.xml
320         COMMAND ${SH}
321                 ${CMAKE_CURRENT_SOURCE_DIR}/check_git_version.sh
322         DEPENDS
323                 ${CMAKE_CURRENT_SOURCE_DIR}/check_git_version.sh
324 )
325
326 add_custom_target(
327         user_guides ALL
328         DEPENDS
329                 wsluarm
330                 wsug_html_chunked/index.html
331                 wsug_html/index.html
332                 user-guide-a4.pdf
333                 user-guide-us.pdf
334 )
335
336 VALIDATE_XML(
337         wsug.validated
338         WSUG_SOURCE
339 )
340
341 XML2HTML(
342         wsug.validated
343         wsug_html/index.html
344         single-page
345         WSUG_SOURCE
346         WSUG_GRAPHICS
347 )
348
349 XML2HTML(
350         wsug.validated
351         wsug_html_chunked/index.html
352         chunked
353         WSUG_SOURCE
354         WSUG_GRAPHICS
355 )
356
357 # 2do: Merge A4 and letter into the smallest dimension of each format.
358 #      Use   --stringparam  page.height <letter-height>mm --stringparam  page.width <at-width>mm
359 #      Test the effect of this on letter and a4 printers first (ps and non-ps).
360
361 XML2PDF(
362         user-guide-a4.pdf
363         WSUG_SOURCE
364         custom_layer_pdf.xsl
365         A4
366 )
367
368 XML2PDF(
369         user-guide-us.pdf
370         WSUG_SOURCE
371         custom_layer_pdf.xsl
372         letter
373 )
374
375 add_custom_target(
376         developer_guides ALL
377         DEPENDS
378                 wsluarm
379                 wsdg_html_chunked/index.html
380                 wsdg_html/index.html
381                 developer-guide-a4.pdf
382                 developer-guide-us.pdf
383 )
384
385 VALIDATE_XML(
386         wsdg.validated
387         WSDG_SOURCE
388 )
389
390 XML2HTML(
391         wsdg.validated
392         wsdg_html/index.html
393         single-page
394         WSDG_SOURCE
395         WSDG_GRAPHICS
396 )
397
398 XML2HTML(
399         wsdg.validated
400         wsdg_html_chunked/index.html
401         chunked
402         WSDG_SOURCE
403         WSDG_GRAPHICS
404 )
405
406 XML2PDF(
407         developer-guide-a4.pdf
408         WSDG_SOURCE
409         custom_layer_pdf.xsl
410         A4
411 )
412
413 XML2PDF(
414         developer-guide-us.pdf
415         WSDG_SOURCE
416         custom_layer_pdf.xsl
417         letter
418 )
419
420 # release_notes: release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf
421
422 add_custom_target(
423         release_notes ALL
424         DEPENDS
425                 release-notes.html
426                 release-notes.txt
427                 release-notes-a4.pdf
428                 release-notes-us.pdf
429                 ${CMAKE_SOURCE_DIR}/NEWS
430 )
431
432 ADD_CUSTOM_COMMAND(
433         OUTPUT
434                 ${CMAKE_SOURCE_DIR}/NEWS
435         COMMAND cp
436                 ${CMAKE_CURRENT_BINARY_DIR}/release-notes.txt
437                 ${CMAKE_SOURCE_DIR}/NEWS
438         DEPENDS
439                 ${CMAKE_CURRENT_BINARY_DIR}/release-notes.txt
440 )
441
442 ASCIIDOC2HTML(
443         release-notes.html
444         release-notes.asciidoc
445         asciidoc.conf
446 )
447
448 ASCIIDOC2TXT(
449         release-notes.txt
450         release-notes.asciidoc
451         asciidoc.conf
452 )
453
454 ASCIIDOC2PDF(
455         release-notes-a4.pdf
456         release-notes.asciidoc
457         asciidoc.conf
458         A4
459 )
460
461 ASCIIDOC2PDF(
462         release-notes-us.pdf
463         release-notes.asciidoc
464         asciidoc.conf
465         letter
466 )
467
468 # wsluarm
469 ADD_CUSTOM_COMMAND(
470         OUTPUT
471                 wsluarm
472         COMMAND cmake -E make_directory wsluarm_src
473         COMMAND ${PERL_EXECUTABLE}
474                 ${CMAKE_CURRENT_SOURCE_DIR}/make-wsluarm.pl
475                 ${WSLUA_MODULES}
476         COMMAND
477                 touch wsluarm
478         DEPENDS
479                 ${CMAKE_CURRENT_SOURCE_DIR}/make-wsluarm.pl
480                 ${WSLUA_MODULES}
481 )
482