Skip to content

Commit

Permalink
Add a 'dist' target for Bro plugins.
Browse files Browse the repository at this point in the history
It's part of the default build target (i.e. built upon doing "make").
It copies dist files to the build dir before creating a plugin
distribution tarball.
  • Loading branch information
jsiwek committed Jun 30, 2016
1 parent b8b4604 commit fe38c07
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions BroPluginDynamic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,29 @@ function(bro_plugin_end_dynamic)

# Create __bro_plugin__
# string(REPLACE "${BRO_PLUGIN_BASE}/" "" msg "Creating ${BRO_PLUGIN_MAGIC} for ${_plugin_name}")
get_filename_component(_magic_basename ${BRO_PLUGIN_MAGIC} NAME)

add_custom_target(bro-plugin-${_plugin_name_canon}
COMMAND echo "${_plugin_name}" ">${BRO_PLUGIN_MAGIC}"
COMMENT "${msg}")
COMMENT "Creating ${_magic_basename} for ${_plugin_name}")

if ( _plugin_deps )
add_dependencies(bro-plugin-${_plugin_name_canon} ${_plugin_deps})
endif()

add_dependencies(${_plugin_lib} bro-plugin-${_plugin_name_canon})

set(_dist_tarball_name ${_plugin_name_canon}.tar.gz)
set(_dist_output ${CMAKE_CURRENT_BINARY_DIR}/${_dist_tarball_name})

# Create binary install package.
add_custom_command(TARGET ${_plugin_lib} POST_BUILD
add_custom_command(OUTPUT ${_dist_output}
COMMAND ${BRO_PLUGIN_BRO_SRC}/cmake/bro-plugin-create-package.sh ${_plugin_name_canon} ${_plugin_dist}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${_plugin_lib}
COMMENT "Building binary plugin package")
COMMENT "Building binary plugin package: ${_dist_tarball_name}")

add_custom_target(dist ALL DEPENDS ${_dist_output})

set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${BRO_PLUGIN_BIF})
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${BRO_PLUGIN_LIB})
Expand Down

0 comments on commit fe38c07

Please sign in to comment.