build stellar and stellar-devel rpm

This commit is contained in:
luwenpeng
2024-05-29 16:14:38 +08:00
parent f82b85c979
commit ba1e651876
14 changed files with 35 additions and 40 deletions

View File

@@ -51,9 +51,6 @@ if(ENABLE_SANITIZE_ADDRESS AND ENABLE_SANITIZE_THREAD)
message(WARNING "Both ENABLE_SANITIZE_ADDRESS and ENABLE_SANITIZE_THREAD set, only ENABLE_SANITIZE_ADDRESS effected.") message(WARNING "Both ENABLE_SANITIZE_ADDRESS and ENABLE_SANITIZE_THREAD set, only ENABLE_SANITIZE_ADDRESS effected.")
endif() endif()
add_custom_target("install-program" COMMAND ${CMAKE_COMMAND} ARGS -DCOMPONENT=Program -P cmake_install.cmake)
add_custom_target("install-profile" COMMAND ${CMAKE_COMMAND} ARGS -DCOMPONENT=Profile -P cmake_install.cmake)
enable_testing() enable_testing()
add_subdirectory(conf) add_subdirectory(conf)
add_subdirectory(vendor) add_subdirectory(vendor)
@@ -63,4 +60,5 @@ add_subdirectory(script)
add_subdirectory(include) add_subdirectory(include)
add_subdirectory(test) add_subdirectory(test)
install(DIRECTORY DESTINATION log) install(DIRECTORY DESTINATION log COMPONENT PROGRAM)
install(DIRECTORY DESTINATION plugin COMPONENT PROGRAM)

View File

@@ -1,12 +1,4 @@
if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CPACK_PACKAGE_VENDOR "TSG")
set(CPACK_PACKAGE_NAME "stellar-debug")
else()
set(CPACK_PACKAGE_NAME "stellar")
endif()
message(STATUS "Package: ${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_VENDOR "TSG")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}.${DESCRIBE}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}.${DESCRIBE}")
@@ -19,17 +11,23 @@ set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_AUTOREQPROV "no") set(CPACK_RPM_PACKAGE_AUTOREQPROV "no")
set(CPACK_RPM_PACKAGE_RELEASE_DIST on) set(CPACK_RPM_PACKAGE_RELEASE_DIST on)
set(CPACK_RPM_DEBUGINFO_PACKAGE on) set(CPACK_RPM_DEBUGINFO_PACKAGE on)
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostInstall.in) set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostUninstall.in)
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PreUninstall.in)
# Must uninstall the debug package before install release package
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CPACK_RPM_PACKAGE_CONFLICTS "stellar") set(CPACK_RPM_PROGRAM_PACKAGE_NAME "stellar-debug")
set(CPACK_RPM_LIBRARIES_PACKAGE_NAME "stellar-devel-debug")
else() else()
set(CPACK_RPM_PACKAGE_CONFLICTS "stellar-debug") set(CPACK_RPM_PROGRAM_PACKAGE_NAME "stellar")
set(CPACK_RPM_LIBRARIES_PACKAGE_NAME "stellar-devel")
endif() endif()
set(CPACK_COMPONENT_PROGRAM_REQUIRED TRUE)
set(CPACK_RPM_PROGRAM_PACKAGE_CONFLICTS ${CPACK_RPM_PROGRAM_PACKAGE_NAME})
set(CPACK_COMPONENT_LIBRARIES_REQUIRED TRUE)
set(CPACK_RPM_LIBRARIES_PACKAGE_CONFLICTS ${CPACK_RPM_LIBRARIES_PACKAGE_NAME})
set(CPACK_COMPONENTS_ALL LIBRARIES PROGRAM)
# setup %config(noreplace) # setup %config(noreplace)
set(CPACK_RPM_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/conf/stellar.toml") set(CPACK_RPM_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/conf/stellar.toml")

View File

@@ -1,2 +0,0 @@
%systemd_post stellar.service
/sbin/ldconfig

View File

@@ -1,2 +0,0 @@
%systemd_postun_with_restart stellar.service
/sbin/ldconfig

View File

@@ -1 +0,0 @@
%systemd_preun stellar.service

View File

@@ -1,2 +1,2 @@
install(FILES stellar.toml DESTINATION conf COMPONENT Profile) install(FILES stellar.toml DESTINATION conf COMPONENT PROGRAM)
install(FILES log.toml DESTINATION conf COMPONENT Profile) install(FILES log.toml DESTINATION conf COMPONENT PROGRAM)

View File

@@ -1,7 +1,7 @@
install(FILES stellar/utils.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/utils.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/tuple.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/tuple.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/packet.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/packet.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/session.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/session.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/stellar.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/stellar.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/session_mq.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/session_mq.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/session_exdata.h DESTINATION include/stellar/ COMPONENT HEADER) install(FILES stellar/session_exdata.h DESTINATION include/stellar/ COMPONENT LIBRARIES)

View File

@@ -1,2 +1,2 @@
install(FILES python_stat.sh DESTINATION ./ COMPONENT Program) install(FILES python_stat.sh DESTINATION ./ COMPONENT PROGRAM)
install(FILES shell_stat.sh DESTINATION ./ COMPONENT Program) install(FILES shell_stat.sh DESTINATION ./ COMPONENT PROGRAM)

View File

@@ -256,6 +256,10 @@ struct plugin_manager_schema *plugin_manager_init(struct stellar *st, const char
void plugin_manager_exit(struct plugin_manager_schema *plug_mgr) void plugin_manager_exit(struct plugin_manager_schema *plug_mgr)
{ {
if (plug_mgr == NULL)
{
return;
}
struct plugin_specific *p=NULL; struct plugin_specific *p=NULL;
if (plug_mgr->plugin_load_specs_array) if (plug_mgr->plugin_load_specs_array)
{ {

View File

@@ -13,5 +13,5 @@ target_link_libraries(stellar stellar_core)
target_link_libraries(stellar "-rdynamic") target_link_libraries(stellar "-rdynamic")
set_target_properties(stellar PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map") set_target_properties(stellar PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map")
install(TARGETS stellar RUNTIME DESTINATION bin COMPONENT Program) install(TARGETS stellar RUNTIME DESTINATION bin COMPONENT PROGRAM)
install(TARGETS stellar_devel LIBRARY DESTINATION lib COMPONENT LIBRARIES) install(TARGETS stellar_devel LIBRARY DESTINATION lib COMPONENT LIBRARIES)

View File

@@ -44,7 +44,7 @@ static uint64_t need_exit = 0;
static thread_local uint16_t __thread_id = 0; static thread_local uint16_t __thread_id = 0;
static const char *log_config_file = "./conf/log.toml"; static const char *log_config_file = "./conf/log.toml";
static const char *main_config_file = "./conf/stellar.toml"; static const char *main_config_file = "./conf/stellar.toml";
static const char *plugin_config_file = "./stellar_plugin/spec.toml"; static const char *plugin_config_file = "./plugin/spec.toml";
/****************************************************************************** /******************************************************************************
* Stellar Thread Main Loop * Stellar Thread Main Loop

View File

@@ -27,4 +27,4 @@ packet_inject_add_case(gtest_inject_tcp_payload_fin_rst_after_recv_c2s_first_pay
file(COPY ./conf/ DESTINATION ./conf/) file(COPY ./conf/ DESTINATION ./conf/)
file(COPY ./pcap/ DESTINATION ./pcap/) file(COPY ./pcap/ DESTINATION ./pcap/)
file(COPY ./stellar_plugin/ DESTINATION ./stellar_plugin/) file(COPY ./plugin/ DESTINATION ./plugin/)

View File

@@ -150,7 +150,7 @@ void packet_inject_test(struct packet_inject_case *test)
} }
system_cmd("cp %s/%s %s", test->input_prefix, test->input_pcap, dumpfile_dir); system_cmd("cp %s/%s %s", test->input_prefix, test->input_pcap, dumpfile_dir);
system_cmd("cp -r conf %s/", test->work_dir); system_cmd("cp -r conf %s/", test->work_dir);
system_cmd("cp -r stellar_plugin %s/", test->work_dir); system_cmd("cp -r plugin %s/", test->work_dir);
system_cmd("cp -r libpacket_inject_plugin.so %s/", test->work_dir); system_cmd("cp -r libpacket_inject_plugin.so %s/", test->work_dir);
// run packet injector // run packet injector