diff options
author | dimdim11 <dimdim11@yandex-team.com> | 2024-03-29 11:12:43 +0300 |
---|---|---|
committer | dimdim11 <dimdim11@yandex-team.com> | 2024-03-29 11:28:40 +0300 |
commit | 0595439604d7da0ebf23a96e99cf4cb19b24648e (patch) | |
tree | 5e277dd430f26a06e4d661b52b19921688985a73 | |
parent | 96aeada1ca0f152abaa79537e03d75a4e4af94f3 (diff) | |
download | ydb-0595439604d7da0ebf23a96e99cf4cb19b24648e.tar.gz |
Control of exporting with system STL/vanilla protoc/linux-headers/openSSL by ymake.core.conf
eb123654ae6ebb82ad676dd1fdcd866e27ee1d88
-rw-r--r-- | build/conf/opensource_export.conf | 20 | ||||
-rw-r--r-- | build/conf/proto.conf | 23 | ||||
-rw-r--r-- | build/ymake.core.conf | 1 | ||||
-rw-r--r-- | contrib/libs/linux-headers/ya.make | 22 | ||||
-rw-r--r-- | contrib/libs/openssl/crypto/ya.make | 14 | ||||
-rw-r--r-- | contrib/libs/openssl/ya.make | 21 | ||||
-rw-r--r-- | contrib/libs/protobuf/ya.make | 24 | ||||
-rw-r--r-- | contrib/libs/protoc/ya.make | 20 |
8 files changed, 107 insertions, 38 deletions
diff --git a/build/conf/opensource_export.conf b/build/conf/opensource_export.conf new file mode 100644 index 0000000000..1712095921 --- /dev/null +++ b/build/conf/opensource_export.conf @@ -0,0 +1,20 @@ +when ($OPENSOURCE_PROJECT) { + select ($OPENSOURCE_PROJECT) { + "catboost" ? { + OPENSOURCE_REPLACE_OPENSSL="1.1.1t" + } + "yt" ? { + OPENSOURCE_REPLACE_LINUX_HEADERS="6.5.9" + } + "yt-cpp-sdk" ? { + USE_STL_SYSTEM=yes + USE_INTERNAL_STL=no + OS_SDK=ubuntu-20 + TSTRING_IS_STD_STRING=yes + _SEM_EXTRA_CXX_FLAGS=-DNO_CUSTOM_CHAR_PTR_COMPARISION + OPENSOURCE_REPLACE_PROTOBUF="3.19.1" + OPENSOURCE_REPLACE_LINUX_HEADERS="6.5.9" + # OPENSOURCE_REPLACE_OPENSSL="[>=3.2.0]" + } + } +} diff --git a/build/conf/proto.conf b/build/conf/proto.conf index 486b32f106..1028a8c79a 100644 --- a/build/conf/proto.conf +++ b/build/conf/proto.conf @@ -5,9 +5,18 @@ NEW_JAVA_PROTOC=yes when ($NEW_JAVA_PROTOC == "yes") { JAVA_PROTOC=${tool:"build/platform/java/protoc"} } -PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE -PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"} -PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src +when ($OPENSOURCE_REPLACE_PROTOBUF) { + PROTOC_STYLEGUIDE_OUT= + PROTOC_PLUGIN_STYLEGUIDE= + PROTOBUF_PATH="${protobuf_INCLUDE_DIRS}" + DEFAULT_PROTOC_TOOLS= +} +otherwise { + PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE + PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"} + PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src + DEFAULT_PROTOC_TOOLS=${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} +} USE_VANILLA_PROTOC=no PROTOC_TRANSITIVE_HEADERS=yes _PROTOC_FLAGS= @@ -352,7 +361,7 @@ GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts macro _GO_PROTO_CMD_IMPL(File, OPTS...) { .CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES} - .ADDINCL=FOR proto contrib/libs/protobuf/src + .ADDINCL=FOR proto ${PROTOBUF_PATH} } # tag:go-specific tag:proto @@ -366,12 +375,12 @@ macro _GO_PROTO_CMD(File) { ### Generate .yson.go from .proto using yt/yt/orm/go/codegen/yson/internal/proto-yson-gen/cmd/proto-yson-gen macro YT_ORM_PROTO_YSON(OUT_OPTS[], Files...) { .CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yt/yt/orm/go/codegen/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" $_PROTOC_FLAGS ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files} ${hide:PROTO_FAKEID} - .ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto contrib/libs/protobuf/src + .ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto ${PROTOBUF_PATH} .PEERDIR=$GOSTD/strings $GOSTD/fmt $GOSTD/errors $GOSTD/encoding/json library/go/core/xerrors yt/go/yson yt/go/yterrors yt/yt/orm/go/codegen/yson/ytypes contrib/libs/protobuf } -_SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \ +_SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} $DEFAULT_PROTOC_TOOLS \ && set_global_flags COMMON_PROTOC_FLAGS \ && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \ && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH @@ -389,7 +398,7 @@ macro _CPP_VANILLA_PROTO_CMD(File) { .PEERDIR=contrib/libs/protobuf_std } -_SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \ +_SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} $DEFAULT_PROTOC_TOOLS \ && set_global_flags COMMON_PROTOC_FLAGS \ && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \ && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH $ARCADIA_ROOT/library/cpp/eventlog diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 61d1ad662d..c232b255a5 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -71,6 +71,7 @@ when ($LOCAL && $XCODE) { @import "${CONF_ROOT}/conf/settings.conf" @import "${CONF_ROOT}/conf/opensource.conf" +@import "${CONF_ROOT}/conf/opensource_export.conf" @import "${CONF_ROOT}/conf/sysincl.conf" @import "${CONF_ROOT}/conf/license.conf" @import "${CONF_ROOT}/conf/docs.conf" diff --git a/contrib/libs/linux-headers/ya.make b/contrib/libs/linux-headers/ya.make index dcaf1a8101..af40e65a2f 100644 --- a/contrib/libs/linux-headers/ya.make +++ b/contrib/libs/linux-headers/ya.make @@ -30,15 +30,27 @@ VERSION(6.5.9) ORIGINAL_SOURCE(mirror://kernel/linux/kernel/v6.x/linux-6.5.9.tar.xz) +IF (OPENSOURCE_REPLACE_LINUX_HEADERS) + + OPENSOURCE_EXPORT_REPLACEMENT( + CMAKE linux-headers-generic + CMAKE_TARGET linux-headers-generic::linux-headers-generic + CONAN linux-headers-generic/${OPENSOURCE_REPLACE_LINUX_HEADERS} + ) + +ELSE() # IF (OPENSOURCE_REPLACE_LINUX_HEADERS) + + ADDINCL( + GLOBAL contrib/libs/linux-headers + GLOBAL contrib/libs/linux-headers/_nf + ) + +ENDIF() # ELSE() # IF (OPENSOURCE_REPLACE_LINUX_HEADERS) + DISABLE(NEED_PLATFORM_PEERDIRS) DISABLE(WITH_VALGRIND) -ADDINCL( - GLOBAL contrib/libs/linux-headers - GLOBAL contrib/libs/linux-headers/_nf -) - NO_PLATFORM() END() diff --git a/contrib/libs/openssl/crypto/ya.make b/contrib/libs/openssl/crypto/ya.make index be3f2b7328..c6e9d82018 100644 --- a/contrib/libs/openssl/crypto/ya.make +++ b/contrib/libs/openssl/crypto/ya.make @@ -13,15 +13,16 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -# TODO(YMAKE-92) Move this information out of ya.make and allow per project configuration -IF (OPENSOURCE_PROJECT == "catboost") +IF (OPENSOURCE_REPLACE_OPENSSL) + OPENSOURCE_EXPORT_REPLACEMENT( CMAKE OpenSSL CMAKE_PACKAGE_COMPONENT Crypto CMAKE_TARGET OpenSSL::Crypto - CONAN openssl/1.1.1t + CONAN openssl/${OPENSOURCE_REPLACE_OPENSSL} ) -ENDIF() + +ENDIF() # IF (OPENSOURCE_REPLACE_OPENSSL) PEERDIR( contrib/libs/zlib @@ -37,8 +38,7 @@ ADDINCL( contrib/libs/openssl/include ) -# TODO(YMAKE-92) Move this information out of ya.make and allow per project configuration -IF (NOT EXPORT_CMAKE OR OPENSOURCE_PROJECT != "catboost") +IF (NOT EXPORT_CMAKE OR NOT OPENSOURCE_REPLACE_OPENSSL) IF (OS_LINUX) IF (ARCH_ARM64) @@ -1362,6 +1362,6 @@ IF (ARCADIA_OPENSSL_DISABLE_ARMV7_TICK) ) ENDIF() -ENDIF() +ENDIF() # IF (NOT EXPORT_CMAKE OR NOT OPENSOURCE_REPLACE_OPENSSL) END() diff --git a/contrib/libs/openssl/ya.make b/contrib/libs/openssl/ya.make index e8d70a9a31..e6c03b5b48 100644 --- a/contrib/libs/openssl/ya.make +++ b/contrib/libs/openssl/ya.make @@ -6,14 +6,21 @@ VERSION(1.1.1t) ORIGINAL_SOURCE(https://github.com/openssl/openssl/archive/OpenSSL_1_1_1t.tar.gz) -# TODO(YMAKE-92) Move this information out of ya.make and allow per project configuration -IF (OPENSOURCE_PROJECT == "catboost") +IF (OPENSOURCE_REPLACE_OPENSSL) + OPENSOURCE_EXPORT_REPLACEMENT( CMAKE OpenSSL CMAKE_TARGET OpenSSL::OpenSSL - CONAN openssl/1.1.1t + CONAN openssl/${OPENSOURCE_REPLACE_OPENSSL} ) -ENDIF() + +ELSE() # IF (OPENSOURCE_REPLACE_OPENSSL) + + ADDINCL( + GLOBAL contrib/libs/openssl/include + ) + +ENDIF() # ELSE() # IF (OPENSOURCE_REPLACE_OPENSSL) LICENSE( Apache-2.0 AND @@ -33,12 +40,10 @@ PEERDIR( ) ADDINCL( - GLOBAL contrib/libs/openssl/include contrib/libs/openssl ) -# TODO(YMAKE-92) Move this information out of ya.make and allow per project configuration -IF (NOT EXPORT_CMAKE OR OPENSOURCE_PROJECT != "catboost") +IF (NOT EXPORT_CMAKE OR NOT OPENSOURCE_REPLACE_OPENSSL) IF (OS_LINUX) IF (ARCH_ARM64) @@ -335,7 +340,7 @@ IF (OS_ANDROID AND ARCH_ARM64) ) ENDIF() -ENDIF() +ENDIF() # IF (NOT EXPORT_CMAKE OR NOT OPENSOURCE_REPLACE_OPENSSL) END() diff --git a/contrib/libs/protobuf/ya.make b/contrib/libs/protobuf/ya.make index 258e325959..60f012f9ff 100644 --- a/contrib/libs/protobuf/ya.make +++ b/contrib/libs/protobuf/ya.make @@ -15,18 +15,28 @@ VERSION(3.19.0) ORIGINAL_SOURCE(https://github.com/protocolbuffers/protobuf/archive/v3.19.0.tar.gz) +IF (OPENSOURCE_REPLACE_PROTOBUF) + + OPENSOURCE_EXPORT_REPLACEMENT( + CMAKE Protobuf + CMAKE_TARGET protobuf::libprotobuf protobuf::libprotoc + CONAN protobuf/${OPENSOURCE_REPLACE_PROTOBUF} "&& conan_require_tool" protobuf/${OPENSOURCE_REPLACE_PROTOBUF} "&& conan_import \"bin, protoc* -> ./bin\" && vanilla_protobuf" + ) + +ELSE() # IF (OPENSOURCE_REPLACE_PROTOBUF) + + ADDINCL( + GLOBAL contrib/libs/protobuf/src + GLOBAL FOR proto contrib/libs/protobuf/src + ) + +ENDIF() # ELSE() # IF (OPENSOURCE_REPLACE_PROTOBUF) + PEERDIR( contrib/libs/zlib library/cpp/sanitizer/include ) -ADDINCL( - GLOBAL contrib/libs/protobuf/src - GLOBAL FOR - proto - contrib/libs/protobuf/src -) - NO_COMPILER_WARNINGS() CFLAGS( diff --git a/contrib/libs/protoc/ya.make b/contrib/libs/protoc/ya.make index f1134013cb..a864faf185 100644 --- a/contrib/libs/protoc/ya.make +++ b/contrib/libs/protoc/ya.make @@ -13,16 +13,28 @@ VERSION(3.19.0) ORIGINAL_SOURCE(https://github.com/protocolbuffers/protobuf/archive/v3.19.0.tar.gz) +IF (OPENSOURCE_REPLACE_PROTOBUF) + + OPENSOURCE_EXPORT_REPLACEMENT( + CMAKE Protobuf + CMAKE_TARGET protobuf::libprotobuf protobuf::libprotoc + CONAN protobuf/${OPENSOURCE_REPLACE_PROTOBUF} "&& conan_require_tool" protobuf/${OPENSOURCE_REPLACE_PROTOBUF} "&& conan_import \"bin, protoc* -> ./bin\" && vanilla_protobuf" + ) + +ELSE() # IF (OPENSOURCE_REPLACE_PROTOBUF) + + ADDINCL( + GLOBAL contrib/libs/protoc/src + ) + +ENDIF() # ELSE() # IF (OPENSOURCE_REPLACE_PROTOBUF) + LICENSE_TEXTS(.yandex_meta/licenses.list.txt) PEERDIR( contrib/libs/protobuf ) -ADDINCL( - GLOBAL contrib/libs/protoc/src -) - NO_COMPILER_WARNINGS() NO_UTIL() |