diff options
author | tekireeva <tekireeva@yandex-team.com> | 2023-11-27 11:07:15 +0300 |
---|---|---|
committer | tekireeva <tekireeva@yandex-team.com> | 2023-11-27 11:47:23 +0300 |
commit | 8ff120094ddf6980a0ebd047056c133ce1c71130 (patch) | |
tree | 04f5372afc46d4e7a401d272ee46cec1eacd75a3 | |
parent | 2d217ef4d8a69dfb8bdf34986b724c585e8655db (diff) | |
download | ydb-8ff120094ddf6980a0ebd047056c133ce1c71130.tar.gz |
Add Python implementation of EXTRALIBS
-rw-r--r-- | build/conf/go.conf | 6 | ||||
-rw-r--r-- | build/conf/linkers/ld.conf | 1 | ||||
-rw-r--r-- | build/conf/swig.conf | 2 | ||||
-rw-r--r-- | build/plugins/extralibs.py | 18 | ||||
-rw-r--r-- | build/ymake.core.conf | 14 |
5 files changed, 31 insertions, 10 deletions
diff --git a/build/conf/go.conf b/build/conf/go.conf index 0093d469ca..f138fc0fe6 100644 --- a/build/conf/go.conf +++ b/build/conf/go.conf @@ -642,7 +642,7 @@ module _GO_BASE_UNIT: _BASE_UNIT { .EXTS=.go .gosrc .o .obj .a .symabis .mf .CMD=TOUCH_UNIT .NODE_TYPE=Bundle - .GLOBAL=GO_LDFLAGS + .GLOBAL=GO_LDFLAGS OBJADDE_LIB .PEERDIR_POLICY=as_build_from .ALIASES=SRCS=_GO_SRCS RESOURCE=_GO_RESOURCE GO_TEST_SRCS=_GO_UNUSED_SRCS GO_XTEST_SRCS=_GO_UNUSED_SRCS GRPC=_GO_GRPC GO_GRPC_GATEWAY_SRCS=_GO_GRPC_GATEWAY_SRCS GO_GRPC_GATEWAY_SWAGGER_SRCS=_GO_GRPC_GATEWAY_SWAGGER_SRCS CFLAGS=CGO_CFLAGS GO_TEST_EMBED_PATTERN=_GO_UNUSED_SRCS GO_XTEST_EMBED_PATTERN=_GO_UNUSED_SRCS GO_TEST_EMBED_DIR=_GO_UNUSED_SRCS GO_XTEST_EMBED_DIR=_GO_UNUSED_SRCS GO_TEST_EMBED_BINDIR=_GO_UNUSED_SRCS GO_XTEST_EMBED_BINDIR=_GO_UNUSED_SRCS GO_GRPC_GATEWAY_V2_SRCS=_GO_GRPC_GATEWAY_V2_SRCS GO_GRPC_GATEWAY_V2_OPENAPI_SRCS=_GO_GRPC_GATEWAY_V2_OPENAPI_SRCS .ALLOWED=GO_PROTO_PLUGIN USE_CXX USE_UTIL RESOURCE_FILES @@ -770,11 +770,11 @@ module _GO_BASE_UNIT: _BASE_UNIT { when ($OS_DARWIN) { PEERDIR+=build/external_resources/go_fake_xcrun - GO_EXTLD = ++extld $_GO_EXTLD ++extldflags $_GO_SONAME $LD_SDK_VERSION -undefined dynamic_lookup $C_FLAGS_PLATFORM --sysroot=$MACOS_SDK_RESOURCE_GLOBAL --start-wa ${rootrel;ext=.a:SRCS_GLOBAL} --end-wa ${rootrel;ext=.o:SRCS_GLOBAL} --cgo-peers $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB $GO_LDFLAGS_GLOBAL $C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG + GO_EXTLD = ++extld $_GO_EXTLD ++extldflags $_GO_SONAME $LD_SDK_VERSION -undefined dynamic_lookup $C_FLAGS_PLATFORM --sysroot=$MACOS_SDK_RESOURCE_GLOBAL --start-wa ${rootrel;ext=.a:SRCS_GLOBAL} --end-wa ${rootrel;ext=.o:SRCS_GLOBAL} --cgo-peers $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $GO_LDFLAGS_GLOBAL $C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG CGO2_LDFLAGS_VALUE += $LD_SDK_VERSION -undefined dynamic_lookup -nodefaultlibs -lc } elsewhen ($OS_LINUX) { - GO_EXTLD = ++extld $_GO_EXTLD ++extldflags $_GO_SONAME $C_FLAGS_PLATFORM --sysroot=$OS_SDK_ROOT_RESOURCE_GLOBAL -Wl,--whole-archive ${rootrel;ext=.a:SRCS_GLOBAL} -Wl,--no-whole-archive ${rootrel;ext=.o:SRCS_GLOBAL} --cgo-peers $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB $GO_LDFLAGS_GLOBAL $C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG + GO_EXTLD = ++extld $_GO_EXTLD ++extldflags $_GO_SONAME $C_FLAGS_PLATFORM --sysroot=$OS_SDK_ROOT_RESOURCE_GLOBAL -Wl,--whole-archive ${rootrel;ext=.a:SRCS_GLOBAL} -Wl,--no-whole-archive ${rootrel;ext=.o:SRCS_GLOBAL} --cgo-peers $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $GO_LDFLAGS_GLOBAL $C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG CGO2_LDFLAGS_VALUE += -Wl,--unresolved-symbols=ignore-all -nodefaultlibs -lc } otherwise { diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf index 96083eb6b8..f6c9cdc0e0 100644 --- a/build/conf/linkers/ld.conf +++ b/build/conf/linkers/ld.conf @@ -152,6 +152,7 @@ _EXE_FLAGS=\ $LDFLAGS_GLOBAL \ $OBJADDE \ $OBJADDE_LIB \ + $OBJADDE_LIB_GLOBAL \ $C_LIBRARY_PATH \ $C_SYSTEM_LIBRARIES_INTERCEPT \ $C_SYSTEM_LIBRARIES \ diff --git a/build/conf/swig.conf b/build/conf/swig.conf index 2bfbbf0a7c..27819f10a8 100644 --- a/build/conf/swig.conf +++ b/build/conf/swig.conf @@ -69,7 +69,7 @@ SWIG_JNI_BINDINGS_SEM= \ target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && \ target_include_directories PRIVATE $_C__INCLUDE_OWNED && \ target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && \ - target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && \ + target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE && \ add_jar ${REALPRJNAME} SOURCES $_EXPLICIT_SWIG_JAVA_SOURCES @${"$"}{CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst ${hide:TARGET} ### @usage: DLL_JAVA() diff --git a/build/plugins/extralibs.py b/build/plugins/extralibs.py new file mode 100644 index 0000000000..80f0a70cdc --- /dev/null +++ b/build/plugins/extralibs.py @@ -0,0 +1,18 @@ +def onpy_extralibs(unit, *args): + """ + @usage: EXTRALIBS(liblist) + Add external dynamic libraries during program linkage stage" } + """ + + libs = unit.get("OBJADDE_LIB_GLOBAL") + changed = False + if not libs: + libs = '' + for lib in args: + if not lib.startswith('-'): + lib = '-l' + lib + if lib not in libs: + libs = libs + ' ' + lib + changed = True + if changed: + unit.set(["OBJADDE_LIB_GLOBAL", libs]) diff --git a/build/ymake.core.conf b/build/ymake.core.conf index d14fb74fc1..2094e110fa 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -1047,7 +1047,7 @@ macro ADD_CLANG_TIDY() { module _BASE_PROGRAM: _LINK_UNIT { .SYMLINK_POLICY=EXE .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE - .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH + .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB SET(MODULE_TYPE PROGRAM) SET(MODULE_LANG CPP) FORCE_COVERAGE_ENABLED=yes @@ -1132,7 +1132,7 @@ module _BASE_PROGRAM: _LINK_UNIT { VCS_INFO_SEM=vcs_info ${input;hide:"build/scripts/vcs_info.py"} ${input;hide:"build/scripts/c_templates/svn_interface.c"} ${input;hide:"build/scripts/c_templates/svnversion.h"} CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \ && ${VCS_INFO_SEM} \ - && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \ + && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE \ && target_include_directories PRIVATE $_C__INCLUDE_OWNED \ && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \ && target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW @@ -1142,6 +1142,7 @@ CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide: ### If name is not specified it will be generated from the name of the containing project directory. module PROGRAM: _BASE_PROGRAM { .SEM=CPP_PROGRAM_SEM + .ALIASES=EXTRALIBS=PY_EXTRALIBS ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor) ADD_CLANG_TIDY() @@ -1691,7 +1692,7 @@ module _LIBRARY: _BASE_UNIT { .PEERDIR_POLICY=as_include .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES - .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH + .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF .FINAL_TARGET=no .GLOBAL_CMD=GLOBAL_LINK_LIB @@ -1775,6 +1776,7 @@ CONAN_OPTS_SEM= module LIBRARY: _LIBRARY { .GLOBAL=_AARS _PROGUARD_RULES .SEM=CPP_LIBRARY_SEM + .ALIASES=EXTRALIBS=PY_EXTRALIBS .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM .DEFAULT_NAME_GENERATOR=ThreeDirNames .ARGS_PARSER=Base @@ -1858,7 +1860,7 @@ module RESOURCES_LIBRARY: _BARE_UNIT { .NODE_TYPE=Library .PEERDIR_POLICY=as_include .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib - .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH + .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB when ($CMAKE_PACKAGE_COMPONENT != "") { CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT @@ -1963,7 +1965,7 @@ _SONAME= _EXPORT_SCRIPT_SEM= _CLEAN_TEXTREL= macro _ADD_DYNLYB_SEM(Libname) { - .SEM=add_shared_library ${MODDIR} ${Libname} ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM + .SEM=add_shared_library ${MODDIR} ${Libname} ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM } CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES @@ -1980,7 +1982,7 @@ module DLL_UNIT: _LINK_UNIT { .SEM=CPP_DYN_LIBRARY_SEM .NODE_TYPE=Library .SYMLINK_POLICY=SO - .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH + .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB .ALLOWED=WHOLE_ARCHIVE .DEFAULT_NAME_GENERATOR=TwoDirNames .ARGS_PARSER=DLL |