spicy: Remove Zeek version from spicyz/config.h.in

It seems that Zeek's version number and string only need to be
available at runtime, so this change removes it from spicyz/configh.in
to avoid needlessly busting ccache for the src/spicyz tree for on a
Zeek version bump.

Closes #3139.
This commit is contained in:
Arne Welzel 2024-02-22 13:13:32 +01:00
parent 5742f7cc21
commit 02703eeb9d
5 changed files with 27 additions and 7 deletions

View file

@ -3,7 +3,7 @@
configure_file(config.h.in config.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/zeek/spicy/spicyz)
add_executable(spicyz driver.cc glue-compiler.cc main.cc)
add_executable(spicyz driver.cc glue-compiler.cc main.cc zeek-version.cc)
target_compile_options(spicyz PRIVATE "-Wall")
target_compile_features(spicyz PRIVATE "${ZEEK_CXX_STD}")
set_target_properties(spicyz PROPERTIES CXX_EXTENSIONS OFF)

View file

@ -58,10 +58,7 @@ inline const auto CxxZeekIncludesDirectories() {
// Version of Spicy that we are compiling against.
#cmakedefine SPICY_VERSION_NUMBER ${SPICY_VERSION_NUMBER}
#cmakedefine ZEEK_VERSION_NUMBER ${ZEEK_VERSION_NUMBER}
inline const auto SpicyVersion = "${SPICY_VERSION_LONG}";
inline const auto ZeekVersion = "${ZEEK_VERSION_FULL}";
inline const auto InstallPrefix = path("${CMAKE_INSTALL_PREFIX}");
} // namespace zeek::spicy::configuration

View file

@ -8,6 +8,7 @@
#include "config.h"
#include "driver.h"
#include "glue-compiler.h"
#include "zeek-version.h"
using namespace zeek::spicy;
@ -194,9 +195,9 @@ static hilti::Result<Nothing> parseOptions(int argc, char** argv, hilti::driver:
compiler_options->keep_tmps = true;
break;
case 'v': std::cout << configuration::ZeekVersion << std::endl; return Nothing();
case 'v': std::cout << configuration::ZeekVersionString() << std::endl; return Nothing();
case 'V': std::cout << ZEEK_VERSION_NUMBER << std::endl; return Nothing();
case 'V': std::cout << configuration::ZeekVersionNumber() << std::endl; return Nothing();
case 'z': {
if ( auto zcfg = getenv("ZEEK_CONFIG"); zcfg && *zcfg )
@ -245,7 +246,8 @@ static hilti::Result<Nothing> parseOptions(int argc, char** argv, hilti::driver:
}
int main(int argc, char** argv) {
Driver driver(std::make_unique<GlueCompiler>(), "", configuration::LibraryPath(), ZEEK_VERSION_NUMBER);
Driver driver(std::make_unique<GlueCompiler>(), "", configuration::LibraryPath(),
configuration::ZeekVersionNumber());
hilti::driver::Options driver_options;
driver_options.execute_code = true;

View file

@ -0,0 +1,11 @@
// See the file "COPYING" in the main distribution directory for copyright.
#include "zeek-version.h"
#include "zeek/zeek-version.h"
using namespace zeek::spicy;
int configuration::ZeekVersionNumber() { return ZEEK_VERSION_NUMBER; }
const char* configuration::ZeekVersionString() { return VERSION; }

View file

@ -0,0 +1,10 @@
// See the file "COPYING" in the main distribution directory for copyright.
#pragma once
namespace zeek::spicy::configuration {
int ZeekVersionNumber();
const char* ZeekVersionString();
} // namespace zeek::spicy::configuration