-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for BRO_PLUGIN_BASE has been removed, resulting in the ZeekPluginDynamic.cmake code to pick-up ${CMAKE_CURRENT_SOURCE_DIR}/scripts as the plugin's script. For the package-template's generated skeleton, these are however the extra scripts usually installed via zkg. Propose creation of another CMakeLists.txt within plugin/ to prevent this. The main wart here is that zeek-plugin-create-package.sh contains assumption about the location of additional DIST_FILES (../ relative to the build directory), so we copy these at configure time into build/ to fix this. I'm liking this more than re-introducing support for BRO_PLUGIN_BASE, but not sure it's overly great. Closes #35
- Loading branch information
Showing
5 changed files
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) | ||
|
||
include(ZeekPlugin) | ||
|
||
zeek_plugin_begin(@NS@ @NAME@) | ||
|
||
file(GLOB cc_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "src/*.cc") | ||
foreach(file ${cc_files}) | ||
zeek_plugin_cc(${file}) | ||
endforeach () | ||
|
||
file(GLOB bif_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "src/*.bif") | ||
foreach(file ${bif_files}) | ||
zeek_plugin_bif(${file}) | ||
endforeach () | ||
|
||
# Copy the dist files to package with the tarball into the top-level | ||
# build directory to fulfill zeek-plugin-create-package.sh assumptions | ||
# about them being located in the parent directory. | ||
set(dist_files README CHANGES COPYING VERSION) | ||
foreach(file ${dist_files}) | ||
if ( EXISTS ../${file} ) | ||
file(COPY ../${file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../) | ||
endif() | ||
endforeach () | ||
|
||
zeek_plugin_dist_files(${dist_files}) | ||
|
||
zeek_plugin_end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
=== without test/scripts | ||
plugin/scripts/__load__.zeek | ||
plugin/scripts/__preload__.zeek | ||
=== with test/scripts | ||
plugin/scripts/__load__.zeek | ||
plugin/scripts/__preload__.zeek | ||
scripts/__load__.zeek | ||
scripts/main.zeek | ||
Hello world! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# A test to verify that plugin/scripts/ is used as the plugin's script | ||
# directory rather than the top-level scripts/ directory. | ||
# | ||
# Regression test for #35. | ||
# | ||
# @TEST-REQUIRES: make --version | ||
# @TEST-REQUIRES: cmake --help | grep -q '^* Unix Makefiles' | ||
# | ||
# @TEST-EXEC: bash %INPUT | ||
# | ||
# @TEST-EXEC: cd test && ./configure 1>&2 | ||
# @TEST-EXEC: make -C test/build/ -j`nproc` 1>&2 | ||
# @TEST-EXEC: echo "=== without test/scripts" >>output | ||
# @TEST-EXEC: ZEEK_PLUGIN_PATH=./test/build zeek </dev/null >>output | ||
# @TEST-EXEC: echo "=== with test/scripts" >>output | ||
# @TEST-EXEC: ZEEK_PLUGIN_PATH=./test/build zeek ./test/scripts >>output | ||
# @TEST-EXEC: btest-diff output | ||
|
||
${SCRIPTS}/zkg create --packagedir=test --features plugin --user-var name=Name --user-var namespace=Namespace | ||
|
||
echo 'event zeek_init() &priority=40 { print "plugin/scripts/__load__.zeek"; }' >> test/plugin/scripts/__load__.zeek | ||
echo 'event zeek_init() &priority=30 { print "plugin/scripts/__preload__.zeek"; }' >> test/plugin/scripts/__preload__.zeek | ||
echo 'event zeek_init() &priority=20 { print "scripts/__load__.zeek"; }' >> test/scripts/__load__.zeek | ||
echo 'event zeek_init() &priority=10 { print "scripts/main.zeek"; }' >> test/scripts/main.zeek |