Skip to content

Commit

Permalink
Zeek/Zeek Issue #1848
Browse files Browse the repository at this point in the history
Add new function zeek_plugin_script().

Script files added through this function will be added as dependencies
to the binary package, and changes to the script will be picked up
by `make && sudo make install` without a `make clean` being required.

Scripts that are *not* added through this command will still be
distributed as before, but a change to the script will require
a `make clean` ( as before ) in order to trigger repackaging if
there is no change that triggers the plugin's not script components
to build.

Follow ons to this are updating the zeek reference, adding init-plugin
support and any doc changes
  • Loading branch information
ottobackwards committed Nov 11, 2021
1 parent f5f9316 commit fb332b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ZeekPluginCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,23 @@ function(zeek_plugin_begin ns name)
set(_plugin_objs "" PARENT_SCOPE)
set(_plugin_deps "" PARENT_SCOPE)
set(_plugin_dist "" PARENT_SCOPE)
set(_plugin_script "" PARENT_SCOPE)
endfunction()

# This is needed to support legacy Bro plugins.
macro(bro_plugin_begin)
zeek_plugin_begin(${ARGV})
endmacro()

# Adds specified .zeek scripts to a plugin
# scripts will be added to the distribution regardless of this
# but adding them explicitly allows tracking changes in scripts
# when building dist
function(zeek_plugin_script)
list(APPEND _plugin_script ${ARGV})
set(_plugin_script "${_plugin_script}" PARENT_SCOPE)
endfunction()

# Adds *.cc files to a plugin.
function(zeek_plugin_cc)
list(APPEND _plugin_objs ${ARGV})
Expand Down
2 changes: 1 addition & 1 deletion ZeekPluginDynamic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function(bro_plugin_end_dynamic)
add_custom_command(OUTPUT ${_dist_output}
COMMAND ${BRO_PLUGIN_BRO_CMAKE}/zeek-plugin-create-package.sh ${_plugin_name_canon} ${_plugin_dist}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${_plugin_lib}
DEPENDS ${_plugin_lib} ${_plugin_scripts}
COMMENT "Building binary plugin package: ${_dist_tarball_name}")

add_custom_target(dist ALL DEPENDS ${_dist_output})
Expand Down

0 comments on commit fb332b8

Please sign in to comment.