RPM package build optimization

This commit is contained in:
LesinLi
2024-12-11 20:15:38 +00:00
committed by ob-robot
parent 5395253ab9
commit 686f30e35f
15 changed files with 76 additions and 31 deletions

View File

@ -69,6 +69,10 @@ function parse_args
then then
CPP_STANDARD_OPTION=20 CPP_STANDARD_OPTION=20
CPP_STANDARD_20_OPTION=ON CPP_STANDARD_20_OPTION=ON
elif [[ "$i" == "-DBUILD_CDC_ONLY=ON" ]]
then
ENABLE_BOLT_OPTION=OFF
BUILD_ARGS+=("$i")
elif [[ $NEED_MAKE == false ]] elif [[ $NEED_MAKE == false ]]
then then
BUILD_ARGS+=("$i") BUILD_ARGS+=("$i")

View File

@ -7,7 +7,7 @@ ob_define(DEP_3RD_DIR "${CMAKE_SOURCE_DIR}/deps/3rd")
ob_define(DEVTOOLS_DIR "${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/devtools") ob_define(DEVTOOLS_DIR "${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/devtools")
ob_define(DEP_DIR "${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/deps/devel") ob_define(DEP_DIR "${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/deps/devel")
ob_define(OB_BUILD_CDC OFF) ob_define(BUILD_CDC_ONLY OFF)
ob_define(OB_USE_CLANG ON) ob_define(OB_USE_CLANG ON)
ob_define(OB_ERRSIM OFF) ob_define(OB_ERRSIM OFF)
ob_define(BUILD_NUMBER 1) ob_define(BUILD_NUMBER 1)
@ -207,7 +207,7 @@ if(OB_BUILD_CPP_ODPS)
endif() endif()
# should not use initial-exec for tls-model if building OBCDC. # should not use initial-exec for tls-model if building OBCDC.
if(OB_BUILD_CDC) if(BUILD_CDC_ONLY)
add_definitions(-DOB_BUILD_CDC_DISABLE_VSAG) add_definitions(-DOB_BUILD_CDC_DISABLE_VSAG)
else() else()
add_definitions(-DENABLE_INITIAL_EXEC_TLS_MODEL) add_definitions(-DENABLE_INITIAL_EXEC_TLS_MODEL)

View File

@ -88,7 +88,7 @@ install(FILES
endif() endif()
## oceanbase-cdc ## oceanbase-cdc
if (NOT OB_SO_CACHE AND OB_BUILD_CDC) if (NOT OB_SO_CACHE AND BUILD_CDC_ONLY)
list(APPEND CPACK_COMPONENTS_ALL cdc) list(APPEND CPACK_COMPONENTS_ALL cdc)
include(GNUInstallDirs) include(GNUInstallDirs)
install( install(

View File

@ -3,9 +3,14 @@ set(CPACK_GENERATOR "RPM")
set(CPACK_COMPONENTS_IGNORE_GROUPS 1) set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
set(CPACK_RPM_COMPONENT_INSTALL ON) set(CPACK_RPM_COMPONENT_INSTALL ON)
# use "server" as main component so its RPM filename won't have "server" # use "server" as main component so its RPM filename won't have "server"
if (BUILD_CDC_ONLY)
set(CPACK_RPM_MAIN_COMPONENT "cdc")
else()
set(CPACK_RPM_MAIN_COMPONENT "server") set(CPACK_RPM_MAIN_COMPONENT "server")
endif()
# let rpmbuild determine rpm filename # let rpmbuild determine rpm filename
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CMAKE_INSTALL_LIBDIR "lib64")
## Stardard debuginfo generating instructions in cmake. However 6u ## Stardard debuginfo generating instructions in cmake. However 6u
## server with rpm-4.8.0 which doesn't support dwarf4 won't generate ## server with rpm-4.8.0 which doesn't support dwarf4 won't generate
## BUILDID for RPM. And Our debuginfo package doesn't contain source ## BUILDID for RPM. And Our debuginfo package doesn't contain source
@ -40,7 +45,7 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(CPACK_RPM_PACKAGE_LICENSE "Mulan PubL v2.") set(CPACK_RPM_PACKAGE_LICENSE "Mulan PubL v2.")
set(CPACK_RPM_DEFAULT_USER "admin") set(CPACK_RPM_DEFAULT_USER "admin")
set(CPACK_RPM_DEFAULT_GROUP "admin") set(CPACK_RPM_DEFAULT_GROUP "admin")
if (OB_BUILD_OPENSOURCE) if (OB_BUILD_OPENSOURCE AND NOT BUILD_CDC_ONLY)
set(DEBUG_INSTALL_POST "mv $RPM_BUILD_ROOT/../server/home/admin/oceanbase/bin/obshell %{_builddir}/obshell; %{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir}; mv %{_builddir}/obshell $RPM_BUILD_ROOT/../server/home/admin/oceanbase/bin/obshell; %{nil}") set(DEBUG_INSTALL_POST "mv $RPM_BUILD_ROOT/../server/home/admin/oceanbase/bin/obshell %{_builddir}/obshell; %{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir}; mv %{_builddir}/obshell $RPM_BUILD_ROOT/../server/home/admin/oceanbase/bin/obshell; %{nil}")
else() else()
set(DEBUG_INSTALL_POST "%{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir};%{nil}") set(DEBUG_INSTALL_POST "%{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir};%{nil}")
@ -102,14 +107,25 @@ install(FILES
COMPONENT server) COMPONENT server)
endif() endif()
if (BUILD_CDC_ONLY)
message(STATUS "oceanbase build cdc only")
set(CPACK_COMPONENTS_ALL cdc)
set(CPACK_PACKAGE_NAME "oceanbase-cdc")
if (OB_BUILD_OPENSOURCE)
set(CPACK_PACKAGE_NAME "oceanbase-ce-cdc")
endif()
else()
add_custom_target(bitcode_to_elf ALL
DEPENDS ${BITCODE_TO_ELF_LIST})
add_custom_target(ob_table ALL
DEPENDS obtable obtable_static)
endif()
message(STATUS "Cpack Components:${CPACK_COMPONENTS_ALL}")
# install cpack to make everything work # install cpack to make everything work
include(CPack) include(CPack)
#add rpm target to create RPMS #add rpm target to create RPMS
add_custom_target(rpm add_custom_target(rpm
COMMAND +make package COMMAND +make package
DEPENDS
observer obcdc_tailf obtable obtable_static
ob_admin ob_error ob_sql_proxy_parser_static
${BITCODE_TO_ELF_LIST}
) )

View File

@ -27,7 +27,7 @@ devdeps-zlib-static-1.2.13-82024102414.al8.aarch64.rpm
devdeps-ncurses-static-6.2-112024092810.al8.aarch64.rpm devdeps-ncurses-static-6.2-112024092810.al8.aarch64.rpm
devdeps-boost-1.74.0-72024092811.al8.aarch64.rpm devdeps-boost-1.74.0-72024092811.al8.aarch64.rpm
devdeps-s2geometry-0.9.0-112024100811.al8.aarch64.rpm devdeps-s2geometry-0.9.0-112024100811.al8.aarch64.rpm
devdeps-icu-69.1-192024092811.al8.aarch64.rpm devdeps-icu-69.1-232024120517.al8.aarch64.rpm
devdeps-cos-c-sdk-5.0.21-282024102810.al8.aarch64.rpm devdeps-cos-c-sdk-5.0.21-282024102810.al8.aarch64.rpm
devdeps-s3-cpp-sdk-1.11.156-222024100811.al8.aarch64.rpm devdeps-s3-cpp-sdk-1.11.156-222024100811.al8.aarch64.rpm
devdeps-protobuf-c-1.4.1-100000132024092815.al8.aarch64.rpm devdeps-protobuf-c-1.4.1-100000132024092815.al8.aarch64.rpm

View File

@ -28,7 +28,7 @@ devdeps-zlib-static-1.2.13-82024102414.al8.x86_64.rpm
devdeps-ncurses-static-6.2-112024092810.al8.x86_64.rpm devdeps-ncurses-static-6.2-112024092810.al8.x86_64.rpm
devdeps-boost-1.74.0-72024092811.al8.x86_64.rpm devdeps-boost-1.74.0-72024092811.al8.x86_64.rpm
devdeps-s2geometry-0.9.0-112024100811.al8.x86_64.rpm devdeps-s2geometry-0.9.0-112024100811.al8.x86_64.rpm
devdeps-icu-69.1-192024092811.al8.x86_64.rpm devdeps-icu-69.1-232024120517.al8.x86_64.rpm
devdeps-cloud-qpl-1.1.0-312024092814.al8.x86_64.rpm devdeps-cloud-qpl-1.1.0-312024092814.al8.x86_64.rpm
devdeps-cos-c-sdk-5.0.21-282024102810.al8.x86_64.rpm devdeps-cos-c-sdk-5.0.21-282024102810.al8.x86_64.rpm
devdeps-s3-cpp-sdk-1.11.156-222024100811.al8.x86_64.rpm devdeps-s3-cpp-sdk-1.11.156-222024100811.al8.x86_64.rpm

View File

@ -426,6 +426,10 @@ add_library(malloc_hook STATIC
alloc/malloc_hook.cpp alloc/malloc_hook.cpp
alloc/malloc_hook.h alloc/malloc_hook.h
alloc/malloc_hook_extended.cpp) alloc/malloc_hook_extended.cpp)
if (BUILD_CDC_ONLY)
set_target_properties(malloc_hook PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
target_link_libraries(malloc_hook oblib_base) target_link_libraries(malloc_hook oblib_base)
if(OB_BUILD_CLOSE_MODULES) if(OB_BUILD_CLOSE_MODULES)
@ -445,7 +449,7 @@ target_link_libraries(oblib_lib
${DEP_DIR}/lib/liblzma.a ${DEP_DIR}/lib/liblzma.a
) )
if (NOT OB_BUILD_CDC) if (NOT BUILD_CDC_ONLY)
# vsag vector library # vsag vector library
target_link_directories( target_link_directories(
oblib_lib PUBLIC ${DEP_DIR}/lib ${DEP_DIR}/lib/vsag_lib oblib_lib PUBLIC ${DEP_DIR}/lib ${DEP_DIR}/lib/vsag_lib

View File

@ -15,7 +15,7 @@ cd ${TOP_DIR}
./build.sh clean ./build.sh clean
./build.sh \ ./build.sh \
deb \ deb \
-DOB_BUILD_CDC=ON \ -DBUILD_CDC_ONLY=ON \
-DOB_RELEASEID=$RELEASE \ -DOB_RELEASEID=$RELEASE \
-DBUILD_NUMBER=$RELEASE \ -DBUILD_NUMBER=$RELEASE \
--init \ --init \

View File

@ -18,7 +18,7 @@ cd ${TOP_DIR}
./build.sh clean ./build.sh clean
./build.sh \ ./build.sh \
rpm \ rpm \
-DOB_BUILD_CDC=ON \ -DBUILD_CDC_ONLY=ON \
-DOB_RELEASEID=$RELEASE \ -DOB_RELEASEID=$RELEASE \
-DBUILD_NUMBER=$RELEASE \ -DBUILD_NUMBER=$RELEASE \
${OB_DISABLE_LSE_OPTION}\ ${OB_DISABLE_LSE_OPTION}\

View File

@ -31,5 +31,10 @@ add_subdirectory(rootserver)
add_subdirectory(logservice) add_subdirectory(logservice)
add_subdirectory(storage) add_subdirectory(storage)
add_subdirectory(diagnose) add_subdirectory(diagnose)
if (BUILD_CDC_ONLY)
add_subdirectory(observer EXCLUDE_FROM_ALL)
add_subdirectory(libtable EXCLUDE_FROM_ALL)
else()
add_subdirectory(observer) add_subdirectory(observer)
add_subdirectory(libtable) add_subdirectory(libtable)
endif()

View File

@ -244,5 +244,15 @@ ob_set_subtarget(ob_logservice common_util
) )
ob_server_add_target(ob_logservice) ob_server_add_target(ob_logservice)
add_subdirectory(libobcdc)
if (BUILD_CDC_ONLY)
add_subdirectory(logminer EXCLUDE_FROM_ALL)
else()
add_subdirectory(logminer) add_subdirectory(logminer)
endif()
if (CMAKE_BUILD_RPM AND NOT BUILD_CDC_ONLY)
add_subdirectory(libobcdc EXCLUDE_FROM_ALL)
else()
add_subdirectory(libobcdc)
endif()

View File

@ -198,6 +198,9 @@ target_link_libraries(obcdc_objects_miner PUBLIC obcdc_base)
add_library(obcdc_static add_library(obcdc_static
STATIC STATIC
${CMAKE_BINARY_DIR}/src/observer/ob_version.cpp) ${CMAKE_BINARY_DIR}/src/observer/ob_version.cpp)
if (BUILD_CDC_ONLY)
set_target_properties(obcdc_static PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
target_link_libraries(obcdc_static target_link_libraries(obcdc_static
PUBLIC obcdc_objects PUBLIC obcdc_objects

View File

@ -10,17 +10,13 @@ ob_add_new_object_target(obcdc_tailf_objects obcdc_tailf_object_list)
target_link_libraries(obcdc_tailf_objects PRIVATE obcdc) target_link_libraries(obcdc_tailf_objects PRIVATE obcdc)
target_link_libraries(obcdc_tailf PRIVATE obcdc_tailf_objects) target_link_libraries(obcdc_tailf PRIVATE obcdc_tailf_objects)
if(ENABLE_THIN_LTO AND USE_LTO_CACHE)
add_dependencies(obcdc_tailf observer)
endif()
# obcdc_tailf_static # obcdc_tailf_static
add_executable(obcdc_tailf_static EXCLUDE_FROM_ALL) add_executable(obcdc_tailf_static EXCLUDE_FROM_ALL)
ob_add_new_object_target(obcdc_tailf_objects_static obcdc_tailf_object_list) ob_add_new_object_target(obcdc_tailf_objects_static obcdc_tailf_object_list)
target_link_libraries(obcdc_tailf_objects_static PRIVATE obcdc_static) target_link_libraries(obcdc_tailf_objects_static PRIVATE obcdc_static)
target_link_libraries(obcdc_tailf_static PRIVATE obcdc_tailf_objects_static) target_link_libraries(obcdc_tailf_static PRIVATE obcdc_tailf_objects_static)
if (OB_BUILD_CDC) if (BUILD_CDC_ONLY)
# execute build_cdc_demo to check dlopen and compile # execute build_cdc_demo to check dlopen and compile
if (NOT OB_STATIC_LINK_LGPL_DEPS) if (NOT OB_STATIC_LINK_LGPL_DEPS)
add_custom_command(TARGET obcdc_tailf POST_BUILD add_custom_command(TARGET obcdc_tailf POST_BUILD

View File

@ -116,7 +116,9 @@ add_library(ob_sql_proxy_parser_objects OBJECT
${ob_sql_parser_hash_object_list} ${ob_sql_parser_hash_object_list}
${ob_sql_parser_charset_object_list} ${ob_sql_parser_charset_object_list}
) )
if (BUILD_CDC_ONLY)
set_target_properties(ob_sql_proxy_parser_objects PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
# ob_sql_server_parser_object is the static library for observer # ob_sql_server_parser_object is the static library for observer
add_library(ob_sql_server_parser_objects OBJECT add_library(ob_sql_server_parser_objects OBJECT

View File

@ -1,5 +1,10 @@
if (BUILD_CDC_ONLY)
add_subdirectory(ob_error EXCLUDE_FROM_ALL)
add_subdirectory(ob_admin EXCLUDE_FROM_ALL)
else()
add_subdirectory(ob_error) add_subdirectory(ob_error)
add_subdirectory(ob_admin) add_subdirectory(ob_admin)
endif()
add_subdirectory(upgrade) add_subdirectory(upgrade)
if(OB_BUILD_CLOSE_MODULES) if(OB_BUILD_CLOSE_MODULES)
add_subdirectory(agentserver EXCLUDE_FROM_ALL) add_subdirectory(agentserver EXCLUDE_FROM_ALL)