Snort 3: Add --disable-txt-docs option to configure_cmake.sh patches
Y M via Snort-devel <[email protected]> Fri, 16 Mar 2018 14:32:56 +0000
| Newsgroups | gmane.comp.security.ids.snort.devel |
|---|---|
| Message-ID | <CY1PR17MB0362E228F23417E2AB82BF7DA8D70@CY1PR17MB0362.namprd17.prod.outlook.com> |
Hi, The attached patch files will add a new option --disable-txt-docs to the configure_cmake.sh script, and wrap the generation of Snort $prefix/doc/* in doc/CMakeList.txt with logic to check if the new option is set. If the option is used, the text files and the $prefix/doc directory will not be generated. This is possible thanks to the existing logic to handle MAKE_TEXT_DOC. This change stems from the fact that the scripts: doc/scripts/generate_help.sh, doc/scripts/generate_list.sh, and doc/scripts/generate_module.sh use bash "#!/usr/bin/env bash" for the shell. On a pristine FreeBSD image or in cases bash is not installed, the make script will fail with the below error with no obvious way on how to proceed with compiling Snort 3. This occurs in Snort builds 243 and 244. Scanningdependencies of target codecs [ 97%] Building CXX object src/codecs/CMakeFiles/codecs.dir/codec_api.cc.o [ 98%] Linking CXX static library libcodecs.a [ 98%] Built target codecs Scanning dependencies of target snort [ 98%] Building CXX object src/CMakeFiles/snort.dir/main.cc.o [ 98%] Linking CXX executable snort [ 98%] Built target snort Scanning dependencies of target all_built_sources [ 98%] Documents: building counts.txt with [ 98%] Documents: building modules.txt with [ 98%] Documents: building plugins.txt with [ 98%] Documents: building signals.txt with [ 98%] Documents: building builtin.txt with [ 98%] Documents: building options.txt with [ 98%] Documents: building config.txt with env: bash: No such file or directory --- doc/counts.txt --- *** [doc/counts.txt] Error code 127 ... With the changes applied, Snort builds successfully. I am not sure if this is the best way to handle it, but it avoids missing with the shell scripts portability among the different shells. Thanks. YM _______________________________________________ Snort-devel mailing list [email protected] https://lists.snort.org/mailman/listinfo/snort-devel Please visit http://blog.snort.org for the latest news about Snort!
doc_cmakelist_disable_txt_docs.patch
(application/octet-stream, 1.7 KB)
--- doc/original_CMakelist.txt 2018-03-16 00:49:04.920528000 +0000
+++ doc/modified_CMakeLists.txt 2018-03-16 00:49:04.876442000 +0000
@@ -79,29 +79,31 @@
wizard.txt
)
-foreach ( output_file ${HELP_SOURCES} )
- add_help_command (
- "${CMAKE_CURRENT_LIST_DIR}/scripts/generate_help.sh"
- "${output_file}"
- )
- list ( APPEND BUILT_SOURCES "${output_file}" )
-endforeach ()
-
-foreach ( output_file ${LIST_SOURCES} )
- add_help_command (
- "${CMAKE_CURRENT_LIST_DIR}/scripts/generate_list.sh"
- "${output_file}"
- )
- list ( APPEND BUILT_SOURCES "${output_file}" )
-endforeach ()
-
-foreach ( output_file ${MODULE_SOURCES} )
- add_help_command (
- "${CMAKE_CURRENT_LIST_DIR}/scripts/generate_module.sh"
- "${output_file}"
- )
- list ( APPEND BUILT_SOURCES "${output_file}" )
-endforeach ()
+if ( MAKE_TEXT_DOC )
+ foreach ( output_file ${HELP_SOURCES} )
+ add_help_command (
+ "${CMAKE_CURRENT_LIST_DIR}/scripts/generate_help.sh"
+ "${output_file}"
+ )
+ list ( APPEND BUILT_SOURCES "${output_file}" )
+ endforeach ()
+
+ foreach ( output_file ${LIST_SOURCES} )
+ add_help_command (
+ "${CMAKE_CURRENT_LIST_DIR}/scripts/generate_list.sh"
+ "${output_file}"
+ )
+ list ( APPEND BUILT_SOURCES "${output_file}" )
+ endforeach ()
+
+ foreach ( output_file ${MODULE_SOURCES} )
+ add_help_command (
+ "${CMAKE_CURRENT_LIST_DIR}/scripts/generate_module.sh"
+ "${output_file}"
+ )
+ list ( APPEND BUILT_SOURCES "${output_file}" )
+ endforeach ()
+endif ( MAKE_TEXT_DOC )
add_custom_command (
OUTPUT version.txt
configure_cmake_disable_txt_docs.patch
(application/octet-stream, 945 B)
--- original_configure_cmake.sh 2018-03-16 00:48:54.220031000 +0000
+++ modified_configure_cmake.sh 2018-03-16 00:48:54.220202000 +0000
@@ -58,6 +58,7 @@
--disable-static-daq link static DAQ modules
--disable-html-docs don't create the HTML documentation
--disable-pdf-docs don't create the PDF documentation
+ --disble-txt-docs don't create the txt documentation
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -301,6 +302,12 @@
--enable-static-daq)
append_cache_entry ENABLE_STATIC_DAQ BOOL true
;;
+ --disable-txt-docs)
+ append_cache_entry MAKE_TEXT_DOC BOOL false
+ ;;
+ --enable-txt-docs)
+ append_cache_entry MAKE_TEXT_DOC BOOL true
+ ;;
--disable-html-docs)
append_cache_entry MAKE_HTML_DOC BOOL false
;;