diff options
author | somov <somov@yandex-team.ru> | 2022-02-10 16:45:47 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:47 +0300 |
commit | a5950576e397b1909261050b8c7da16db58f10b1 (patch) | |
tree | 7ba7677f6a4c3e19e2cefab34d16df2c8963b4d4 /build | |
parent | 81eddc8c0b55990194e112b02d127b87d54164a9 (diff) | |
download | ydb-a5950576e397b1909261050b8c7da16db58f10b1.tar.gz |
Restoring authorship annotation for <somov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build')
43 files changed, 3354 insertions, 3354 deletions
diff --git a/build/conf/license.conf b/build/conf/license.conf index f2fb576b0d..0b36bfcc0d 100644 --- a/build/conf/license.conf +++ b/build/conf/license.conf @@ -22,34 +22,34 @@ LICENSE_PROPERTIES= \ FORBIDDEN NDA REQUIRE_DISCLOSURE PERMISSIVE REQUIRE_CITATION SERVICE LICENSES_UNATTRIBUTED= \ - AFL-2.0 \ - AML \ - APSL-1.0 \ + AFL-2.0 \ + AML \ + APSL-1.0 \ ASM-BSD-3-Clause \ Amazon-SL \ - Artistic-1.0-Perl \ - BCL \ - BSD-3-Clause-Open-MPI \ - BSD-4-Clause-Shortened \ - BSLA \ - Bison-Exception \ - BouncyCastle-MIT \ + Artistic-1.0-Perl \ + BCL \ + BSD-3-Clause-Open-MPI \ + BSD-4-Clause-Shortened \ + BSLA \ + Bison-Exception \ + BouncyCastle-MIT \ Brian-Gladman-3-Clause \ - Bsd-New-Tcpdump \ + Bsd-New-Tcpdump \ Bsd-Original-Uc-1986 \ CC-BY-1.0 \ CC-BY-2.0 \ CC-BY-2.5 \ - CC-BY-3.0 \ - CC-BY-4.0 \ + CC-BY-3.0 \ + CC-BY-4.0 \ CC-BY-NC-1.0 \ CC-BY-NC-2.0 \ CC-BY-NC-2.5 \ CC-BY-NC-3.0 \ - CC-BY-NC-ND-1.0 \ - CC-BY-NC-ND-2.0 \ - CC-BY-NC-ND-2.5 \ - CC-BY-NC-ND-3.0 \ + CC-BY-NC-ND-1.0 \ + CC-BY-NC-ND-2.0 \ + CC-BY-NC-ND-2.5 \ + CC-BY-NC-ND-3.0 \ CC-BY-NC-SA-1.0 \ CC-BY-NC-SA-2.0 \ CC-BY-NC-SA-2.5 \ @@ -61,93 +61,93 @@ LICENSES_UNATTRIBUTED= \ CC-BY-SA-1.0 \ CC-BY-SA-2.0 \ CC-BY-SA-2.5 \ - CC-BY-SA-3.0 \ + CC-BY-SA-3.0 \ CC-BY-SA-4.0 \ - CDDL \ - CECILL-B \ - Carnegie-Mellon \ - Carnegie-Mellon-Contributors \ - DOC \ - DSO-1.1 \ - EDL-1.0 \ - Elastic-License-2.0 \ - FSFUL \ - FSFULLR \ - Fftpack-2004 \ - GCC-exception-3.1 \ - GDAL \ - GFDL-1.1-or-later \ - GPL-2.0 WITH Classpath-exception-2.0 \ - GPL-2.0 WITH FOSS-exception \ - GPL-2.0-only WITH Mysql-Linking-Exception-2018 \ - GPL-2.0-only WITH Universal-FOSS-exception-1.0 \ - GPL-2.0-or-later WITH Avisynth-C-Interface-Exception \ - GPL-2.0-or-later WITH Bison-Exception-2.0 \ - GPL-2.0-or-later WITH Bison-exception-2.2 \ - GPL-2.0-or-later WITH C-Interface-Exception \ - GPL-2.0-or-later WITH Libtool-exception \ - GPL-2.0-or-later WITH mif-exception \ - Go-License \ - Google-Patent-License-Webm \ - Google-Patent-License-Webrtc \ - HPND \ - HPND-sell-variant \ - HPND-sell-variant \ - HSQLDB-BSD-3-Clause \ - Hdf5 \ - IPL-1.0 \ - Ibm-Dhcp \ - Ietf-trust \ - ImageMagick \ - Info-Zip \ - Intel-Confidential \ - Intel-Material \ - JAMon-BSD-3-Clause \ - LGPL-3.0-or-later WITH ZeroMQ-Exception \ - LPL-1.02 \ + CDDL \ + CECILL-B \ + Carnegie-Mellon \ + Carnegie-Mellon-Contributors \ + DOC \ + DSO-1.1 \ + EDL-1.0 \ + Elastic-License-2.0 \ + FSFUL \ + FSFULLR \ + Fftpack-2004 \ + GCC-exception-3.1 \ + GDAL \ + GFDL-1.1-or-later \ + GPL-2.0 WITH Classpath-exception-2.0 \ + GPL-2.0 WITH FOSS-exception \ + GPL-2.0-only WITH Mysql-Linking-Exception-2018 \ + GPL-2.0-only WITH Universal-FOSS-exception-1.0 \ + GPL-2.0-or-later WITH Avisynth-C-Interface-Exception \ + GPL-2.0-or-later WITH Bison-Exception-2.0 \ + GPL-2.0-or-later WITH Bison-exception-2.2 \ + GPL-2.0-or-later WITH C-Interface-Exception \ + GPL-2.0-or-later WITH Libtool-exception \ + GPL-2.0-or-later WITH mif-exception \ + Go-License \ + Google-Patent-License-Webm \ + Google-Patent-License-Webrtc \ + HPND \ + HPND-sell-variant \ + HPND-sell-variant \ + HSQLDB-BSD-3-Clause \ + Hdf5 \ + IPL-1.0 \ + Ibm-Dhcp \ + Ietf-trust \ + ImageMagick \ + Info-Zip \ + Intel-Confidential \ + Intel-Material \ + JAMon-BSD-3-Clause \ + LGPL-3.0-or-later WITH ZeroMQ-Exception \ + LPL-1.02 \ LicenseRef-scancode-bsd-new-nomod \ LicenseRef-scancode-cc-by-2.0-uk \ LicenseRef-scancode-cc-devnations-2.0 \ LicenseRef-scancode-cc-sampling-1.0 \ - LicenseRef-scancode-free-unknown \ - LicenseRef-scancode-generic-cla \ - LicenseRef-scancode-other-copyleft \ - LicenseRef-scancode-other-permissive \ + LicenseRef-scancode-free-unknown \ + LicenseRef-scancode-generic-cla \ + LicenseRef-scancode-other-copyleft \ + LicenseRef-scancode-other-permissive \ LicenseRef-scancode-pcre \ - LicenseRef-scancode-proprietary-license \ - LicenseRef-scancode-unknown \ - LicenseRef-scancode-unknown-license-reference \ - LicenseRef-scancode-warranty-disclaimer \ - MirOS \ - Mit-Xfig \ - Mozilla-GC \ - NAIST-2003 \ - Nvidia-Gov \ - Oracle \ - Oracle-technology \ - PSF-3.7.2 \ - Qhull \ - Quicklz \ - Ruby \ - SSPL-1.0 \ - SZIP \ - Sendmail \ - Softsurfer \ - Stlport-4.5 \ - TCL \ - TU-Berlin-1.0 \ - Unicode-TOU \ - Universal-FOSS-exception-1.0 \ - Unknown \ - Unlicense \ - Vcalendar \ - Vim \ - X11-Adobe-Dec \ - X11-Hanson \ - X11-XConsortium-Veillard \ - Xfree86-1.0 \ - Xnet \ - jQuery-MIT + LicenseRef-scancode-proprietary-license \ + LicenseRef-scancode-unknown \ + LicenseRef-scancode-unknown-license-reference \ + LicenseRef-scancode-warranty-disclaimer \ + MirOS \ + Mit-Xfig \ + Mozilla-GC \ + NAIST-2003 \ + Nvidia-Gov \ + Oracle \ + Oracle-technology \ + PSF-3.7.2 \ + Qhull \ + Quicklz \ + Ruby \ + SSPL-1.0 \ + SZIP \ + Sendmail \ + Softsurfer \ + Stlport-4.5 \ + TCL \ + TU-Berlin-1.0 \ + Unicode-TOU \ + Universal-FOSS-exception-1.0 \ + Unknown \ + Unlicense \ + Vcalendar \ + Vim \ + X11-Adobe-Dec \ + X11-Hanson \ + X11-XConsortium-Veillard \ + Xfree86-1.0 \ + Xnet \ + jQuery-MIT LICENSES_PATCHES_FORBIDDEN= \ Unicode @@ -265,7 +265,7 @@ LICENSES_PERMISSIVE= \ MIT-Modern-Variant \ MIT-Nagy \ MIT-open-group \ - Mit-Old-Style \ + Mit-Old-Style \ Mit-Veillard-Variant \ MPL-1.0 \ MPL-1.1 \ diff --git a/build/platform.md b/build/platform.md index deb8acfb09..f071401e00 100644 --- a/build/platform.md +++ b/build/platform.md @@ -1,23 +1,23 @@ -## `--target-platform` -### `default` -* `android` - * `i686`, `x86_64`, `armv7a`, `armv7a_neon`, `armv8a` +## `--target-platform` +### `default` +* `android` + * `i686`, `x86_64`, `armv7a`, `armv7a_neon`, `armv8a` Clang 9.0.8, Android NDK r21b. API 16 for the 32-bit platforms, API 21 for 64-bit. -* `darwin` - * `x86_64` +* `darwin` + * `x86_64` Clang 12.0.0, macOS SDK 10.13 * `arm64` Clang 12.0.0, macOS SDK ??? -* `ios` - * `i386`, `x86_64`, `armv7`, `arm64` +* `ios` + * `i386`, `x86_64`, `armv7`, `arm64` Clang 12.0.0, iOS SDK and iOS Simulator SDK 11.1 -* `linux` - * `x86_64` +* `linux` + * `x86_64` Clang 12.0.0, Ubuntu Linux 14.04 x86-64 SDK - * `aarch64` + * `aarch64` Clang 12.0.0, Ubuntu Linux 16.04 aarch64 SDK - * `ppc64le` + * `ppc64le` Clang 12.0.0, Ubuntu Linux 14.04 ppc64le SDK -* `win` - * `i686`, `x86_64` - Microsoft Visual C++ 2017 14.16.27023, Windows Kits 10.0.16299.0 +* `win` + * `i686`, `x86_64` + Microsoft Visual C++ 2017 14.16.27023, Windows Kits 10.0.16299.0 diff --git a/build/platform/bfd/ya.make b/build/platform/bfd/ya.make index 67501f665f..d40b45b936 100644 --- a/build/platform/bfd/ya.make +++ b/build/platform/bfd/ya.make @@ -1,9 +1,9 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - +RESOURCES_LIBRARY() + +OWNER(somov) + INCLUDE(${ARCADIA_ROOT}/build/platform/binutils/binutils.resource) - + LDFLAGS(-fuse-ld=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/ld.bfd) - -END() + +END() diff --git a/build/platform/binutils/ya.make b/build/platform/binutils/ya.make index aedcb12f23..1d22602e8e 100644 --- a/build/platform/binutils/ya.make +++ b/build/platform/binutils/ya.make @@ -1,8 +1,8 @@ -RESOURCES_LIBRARY() - +RESOURCES_LIBRARY() + OWNER(g:contrib somov) - + INCLUDE(binutils.resource) - -END() - + +END() + diff --git a/build/platform/cctools/ya.make b/build/platform/cctools/ya.make index c17a6abc67..cb9632425b 100644 --- a/build/platform/cctools/ya.make +++ b/build/platform/cctools/ya.make @@ -1,12 +1,12 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - +RESOURCES_LIBRARY() + +OWNER(somov) + DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE( CCTOOLS_ROOT sbr:2135298496 FOR LINUX sbr:2135992724 FOR DARWIN sbr:2135992724 FOR DARWIN-ARM64 ) - -END() + +END() diff --git a/build/platform/cuda/cuda_runtime_include.h b/build/platform/cuda/cuda_runtime_include.h index e60aacc4fb..0acd501894 100644 --- a/build/platform/cuda/cuda_runtime_include.h +++ b/build/platform/cuda/cuda_runtime_include.h @@ -1,13 +1,13 @@ -#pragma once - -// Компилятор nvcc из CUDA Toolkit при компиляции файла включает неявную зависимость -// $CUDA_ROOT/include/cuda_runtime.h, которая в свою очередь включает другие файлы -// из $CUDA_ROOT, а так же из стандартной библиотеки C++. Файлы из внешних ресурсов -// не доступны на этапе конфигурирования сборки, и зависимости из них не учитываются. -// Это, в частности, приводит к поломке сборки с использованием nvcc в режиме sandboxing-а. - -// Здесь перечислены такие зависимости. Этот файл добавляется в качестве дополнительной -// зависимости к каждой компиляции nvcc. - -#include <cmath> -#include <new> +#pragma once + +// Компилятор nvcc из CUDA Toolkit при компиляции файла включает неявную зависимость +// $CUDA_ROOT/include/cuda_runtime.h, которая в свою очередь включает другие файлы +// из $CUDA_ROOT, а так же из стандартной библиотеки C++. Файлы из внешних ресурсов +// не доступны на этапе конфигурирования сборки, и зависимости из них не учитываются. +// Это, в частности, приводит к поломке сборки с использованием nvcc в режиме sandboxing-а. + +// Здесь перечислены такие зависимости. Этот файл добавляется в качестве дополнительной +// зависимости к каждой компиляции nvcc. + +#include <cmath> +#include <new> diff --git a/build/platform/cuda/ya.make b/build/platform/cuda/ya.make index 3615f682cd..5f3c896c47 100644 --- a/build/platform/cuda/ya.make +++ b/build/platform/cuda/ya.make @@ -1,16 +1,16 @@ -RESOURCES_LIBRARY() - -# https://wiki.yandex-team.ru/devtools/cuda/ - -OWNER(g:contrib somov) - -IF (NOT HAVE_CUDA) - MESSAGE(FATAL_ERROR "No CUDA Toolkit for your build") -ENDIF() - -IF (USE_ARCADIA_CUDA) - IF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - IF (OS_LINUX AND ARCH_X86_64) +RESOURCES_LIBRARY() + +# https://wiki.yandex-team.ru/devtools/cuda/ + +OWNER(g:contrib somov) + +IF (NOT HAVE_CUDA) + MESSAGE(FATAL_ERROR "No CUDA Toolkit for your build") +ENDIF() + +IF (USE_ARCADIA_CUDA) + IF (HOST_OS_LINUX AND HOST_ARCH_X86_64) + IF (OS_LINUX AND ARCH_X86_64) IF (CUDA_VERSION == "11.4") DECLARE_EXTERNAL_RESOURCE(CUDA sbr:2410761119) # CUDA Toolkit 11.4.2 for Linux x86-64 ELSEIF (CUDA_VERSION == "11.3") @@ -20,12 +20,12 @@ IF (USE_ARCADIA_CUDA) ELSEIF (CUDA_VERSION == "11.1") DECLARE_EXTERNAL_RESOURCE(CUDA sbr:1882836946) # CUDA Toolkit 11.1.1 for Linux x86-64 ELSEIF (CUDA_VERSION == "11.0") - DECLARE_EXTERNAL_RESOURCE(CUDA sbr:1647896014) # CUDA Toolkit 11.0.2 for Linux x86-64 + DECLARE_EXTERNAL_RESOURCE(CUDA sbr:1647896014) # CUDA Toolkit 11.0.2 for Linux x86-64 ELSEIF (CUDA_VERSION == "10.1") DECLARE_EXTERNAL_RESOURCE(CUDA sbr:2077988857) # CUDA Toolkit 10.1.168 for Linux x86-64 - ELSE() - ENABLE(CUDA_NOT_FOUND) - ENDIF() + ELSE() + ENABLE(CUDA_NOT_FOUND) + ENDIF() ELSEIF(OS_LINUX AND ARCH_AARCH64) IF (CUDA_VERSION == "11.3") DECLARE_EXTERNAL_RESOURCE(CUDA sbr:2227720086) # CUDA Toolkit 11.3.20210513 (11.3.1) for Linux x86-64 with linux-aarch64 support @@ -34,10 +34,10 @@ IF (USE_ARCADIA_CUDA) ELSE() ENABLE(CUDA_NOT_FOUND) ENDIF() - ELSE() - ENABLE(CUDA_NOT_FOUND) - ENDIF() - + ELSE() + ENABLE(CUDA_NOT_FOUND) + ENDIF() + ELSEIF (HOST_OS_LINUX AND HOST_ARCH_PPC64LE) IF (OS_LINUX AND ARCH_PPC64LE) IF (CUDA_VERSION == "10.1") @@ -50,51 +50,51 @@ IF (USE_ARCADIA_CUDA) ENABLE(CUDA_NOT_FOUND) ENDIF() - ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - IF (OS_DARWIN AND ARCH_X86_64) + ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) + IF (OS_DARWIN AND ARCH_X86_64) IF (CUDA_VERSION == "10.1") - DECLARE_EXTERNAL_RESOURCE(CUDA sbr:978727023) # CUDA Toolkit 10.1.168 for macOS x86-64 - ENDIF() - - ELSE() - ENABLE(CUDA_NOT_FOUND) - ENDIF() - - ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - IF (OS_WINDOWS AND ARCH_X86_64) + DECLARE_EXTERNAL_RESOURCE(CUDA sbr:978727023) # CUDA Toolkit 10.1.168 for macOS x86-64 + ENDIF() + + ELSE() + ENABLE(CUDA_NOT_FOUND) + ENDIF() + + ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) + IF (OS_WINDOWS AND ARCH_X86_64) IF (CUDA_VERSION == "11.3") DECLARE_EXTERNAL_RESOURCE(CUDA sbr:2215101513) # CUDA Toolkit 11.3.1 for Windows x86-64 ELSEIF (CUDA_VERSION == "11.1") DECLARE_EXTERNAL_RESOURCE(CUDA sbr:1896564605) # CUDA Toolkit 11.1.1 for Windows x86-64 ELSEIF (CUDA_VERSION == "10.1") - DECLARE_EXTERNAL_RESOURCE(CUDA sbr:978734165) # CUDA Toolkit 10.1.168 for Windows x86-64 - ELSE() - ENABLE(CUDA_NOT_FOUND) - ENDIF() - - ELSE() - ENABLE(CUDA_NOT_FOUND) - ENDIF() - - ELSE() - ENABLE(CUDA_NOT_FOUND) - ENDIF() -ENDIF() - -IF (USE_ARCADIA_CUDA_HOST_COMPILER) - IF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - IF (OS_LINUX AND ARCH_X86_64) + DECLARE_EXTERNAL_RESOURCE(CUDA sbr:978734165) # CUDA Toolkit 10.1.168 for Windows x86-64 + ELSE() + ENABLE(CUDA_NOT_FOUND) + ENDIF() + + ELSE() + ENABLE(CUDA_NOT_FOUND) + ENDIF() + + ELSE() + ENABLE(CUDA_NOT_FOUND) + ENDIF() +ENDIF() + +IF (USE_ARCADIA_CUDA_HOST_COMPILER) + IF (HOST_OS_LINUX AND HOST_ARCH_X86_64) + IF (OS_LINUX AND ARCH_X86_64) DECLARE_EXTERNAL_RESOURCE(CUDA_HOST_TOOLCHAIN sbr:1886578148) # Clang 11.0.0 for linux-x86_64 IF (CUDA_VERSION VERSION_LT "11.2") # Equivalent to nvcc -allow-unsupported-compiler (present since 11.0). CFLAGS(GLOBAL "-D__NV_NO_HOST_COMPILER_CHECK") - ENDIF() + ENDIF() ELSEIF(OS_LINUX AND ARCH_AARCH64) DECLARE_EXTERNAL_RESOURCE(CUDA_HOST_TOOLCHAIN sbr:1886578148) # Clang 11.0.0 for linux-x86_64 - ELSE() - ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) - ENDIF() - + ELSE() + ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) + ENDIF() + ELSEIF (HOST_OS_LINUX AND HOST_ARCH_PPC64LE) IF (OS_LINUX AND ARCH_PPC64LE) IF (CUDA_VERSION == "10.1") @@ -107,51 +107,51 @@ IF (USE_ARCADIA_CUDA_HOST_COMPILER) ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) ENDIF() - ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - IF (OS_DARWIN AND ARCH_X86_64) + ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) + IF (OS_DARWIN AND ARCH_X86_64) SET(__XCODE_RESOURCE_NAME CUDA_HOST_TOOLCHAIN) IF (CUDA_VERSION == "10.1") - SET(__XCODE_TOOLCHAIN_VERSION "9.2") # (not latest) + SET(__XCODE_TOOLCHAIN_VERSION "9.2") # (not latest) ELSE() SET(__XCODE_TOOLCHAIN_VERSION "") ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) - ENDIF() + ENDIF() IF (__XCODE_TOOLCHAIN_VERSION) INCLUDE(${ARCADIA_ROOT}/build/platform/xcode/ya.make.inc) ENDIF() - ELSE() - ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) - ENDIF() - - ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - IF (OS_WINDOWS AND ARCH_X86_64) + ELSE() + ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) + ENDIF() + + ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) + IF (OS_WINDOWS AND ARCH_X86_64) # To create this toolchain, install MSVS on Windows and run: # devtools/tools_build/pack_sdk.py msvc out.tar # Note: it will contain patched "VC/Auxiliary/Build/vcvarsall.bat" # to prevent "nvcc fatal : Host compiler targets unsupported OS." IF (CUDA_HOST_MSVC_VERSION == "14.28.29910") DECLARE_EXTERNAL_RESOURCE(CUDA_HOST_TOOLCHAIN sbr:2153212401) - ELSE() - MESSAGE(FATAL_ERROR "Unexpected or unspecified Microsoft Visual C++ CUDA host compiler version") - ENDIF() - - ELSE() - ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) - ENDIF() - - ELSE() - ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) - ENDIF() -ENDIF() - -IF (CUDA_NOT_FOUND) - MESSAGE(FATAL_ERROR "No CUDA Toolkit for the selected platform") -ENDIF() - -IF (CUDA_HOST_COMPILER_NOT_FOUND) - MESSAGE(FATAL_ERROR "No CUDA host compiler for the selected platform and CUDA Toolkit version ${CUDA_VERSION}") -ENDIF() - + ELSE() + MESSAGE(FATAL_ERROR "Unexpected or unspecified Microsoft Visual C++ CUDA host compiler version") + ENDIF() + + ELSE() + ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) + ENDIF() + + ELSE() + ENABLE(CUDA_HOST_COMPILER_NOT_FOUND) + ENDIF() +ENDIF() + +IF (CUDA_NOT_FOUND) + MESSAGE(FATAL_ERROR "No CUDA Toolkit for the selected platform") +ENDIF() + +IF (CUDA_HOST_COMPILER_NOT_FOUND) + MESSAGE(FATAL_ERROR "No CUDA host compiler for the selected platform and CUDA Toolkit version ${CUDA_VERSION}") +ENDIF() + # Use thrust and cub from Arcadia, not from HPC SDK # NB: # it would be better to use PEERDIR instead, @@ -161,22 +161,22 @@ ADDINCL( GLOBAL contrib/libs/nvidia/cub ) -IF (HOST_OS_WINDOWS) - SET_APPEND_WITH_GLOBAL(USER_CFLAGS GLOBAL "\"-I${CUDA_ROOT}/include\"") -ELSE() - CFLAGS(GLOBAL "-I${CUDA_ROOT}/include") -ENDIF() - -IF (HOST_OS_WINDOWS) - SET_APPEND(LDFLAGS_GLOBAL "\"/LIBPATH:${CUDA_ROOT}/lib/x64\"") +IF (HOST_OS_WINDOWS) + SET_APPEND_WITH_GLOBAL(USER_CFLAGS GLOBAL "\"-I${CUDA_ROOT}/include\"") +ELSE() + CFLAGS(GLOBAL "-I${CUDA_ROOT}/include") +ENDIF() + +IF (HOST_OS_WINDOWS) + SET_APPEND(LDFLAGS_GLOBAL "\"/LIBPATH:${CUDA_ROOT}/lib/x64\"") ELSEIF(HOST_OS_LINUX AND OS_LINUX AND ARCH_AARCH64) LDFLAGS("-L${CUDA_ROOT}/targets/sbsa-linux/lib") -ELSEIF(HOST_OS_LINUX) - LDFLAGS("-L${CUDA_ROOT}/lib64") -ELSE() - LDFLAGS("-L${CUDA_ROOT}/lib") -ENDIF() - +ELSEIF(HOST_OS_LINUX) + LDFLAGS("-L${CUDA_ROOT}/lib64") +ELSE() + LDFLAGS("-L${CUDA_ROOT}/lib") +ENDIF() + IF (CUDA_REQUIRED) IF(HOST_OS_LINUX) LDFLAGS("-L${CUDA_ROOT}/lib64/stubs") @@ -186,10 +186,10 @@ IF (CUDA_REQUIRED) ENDIF() ENDIF() -IF (HOST_OS_WINDOWS) +IF (HOST_OS_WINDOWS) LDFLAGS(cudadevrt.lib cudart_static.lib) -ELSE() +ELSE() EXTRALIBS(-lcudadevrt -lcudart_static -lculibos) -ENDIF() - -END() +ENDIF() + +END() diff --git a/build/platform/gold/ya.make b/build/platform/gold/ya.make index 91f01602f7..4e49b9df24 100644 --- a/build/platform/gold/ya.make +++ b/build/platform/gold/ya.make @@ -1,12 +1,12 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - +RESOURCES_LIBRARY() + +OWNER(somov) + INCLUDE(${ARCADIA_ROOT}/build/platform/binutils/binutils.resource) - + LDFLAGS( -fuse-ld=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/ld.gold -Wl,-z,noexecstack ) - -END() + +END() diff --git a/build/platform/intel_fpga_sdk/ya.make b/build/platform/intel_fpga_sdk/ya.make index 5cefb02250..d01ab1bb1f 100644 --- a/build/platform/intel_fpga_sdk/ya.make +++ b/build/platform/intel_fpga_sdk/ya.make @@ -1,9 +1,9 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -DECLARE_EXTERNAL_RESOURCE(INTEL_FPGA_SDK sbr:606576548) - -LDFLAGS(-L$INTEL_FPGA_SDK_RESOURCE_GLOBAL/lib) - -END() +RESOURCES_LIBRARY() + +OWNER(somov) + +DECLARE_EXTERNAL_RESOURCE(INTEL_FPGA_SDK sbr:606576548) + +LDFLAGS(-L$INTEL_FPGA_SDK_RESOURCE_GLOBAL/lib) + +END() diff --git a/build/platform/ios_sdk/ya.make b/build/platform/ios_sdk/ya.make index b1246a70b9..87bef6b17e 100644 --- a/build/platform/ios_sdk/ya.make +++ b/build/platform/ios_sdk/ya.make @@ -1,17 +1,17 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -SET(NEED_PLATFORM_PEERDIRS no) - +RESOURCES_LIBRARY() + +OWNER(somov) + +SET(NEED_PLATFORM_PEERDIRS no) + IF (OS_IOS AND NOT OS_IOSSIM) # iOS 14.5 SDK / Xcode 12.5.1 (12E507) DECLARE_EXTERNAL_RESOURCE(IOS_SDK_ROOT sbr:2661782168) ELSEIF (OS_IOSSIM) # iOS Simulator 14.5 SDK / Xcode 12.5.1 (12E507) DECLARE_EXTERNAL_RESOURCE(IOS_SDK_ROOT sbr:2661786760) -ELSE() - MESSAGE(FATAL_ERROR "There is no iOS SDK for the selected target platform") -ENDIF() - -END() +ELSE() + MESSAGE(FATAL_ERROR "There is no iOS SDK for the selected target platform") +ENDIF() + +END() diff --git a/build/platform/linux_sdk/README.md b/build/platform/linux_sdk/README.md index ff846cefbf..7bf9d7eb90 100644 --- a/build/platform/linux_sdk/README.md +++ b/build/platform/linux_sdk/README.md @@ -1,7 +1,7 @@ -### Правки в Ubuntu 14.04 SDK -* `lib/x86_64-linux-gnu/libc-2.19.so` — удалены dynamic версии символов - * `__cxa_thread_atexit_impl` - * `getauxval` - * `__getauxval` -* `usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19` — удалены dynamic версии символов - * `__cxa_thread_atexit_impl` +### Правки в Ubuntu 14.04 SDK +* `lib/x86_64-linux-gnu/libc-2.19.so` — удалены dynamic версии символов + * `__cxa_thread_atexit_impl` + * `getauxval` + * `__getauxval` +* `usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19` — удалены dynamic версии символов + * `__cxa_thread_atexit_impl` diff --git a/build/platform/linux_sdk/ya.make b/build/platform/linux_sdk/ya.make index add74eee9e..641d78d050 100644 --- a/build/platform/linux_sdk/ya.make +++ b/build/platform/linux_sdk/ya.make @@ -1,45 +1,45 @@ -RESOURCES_LIBRARY() - -OWNER(g:contrib somov) - -NO_PLATFORM_RESOURCES() - -SET(NEED_PLATFORM_PEERDIRS no) - +RESOURCES_LIBRARY() + +OWNER(g:contrib somov) + +NO_PLATFORM_RESOURCES() + +SET(NEED_PLATFORM_PEERDIRS no) + IF (OS_SDK == "local") - # Implementation is in $S/build/ymake.core.conf -ELSEIF (ARCH_X86_64) + # Implementation is in $S/build/ymake.core.conf +ELSEIF (ARCH_X86_64) IF (OS_SDK == "ubuntu-10") - DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:244388930) + DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:244388930) ELSEIF (OS_SDK == "ubuntu-12") - DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:244387436) + DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:244387436) ELSEIF (OS_SDK == "ubuntu-14") - DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:1966560555) + DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:1966560555) ELSEIF (OS_SDK == "ubuntu-16") - DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:243881345) + DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:243881345) ELSEIF (OS_SDK == "ubuntu-18") - DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:617908641) + DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:617908641) ELSEIF (OS_SDK == "ubuntu-20") DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:2635714620) - ELSE() - MESSAGE(FATAL_ERROR "There is no ${OS_SDK} SDK for x86-64") - ENDIF() -ELSEIF (ARCH_AARCH64) + ELSE() + MESSAGE(FATAL_ERROR "There is no ${OS_SDK} SDK for x86-64") + ENDIF() +ELSEIF (ARCH_AARCH64) IF (OS_SDK == "ubuntu-16") - DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:309054781) - ELSE() + DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:309054781) + ELSE() MESSAGE(FATAL_ERROR "There is no ${OS_SDK} SDK for AArch64/ARMv8 64 bit") - ENDIF() -ELSEIF (ARCH_PPC64LE) + ENDIF() +ELSEIF (ARCH_PPC64LE) IF (OS_SDK == "ubuntu-14") IF (HOST_ARCH_PPC64LE) DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:1570528338) ELSE() DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:233217651) ENDIF() - ELSE() - MESSAGE(FATAL_ERROR "There is no ${OS_SDK} SDK for PPC64LE") - ENDIF() + ELSE() + MESSAGE(FATAL_ERROR "There is no ${OS_SDK} SDK for PPC64LE") + ENDIF() ELSEIF (ARCH_ARM7) IF (ARM7_FLOAT_ABI == "hard" AND OS_SDK == "ubuntu-16") DECLARE_EXTERNAL_RESOURCE(OS_SDK_ROOT sbr:1323200692) @@ -48,8 +48,8 @@ ELSEIF (ARCH_ARM7) ELSE() MESSAGE(FATAL_ERROR "There is no ${OS_SDK} SDK for ARMv7 32 bit (float ABI: ${ARM7_FLOAT_ABI})") ENDIF() -ELSE() - MESSAGE(FATAL_ERROR "Unexpected OS_SDK value: ${OS_SDK}") -ENDIF() - -END() +ELSE() + MESSAGE(FATAL_ERROR "Unexpected OS_SDK value: ${OS_SDK}") +ENDIF() + +END() diff --git a/build/platform/lld/ya.make b/build/platform/lld/ya.make index c046e89098..4d7b41c957 100644 --- a/build/platform/lld/ya.make +++ b/build/platform/lld/ya.make @@ -1,9 +1,9 @@ RESOURCES_LIBRARY() - + LICENSE(Service-Prebuilt-Tool) -OWNER(somov) - +OWNER(somov) + IF (USE_LTO OR USE_THINLTO) IF (CLANG7 OR CLANG8) # Use LLD 8 for old Clang because its IR code fails LLD 11 validation. @@ -58,5 +58,5 @@ ELSE() LDFLAGS("-fuse-ld=$LLD_ROOT_RESOURCE_GLOBAL/ld" "-Wl,--no-rosegment") ENDIF() - -END() + +END() diff --git a/build/platform/macos_sdk/ya.make b/build/platform/macos_sdk/ya.make index 6fb8dc54c0..8f9266f4bd 100644 --- a/build/platform/macos_sdk/ya.make +++ b/build/platform/macos_sdk/ya.make @@ -1,10 +1,10 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - +RESOURCES_LIBRARY() + +OWNER(somov) + # macOS 11.1 Big Sur SDK / Xcode 12.4 (12D4e) DECLARE_EXTERNAL_RESOURCE(MACOS_SDK sbr:2088833948) - + IF (USE_STL_SYSTEM) SET(__XCODE_RESOURCE_NAME CPP_XCODE_TOOLCHAIN_ROOT) SET(__XCODE_TOOLCHAIN_VERSION ${CPP_XCODE_TOOLCHAIN_VERSION}) @@ -17,4 +17,4 @@ IF (USE_STL_SYSTEM) ) ENDIF() -END() +END() diff --git a/build/platform/mapkit/ya.make b/build/platform/mapkit/ya.make index 513dff5bcf..dfc20f0c0a 100644 --- a/build/platform/mapkit/ya.make +++ b/build/platform/mapkit/ya.make @@ -1,32 +1,32 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -NO_PLATFORM() - -IF (OS_ANDROID) +RESOURCES_LIBRARY() + +OWNER(somov) + +NO_PLATFORM() + +IF (OS_ANDROID) IF (MAPS_MOBILE_EXPORT_CPP_API) # Sandbox Resource ID duplicates # arcadia/sandbox/projects/maps/mobile/MapsMobileMakeArtifacts/__init__.py DECLARE_EXTERNAL_RESOURCE(MAPKIT_ANDROID_LIBCXX_HEADERS sbr:2527848662) CFLAGS(GLOBAL -nostdinc++ GLOBAL -cxx-isystem GLOBAL $MAPKIT_ANDROID_LIBCXX_HEADERS_RESOURCE_GLOBAL) ENDIF() - + DECLARE_EXTERNAL_RESOURCE(MAPKIT_ANDROID_LIBCXX_LIBRARIES sbr:2527853263) - - IF (ARCH_ARM7) - SET(ARCH_NAME arm) - ELSEIF (ARCH_ARM64) - SET(ARCH_NAME arm64) - ELSEIF (ARCH_I686) - SET(ARCH_NAME x86) - ELSEIF (ARCH_X86_64) - SET(ARCH_NAME x86-64) - ENDIF() - - SET(LIBS $MAPKIT_ANDROID_LIBCXX_LIBRARIES_RESOURCE_GLOBAL/$ARCH_NAME) - - LDFLAGS(-L$LIBS) -ENDIF() - -END() + + IF (ARCH_ARM7) + SET(ARCH_NAME arm) + ELSEIF (ARCH_ARM64) + SET(ARCH_NAME arm64) + ELSEIF (ARCH_I686) + SET(ARCH_NAME x86) + ELSEIF (ARCH_X86_64) + SET(ARCH_NAME x86-64) + ENDIF() + + SET(LIBS $MAPKIT_ANDROID_LIBCXX_LIBRARIES_RESOURCE_GLOBAL/$ARCH_NAME) + + LDFLAGS(-L$LIBS) +ENDIF() + +END() diff --git a/build/platform/msvc/ya.make b/build/platform/msvc/ya.make index ccb602c280..9de4244bda 100644 --- a/build/platform/msvc/ya.make +++ b/build/platform/msvc/ya.make @@ -1,19 +1,19 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - +RESOURCES_LIBRARY() + +OWNER(somov) + IF (WINDOWS_KITS_VERSION == "10.0.10586.0") - DECLARE_EXTERNAL_RESOURCE(WINDOWS_KITS sbr:544779014) + DECLARE_EXTERNAL_RESOURCE(WINDOWS_KITS sbr:544779014) ELSEIF (WINDOWS_KITS_VERSION == "10.0.16299.0") - DECLARE_EXTERNAL_RESOURCE(WINDOWS_KITS sbr:1379398385) + DECLARE_EXTERNAL_RESOURCE(WINDOWS_KITS sbr:1379398385) ELSEIF (WINDOWS_KITS_VERSION == "10.0.18362.0") DECLARE_EXTERNAL_RESOURCE(WINDOWS_KITS sbr:1939557911) -ELSE() - MESSAGE(FATAL_ERROR "We have no Windows Kits version ${WINDOWS_KITS_VERSION}") -ENDIF() - -IF (CLANG_CL) +ELSE() + MESSAGE(FATAL_ERROR "We have no Windows Kits version ${WINDOWS_KITS_VERSION}") +ENDIF() + +IF (CLANG_CL) DECLARE_EXTERNAL_RESOURCE(MSVC_FOR_CLANG sbr:1383387533) # Microsoft Visual C++ 2017 14.16.27023 (15.9.5) -ENDIF() - -END() +ENDIF() + +END() diff --git a/build/platform/perl/5.14/ya.make b/build/platform/perl/5.14/ya.make index 3db5747945..28a1734640 100644 --- a/build/platform/perl/5.14/ya.make +++ b/build/platform/perl/5.14/ya.make @@ -1,11 +1,11 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -SET(PERL_SDK ubuntu-12) - -SRCDIR(build/platform/perl) - -INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) - -END() +RESOURCES_LIBRARY() + +OWNER(somov) + +SET(PERL_SDK ubuntu-12) + +SRCDIR(build/platform/perl) + +INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) + +END() diff --git a/build/platform/perl/5.18/ya.make b/build/platform/perl/5.18/ya.make index 1d17311066..ae293b04d3 100644 --- a/build/platform/perl/5.18/ya.make +++ b/build/platform/perl/5.18/ya.make @@ -1,11 +1,11 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -SET(PERL_SDK ubuntu-14) - -SRCDIR(build/platform/perl) - -INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) - -END() +RESOURCES_LIBRARY() + +OWNER(somov) + +SET(PERL_SDK ubuntu-14) + +SRCDIR(build/platform/perl) + +INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) + +END() diff --git a/build/platform/perl/5.22/ya.make b/build/platform/perl/5.22/ya.make index 658bcc2552..0a1ce79d9e 100644 --- a/build/platform/perl/5.22/ya.make +++ b/build/platform/perl/5.22/ya.make @@ -1,11 +1,11 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -SET(PERL_SDK ubuntu-16) - -SRCDIR(build/platform/perl) - -INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) - -END() +RESOURCES_LIBRARY() + +OWNER(somov) + +SET(PERL_SDK ubuntu-16) + +SRCDIR(build/platform/perl) + +INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) + +END() diff --git a/build/platform/perl/5.26/ya.make b/build/platform/perl/5.26/ya.make index c510f6091a..c481dce711 100644 --- a/build/platform/perl/5.26/ya.make +++ b/build/platform/perl/5.26/ya.make @@ -1,11 +1,11 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -SET(PERL_SDK ubuntu-18) - -SRCDIR(build/platform/perl) - -INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) - -END() +RESOURCES_LIBRARY() + +OWNER(somov) + +SET(PERL_SDK ubuntu-18) + +SRCDIR(build/platform/perl) + +INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) + +END() diff --git a/build/platform/perl/5.30/ya.make b/build/platform/perl/5.30/ya.make index ba0132c6ba..199464caa4 100644 --- a/build/platform/perl/5.30/ya.make +++ b/build/platform/perl/5.30/ya.make @@ -1,11 +1,11 @@ -RESOURCES_LIBRARY() - -OWNER(somov) - -SET(PERL_SDK ubuntu-20) - -SRCDIR(build/platform/perl) - -INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) - -END() +RESOURCES_LIBRARY() + +OWNER(somov) + +SET(PERL_SDK ubuntu-20) + +SRCDIR(build/platform/perl) + +INCLUDE(${ARCADIA_ROOT}/build/platform/perl/perl.inc) + +END() diff --git a/build/platform/perl/perl.inc b/build/platform/perl/perl.inc index 139e65bb33..840a19989b 100644 --- a/build/platform/perl/perl.inc +++ b/build/platform/perl/perl.inc @@ -1,33 +1,33 @@ -PROVIDES(system_perl) - -IF (PERL_SDK == "ubuntu-12") - DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_514 sbr:337748278) -ELSEIF (PERL_SDK == "ubuntu-14") - DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_518 sbr:1655582861) -ELSEIF (PERL_SDK == "ubuntu-16") - DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_522 sbr:323251590) -ELSEIF (PERL_SDK == "ubuntu-18") - DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_526 sbr:616700320) -ELSEIF (PERL_SDK == "ubuntu-20") - DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_530 sbr:2001114055) -ELSE() - MESSAGE(FATAL_ERROR "Building against system perl is not supported on ${PERL_SDK}") -ENDIF() - -IF (PERL_INCLUDE) - CFLAGS(GLOBAL $PERL_INCLUDE) -ENDIF() - -CFLAGS(GLOBAL -I$PERL_ARCHLIB/CORE) - -IF (PERL_LIBS) - LDFLAGS(-L${PERL_LIBS}) -ENDIF() - -IF (NOT OS_WINDOWS) - LDFLAGS(-lperl) -ELSE() - LDFLAGS(perl.lib) -ENDIF() - -CFLAGS(GLOBAL -DUSE_PERL) +PROVIDES(system_perl) + +IF (PERL_SDK == "ubuntu-12") + DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_514 sbr:337748278) +ELSEIF (PERL_SDK == "ubuntu-14") + DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_518 sbr:1655582861) +ELSEIF (PERL_SDK == "ubuntu-16") + DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_522 sbr:323251590) +ELSEIF (PERL_SDK == "ubuntu-18") + DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_526 sbr:616700320) +ELSEIF (PERL_SDK == "ubuntu-20") + DECLARE_EXTERNAL_RESOURCE(SYSTEM_PERL_530 sbr:2001114055) +ELSE() + MESSAGE(FATAL_ERROR "Building against system perl is not supported on ${PERL_SDK}") +ENDIF() + +IF (PERL_INCLUDE) + CFLAGS(GLOBAL $PERL_INCLUDE) +ENDIF() + +CFLAGS(GLOBAL -I$PERL_ARCHLIB/CORE) + +IF (PERL_LIBS) + LDFLAGS(-L${PERL_LIBS}) +ENDIF() + +IF (NOT OS_WINDOWS) + LDFLAGS(-lperl) +ELSE() + LDFLAGS(perl.lib) +ENDIF() + +CFLAGS(GLOBAL -DUSE_PERL) diff --git a/build/platform/perl/perl_5.18.patch b/build/platform/perl/perl_5.18.patch index 840227eb54..ba350db058 100644 --- a/build/platform/perl/perl_5.18.patch +++ b/build/platform/perl/perl_5.18.patch @@ -1,51 +1,51 @@ -diff --unified --recursive a/perl5.18/lib/perl/5.18/CORE/pad.h b/perl5.18/lib/perl/5.18/CORE/pad.h ---- a/perl5.18/lib/perl/5.18/CORE/pad.h 2020-08-10 09:58:43.970483379 +0300 -+++ b/perl5.18/lib/perl/5.18/CORE/pad.h 2020-08-10 10:00:56.850097798 +0300 -@@ -320,7 +320,7 @@ - PL_comppad = (PAD*) (PadlistARRAY(padlist)[nth]); \ - PL_curpad = AvARRAY(PL_comppad); \ - DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ -- "Pad 0x%"UVxf"[0x%"UVxf"] set_cur depth=%d\n", \ -+ "Pad 0x%" UVxf "[0x%" UVxf "] set_cur depth=%d\n", \ - PTR2UV(PL_comppad), PTR2UV(PL_curpad), (int)(nth))); - - -@@ -338,7 +338,7 @@ - PL_comppad = (npad); \ - PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ - DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ -- "Pad 0x%"UVxf"[0x%"UVxf"] save_local\n", \ -+ "Pad 0x%" UVxf "[0x%" UVxf "] save_local\n", \ - PTR2UV(PL_comppad), PTR2UV(PL_curpad))); - - #define PAD_RESTORE_LOCAL(opad) \ -@@ -346,7 +346,7 @@ - PL_comppad = opad; \ - PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ - DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ -- "Pad 0x%"UVxf"[0x%"UVxf"] restore_local\n", \ -+ "Pad 0x%" UVxf "[0x%" UVxf "] restore_local\n", \ - PTR2UV(PL_comppad), PTR2UV(PL_curpad))); - - -diff --unified --recursive a/perl5.18/lib/perl/5.18/CORE/perl.h b/perl5.18/lib/perl/5.18/CORE/perl.h ---- a/perl5.18/lib/perl/5.18/CORE/perl.h 2020-08-10 09:58:43.966483390 +0300 -+++ b/perl5.18/lib/perl/5.18/CORE/perl.h 2020-08-10 10:01:44.649957846 +0300 -@@ -4254,7 +4254,7 @@ - EXTCONST char PL_warn_uninit[] - INIT("Use of uninitialized value%s%s%s"); - EXTCONST char PL_warn_uninit_sv[] -- INIT("Use of uninitialized value%"SVf"%s%s"); -+ INIT("Use of uninitialized value%" SVf "%s%s"); - EXTCONST char PL_warn_nosemi[] - INIT("Semicolon seems to be missing"); - EXTCONST char PL_warn_reserved[] -@@ -4274,7 +4274,7 @@ - EXTCONST char PL_no_aelem[] - INIT("Modification of non-creatable array value attempted, subscript %d"); - EXTCONST char PL_no_helem_sv[] -- INIT("Modification of non-creatable hash value attempted, subscript \"%"SVf"\""); -+ INIT("Modification of non-creatable hash value attempted, subscript \"%" SVf "\""); - EXTCONST char PL_no_modify[] - INIT("Modification of a read-only value attempted"); - EXTCONST char PL_no_mem[sizeof("Out of memory!\n")] +diff --unified --recursive a/perl5.18/lib/perl/5.18/CORE/pad.h b/perl5.18/lib/perl/5.18/CORE/pad.h +--- a/perl5.18/lib/perl/5.18/CORE/pad.h 2020-08-10 09:58:43.970483379 +0300 ++++ b/perl5.18/lib/perl/5.18/CORE/pad.h 2020-08-10 10:00:56.850097798 +0300 +@@ -320,7 +320,7 @@ + PL_comppad = (PAD*) (PadlistARRAY(padlist)[nth]); \ + PL_curpad = AvARRAY(PL_comppad); \ + DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ +- "Pad 0x%"UVxf"[0x%"UVxf"] set_cur depth=%d\n", \ ++ "Pad 0x%" UVxf "[0x%" UVxf "] set_cur depth=%d\n", \ + PTR2UV(PL_comppad), PTR2UV(PL_curpad), (int)(nth))); + + +@@ -338,7 +338,7 @@ + PL_comppad = (npad); \ + PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ + DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ +- "Pad 0x%"UVxf"[0x%"UVxf"] save_local\n", \ ++ "Pad 0x%" UVxf "[0x%" UVxf "] save_local\n", \ + PTR2UV(PL_comppad), PTR2UV(PL_curpad))); + + #define PAD_RESTORE_LOCAL(opad) \ +@@ -346,7 +346,7 @@ + PL_comppad = opad; \ + PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ + DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ +- "Pad 0x%"UVxf"[0x%"UVxf"] restore_local\n", \ ++ "Pad 0x%" UVxf "[0x%" UVxf "] restore_local\n", \ + PTR2UV(PL_comppad), PTR2UV(PL_curpad))); + + +diff --unified --recursive a/perl5.18/lib/perl/5.18/CORE/perl.h b/perl5.18/lib/perl/5.18/CORE/perl.h +--- a/perl5.18/lib/perl/5.18/CORE/perl.h 2020-08-10 09:58:43.966483390 +0300 ++++ b/perl5.18/lib/perl/5.18/CORE/perl.h 2020-08-10 10:01:44.649957846 +0300 +@@ -4254,7 +4254,7 @@ + EXTCONST char PL_warn_uninit[] + INIT("Use of uninitialized value%s%s%s"); + EXTCONST char PL_warn_uninit_sv[] +- INIT("Use of uninitialized value%"SVf"%s%s"); ++ INIT("Use of uninitialized value%" SVf "%s%s"); + EXTCONST char PL_warn_nosemi[] + INIT("Semicolon seems to be missing"); + EXTCONST char PL_warn_reserved[] +@@ -4274,7 +4274,7 @@ + EXTCONST char PL_no_aelem[] + INIT("Modification of non-creatable array value attempted, subscript %d"); + EXTCONST char PL_no_helem_sv[] +- INIT("Modification of non-creatable hash value attempted, subscript \"%"SVf"\""); ++ INIT("Modification of non-creatable hash value attempted, subscript \"%" SVf "\""); + EXTCONST char PL_no_modify[] + INIT("Modification of a read-only value attempted"); + EXTCONST char PL_no_mem[sizeof("Out of memory!\n")] diff --git a/build/platform/perl/ya.make b/build/platform/perl/ya.make index cc50c05c26..cb7a4ee075 100644 --- a/build/platform/perl/ya.make +++ b/build/platform/perl/ya.make @@ -1,24 +1,24 @@ -LIBRARY() +LIBRARY() OWNER(somov) -NO_PLATFORM() - +NO_PLATFORM() + IF (USE_PERL_SYSTEM) - IF (PERL_SDK == "ubuntu-12") - PEERDIR(build/platform/perl/5.14) - ELSEIF (PERL_SDK == "ubuntu-14") - PEERDIR(build/platform/perl/5.18) - ELSEIF (PERL_SDK == "ubuntu-16") - PEERDIR(build/platform/perl/5.22) - ELSEIF (PERL_SDK == "ubuntu-18") - PEERDIR(build/platform/perl/5.26) - ELSEIF (PERL_SDK == "ubuntu-20") - PEERDIR(build/platform/perl/5.30) + IF (PERL_SDK == "ubuntu-12") + PEERDIR(build/platform/perl/5.14) + ELSEIF (PERL_SDK == "ubuntu-14") + PEERDIR(build/platform/perl/5.18) + ELSEIF (PERL_SDK == "ubuntu-16") + PEERDIR(build/platform/perl/5.22) + ELSEIF (PERL_SDK == "ubuntu-18") + PEERDIR(build/platform/perl/5.26) + ELSEIF (PERL_SDK == "ubuntu-20") + PEERDIR(build/platform/perl/5.30) ELSE() - MESSAGE(FATAL_ERROR "Building against system perl is not supported on ${PERL_SDK}") - ENDIF() - + MESSAGE(FATAL_ERROR "Building against system perl is not supported on ${PERL_SDK}") + ENDIF() + ELSE() MESSAGE(FATAL_ERROR "There is no perl ready for static linkage. Try using the system one.") diff --git a/build/platform/python/ya.make b/build/platform/python/ya.make index 247e65f4c9..d08982144d 100644 --- a/build/platform/python/ya.make +++ b/build/platform/python/ya.make @@ -7,7 +7,7 @@ OWNER( INCLUDE(resources.inc) -IF (USE_SYSTEM_PYTHON) +IF (USE_SYSTEM_PYTHON) IF (OS_LINUX) IF (ARCH_ARM64 OR ARCH_AARCH64) IF (_SYSTEM_PYTHON27) @@ -41,7 +41,7 @@ IF (USE_SYSTEM_PYTHON) CFLAGS( GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include" GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include/python${PY_VERSION}" - ) + ) ELSEIF (OS_DARWIN) IF (PYTHON_DISTR == "macos-brew") IF (ARCH_X86_64) @@ -117,13 +117,13 @@ IF (USE_SYSTEM_PYTHON) ENDIF() CFLAGS(GLOBAL "/I$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include") LDFLAGS("/LIBPATH:$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/libs") - ENDIF() + ENDIF() IF (PYTHON_NOT_FOUND) MESSAGE(FATAL_ERROR "No system Python ${USE_SYSTEM_PYTHON} for the selected platform") ENDIF() ELSEIF (NOT USE_ARCADIA_PYTHON) - CFLAGS(GLOBAL $PYTHON_FLAGS) + CFLAGS(GLOBAL $PYTHON_FLAGS) IF (OS_WINDOWS) LDFLAGS($PYTHON_LDFLAGS $PYTHON_LIBRARIES) ENDIF() diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index f32a2d39a0..e75e730e7b 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -237,15 +237,15 @@ def onpy_srcs(unit, *args): fbss = [] py_namespaces = {} - dump_dir = unit.get('PYTHON_BUILD_DUMP_DIR') - dump_output = None - if dump_dir: - import thread - pid = os.getpid() - tid = thread.get_ident() - dump_name = '{}-{}.dump'.format(pid, tid) - dump_output = open(os.path.join(dump_dir, dump_name), 'a') - + dump_dir = unit.get('PYTHON_BUILD_DUMP_DIR') + dump_output = None + if dump_dir: + import thread + pid = os.getpid() + tid = thread.get_ident() + dump_name = '{}-{}.dump'.format(pid, tid) + dump_output = open(os.path.join(dump_dir, dump_name), 'a') + args = iter(args) for arg in args: # Namespace directives. @@ -325,9 +325,9 @@ def onpy_srcs(unit, *args): pathmod = (path, mod) - if dump_output is not None: - dump_output.write('{path}\t{module}\n'.format(path=rootrel_arc_src(path, unit), module=mod)) - + if dump_output is not None: + dump_output.write('{path}\t{module}\n'.format(path=rootrel_arc_src(path, unit), module=mod)) + if path.endswith('.py'): if cythonize_py: pyxs.append(pathmod) @@ -349,9 +349,9 @@ def onpy_srcs(unit, *args): else: ymake.report_configure_error('in PY_SRCS: unrecognized arg {!r}'.format(path)) - if dump_output is not None: - dump_output.close() - + if dump_output is not None: + dump_output.close() + if pyxs: files2res = set() # Include map stores files which were included in the processing pyx file, diff --git a/build/plugins/rodata.py b/build/plugins/rodata.py index 3ecb0f9a83..c0448d247f 100644 --- a/build/plugins/rodata.py +++ b/build/plugins/rodata.py @@ -158,7 +158,7 @@ class RODataCXX(iw.CustomCommand): def ro_data(path, unit): - if unit.enabled('ARCH_AARCH64') or unit.enabled('ARCH_ARM') or unit.enabled('ARCH_PPC64LE'): + if unit.enabled('ARCH_AARCH64') or unit.enabled('ARCH_ARM') or unit.enabled('ARCH_PPC64LE'): return RODataCXX(path, unit) return ROData(path, unit) diff --git a/build/plugins/swig.py b/build/plugins/swig.py index 32a37204a6..b9a54f5eaf 100644 --- a/build/plugins/swig.py +++ b/build/plugins/swig.py @@ -1,5 +1,5 @@ import os -import posixpath +import posixpath import re import _import_wrapper as iw @@ -12,10 +12,10 @@ def init(): class Swig(iw.CustomCommand): def __init__(self, path, unit): - self._tool = unit.get('SWIG_TOOL') - self._library_dir = unit.get('SWIG_LIBRARY') or 'contrib/tools/swig/Lib' - self._local_swig = unit.get('USE_LOCAL_SWIG') == "yes" - + self._tool = unit.get('SWIG_TOOL') + self._library_dir = unit.get('SWIG_LIBRARY') or 'contrib/tools/swig/Lib' + self._local_swig = unit.get('USE_LOCAL_SWIG') == "yes" + self._path = path self._flags = ['-cpperraswarn'] @@ -44,17 +44,17 @@ class Swig(iw.CustomCommand): lang_specific_incl_dir = 'java' incl_dirs = [ "FOR", "swig", - posixpath.join(self._library_dir, lang_specific_incl_dir), + posixpath.join(self._library_dir, lang_specific_incl_dir), "FOR", "swig", - self._library_dir + self._library_dir ] - self._incl_dirs = ['$S', '$B'] + [posixpath.join('$S', d) for d in incl_dirs] + self._incl_dirs = ['$S', '$B'] + [posixpath.join('$S', d) for d in incl_dirs] modname = unit.get('REALPRJNAME') self._flags.extend(['-module', modname]) - if not self._local_swig: - unit.onaddincl(incl_dirs) + if not self._local_swig: + unit.onaddincl(incl_dirs) if self._swig_lang == 'python': self._out_name = modname + '.py' @@ -83,7 +83,7 @@ class Swig(iw.CustomCommand): return self._flags def tools(self): - return ['contrib/tools/swig'] if not self._tool else [] + return ['contrib/tools/swig'] if not self._tool else [] def input(self): return [ @@ -105,8 +105,8 @@ class Swig(iw.CustomCommand): return [(self._out_header, [])] if self._swig_lang in ['java', 'jni_cpp'] else [] def run(self, extra_args, binary): - if self._local_swig: - binary = self._tool + if self._local_swig: + binary = self._tool return self.do_run_java(binary, self._path) if self._swig_lang in ['java', 'jni_cpp', 'jni_java'] else self.do_run(binary, self._path) def _incl_flags(self): diff --git a/build/scripts/check_config_h.py b/build/scripts/check_config_h.py index 07bc12e230..b5e53cecd8 100644 --- a/build/scripts/check_config_h.py +++ b/build/scripts/check_config_h.py @@ -2,81 +2,81 @@ import sys data = """ #if defined(SIZEOF_LONG) -static_assert(sizeof(long) == SIZEOF_LONG, "fixme 1"); +static_assert(sizeof(long) == SIZEOF_LONG, "fixme 1"); #endif #if defined(SIZEOF_PTHREAD_T) #include <pthread.h> -static_assert(sizeof(pthread_t) == SIZEOF_PTHREAD_T, "fixme 2"); +static_assert(sizeof(pthread_t) == SIZEOF_PTHREAD_T, "fixme 2"); #endif #if defined(SIZEOF_SIZE_T) #include <stddef.h> -static_assert(sizeof(size_t) == SIZEOF_SIZE_T, "fixme 3"); +static_assert(sizeof(size_t) == SIZEOF_SIZE_T, "fixme 3"); #endif #if defined(SIZEOF_TIME_T) #include <time.h> -static_assert(sizeof(time_t) == SIZEOF_TIME_T, "fixme 4"); +static_assert(sizeof(time_t) == SIZEOF_TIME_T, "fixme 4"); #endif #if defined(SIZEOF_UINTPTR_T) #include <stdint.h> -static_assert(sizeof(uintptr_t) == SIZEOF_UINTPTR_T, "fixme 5"); +static_assert(sizeof(uintptr_t) == SIZEOF_UINTPTR_T, "fixme 5"); #endif #if defined(SIZEOF_VOID_P) -static_assert(sizeof(void*) == SIZEOF_VOID_P, "fixme 6"); +static_assert(sizeof(void*) == SIZEOF_VOID_P, "fixme 6"); #endif #if defined(SIZEOF_FPOS_T) #include <stdio.h> -static_assert(sizeof(fpos_t) == SIZEOF_FPOS_T, "fixme 7"); +static_assert(sizeof(fpos_t) == SIZEOF_FPOS_T, "fixme 7"); #endif #if defined(SIZEOF_DOUBLE) -static_assert(sizeof(double) == SIZEOF_DOUBLE, "fixme 8"); +static_assert(sizeof(double) == SIZEOF_DOUBLE, "fixme 8"); #endif #if defined(SIZEOF_LONG_DOUBLE) -static_assert(sizeof(long double) == SIZEOF_LONG_DOUBLE, "fixme 9"); +static_assert(sizeof(long double) == SIZEOF_LONG_DOUBLE, "fixme 9"); #endif #if defined(SIZEOF_FLOAT) -static_assert(sizeof(float) == SIZEOF_FLOAT, "fixme 10"); +static_assert(sizeof(float) == SIZEOF_FLOAT, "fixme 10"); #endif #if defined(SIZEOF_INT) -static_assert(sizeof(int) == SIZEOF_INT, "fixme 11"); +static_assert(sizeof(int) == SIZEOF_INT, "fixme 11"); #endif #if defined(SIZEOF_LONG_LONG) -static_assert(sizeof(long long) == SIZEOF_LONG_LONG, "fixme 12"); +static_assert(sizeof(long long) == SIZEOF_LONG_LONG, "fixme 12"); #endif #if defined(SIZEOF_OFF_T) #include <stdio.h> -static_assert(sizeof(off_t) == SIZEOF_OFF_T, "fixme 13"); +static_assert(sizeof(off_t) == SIZEOF_OFF_T, "fixme 13"); #endif #if defined(SIZEOF_PID_T) #include <unistd.h> -static_assert(sizeof(pid_t) == SIZEOF_PID_T, "fixme 14"); +static_assert(sizeof(pid_t) == SIZEOF_PID_T, "fixme 14"); #endif #if defined(SIZEOF_SHORT) -static_assert(sizeof(short) == SIZEOF_SHORT, "fixme 15"); +static_assert(sizeof(short) == SIZEOF_SHORT, "fixme 15"); #endif #if defined(SIZEOF_WCHAR_T) -static_assert(sizeof(wchar_t) == SIZEOF_WCHAR_T, "fixme 16"); +static_assert(sizeof(wchar_t) == SIZEOF_WCHAR_T, "fixme 16"); #endif #if defined(SIZEOF__BOOL) diff --git a/build/scripts/clang_wrapper.py b/build/scripts/clang_wrapper.py index af3869f789..f574e594ac 100644 --- a/build/scripts/clang_wrapper.py +++ b/build/scripts/clang_wrapper.py @@ -1,8 +1,8 @@ import subprocess -import sys - - -def fix(s): +import sys + + +def fix(s): # disable dbg DEVTOOLS-2744 if s == '-g': return None @@ -17,14 +17,14 @@ def fix(s): if s.startswith('-fabi-version'): return None - # remove arguments unknown to clang-cl + # remove arguments unknown to clang-cl if s == '-fcase-insensitive-paths': # or s == '-fno-lto': # DEVTOOLSSUPPORT-3966 - return None - + return None + # Paths under .ya/tools/v3/.../msvc/include are divided with '\' return s.replace('\\', '/') - - + + def fix_path(p): try: i = p.rfind('/bin/clang') @@ -34,7 +34,7 @@ def fix_path(p): return p -if __name__ == '__main__': +if __name__ == '__main__': is_on_win = sys.argv[1] == 'yes' path = sys.argv[2] args = filter(None, [fix(s) for s in sys.argv[3:]]) @@ -46,7 +46,7 @@ if __name__ == '__main__': except ValueError: pass args.append('-fms-compatibility-version=19') - + cmd = [path] + args rc = subprocess.call(cmd, shell=False, stderr=sys.stderr, stdout=sys.stdout) diff --git a/build/scripts/compile_cuda.py b/build/scripts/compile_cuda.py index c0bec50b2a..aaf9142b6d 100644 --- a/build/scripts/compile_cuda.py +++ b/build/scripts/compile_cuda.py @@ -1,7 +1,7 @@ import sys import subprocess -import os -import collections +import os +import collections import re import tempfile @@ -13,52 +13,52 @@ def is_clang(command): return False - -def main(): - try: - sys.argv.remove('--y_skip_nocxxinc') - skip_nocxxinc = True - except ValueError: - skip_nocxxinc = False - + +def main(): + try: + sys.argv.remove('--y_skip_nocxxinc') + skip_nocxxinc = True + except ValueError: + skip_nocxxinc = False + spl = sys.argv.index('--cflags') mtime0 = sys.argv[1] command = sys.argv[2: spl] cflags = sys.argv[spl + 1:] - dump_args = False - if '--y_dump_args' in command: - command.remove('--y_dump_args') - dump_args = True - + dump_args = False + if '--y_dump_args' in command: + command.remove('--y_dump_args') + dump_args = True + executable = command[0] if not os.path.exists(executable): print >> sys.stderr, '{} not found'.format(executable) sys.exit(1) - if is_clang(command): + if is_clang(command): # nvcc concatenates the sources for clang, and clang reports unused # things from .h files as if they they were defined in a .cpp file. cflags += ['-Wno-unused-function', '-Wno-unused-parameter'] - + if not is_clang(command) and '-fopenmp=libomp' in cflags: cflags.append('-fopenmp') cflags.remove('-fopenmp=libomp') - + skip_list = [ '-gline-tables-only', # clang coverage '-fprofile-instr-generate', '-fcoverage-mapping', '/Zc:inline', # disable unreferenced functions (kernel registrators) remove - '-Wno-c++17-extensions', - '-flto', + '-Wno-c++17-extensions', + '-flto', '-faligned-allocation', ] - if skip_nocxxinc: - skip_list.append('-nostdinc++') - + if skip_nocxxinc: + skip_list.append('-nostdinc++') + for flag in skip_list: if flag in cflags: cflags.remove(flag) @@ -67,7 +67,7 @@ def main(): '-fsanitize=', '-fsanitize-coverage=', '-fsanitize-blacklist=', - '--system-header-prefix', + '--system-header-prefix', ] for prefix in skip_prefix_list: cflags = [i for i in cflags if not i.startswith(prefix)] @@ -83,49 +83,49 @@ def main(): cflags = filter(good, cflags) cpp_args = [] - compiler_args = [] - - # NVCC requires particular MSVC versions which may differ from the version - # used to compile regular C++ code. We have a separate MSVC in Arcadia for - # the CUDA builds and pass it's root in $Y_VC_Root. - # The separate MSVC for CUDA may absent in Yandex Open Source builds. - vc_root = os.environ.get('Y_VC_Root') - - cflags_queue = collections.deque(cflags) - while cflags_queue: - - arg = cflags_queue.popleft() + compiler_args = [] + + # NVCC requires particular MSVC versions which may differ from the version + # used to compile regular C++ code. We have a separate MSVC in Arcadia for + # the CUDA builds and pass it's root in $Y_VC_Root. + # The separate MSVC for CUDA may absent in Yandex Open Source builds. + vc_root = os.environ.get('Y_VC_Root') + + cflags_queue = collections.deque(cflags) + while cflags_queue: + + arg = cflags_queue.popleft() if arg == '-mllvm': compiler_args.append(arg) compiler_args.append(cflags_queue.popleft()) continue if arg[:2].upper() in ('-I', '/I', '-B'): - value = arg[2:] - if not value: - value = cflags_queue.popleft() + value = arg[2:] + if not value: + value = cflags_queue.popleft() if arg[1] == 'I': cpp_args.append('-I{}'.format(value)) elif arg[1] == 'B': # todo: delete "B" flag check when cuda stop to use gcc pass continue - - match = re.match(r'[-/]D(.*)', arg) - if match: - define = match.group(1) - # We have C++ flags configured for the regular C++ build. - # There is Y_MSVC_INCLUDE define with a path to the VC header files. - # We need to change the path accordingly when using a separate MSVC for CUDA. - if vc_root and define.startswith('Y_MSVC_INCLUDE'): - define = os.path.expandvars('Y_MSVC_INCLUDE={}/include'.format(vc_root)) - cpp_args.append('-D' + define.replace('\\', '/')) + + match = re.match(r'[-/]D(.*)', arg) + if match: + define = match.group(1) + # We have C++ flags configured for the regular C++ build. + # There is Y_MSVC_INCLUDE define with a path to the VC header files. + # We need to change the path accordingly when using a separate MSVC for CUDA. + if vc_root and define.startswith('Y_MSVC_INCLUDE'): + define = os.path.expandvars('Y_MSVC_INCLUDE={}/include'.format(vc_root)) + cpp_args.append('-D' + define.replace('\\', '/')) continue - + compiler_args.append(arg) - + command += cpp_args if compiler_args: command += ['--compiler-options', ','.join(compiler_args)] - + # --keep is necessary to prevent nvcc from embedding nvcc pid in generated # symbols. It makes nvcc use the original file name as the prefix in the # generated files (otherwise it also prepends tmpxft_{pid}_00000000-5), and @@ -142,11 +142,11 @@ def main(): os.environ['TZ'] = 'UTC0' # POSIX fixed offset format. os.environ['TZDIR'] = '/var/empty' # Against counterfeit /usr/share/zoneinfo/$TZ. - if dump_args: - sys.stdout.write('\n'.join(command)) - else: + if dump_args: + sys.stdout.write('\n'.join(command)) + else: sys.exit(subprocess.Popen(command, stdout=sys.stderr, stderr=sys.stderr, cwd='/').wait()) - - -if __name__ == '__main__': - main() + + +if __name__ == '__main__': + main() diff --git a/build/scripts/custom_link_green_mysql.py b/build/scripts/custom_link_green_mysql.py index 13bb9e4ac7..81d57b1f11 100644 --- a/build/scripts/custom_link_green_mysql.py +++ b/build/scripts/custom_link_green_mysql.py @@ -1,97 +1,97 @@ -import os -import shutil -import subprocess -import sys -import tempfile - - -SYMBOLS_TO_PATCH = ( - 'connect', - 'poll', - 'recv', - 'recvfrom', - 'send', - 'sendto', -) - -class Error(Exception): - pass - - -def find_compiler(args): - for arg in args: - if os.path.basename(arg) in ('clang', 'clang++'): - return arg - raise Error('No known compiler found in the command line') - - -def find_libraries(project, args): - if not project.endswith('/'): - project = project + '/' - - for arg in args: - if arg.startswith(project): - yield arg - - -def rename_symbol(symbol): - return 'green_{}'.format(symbol) - - -def patch_object(object_path, objcopy): - args = [objcopy] - for symbol in SYMBOLS_TO_PATCH: - args.extend(('--redefine-sym', '{}={}'.format(symbol, rename_symbol(symbol)))) - args.append(object_path) - subprocess.check_call(args) - - -def patch_library(library_path, ar, objcopy): - tmpdir = tempfile.mkdtemp(dir=os.path.dirname(library_path)) - try: - subprocess.check_call((ar, 'x', library_path), cwd=tmpdir) - names = os.listdir(tmpdir) - for name in names: - patch_object(os.path.join(tmpdir, name), objcopy=objcopy) - - new_library_path = os.path.join(tmpdir, 'library.a') - subprocess.check_call([ar, 'rcs', new_library_path] + names, cwd=tmpdir) - - os.rename(new_library_path, library_path) - - finally: - shutil.rmtree(tmpdir) - - -def main(): - try: - args = sys.argv[1:] - compiler = find_compiler(args) - compiler_dir = os.path.dirname(compiler) - - def get_tool(name): - path = os.path.join(compiler_dir, name) - if not os.path.exists(path): - raise Error('No {} found alongside the compiler'.format(name)) - return path - - ar = get_tool('llvm-ar') - objcopy = get_tool('llvm-objcopy') - - libraries = tuple(find_libraries('contrib/libs/libmysql_r', args)) - for library in libraries: - library_path = os.path.abspath(library) - if not os.path.exists(library_path): - raise Error('No {} file exists'.format(library)) - - patch_library(library_path, ar=ar, objcopy=objcopy) - - except Exception as error: - name = os.path.basename(sys.argv[0]) - command = ' '.join(args) - message = '{name} failed: {error}\nCommand line: {command}' - print >> sys.stderr, message.format(**locals()) - - -if __name__ == '__main__': - main() +import os +import shutil +import subprocess +import sys +import tempfile + + +SYMBOLS_TO_PATCH = ( + 'connect', + 'poll', + 'recv', + 'recvfrom', + 'send', + 'sendto', +) + +class Error(Exception): + pass + + +def find_compiler(args): + for arg in args: + if os.path.basename(arg) in ('clang', 'clang++'): + return arg + raise Error('No known compiler found in the command line') + + +def find_libraries(project, args): + if not project.endswith('/'): + project = project + '/' + + for arg in args: + if arg.startswith(project): + yield arg + + +def rename_symbol(symbol): + return 'green_{}'.format(symbol) + + +def patch_object(object_path, objcopy): + args = [objcopy] + for symbol in SYMBOLS_TO_PATCH: + args.extend(('--redefine-sym', '{}={}'.format(symbol, rename_symbol(symbol)))) + args.append(object_path) + subprocess.check_call(args) + + +def patch_library(library_path, ar, objcopy): + tmpdir = tempfile.mkdtemp(dir=os.path.dirname(library_path)) + try: + subprocess.check_call((ar, 'x', library_path), cwd=tmpdir) + names = os.listdir(tmpdir) + for name in names: + patch_object(os.path.join(tmpdir, name), objcopy=objcopy) + + new_library_path = os.path.join(tmpdir, 'library.a') + subprocess.check_call([ar, 'rcs', new_library_path] + names, cwd=tmpdir) + + os.rename(new_library_path, library_path) + + finally: + shutil.rmtree(tmpdir) + + +def main(): + try: + args = sys.argv[1:] + compiler = find_compiler(args) + compiler_dir = os.path.dirname(compiler) + + def get_tool(name): + path = os.path.join(compiler_dir, name) + if not os.path.exists(path): + raise Error('No {} found alongside the compiler'.format(name)) + return path + + ar = get_tool('llvm-ar') + objcopy = get_tool('llvm-objcopy') + + libraries = tuple(find_libraries('contrib/libs/libmysql_r', args)) + for library in libraries: + library_path = os.path.abspath(library) + if not os.path.exists(library_path): + raise Error('No {} file exists'.format(library)) + + patch_library(library_path, ar=ar, objcopy=objcopy) + + except Exception as error: + name = os.path.basename(sys.argv[0]) + command = ' '.join(args) + message = '{name} failed: {error}\nCommand line: {command}' + print >> sys.stderr, message.format(**locals()) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py index 23487f5c1e..cd31592997 100644 --- a/build/scripts/link_dyn_lib.py +++ b/build/scripts/link_dyn_lib.py @@ -133,7 +133,7 @@ def fix_cmd(arch, musl, c): f = fix_windows_param else: prefix = '-Wl,--version-script=' - if arch in ('DARWIN', 'IOS'): + if arch in ('DARWIN', 'IOS'): f = fix_darwin_param else: f = lambda x: fix_gnu_param(arch, x) diff --git a/build/scripts/link_exe.py b/build/scripts/link_exe.py index f469e3b442..8919ec1642 100644 --- a/build/scripts/link_exe.py +++ b/build/scripts/link_exe.py @@ -47,8 +47,8 @@ def parse_args(): parser = optparse.OptionParser() parser.disable_interspersed_args() parser.add_option('--musl', action='store_true') - parser.add_option('--custom-step') - parser.add_option('--python') + parser.add_option('--custom-step') + parser.add_option('--python') parser.add_option('--source-root') parser.add_option('--arch') parser.add_option('--linker-output') @@ -63,9 +63,9 @@ if __name__ == '__main__': cmd = fix_cmd(opts.musl, args) cmd = ProcessWholeArchiveOption(opts.arch, opts.whole_archive_peers, opts.whole_archive_libs).construct_cmd(cmd) - if opts.custom_step: - assert opts.python - subprocess.check_call([opts.python] + [opts.custom_step] + args) + if opts.custom_step: + assert opts.python + subprocess.check_call([opts.python] + [opts.custom_step] + args) supp, cmd = get_leaks_suppressions(cmd) if supp: diff --git a/build/scripts/link_fat_obj.py b/build/scripts/link_fat_obj.py index c189668b9e..c21a6f4cd8 100644 --- a/build/scripts/link_fat_obj.py +++ b/build/scripts/link_fat_obj.py @@ -4,10 +4,10 @@ import sys from process_whole_archive_option import ProcessWholeArchiveOption -YA_ARG_PREFIX = '-Ya,' - - -def get_args(): +YA_ARG_PREFIX = '-Ya,' + + +def get_args(): parser = argparse.ArgumentParser() parser.add_argument('--obj') parser.add_argument('--globals-lib') @@ -17,9 +17,9 @@ def get_args(): parser.add_argument('--with-own-obj', action='store_true', default=False) parser.add_argument('--with-global-srcs', action='store_true', default=False) - groups = {} - args_list = groups.setdefault('default', []) - for arg in sys.argv[1:]: + groups = {} + args_list = groups.setdefault('default', []) + for arg in sys.argv[1:]: if arg == '--with-own-obj': groups['default'].append(arg) elif arg == '--globals-lib': @@ -27,40 +27,40 @@ def get_args(): elif arg == '--with-global-srcs': groups['default'].append(arg) elif arg.startswith(YA_ARG_PREFIX): - group_name = arg[len(YA_ARG_PREFIX):] - args_list = groups.setdefault(group_name, []) - else: - args_list.append(arg) - - return parser.parse_args(groups['default']), groups - - + group_name = arg[len(YA_ARG_PREFIX):] + args_list = groups.setdefault(group_name, []) + else: + args_list.append(arg) + + return parser.parse_args(groups['default']), groups + + def strip_suppression_files(srcs): return [s for s in srcs if not s.endswith('.supp')] -def main(): - args, groups = get_args() - - # Inputs - auto_input = groups['input'] - - # Outputs +def main(): + args, groups = get_args() + + # Inputs + auto_input = groups['input'] + + # Outputs lib_output = args.lib obj_output = args.obj - - # Dependencies - global_srcs = groups['global_srcs'] + + # Dependencies + global_srcs = groups['global_srcs'] global_srcs = strip_suppression_files(global_srcs) global_srcs = ProcessWholeArchiveOption(args.arch).construct_cmd(global_srcs) - peers = groups['peers'] - - # Tools - linker = groups['linker'] - archiver = groups['archiver'] - + peers = groups['peers'] + + # Tools + linker = groups['linker'] + archiver = groups['archiver'] + do_link = linker + ['-o', obj_output, '-Wl,-r', '-nodefaultlibs', '-nostartfiles'] + global_srcs + auto_input - do_archive = archiver + [lib_output] + peers + do_archive = archiver + [lib_output] + peers do_globals = None if args.globals_lib: do_globals = archiver + [args.globals_lib] + auto_input + global_srcs @@ -84,8 +84,8 @@ def main(): if glob_res: sys.exit(glob_res) - sys.exit(call(do_archive)) - - -if __name__ == '__main__': - main() + sys.exit(call(do_archive)) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/link_lib.py b/build/scripts/link_lib.py index 344d50d4eb..2e66d21500 100644 --- a/build/scripts/link_lib.py +++ b/build/scripts/link_lib.py @@ -32,9 +32,9 @@ class Opts(object): self.objs = auto_input self.libs = [] - self.plugin_flags = ['--plugin', self.plugin] if self.plugin != 'None' else [] - + self.plugin_flags = ['--plugin', self.plugin] if self.plugin != 'None' else [] + def get_opts(args): return Opts(args) @@ -42,12 +42,12 @@ def get_opts(args): if __name__ == "__main__": opts = get_opts(sys.argv[1:]) - # There is a bug in llvm-ar. Some files with size slightly greater 2^32 - # still have GNU format instead of GNU64 and cause link problems. - # Workaround just lowers llvm-ar's GNU64 threshold to 2^31. - if opts.arch_type == 'LLVM_AR': - os.environ['SYM64_THRESHOLD'] = '31' - + # There is a bug in llvm-ar. Some files with size slightly greater 2^32 + # still have GNU format instead of GNU64 and cause link problems. + # Workaround just lowers llvm-ar's GNU64 threshold to 2^31. + if opts.arch_type == 'LLVM_AR': + os.environ['SYM64_THRESHOLD'] = '31' + def call(): try: p = subprocess.Popen(cmd, stdin=stdin, cwd=opts.build_root) @@ -62,7 +62,7 @@ if __name__ == "__main__": pass if not opts.libs: - cmd = [opts.archiver] + opts.create_flags + opts.plugin_flags + [opts.output] + opts.objs + cmd = [opts.archiver] + opts.create_flags + opts.plugin_flags + [opts.output] + opts.objs stdin = None exit_code = call() else: @@ -76,7 +76,7 @@ if __name__ == "__main__": tmp.write('ADDMOD {0}\n'.format(obj)) tmp.write('SAVE\n') tmp.write('END\n') - cmd = [opts.archiver] + opts.modify_flags + opts.plugin_flags + cmd = [opts.archiver] + opts.modify_flags + opts.plugin_flags stdin = open(temp.name) exit_code = call() os.remove(temp.name) diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py index 439d1f8831..4779a868cd 100644 --- a/build/scripts/run_msvc_wine.py +++ b/build/scripts/run_msvc_wine.py @@ -6,7 +6,7 @@ import signal import time import json import argparse -import errno +import errno import process_command_files as pcf import process_whole_archive_option as pwa @@ -55,20 +55,20 @@ def subst_path(l): def call_wine_cmd_once(wine, cmd, env, mode): p = run_subprocess(wine + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, close_fds=True, shell=False) - output = find_cmd_out(cmd) - error = None - if output is not None and os.path.exists(output): - try: - os.remove(output) - except OSError as e: - if e.errno != errno.ENOENT: - error = e - except Exception as e: - error = e - - if error is not None: - print >> sys.stderr, 'Output {} already exists and we have failed to remove it: {}'.format(output, error) - + output = find_cmd_out(cmd) + error = None + if output is not None and os.path.exists(output): + try: + os.remove(output) + except OSError as e: + if e.errno != errno.ENOENT: + error = e + except Exception as e: + error = e + + if error is not None: + print >> sys.stderr, 'Output {} already exists and we have failed to remove it: {}'.format(output, error) + # print >>sys.stderr, cmd, env, wine stdout_and_stderr, _ = p.communicate() @@ -360,7 +360,7 @@ def make_full_path_arg(arg, bld_root, short_root): return arg def fix_path(p): - topdirs = ['/%s/' % d for d in os.listdir('/')] + topdirs = ['/%s/' % d for d in os.listdir('/')] def abs_path_start(path, pos): if pos < 0: return False @@ -482,7 +482,7 @@ def run_main(): log = colorize(log) print >>sys.stderr, log - tout = 200 + tout = 200 while True: rc, out = run_process(0, tout) @@ -525,12 +525,12 @@ def run_main(): def main(): - prefix_suffix = os.environ.pop('WINEPREFIX_SUFFIX', None) - if prefix_suffix is not None: - prefix = os.environ.pop('WINEPREFIX', None) - if prefix is not None: - os.environ['WINEPREFIX'] = os.path.join(prefix, prefix_suffix) - + prefix_suffix = os.environ.pop('WINEPREFIX_SUFFIX', None) + if prefix_suffix is not None: + prefix = os.environ.pop('WINEPREFIX', None) + if prefix is not None: + os.environ['WINEPREFIX'] = os.path.join(prefix, prefix_suffix) + # just in case signal.alarm(2000) diff --git a/build/sysincl/android.yml b/build/sysincl/android.yml index 97cfbf38d2..3ac69c46dd 100644 --- a/build/sysincl/android.yml +++ b/build/sysincl/android.yml @@ -9,11 +9,11 @@ - jni.h: contrib/libs/jdk/include/jni.h - vulkan/vulkan.h - vulkan/vk_sdk_platform.h - - EGL/egl.h - - EGL/eglext.h - - GLES2/gl2.h - - GLES2/gl2ext.h - - GLES3/gl31.h + - EGL/egl.h + - EGL/eglext.h + - GLES2/gl2.h + - GLES2/gl2ext.h + - GLES3/gl31.h - SLES/OpenSLES.h - SLES/OpenSLES_Android.h - SLES/OpenSLES_AndroidConfiguration.h diff --git a/build/sysincl/misc.yml b/build/sysincl/misc.yml index e9e6095888..603ae03af8 100644 --- a/build/sysincl/misc.yml +++ b/build/sysincl/misc.yml @@ -377,7 +377,7 @@ includes: - mem.h -- source_filter: "^contrib/libs/(authparser|libcoro-perl|libev-perl|libevent-perl|uatraits)" +- source_filter: "^contrib/libs/(authparser|libcoro-perl|libev-perl|libevent-perl|uatraits)" includes: - patchlevel.h diff --git a/build/sysincl/swig-to-nothing.yml b/build/sysincl/swig-to-nothing.yml index 1d3f987371..91d8238faa 100644 --- a/build/sysincl/swig-to-nothing.yml +++ b/build/sysincl/swig-to-nothing.yml @@ -1,235 +1,235 @@ -- includes: -# (cd $S/contrib/tools/swig/Lib; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' - - allkw.swg - - attribute.i - - carrays.i - - cdata.i - - cmalloc.i - - constraints.i - - cpointer.i - - cstring.i - - cwstring.i - - director_common.swg - - exception.i - - intrusive_ptr.i - - inttypes.i - - math.i - - pointer.i - - runtime.swg - - shared_ptr.i - - std_except.i - - stdint.i - - stl.i - - swigarch.i - - swigerrors.swg - - swigfragments.swg - - swiginit.swg - - swiglabels.swg - - swigrun.i - - swigrun.swg - - swig.swg - - swigwarnings.swg - - swigwarn.swg - - typemaps/attribute.swg - - typemaps/carrays.swg - - typemaps/cdata.swg - - typemaps/cmalloc.swg - - typemaps/cpointer.swg - - typemaps/cstring.swg - - typemaps/cstrings.swg - - typemaps/cwstring.swg - - typemaps/enumint.swg - - typemaps/exception.swg - - typemaps/factory.swg - - typemaps/fragments.swg - - typemaps/implicit.swg - - typemaps/inoutlist.swg - - typemaps/misctypes.swg - - typemaps/primtypes.swg - - typemaps/ptrtypes.swg - - typemaps/std_except.swg - - typemaps/std_string.swg - - typemaps/std_strings.swg - - typemaps/std_wstring.swg - - typemaps/string.swg - - typemaps/strings.swg - - typemaps/swigmacros.swg - - typemaps/swigobject.swg - - typemaps/swigtype.swg - - typemaps/swigtypemaps.swg - - typemaps/typemaps.swg - - typemaps/valtypes.swg - - typemaps/void.swg - - typemaps/wstring.swg - - wchar.i - - windows.i -# (cd $S/contrib/tools/swig/Lib/python; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' - - argcargv.i - - attribute.i - - boost_shared_ptr.i - - builtin.swg - - carrays.i - - ccomplex.i - - cdata.i - - cmalloc.i - - complex.i - - cpointer.i - - cstring.i - - cwstring.i - - defarg.swg - - director.swg - - embed.i - - exception.i - - factory.i - - file.i - - implicit.i - - pyabc.i - - pyapi.swg - - pybackward.swg - - pybuffer.i - - pyclasses.swg - - pycomplex.swg - - pycontainer.swg - - pydocs.swg - - pyerrors.swg - - pyfragments.swg - - pyhead.swg - - pyinit.swg - - pyiterators.swg - - pymacros.swg - - pyname_compat.i - - pyopers.swg - - pyprimtypes.swg - - pyrun.swg - - pyruntime.swg - - pystdcommon.swg - - pystrings.swg - - pythonkw.swg - - python.swg - - pythreads.swg - - pytuplehlp.swg - - pytypemaps.swg - - pyuserdir.swg - - pywstrings.swg - - std_alloc.i - - std_array.i - - std_auto_ptr.i - - std_basic_string.i - - std_carray.i - - std_char_traits.i - - std_common.i - - std_complex.i - - std_container.i - - std_deque.i - - std_except.i - - std_ios.i - - std_iostream.i - - std_list.i - - std_map.i - - std_multimap.i - - std_multiset.i - - std_pair.i - - std_set.i - - std_shared_ptr.i - - std_sstream.i - - std_streambuf.i - - std_string.i - - std_unordered_map.i - - std_unordered_multimap.i - - std_unordered_multiset.i - - std_unordered_set.i - - std_vectora.i - - std_vector.i - - std_wios.i - - std_wiostream.i - - std_wsstream.i - - std_wstreambuf.i - - std_wstring.i - - stl.i - - typemaps.i - - wchar.i -# (cd $S/contrib/tools/swig/Lib/java; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' - - arrays_java.i - - boost_intrusive_ptr.i - - boost_shared_ptr.i - - director.swg - - enumsimple.swg - - enums.swg - - enumtypesafe.swg - - enumtypeunsafe.swg - - javahead.swg - - javakw.swg - - java.swg - - std_array.i - - std_auto_ptr.i - - std_common.i - - std_deque.i - - std_except.i - - std_list.i - - std_map.i - - std_pair.i - - std_set.i - - std_shared_ptr.i - - std_string.i - - std_unordered_map.i - - std_unordered_set.i - - std_vector.i - - std_wstring.i - - stl.i - - swiginterface.i - - typemaps.i - - various.i -# (cd $S/contrib/tools/swig/Lib/go; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' - - cdata.i - - director.swg - - exception.i - - gokw.swg - - goruntime.swg - - gostring.swg - - go.swg - - std_common.i - - std_deque.i - - std_except.i - - std_list.i - - std_map.i - - std_pair.i - - std_string.i - - std_vector.i - - stl.i - - typemaps.i -# (cd $S/contrib/tools/swig/Lib/perl5; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' - - attribute.i - - carrays.i - - cdata.i - - cmalloc.i - - cpointer.i - - cstring.i - - director.swg - - exception.i - - factory.i - - perl5.swg - - perlerrors.swg - - perlfragments.swg - - perlhead.swg - - perlinit.swg - - perlkw.swg - - perlmacros.swg - - perlmain.i - - perlopers.swg - - perlprimtypes.swg - - perlrun.swg - - perlruntime.swg - - perlstrings.swg - - perltypemaps.swg - - perluserdir.swg - - reference.i - - std_common.i - - std_deque.i - - std_except.i - - std_list.i - - std_map.i - - std_pair.i - - std_string.i - - std_vector.i - - stl.i - - typemaps.i +- includes: +# (cd $S/contrib/tools/swig/Lib; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' + - allkw.swg + - attribute.i + - carrays.i + - cdata.i + - cmalloc.i + - constraints.i + - cpointer.i + - cstring.i + - cwstring.i + - director_common.swg + - exception.i + - intrusive_ptr.i + - inttypes.i + - math.i + - pointer.i + - runtime.swg + - shared_ptr.i + - std_except.i + - stdint.i + - stl.i + - swigarch.i + - swigerrors.swg + - swigfragments.swg + - swiginit.swg + - swiglabels.swg + - swigrun.i + - swigrun.swg + - swig.swg + - swigwarnings.swg + - swigwarn.swg + - typemaps/attribute.swg + - typemaps/carrays.swg + - typemaps/cdata.swg + - typemaps/cmalloc.swg + - typemaps/cpointer.swg + - typemaps/cstring.swg + - typemaps/cstrings.swg + - typemaps/cwstring.swg + - typemaps/enumint.swg + - typemaps/exception.swg + - typemaps/factory.swg + - typemaps/fragments.swg + - typemaps/implicit.swg + - typemaps/inoutlist.swg + - typemaps/misctypes.swg + - typemaps/primtypes.swg + - typemaps/ptrtypes.swg + - typemaps/std_except.swg + - typemaps/std_string.swg + - typemaps/std_strings.swg + - typemaps/std_wstring.swg + - typemaps/string.swg + - typemaps/strings.swg + - typemaps/swigmacros.swg + - typemaps/swigobject.swg + - typemaps/swigtype.swg + - typemaps/swigtypemaps.swg + - typemaps/typemaps.swg + - typemaps/valtypes.swg + - typemaps/void.swg + - typemaps/wstring.swg + - wchar.i + - windows.i +# (cd $S/contrib/tools/swig/Lib/python; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' + - argcargv.i + - attribute.i + - boost_shared_ptr.i + - builtin.swg + - carrays.i + - ccomplex.i + - cdata.i + - cmalloc.i + - complex.i + - cpointer.i + - cstring.i + - cwstring.i + - defarg.swg + - director.swg + - embed.i + - exception.i + - factory.i + - file.i + - implicit.i + - pyabc.i + - pyapi.swg + - pybackward.swg + - pybuffer.i + - pyclasses.swg + - pycomplex.swg + - pycontainer.swg + - pydocs.swg + - pyerrors.swg + - pyfragments.swg + - pyhead.swg + - pyinit.swg + - pyiterators.swg + - pymacros.swg + - pyname_compat.i + - pyopers.swg + - pyprimtypes.swg + - pyrun.swg + - pyruntime.swg + - pystdcommon.swg + - pystrings.swg + - pythonkw.swg + - python.swg + - pythreads.swg + - pytuplehlp.swg + - pytypemaps.swg + - pyuserdir.swg + - pywstrings.swg + - std_alloc.i + - std_array.i + - std_auto_ptr.i + - std_basic_string.i + - std_carray.i + - std_char_traits.i + - std_common.i + - std_complex.i + - std_container.i + - std_deque.i + - std_except.i + - std_ios.i + - std_iostream.i + - std_list.i + - std_map.i + - std_multimap.i + - std_multiset.i + - std_pair.i + - std_set.i + - std_shared_ptr.i + - std_sstream.i + - std_streambuf.i + - std_string.i + - std_unordered_map.i + - std_unordered_multimap.i + - std_unordered_multiset.i + - std_unordered_set.i + - std_vectora.i + - std_vector.i + - std_wios.i + - std_wiostream.i + - std_wsstream.i + - std_wstreambuf.i + - std_wstring.i + - stl.i + - typemaps.i + - wchar.i +# (cd $S/contrib/tools/swig/Lib/java; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' + - arrays_java.i + - boost_intrusive_ptr.i + - boost_shared_ptr.i + - director.swg + - enumsimple.swg + - enums.swg + - enumtypesafe.swg + - enumtypeunsafe.swg + - javahead.swg + - javakw.swg + - java.swg + - std_array.i + - std_auto_ptr.i + - std_common.i + - std_deque.i + - std_except.i + - std_list.i + - std_map.i + - std_pair.i + - std_set.i + - std_shared_ptr.i + - std_string.i + - std_unordered_map.i + - std_unordered_set.i + - std_vector.i + - std_wstring.i + - stl.i + - swiginterface.i + - typemaps.i + - various.i +# (cd $S/contrib/tools/swig/Lib/go; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' + - cdata.i + - director.swg + - exception.i + - gokw.swg + - goruntime.swg + - gostring.swg + - go.swg + - std_common.i + - std_deque.i + - std_except.i + - std_list.i + - std_map.i + - std_pair.i + - std_string.i + - std_vector.i + - stl.i + - typemaps.i +# (cd $S/contrib/tools/swig/Lib/perl5; find * '(' -not -path '*/*' -or -path 'typemaps/*' ')' -and '(' -name '*.i' -or -name '*.swg' ')' ) | awk '{print " - "$0}' + - attribute.i + - carrays.i + - cdata.i + - cmalloc.i + - cpointer.i + - cstring.i + - director.swg + - exception.i + - factory.i + - perl5.swg + - perlerrors.swg + - perlfragments.swg + - perlhead.swg + - perlinit.swg + - perlkw.swg + - perlmacros.swg + - perlmain.i + - perlopers.swg + - perlprimtypes.swg + - perlrun.swg + - perlruntime.swg + - perlstrings.swg + - perltypemaps.swg + - perluserdir.swg + - reference.i + - std_common.i + - std_deque.i + - std_except.i + - std_list.i + - std_map.i + - std_pair.i + - std_string.i + - std_vector.i + - stl.i + - typemaps.i diff --git a/build/ya.conf.json b/build/ya.conf.json index 5f7cc875d6..1e720e19cd 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -755,9 +755,9 @@ } ] }, - "msvc2019-i686": { - "name": "msvc2019", - "tools": { + "msvc2019-i686": { + "name": "msvc2019", + "tools": { "cc": { "bottle": "msvc2019", "executable": "msvc" @@ -766,7 +766,7 @@ "bottle": "msvc2019", "executable": "msvc" } - }, + }, "platforms": [ { "host": { @@ -779,19 +779,19 @@ "default": true } ], - "params": { - "type": "msvc", - "match_root": "MSVC", - "werror_mode": "compiler_specific", - "c_compiler": "$(MSVC)/bin/Hostx64/x86/cl.exe", - "cxx_compiler": "$(MSVC)/bin/Hostx64/x86/cl.exe", + "params": { + "type": "msvc", + "match_root": "MSVC", + "werror_mode": "compiler_specific", + "c_compiler": "$(MSVC)/bin/Hostx64/x86/cl.exe", + "cxx_compiler": "$(MSVC)/bin/Hostx64/x86/cl.exe", "cxx_std": "c++latest", - "version": "2019" - } - }, - "msvc2019-x86_64": { - "name": "msvc2019", - "tools": { + "version": "2019" + } + }, + "msvc2019-x86_64": { + "name": "msvc2019", + "tools": { "cc": { "bottle": "msvc2019", "executable": "msvc" @@ -800,7 +800,7 @@ "bottle": "msvc2019", "executable": "msvc" } - }, + }, "platforms": [ { "host": { @@ -809,20 +809,20 @@ "default": true } ], - "params": { - "type": "msvc", - "match_root": "MSVC", - "werror_mode": "compiler_specific", - "c_compiler": "$(MSVC)/bin/Hostx64/x64/cl.exe", - "cxx_compiler": "$(MSVC)/bin/Hostx64/x64/cl.exe", + "params": { + "type": "msvc", + "match_root": "MSVC", + "werror_mode": "compiler_specific", + "c_compiler": "$(MSVC)/bin/Hostx64/x64/cl.exe", + "cxx_compiler": "$(MSVC)/bin/Hostx64/x64/cl.exe", "cxx_std": "c++latest", "version": "2019", "for_ide": "msvs2019" - } - }, - "msvc2019-arm": { - "name": "msvc2019", - "tools": { + } + }, + "msvc2019-arm": { + "name": "msvc2019", + "tools": { "cc": { "bottle": "msvc2019", "executable": "msvc" @@ -831,7 +831,7 @@ "bottle": "msvc2019", "executable": "msvc" } - }, + }, "platforms": [ { "host": { @@ -844,19 +844,19 @@ "default": true } ], - "params": { - "type": "msvc", - "match_root": "MSVC", - "werror_mode": "compiler_specific", - "c_compiler": "$(MSVC)/bin/Hostx64/arm/cl.exe", - "cxx_compiler": "$(MSVC)/bin/Hostx64/arm/cl.exe", + "params": { + "type": "msvc", + "match_root": "MSVC", + "werror_mode": "compiler_specific", + "c_compiler": "$(MSVC)/bin/Hostx64/arm/cl.exe", + "cxx_compiler": "$(MSVC)/bin/Hostx64/arm/cl.exe", "cxx_std": "c++latest", - "version": "2019" - } - }, - "wine-msvc2019-i686": { - "name": "msvc2019", - "tools": { + "version": "2019" + } + }, + "wine-msvc2019-i686": { + "name": "msvc2019", + "tools": { "cc": { "bottle": "msvc2019", "executable": "msvc" @@ -865,7 +865,7 @@ "bottle": "msvc2019", "executable": "msvc" } - }, + }, "platforms": [ { "host": { @@ -878,20 +878,20 @@ "default": true } ], - "params": { - "type": "msvc", - "match_root": "MSVC", - "werror_mode": "compiler_specific", - "c_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 c $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x86/cl.exe", - "cxx_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 cxx $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x86/cl.exe", + "params": { + "type": "msvc", + "match_root": "MSVC", + "werror_mode": "compiler_specific", + "c_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 c $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x86/cl.exe", + "cxx_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 cxx $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x86/cl.exe", "cxx_std": "c++latest", - "version": "2019", - "wine": "yes" - } - }, - "wine-msvc2019-x86_64": { - "name": "msvc2019", - "tools": { + "version": "2019", + "wine": "yes" + } + }, + "wine-msvc2019-x86_64": { + "name": "msvc2019", + "tools": { "cc": { "bottle": "msvc2019", "executable": "msvc" @@ -900,7 +900,7 @@ "bottle": "msvc2019", "executable": "msvc" } - }, + }, "platforms": [ { "host": { @@ -912,20 +912,20 @@ "default": true } ], - "params": { - "type": "msvc", - "match_root": "MSVC", - "werror_mode": "compiler_specific", - "c_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 c $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x64/cl.exe", - "cxx_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 cxx $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x64/cl.exe", + "params": { + "type": "msvc", + "match_root": "MSVC", + "werror_mode": "compiler_specific", + "c_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 c $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x64/cl.exe", + "cxx_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 cxx $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/x64/cl.exe", "cxx_std": "c++latest", - "version": "2019", - "wine": "yes" - } - }, - "wine-msvc2019-arm": { - "name": "msvc2019", - "tools": { + "version": "2019", + "wine": "yes" + } + }, + "wine-msvc2019-arm": { + "name": "msvc2019", + "tools": { "cc": { "bottle": "msvc2019", "executable": "msvc" @@ -934,7 +934,7 @@ "bottle": "msvc2019", "executable": "msvc" } - }, + }, "platforms": [ { "host": { @@ -947,17 +947,17 @@ "default": true } ], - "params": { - "type": "msvc", - "match_root": "MSVC", - "werror_mode": "compiler_specific", - "c_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 c $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/arm/cl.exe", - "cxx_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 cxx $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/arm/cl.exe", + "params": { + "type": "msvc", + "match_root": "MSVC", + "werror_mode": "compiler_specific", + "c_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 c $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/arm/cl.exe", + "cxx_compiler": "${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140 cxx $WINE_ENV ${ARCADIA_ROOT} ${ARCADIA_BUILD_ROOT} $(MSVC)/bin/Hostx64/arm/cl.exe", "cxx_std": "c++latest", - "version": "2019", - "wine": "yes" - } - }, + "version": "2019", + "wine": "yes" + } + }, "clang-format": { "tools": { "clang-format": { @@ -1378,8 +1378,8 @@ } ] }, - "gcc82": { - "tools": { + "gcc82": { + "tools": { "cc": { "bottle": "gcc82", "executable": "cc" @@ -1404,8 +1404,8 @@ "bottle": "gcc82", "executable": "strip" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -1416,23 +1416,23 @@ "os": "DARWIN" } } - ], - "params": { - "type": "gnu", - "match_root": "GCC", - "werror_mode": "compiler_specific", - "c_compiler": "$(GCC)/gcc/bin/gcc", - "cxx_compiler": "$(GCC)/gcc/bin/g++", + ], + "params": { + "type": "gnu", + "match_root": "GCC", + "werror_mode": "compiler_specific", + "c_compiler": "$(GCC)/gcc/bin/gcc", + "cxx_compiler": "$(GCC)/gcc/bin/g++", "cxx_std": "c++17", - "gcc_version": "8.2.0", + "gcc_version": "8.2.0", "arch_opt": [ "-w" ], - "dwarf_tool": { - "DARWIN": "dsymutil -f" - } - } - }, + "dwarf_tool": { + "DARWIN": "dsymutil -f" + } + } + }, "clang12-windows": { "name": "clang12", "tools": { @@ -2055,270 +2055,270 @@ "gcc_version": "13.1" } }, - "xcode_11_1": { - "tools": { - "c++": { - "bottle": "xcode_11_1", - "executable": "c++" - }, - "cc": { - "bottle": "xcode_11_1", - "executable": "cc" - }, - "llvm-cov": { - "bottle": "xcode_11_1", - "executable": "llvm-cov" - }, - "llvm-profdata": { - "bottle": "xcode_11_1", - "executable": "llvm-profdata" - }, - "nm": { - "bottle": "xcode_11_1", - "executable": "llvm-nm" - }, - "strip": { - "bottle": "xcode_11_1", - "executable": "strip" - } - }, - "platforms": [ - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "DARWIN", - "arch": "x86_64" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "i386" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "x86_64" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "armv7" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "arm64" - }, - "default": false - } - ], - "params": { + "xcode_11_1": { + "tools": { + "c++": { + "bottle": "xcode_11_1", + "executable": "c++" + }, + "cc": { + "bottle": "xcode_11_1", + "executable": "cc" + }, + "llvm-cov": { + "bottle": "xcode_11_1", + "executable": "llvm-cov" + }, + "llvm-profdata": { + "bottle": "xcode_11_1", + "executable": "llvm-profdata" + }, + "nm": { + "bottle": "xcode_11_1", + "executable": "llvm-nm" + }, + "strip": { + "bottle": "xcode_11_1", + "executable": "strip" + } + }, + "platforms": [ + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "DARWIN", + "arch": "x86_64" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "i386" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "x86_64" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "armv7" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "arm64" + }, + "default": false + } + ], + "params": { "type": "xcode", - "match_root": "CLANG", - "werror_mode": "all", - "c_compiler": "$(CLANG)/usr/bin/clang", - "cxx_compiler": "$(CLANG)/usr/bin/clang++", + "match_root": "CLANG", + "werror_mode": "all", + "c_compiler": "$(CLANG)/usr/bin/clang", + "cxx_compiler": "$(CLANG)/usr/bin/clang++", "ar": "$(CLANG)/usr/bin/libtool", - "inplace_tools": true, - "gcc_version": "8.0", - "dwarf_tool": { - "DARWIN": "$(CLANG)/usr/bin/dsymutil -flat" - } - } - }, - "xcode_12_1": { - "tools": { - "c++": { - "bottle": "xcode_12_1", - "executable": "c++" - }, - "cc": { - "bottle": "xcode_12_1", - "executable": "cc" - }, - "llvm-cov": { - "bottle": "xcode_12_1", - "executable": "llvm-cov" - }, - "llvm-profdata": { - "bottle": "xcode_12_1", - "executable": "llvm-profdata" - }, - "nm": { - "bottle": "xcode_12_1", - "executable": "llvm-nm" - }, - "strip": { - "bottle": "xcode_12_1", - "executable": "strip" - } - }, - "platforms": [ - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "DARWIN", - "arch": "x86_64" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "i386" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "x86_64" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "armv7" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "arm64" - }, - "default": false - } - ], - "params": { + "inplace_tools": true, + "gcc_version": "8.0", + "dwarf_tool": { + "DARWIN": "$(CLANG)/usr/bin/dsymutil -flat" + } + } + }, + "xcode_12_1": { + "tools": { + "c++": { + "bottle": "xcode_12_1", + "executable": "c++" + }, + "cc": { + "bottle": "xcode_12_1", + "executable": "cc" + }, + "llvm-cov": { + "bottle": "xcode_12_1", + "executable": "llvm-cov" + }, + "llvm-profdata": { + "bottle": "xcode_12_1", + "executable": "llvm-profdata" + }, + "nm": { + "bottle": "xcode_12_1", + "executable": "llvm-nm" + }, + "strip": { + "bottle": "xcode_12_1", + "executable": "strip" + } + }, + "platforms": [ + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "DARWIN", + "arch": "x86_64" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "i386" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "x86_64" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "armv7" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "arm64" + }, + "default": false + } + ], + "params": { "type": "xcode", - "match_root": "CLANG", - "werror_mode": "all", - "c_compiler": "$(CLANG)/usr/bin/clang", - "cxx_compiler": "$(CLANG)/usr/bin/clang++", + "match_root": "CLANG", + "werror_mode": "all", + "c_compiler": "$(CLANG)/usr/bin/clang", + "cxx_compiler": "$(CLANG)/usr/bin/clang++", "cxx_std": "c++17", - "ar": "$(CLANG)/usr/bin/libtool", - "inplace_tools": true, - "gcc_version": "8.0", - "dwarf_tool": { - "DARWIN": "$(CLANG)/usr/bin/dsymutil -flat" - } - } - }, - "xcode_12_5": { - "tools": { - "c++": { - "bottle": "xcode_12_5", - "executable": "c++" - }, - "cc": { - "bottle": "xcode_12_5", - "executable": "cc" - }, - "llvm-cov": { - "bottle": "xcode_12_5", - "executable": "llvm-cov" - }, - "llvm-profdata": { - "bottle": "xcode_12_5", - "executable": "llvm-profdata" - }, - "nm": { - "bottle": "xcode_12_5", - "executable": "llvm-nm" - }, - "strip": { - "bottle": "xcode_12_5", - "executable": "strip" - } - }, - "platforms": [ - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "DARWIN", - "arch": "x86_64" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "i386" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "x86_64" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "armv7" - }, - "default": false - }, - { - "host": { - "os": "DARWIN" - }, - "target": { - "os": "IOS", - "arch": "arm64" - }, - "default": false + "ar": "$(CLANG)/usr/bin/libtool", + "inplace_tools": true, + "gcc_version": "8.0", + "dwarf_tool": { + "DARWIN": "$(CLANG)/usr/bin/dsymutil -flat" + } + } + }, + "xcode_12_5": { + "tools": { + "c++": { + "bottle": "xcode_12_5", + "executable": "c++" + }, + "cc": { + "bottle": "xcode_12_5", + "executable": "cc" + }, + "llvm-cov": { + "bottle": "xcode_12_5", + "executable": "llvm-cov" + }, + "llvm-profdata": { + "bottle": "xcode_12_5", + "executable": "llvm-profdata" + }, + "nm": { + "bottle": "xcode_12_5", + "executable": "llvm-nm" + }, + "strip": { + "bottle": "xcode_12_5", + "executable": "strip" + } + }, + "platforms": [ + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "DARWIN", + "arch": "x86_64" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "i386" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "x86_64" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "armv7" + }, + "default": false + }, + { + "host": { + "os": "DARWIN" + }, + "target": { + "os": "IOS", + "arch": "arm64" + }, + "default": false }, { "host": { @@ -2329,23 +2329,23 @@ "arch": "arm64" }, "default": false - } - ], - "params": { + } + ], + "params": { "type": "xcode", - "match_root": "CLANG", - "werror_mode": "all", - "c_compiler": "$(CLANG)/usr/bin/clang", - "cxx_compiler": "$(CLANG)/usr/bin/clang++", - "cxx_std": "c++17", - "ar": "$(CLANG)/usr/bin/libtool", - "inplace_tools": true, - "gcc_version": "8.0", - "dwarf_tool": { - "DARWIN": "$(CLANG)/usr/bin/dsymutil -flat" - } - } - }, + "match_root": "CLANG", + "werror_mode": "all", + "c_compiler": "$(CLANG)/usr/bin/clang", + "cxx_compiler": "$(CLANG)/usr/bin/clang++", + "cxx_std": "c++17", + "ar": "$(CLANG)/usr/bin/libtool", + "inplace_tools": true, + "gcc_version": "8.0", + "dwarf_tool": { + "DARWIN": "$(CLANG)/usr/bin/dsymutil -flat" + } + } + }, "android-ndk-r23": { "name": "clang12", "tools": { @@ -2747,10 +2747,10 @@ "default": true } ], - "env": { - "TERMINFO": [ + "env": { + "TERMINFO": [ "$(ROOT)/gdb/lib/terminfo" - ] + ] } }, "gdbserver": { @@ -3946,12 +3946,12 @@ } ] }, - "cuda": { - "tools": { + "cuda": { + "tools": { "cuda": { "bottle": "cuda" } - }, + }, "platforms": [ { "host": { @@ -5724,20 +5724,20 @@ } }, "bottles": { - "msvc2019": { - "formula": { + "msvc2019": { + "formula": { "sandbox_id": 887495315, - "match": "Microsoft Visual C++" - }, - "executable": { + "match": "Microsoft Visual C++" + }, + "executable": { "msvc": [ "bin", "Hostx64", "x64", "cl.exe" ] - } - }, + } + }, "ymake": { "formula": { "sandbox_id": [ @@ -6133,130 +6133,130 @@ ], "llvm-objcopy": [ "bin", - "llvm-objcopy" - ] - } - }, - "xcode_11_1": { - "formula": { - "sandbox_id": [ - 542909976 - ], - "match": "toolchain" - }, - "executable": { - "c++": [ - "usr", - "bin", - "clang++" - ], - "cc": [ - "usr", - "bin", - "clang" - ], - "llvm-cov": [ - "usr", - "bin", - "llvm-cov" - ], - "llvm-profdata": [ - "usr", - "bin", - "llvm-profdata" - ], - "llvm-nm": [ - "usr", - "bin", - "llvm-nm" - ], - "strip": [ - "usr", - "bin", - "strip" - ] - } - }, - "xcode_12_1": { - "formula": { - "sandbox_id": [ - 816448826 - ], - "match": "toolchain" - }, - "executable": { - "c++": [ - "usr", - "bin", - "clang++" - ], - "cc": [ - "usr", - "bin", - "clang" - ], - "llvm-cov": [ - "usr", - "bin", - "llvm-cov" - ], - "llvm-profdata": [ - "usr", - "bin", - "llvm-profdata" - ], - "llvm-nm": [ - "usr", - "bin", - "llvm-nm" - ], - "strip": [ - "usr", - "bin", - "strip" - ] - } - }, - "xcode_12_5": { - "formula": { - "sandbox_id": [ - 1047943010 - ], - "match": "toolchain" - }, - "executable": { - "c++": [ - "usr", - "bin", - "clang++" - ], - "cc": [ - "usr", - "bin", - "clang" - ], - "llvm-cov": [ - "usr", - "bin", - "llvm-cov" - ], - "llvm-profdata": [ - "usr", - "bin", - "llvm-profdata" - ], - "llvm-nm": [ - "usr", - "bin", - "llvm-nm" - ], - "strip": [ - "usr", - "bin", - "strip" - ] - } - }, + "llvm-objcopy" + ] + } + }, + "xcode_11_1": { + "formula": { + "sandbox_id": [ + 542909976 + ], + "match": "toolchain" + }, + "executable": { + "c++": [ + "usr", + "bin", + "clang++" + ], + "cc": [ + "usr", + "bin", + "clang" + ], + "llvm-cov": [ + "usr", + "bin", + "llvm-cov" + ], + "llvm-profdata": [ + "usr", + "bin", + "llvm-profdata" + ], + "llvm-nm": [ + "usr", + "bin", + "llvm-nm" + ], + "strip": [ + "usr", + "bin", + "strip" + ] + } + }, + "xcode_12_1": { + "formula": { + "sandbox_id": [ + 816448826 + ], + "match": "toolchain" + }, + "executable": { + "c++": [ + "usr", + "bin", + "clang++" + ], + "cc": [ + "usr", + "bin", + "clang" + ], + "llvm-cov": [ + "usr", + "bin", + "llvm-cov" + ], + "llvm-profdata": [ + "usr", + "bin", + "llvm-profdata" + ], + "llvm-nm": [ + "usr", + "bin", + "llvm-nm" + ], + "strip": [ + "usr", + "bin", + "strip" + ] + } + }, + "xcode_12_5": { + "formula": { + "sandbox_id": [ + 1047943010 + ], + "match": "toolchain" + }, + "executable": { + "c++": [ + "usr", + "bin", + "clang++" + ], + "cc": [ + "usr", + "bin", + "clang" + ], + "llvm-cov": [ + "usr", + "bin", + "llvm-cov" + ], + "llvm-profdata": [ + "usr", + "bin", + "llvm-profdata" + ], + "llvm-nm": [ + "usr", + "bin", + "llvm-nm" + ], + "strip": [ + "usr", + "bin", + "strip" + ] + } + }, "android-ndk-r23": { "formula": { "sandbox_id": [ @@ -6311,7 +6311,7 @@ "bin", "llvm-objcopy" ] - } + } }, "android-ndk-r24": { "formula": { @@ -6368,15 +6368,15 @@ "llvm-objcopy" ] } - }, - "cuda": { - "formula": { + }, + "cuda": { + "formula": { "sandbox_id": [ 29625981 ], - "match": "CUDA" - } - }, + "match": "CUDA" + } + }, "idea_run_plugin": { "formula": { "sandbox_id": [ @@ -6646,12 +6646,12 @@ ] } }, - "gcc61": { - "formula": { - "sandbox_id": 63189766, - "match": "GCC" - }, - "executable": { + "gcc61": { + "formula": { + "sandbox_id": 63189766, + "match": "GCC" + }, + "executable": { "c++": [ "gcc", "bin", @@ -6682,14 +6682,14 @@ "bin", "strip" ] - } - }, - "gcc82": { - "formula": { - "sandbox_id": 288125345, - "match": "GCC" - }, - "executable": { + } + }, + "gcc82": { + "formula": { + "sandbox_id": 288125345, + "match": "GCC" + }, + "executable": { "c++": [ "gcc", "bin", @@ -6720,8 +6720,8 @@ "bin", "strip" ] - } - }, + } + }, "gdb": { "formula": { "sandbox_id": [ diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 081833998b..801289a085 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -52,7 +52,7 @@ when ($USE_YMAKE_RESOURCE == "yes") { __COMMA__=${comma:""} -ARCADIA_TEST_ROOT=../arcadia_tests_data/ +ARCADIA_TEST_ROOT=../arcadia_tests_data/ DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32 CC_REQUIREMENTS=$DEFAULT_REQUIREMENTS LIB_REQUIREMENTS=$DEFAULT_REQUIREMENTS @@ -140,12 +140,12 @@ when ($OS_CYGWIN == "yes") { CFLAGS+=$COVERAGE_FLAGS LDFLAGS+=$COVERAGE_FLAGS -CHECKFLAG= -LEX_FLAGS= -NO_MAPREDUCE= +CHECKFLAG= +LEX_FLAGS= +NO_MAPREDUCE= -when ($NO_MAPREDUCE == "yes") { - C_DEFINES+=-DNO_MAPREDUCE +when ($NO_MAPREDUCE == "yes") { + C_DEFINES+=-DNO_MAPREDUCE } when ($OS_ANDROID == "yes") { @@ -163,15 +163,15 @@ when ($MAPSMOBI_BUILD_TARGET == "yes" && $OS_IOS == "yes") { } } -# USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to -# select system standard C++ library when USE_INTERNAL_STL=no is set. -# -# USE_STL_SYSTEM=yes is a regular way to select system standard C++ library. -# +# USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to +# select system standard C++ library when USE_INTERNAL_STL=no is set. +# +# USE_STL_SYSTEM=yes is a regular way to select system standard C++ library. +# when ($USE_STL_SYSTEM == "yes") { USE_INTERNAL_STL=no } - + when ($USE_INTERNAL_STL == "no") { USE_STL_SYSTEM=yes } @@ -192,10 +192,10 @@ otherwise { } # tag:linux-specific -when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") { - USE_UBUNTU_COMPATIBILITY=yes -} - +when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") { + USE_UBUNTU_COMPATIBILITY=yes +} + USE_ARCADIA_PYTHON=yes USE_ARCADIA_LIBM=no USE_EAT_MY_DATA=no @@ -213,25 +213,25 @@ when ($HAVE_MKL == "") { SFDL_TMP_OUT= ${output;tmp:SRC.tmp} # tag:perl-specific -when ($USE_LOCAL_TOOLS == "yes") { - PERL=$LOCAL_PERL - PERL_VERSION=$LOCAL_PERL_VERSION - PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB - PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB - when ($LOCAL_PERL_LIBS) { - PERL_LIBS=$LOCAL_PERL_LIBS - } -} -otherwise { - PERL=NO-PERL-SELECTED - PERL_VERSION=NO-PERL-SELECTED-VERSION - PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB - PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB -} - +when ($USE_LOCAL_TOOLS == "yes") { + PERL=$LOCAL_PERL + PERL_VERSION=$LOCAL_PERL_VERSION + PERL_PRIVLIB=$LOCAL_PERL_PRIVLIB + PERL_ARCHLIB=$LOCAL_PERL_ARCHLIB + when ($LOCAL_PERL_LIBS) { + PERL_LIBS=$LOCAL_PERL_LIBS + } +} +otherwise { + PERL=NO-PERL-SELECTED + PERL_VERSION=NO-PERL-SELECTED-VERSION + PERL_PRIVLIB=NO-PERL-SELECTED-PRIVLIB + PERL_ARCHLIB=NO-PERL-SELECTED-ARCHLIB +} + # tag:perl-specific -PERL_LD_LIBRARY_PATH= -PERL_INCLUDE= +PERL_LD_LIBRARY_PATH= +PERL_INCLUDE= USE_PERL_SYSTEM=yes when ($USE_PERL_SYSTEM == "yes") { select ($PERL_SDK) { @@ -272,17 +272,17 @@ when ($USE_PERL_SYSTEM == "yes") { # so default Perl module directories should be prepended to perl command lines when using non-local perl. PERL_INCLUDE=-I${PERL_ARCHLIB} -I${PERL_PRIVLIB} } -PERL_DEFAULT_PEERDIR=yes - +PERL_DEFAULT_PEERDIR=yes + # tag:perl-specific -PERLSUFFIX=-csuffix .cpp +PERLSUFFIX=-csuffix .cpp PERLOUTPUT=${stdout;output:SRC.cpp} when ($PERLC == "yes") { PERLSUFFIX=-csuffix .c PERLOUTPUT=${stdout;output:SRC.c} } -XSUBPPFLAGS= - +XSUBPPFLAGS= + # tag:tool-specific ARCH_TOOL=${tool:"tools/archiver"} @@ -329,16 +329,16 @@ elsewhen ($OS_WINDOWS) { CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows } -when ($USE_LOCAL_SWIG != "yes") { - _SWIG_TOOL=${tool:"contrib/tools/swig"} - _SWIG_LIBRARY=contrib/tools/swig/Lib - _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY -} -otherwise { - _SWIG_TOOL=$SWIG_TOOL - _SWIG_LIBRARY=$SWIG_LIBRARY - _SWIG_LIBRARY_ABS=$SWIG_LIBRARY -} +when ($USE_LOCAL_SWIG != "yes") { + _SWIG_TOOL=${tool:"contrib/tools/swig"} + _SWIG_LIBRARY=contrib/tools/swig/Lib + _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY +} +otherwise { + _SWIG_TOOL=$SWIG_TOOL + _SWIG_LIBRARY=$SWIG_LIBRARY + _SWIG_LIBRARY_ABS=$SWIG_LIBRARY +} SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg FATAL_ERROR_MODULE=no @@ -1011,8 +1011,8 @@ when ($ALLOCATOR == "LF") { } # tag:sanitize -SANITIZER_CFLAGS= - +SANITIZER_CFLAGS= + # tag:proto tag:grpc ### @usage: GRPC() ### @@ -1214,10 +1214,10 @@ module _BASE_UNIT: _BARE_UNIT { } } } - + when ($HARDENING == "yes") { when ($CLANG) { - CFLAGS+=-fstack-protector-all -D_hardening_enabled_ + CFLAGS+=-fstack-protector-all -D_hardening_enabled_ LDFLAGS+=-z relro -z now -z noexecstack PIE=yes } @@ -1230,10 +1230,10 @@ module _BASE_UNIT: _BARE_UNIT { } when ($CLANG) { CFLAGS+=-flto - LDFLAGS+=-flto + LDFLAGS+=-flto } } - + when ($USE_THINLTO == "yes") { when ($GCC) { CFLAGS+=-flto=thin @@ -1269,19 +1269,19 @@ module _BASE_UNIT: _BARE_UNIT { # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl # Workaround this issue by setting variable with PEERDIR in trigger # and then adding PEERDIR to it's value unconditionally. - when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") { - _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14 - } - otherwise { - _UBUNTU_COMPAT_PEERDIR= - } - PEERDIR+=$_UBUNTU_COMPAT_PEERDIR - + when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") { + _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14 + } + otherwise { + _UBUNTU_COMPAT_PEERDIR= + } + PEERDIR+=$_UBUNTU_COMPAT_PEERDIR + when ($NORUNTIME != "yes") { PEERDIR+=contrib/libs/cxxsupp - when ($MAPSMOBI_BUILD_TARGET == "yes") { - PEERDIR+=build/platform/mapkit - } + when ($MAPSMOBI_BUILD_TARGET == "yes") { + PEERDIR+=build/platform/mapkit + } } when ($NOUTIL != "yes") { @@ -1303,7 +1303,7 @@ module _BASE_UNIT: _BARE_UNIT { when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") { CXXFLAGS += -nostdinc++ } - + when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") { PEERDIR += build/external_resources/codenavigation } @@ -1336,10 +1336,10 @@ module _BASE_UNIT: _BARE_UNIT { DEFAULT(PACKAGE_PREFIX_ARGS) - DEFAULT(BYACC_FLAGS -v) - DEFAULT(SWIG_LANG python) - DEFAULT(BISON_FLAGS -v) - DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c) + DEFAULT(BYACC_FLAGS -v) + DEFAULT(SWIG_LANG python) + DEFAULT(BISON_FLAGS -v) + DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c) when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") { PEERDIR+=build/platform/binutils @@ -1416,10 +1416,10 @@ when ($COMMON_LINK_SETTINGS == "yes") { PEERDIR+=contrib/libs/libm } when ($USE_ARCADIA_LIBM == "no") { - C_SYSTEM_LIBRARIES+=-lm + C_SYSTEM_LIBRARIES+=-lm } - when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") { + when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") { when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU" ]) { PEERDIR+=library/cpp/malloc/system } @@ -1498,7 +1498,7 @@ when ($COMMON_LINK_SETTINGS == "yes") { C_WARNING_OPTS += $WERROR_FLAG } } - + when ($ICC == "yes") { PEERDIR+=contrib/libs/intel/core } @@ -1660,10 +1660,10 @@ module _BASE_PROGRAM: _LINK_UNIT { when ($IDE_MSVS == "yes") { PEERDIR+=build/scripts/c_templates } - - when ($_CUSTOM_LINK_STEP_SCRIPT) { - LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT} - } + + when ($_CUSTOM_LINK_STEP_SCRIPT) { + LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT} + } } CPP_PROGRAM_SEM=add_executable $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} && vcs_info && target_link_flags PUBLIC $OBJADDE_LIB $OBJADDE @@ -1822,15 +1822,15 @@ macro EXPORT_ALL_DYNAMIC_SYMBOLS() { ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS) } -### @usage: CUSTOM_LINK_STEP_SCRIPT(name) -### -### Specifies name of a script for custom link step. The scripts -### should be placed in the build/scripts directory and are subject to -### review by devtools@. -macro CUSTOM_LINK_STEP_SCRIPT(Name) { - SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name) -} - +### @usage: CUSTOM_LINK_STEP_SCRIPT(name) +### +### Specifies name of a script for custom link step. The scripts +### should be placed in the build/scripts directory and are subject to +### review by devtools@. +macro CUSTOM_LINK_STEP_SCRIPT(Name) { + SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name) +} + ### @usage: _BASE_UNITTEST # internal ### ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery. @@ -2395,7 +2395,7 @@ module _LIBRARY: _BASE_UNIT { C_WARNING_OPTS += $WERROR_FLAG } } - + when ($WITH_VALGRIND == "yes") { PEERDIR+=contrib/libs/valgrind } @@ -2608,7 +2608,7 @@ module DLL_UNIT: _LINK_UNIT { when ($MSVC == "yes" || $CYGWIN == "yes") { MODULE_SUFFIX=.dll } - elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") { + elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") { MODULE_PREFIX=lib MODULE_SUFFIX=.dylib } @@ -2636,10 +2636,10 @@ module DLL_UNIT: _LINK_UNIT { } } - when ($DARWIN == "yes") { - LDFLAGS += -undefined dynamic_lookup - } - + when ($DARWIN == "yes") { + LDFLAGS += -undefined dynamic_lookup + } + when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") { PEERDIR+=library/cpp/testing/dump_clang_coverage } @@ -2687,7 +2687,7 @@ module PY_ANY_MODULE: DLL_UNIT { # -bundle when ($DARWIN == "yes") { - LDFLAGS+=-flat_namespace + LDFLAGS+=-flat_namespace } when ($MSVC == "yes" || $CYGWIN == "yes") { @@ -4139,9 +4139,9 @@ module _BASE_PY_PROGRAM: _BASE_PROGRAM { ALLOCATOR($_MY_ALLOCATOR) STRIP() - when ($BUILD_TYPE == "DEBUG") { - NO_STRIP=yes - } + when ($BUILD_TYPE == "DEBUG") { + NO_STRIP=yes + } when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { NO_STRIP=yes } @@ -4193,9 +4193,9 @@ module _BASE_PY3_PROGRAM: _BASE_PROGRAM { when ($NO_PYTHON_INCLS != "yes") { PEERDIR+=contrib/libs/python } - when ($BUILD_TYPE == "DEBUG") { - NO_STRIP=yes - } + when ($BUILD_TYPE == "DEBUG") { + NO_STRIP=yes + } when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { NO_STRIP=yes } @@ -5222,10 +5222,10 @@ macro USE_PYTHON3() { } # tag:python-specific -when ($PERL_DEFAULT_PEERDIR == "yes") { - when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) { - PEERDIR+=build/platform/perl - } +when ($PERL_DEFAULT_PEERDIR == "yes") { + when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) { + PEERDIR+=build/platform/perl + } } # tag:perl-specific @@ -5236,14 +5236,14 @@ macro USE_PERL_LIB() { } # tag:perl-specific -### @usage: USE_PERL_514_LIB() -### Add dependency on Perl 5.14 to your LIBRARY -macro USE_PERL_514_LIB() { - SET(PERL_SDK ubuntu-12) - SET(PERL_DEFAULT_PEERDIR no) - PEERDIR(build/platform/perl/5.14) -} - +### @usage: USE_PERL_514_LIB() +### Add dependency on Perl 5.14 to your LIBRARY +macro USE_PERL_514_LIB() { + SET(PERL_SDK ubuntu-12) + SET(PERL_DEFAULT_PEERDIR no) + PEERDIR(build/platform/perl/5.14) +} + # tag:perl-specific ### @usage: ADD_PERL_MODULE(Dir ModuleName) ### Add dependency on specified Perl module to the library @@ -5601,7 +5601,7 @@ macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) { } # tag:cpu -PIC_CFLAGS= +PIC_CFLAGS= SSE2_CFLAGS= SSE3_CFLAGS= SSSE3_CFLAGS= @@ -5623,7 +5623,7 @@ SSE4_CFLAGS= # tag:cpu when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") { when ($CLANG || $CLANG_CL || $GCC) { - PIC_CFLAGS=-fPIC + PIC_CFLAGS=-fPIC SSE2_CFLAGS=-msse2 SSE3_CFLAGS=-msse3 SSSE3_CFLAGS=-mssse3 @@ -6214,12 +6214,12 @@ macro SRC_C_AVX2(FILE, FLAGS...) { } # tag:cpu tag:src-processing -### @usage SRC_CPP_PIC(File Flags...) -### Compile single .c-file with -fPIC and extra Flags. -macro SRC_CPP_PIC(FILE, FLAGS...) { - _SRC(cpp $FILE $PIC_CFLAGS $FLAGS) -} - +### @usage SRC_CPP_PIC(File Flags...) +### Compile single .c-file with -fPIC and extra Flags. +macro SRC_CPP_PIC(FILE, FLAGS...) { + _SRC(cpp $FILE $PIC_CFLAGS $FLAGS) +} + # tag:cpu tag:src-processing ### @usage SRC_CPP_SSE2(File Flags...) ### Compile single .cpp-file with SSE2 and extra Flags. @@ -6332,7 +6332,7 @@ macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) { ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that ### provides DstSubPrefix_swg python module. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) { - .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -c++ -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.cpp:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"} + .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -c++ -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.cpp:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"} ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY) } @@ -6341,7 +6341,7 @@ macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) { ### ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c. macro _SWIG_PYTHON_C(Src, DstSubPrefix) { - .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.c:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"} + .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.c:DstSubPrefix} ${input:Src} ${output;noauto;hide;suf=.py:DstSubPrefix} ${kv;hide:"p SW"} ${kv;hide:"pc yellow"} ADDINCL(FOR swig $_SWIG_LIBRARY/python FOR swig $_SWIG_LIBRARY) } @@ -8999,10 +8999,10 @@ when ($TENSORFLOW_WITH_CUDA) { CUDA_REQUIRED=yes } -when (!$TENSORRT_VERSION) { - TENSORRT_VERSION=5 -} - +when (!$TENSORRT_VERSION) { + TENSORRT_VERSION=5 +} + ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin @@ -9138,41 +9138,41 @@ macro NGINX_MODULES(Modules...) { PEERDIR(${Modules}) RUN_PROGRAM(nginx/module_gen ${Modules} CWD ${ARCADIA_ROOT} IN ${suf=/modules.json:Modules} OUTPUT_INCLUDES contrib/nginx/core/src/core/ngx_config.h contrib/nginx/core/src/core/ngx_core.h STDOUT ngx_modules.c) } - -# Experimental: container as output. https://st.yandex-team.ru/DTCC-179 - + +# Experimental: container as output. https://st.yandex-team.ru/DTCC-179 + # tag:external-build -CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container_layer.py"} -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"} -CONTAINER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container.py"} -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"} - +CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container_layer.py"} -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"} +CONTAINER_CMD=$YMAKE_PYTHON ${input:"devtools/experimental/solar/selfcontainer/scripts/make_container.py"} -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"} + # tag:external-build module CONTAINER_LAYER: _BARE_UNIT { - .CMD=CONTAINER_LAYER_CMD - - MODULE_SUFFIX=.container_layer -} - + .CMD=CONTAINER_LAYER_CMD + + MODULE_SUFFIX=.container_layer +} + # tag:external-build module CONTAINER: _BARE_UNIT { - .NODE_TYPE=Bundle - .PEERDIR_POLICY=as_build_from - .FINAL_TARGET=yes - .CMD=CONTAINER_CMD -} + .NODE_TYPE=Bundle + .PEERDIR_POLICY=as_build_from + .FINAL_TARGET=yes + .CMD=CONTAINER_CMD +} # tag:external-build -CUSTOM_BUILD_LIBRARY_USE= -CUSTOM_BUILD_LIBRARY_CMD=$GENERATE_MF && ${tool:"devtools/experimental/solar/outbuild/runner"} ${hide:PEERS} --script=${input:CUSTOM_SCRIPT} --output $TARGET --python=${tool:"contrib/tools/python3"} --isolator=${tool:"devtools/experimental/solar/outbuild/isolator"} $CUSTOM_BUILD_LIBRARY_USE - +CUSTOM_BUILD_LIBRARY_USE= +CUSTOM_BUILD_LIBRARY_CMD=$GENERATE_MF && ${tool:"devtools/experimental/solar/outbuild/runner"} ${hide:PEERS} --script=${input:CUSTOM_SCRIPT} --output $TARGET --python=${tool:"contrib/tools/python3"} --isolator=${tool:"devtools/experimental/solar/outbuild/isolator"} $CUSTOM_BUILD_LIBRARY_USE + # tag:external-build -module CUSTOM_BUILD_LIBRARY: LIBRARY { - .NODE_TYPE=Bundle - .PEERDIR_POLICY=as_build_from - .PROXY=yes - .CMD=CUSTOM_BUILD_LIBRARY_CMD - DISABLE(NEED_ADD_FAKE_SRC) -} - +module CUSTOM_BUILD_LIBRARY: LIBRARY { + .NODE_TYPE=Bundle + .PEERDIR_POLICY=as_build_from + .PROXY=yes + .CMD=CUSTOM_BUILD_LIBRARY_CMD + DISABLE(NEED_ADD_FAKE_SRC) +} + ### @usage: ORIGINAL_SOURCE(Source) ### ### This macro specifies the source repository for contrib diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 30219eb85e..6cf2422240 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -1,58 +1,58 @@ #!/usr/bin/env python -# coding=utf-8 +# coding=utf-8 from __future__ import print_function -import base64 -import itertools -import json -import logging -import ntpath -import optparse +import base64 +import itertools +import json +import logging +import ntpath +import optparse import os -import posixpath +import posixpath import re import subprocess -import sys -import tempfile +import sys +import tempfile import six -logger = logging.getLogger(__name__ if __name__ != '__main__' else 'ymake_conf.py') +logger = logging.getLogger(__name__ if __name__ != '__main__' else 'ymake_conf.py') -def init_logger(verbose): - logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO) +def init_logger(verbose): + logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO) -class DebugString(object): - def __init__(self, get_string_func): - self.get_string_func = get_string_func +class DebugString(object): + def __init__(self, get_string_func): + self.get_string_func = get_string_func - def __str__(self): - return self.get_string_func() - - -class ConfigureError(Exception): + def __str__(self): + return self.get_string_func() + + +class ConfigureError(Exception): pass -class Platform(object): - def __init__(self, name, os, arch): - """ - :type name: str - :type os: str - :type arch: str - """ - self.name = name - self.os = self._parse_os(os) - self.arch = arch.lower() +class Platform(object): + def __init__(self, name, os, arch): + """ + :type name: str + :type os: str + :type arch: str + """ + self.name = name + self.os = self._parse_os(os) + self.arch = arch.lower() - self.is_i386 = self.arch in ('i386', 'x86') - self.is_i686 = self.arch == 'i686' - self.is_x86 = self.is_i386 or self.is_i686 - self.is_x86_64 = self.arch in ('x86_64', 'amd64') - self.is_intel = self.is_x86 or self.is_x86_64 + self.is_i386 = self.arch in ('i386', 'x86') + self.is_i686 = self.arch == 'i686' + self.is_x86 = self.is_i386 or self.is_i686 + self.is_x86_64 = self.arch in ('x86_64', 'amd64') + self.is_intel = self.is_x86 or self.is_x86_64 self.is_armv7 = self.arch in ('armv7', 'armv7a', 'armv7a_neon', 'arm', 'armv7a_cortex_a9', 'armv7ahf_cortex_a35', 'armv7ahf_cortex_a53') self.is_armv8 = self.arch in ('armv8', 'armv8a', 'arm64', 'aarch64', 'armv8a_cortex_a35', 'armv8a_cortex_a53') @@ -61,7 +61,7 @@ class Platform(object): self.is_arm = self.is_armv7 or self.is_armv8 or self.is_armv8m self.is_armv7_neon = self.arch in ('armv7a_neon', 'armv7a_cortex_a9', 'armv7ahf_cortex_a35', 'armv7ahf_cortex_a53') self.is_armv7hf = self.arch in ('armv7ahf_cortex_a35', 'armv7ahf_cortex_a53') - + self.armv7_float_abi = None if self.is_armv7: if self.is_armv7hf: @@ -80,29 +80,29 @@ class Platform(object): self.is_32_bit = self.is_x86 or self.is_armv7 or self.is_armv8m self.is_64_bit = self.is_x86_64 or self.is_armv8 or self.is_powerpc - - assert self.is_32_bit or self.is_64_bit - assert not (self.is_32_bit and self.is_64_bit) + + assert self.is_32_bit or self.is_64_bit + assert not (self.is_32_bit and self.is_64_bit) self.is_linux = self.os == 'linux' or 'yocto' in self.os - self.is_linux_x86_64 = self.is_linux and self.is_x86_64 - self.is_linux_armv8 = self.is_linux and self.is_armv8 + self.is_linux_x86_64 = self.is_linux and self.is_x86_64 + self.is_linux_armv8 = self.is_linux and self.is_armv8 self.is_linux_armv7 = self.is_linux and self.is_armv7 self.is_linux_power8le = self.is_linux and self.is_power8le self.is_linux_power9le = self.is_linux and self.is_power9le self.is_linux_powerpc = self.is_linux_power8le or self.is_linux_power9le - - self.is_macos = self.os == 'macos' - self.is_macos_x86_64 = self.is_macos and self.is_x86_64 + + self.is_macos = self.os == 'macos' + self.is_macos_x86_64 = self.is_macos and self.is_x86_64 self.is_macos_arm64 = self.is_macos and self.is_arm64 self.is_iossim = self.os == 'iossim' or (self.os == 'ios' and self.is_intel) self.is_ios = self.os == 'ios' or self.is_iossim self.is_apple = self.is_macos or self.is_ios - self.is_windows = self.os == 'windows' - self.is_windows_x86_64 = self.is_windows and self.is_x86_64 + self.is_windows = self.os == 'windows' + self.is_windows_x86_64 = self.is_windows and self.is_x86_64 - self.is_android = self.os == 'android' + self.is_android = self.os == 'android' if self.is_android: # This is default Android API level unless `ANDROID_API` is specified # 18 is the smallest level with OpenGL support @@ -110,161 +110,161 @@ class Platform(object): default_android_api = 21 if self.is_64_bit else 18 self.android_api = int(preset('ANDROID_API', default_android_api)) - self.is_cygwin = self.os == 'cygwin' + self.is_cygwin = self.os == 'cygwin' self.is_yocto = self.os == 'yocto' - + self.is_none = self.os == 'none' self.is_posix = self.is_linux or self.is_apple or self.is_android or self.is_cygwin or self.is_yocto - @staticmethod - def from_json(data): - name = data.get('visible_name', data['toolchain']) - return Platform(name, os=data['os'], arch=data['arch']) + @staticmethod + def from_json(data): + name = data.get('visible_name', data['toolchain']) + return Platform(name, os=data['os'], arch=data['arch']) - @property - def os_variables(self): - # 'LINUX' variable, for backward compatibility - yield self.os.upper() + @property + def os_variables(self): + # 'LINUX' variable, for backward compatibility + yield self.os.upper() - # 'OS_LINUX' variable - yield 'OS_{}'.format(self.os.upper()) + # 'OS_LINUX' variable + yield 'OS_{}'.format(self.os.upper()) # yocto is linux if 'yocto' in self.os: yield 'LINUX' yield 'OS_LINUX' - if self.is_macos: - yield 'DARWIN' - yield 'OS_DARWIN' + if self.is_macos: + yield 'DARWIN' + yield 'OS_DARWIN' if self.is_iossim: yield 'IOS' yield 'OS_IOS' yield 'OS_IOSSIM' - @property - def arch_variables(self): - return select_multiple(( - (self.is_i386 or self.is_i686, 'ARCH_I386'), - (self.is_i686, 'ARCH_I686'), - (self.is_x86_64, 'ARCH_X86_64'), - (self.is_armv7, 'ARCH_ARM7'), + @property + def arch_variables(self): + return select_multiple(( + (self.is_i386 or self.is_i686, 'ARCH_I386'), + (self.is_i686, 'ARCH_I686'), + (self.is_x86_64, 'ARCH_X86_64'), + (self.is_armv7, 'ARCH_ARM7'), (self.is_armv7_neon, 'ARCH_ARM7_NEON'), - (self.is_armv8, 'ARCH_ARM64'), + (self.is_armv8, 'ARCH_ARM64'), (self.is_armv8m, 'ARCH_ARM8M'), - (self.is_arm, 'ARCH_ARM'), + (self.is_arm, 'ARCH_ARM'), (self.is_linux_armv8 or self.is_macos_arm64, 'ARCH_AARCH64'), (self.is_powerpc, 'ARCH_PPC64LE'), (self.is_power8le, 'ARCH_POWER8LE'), (self.is_power9le, 'ARCH_POWER9LE'), - (self.is_32_bit, 'ARCH_TYPE_32'), - (self.is_64_bit, 'ARCH_TYPE_64'), - )) + (self.is_32_bit, 'ARCH_TYPE_32'), + (self.is_64_bit, 'ARCH_TYPE_64'), + )) - @property + @property def library_path_variables(self): return ['LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH'] - - def find_in_dict(self, dict_, default=None): - if dict_ is None: - return default + + def find_in_dict(self, dict_, default=None): + if dict_ is None: + return default for key in six.iterkeys(dict_): - if self._parse_os(key) == self.os: - return dict_[key] - return default - - @property - def os_compat(self): - if self.is_macos: - return 'DARWIN' - else: - return self.os.upper() - - def exe(self, *paths): - if self.is_windows: - return ntpath.join(*itertools.chain(paths[:-1], (paths[-1] + '.exe',))) - else: - return posixpath.join(*paths) - - def __str__(self): - return '{name}-{os}-{arch}'.format(name=self.name, os=self.os, arch=self.arch) - - def __cmp__(self, other): - return cmp((self.name, self.os, self.arch), (other.name, other.os, other.arch)) - - def __hash__(self): - return hash((self.name, self.os, self.arch)) - - @staticmethod - def _parse_os(os): - os = os.lower() - - if os == 'darwin': - return 'macos' - if os in ('win', 'win32', 'win64'): - return 'windows' - if os.startswith('cygwin'): - return 'cygwin' - - return os - - -def which(prog): - if os.path.exists(prog) and os.access(prog, os.X_OK): - return prog - - # Ищем в $PATH только простые команды, без путей. - if os.path.dirname(prog) != '': + if self._parse_os(key) == self.os: + return dict_[key] + return default + + @property + def os_compat(self): + if self.is_macos: + return 'DARWIN' + else: + return self.os.upper() + + def exe(self, *paths): + if self.is_windows: + return ntpath.join(*itertools.chain(paths[:-1], (paths[-1] + '.exe',))) + else: + return posixpath.join(*paths) + + def __str__(self): + return '{name}-{os}-{arch}'.format(name=self.name, os=self.os, arch=self.arch) + + def __cmp__(self, other): + return cmp((self.name, self.os, self.arch), (other.name, other.os, other.arch)) + + def __hash__(self): + return hash((self.name, self.os, self.arch)) + + @staticmethod + def _parse_os(os): + os = os.lower() + + if os == 'darwin': + return 'macos' + if os in ('win', 'win32', 'win64'): + return 'windows' + if os.startswith('cygwin'): + return 'cygwin' + + return os + + +def which(prog): + if os.path.exists(prog) and os.access(prog, os.X_OK): + return prog + + # Ищем в $PATH только простые команды, без путей. + if os.path.dirname(prog) != '': return None - path = os.getenv('PATH', '') + path = os.getenv('PATH', '') - pathext = os.environ.get('PATHEXT') - # На Windows %PATHEXT% указывает на список расширений, которые нужно проверять - # при поиске команды в пути. Точное совпадение без расширения имеет приоритет. - pathext = [''] if pathext is None else [''] + pathext.lower().split(os.pathsep) + pathext = os.environ.get('PATHEXT') + # На Windows %PATHEXT% указывает на список расширений, которые нужно проверять + # при поиске команды в пути. Точное совпадение без расширения имеет приоритет. + pathext = [''] if pathext is None else [''] + pathext.lower().split(os.pathsep) - for dir_ in path.split(os.path.pathsep): - for ext in pathext: - p = os.path.join(dir_, prog + ext) - if os.path.exists(p) and os.path.isfile(p) and os.access(p, os.X_OK): - return p + for dir_ in path.split(os.path.pathsep): + for ext in pathext: + p = os.path.join(dir_, prog + ext) + if os.path.exists(p) and os.path.isfile(p) and os.access(p, os.X_OK): + return p - return None + return None -def get_stdout(command): - stdout, code = get_stdout_and_code(command) - return stdout if code == 0 else None +def get_stdout(command): + stdout, code = get_stdout_and_code(command) + return stdout if code == 0 else None -def get_stdout_and_code(command): - # noinspection PyBroadException - try: - process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, _ = process.communicate() - return stdout, process.returncode - except Exception: - return None, None +def get_stdout_and_code(command): + # noinspection PyBroadException + try: + process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, _ = process.communicate() + return stdout, process.returncode + except Exception: + return None, None -def to_strings(o): - if isinstance(o, (list, tuple)): - for s in o: - for ss in to_strings(s): - yield ss - else: - if o is not None: - if isinstance(o, bool): - yield 'yes' if o else 'no' - elif isinstance(o, (str, int)): - yield str(o) - else: - raise ConfigureError('Unexpected value {} {}'.format(type(o), o)) +def to_strings(o): + if isinstance(o, (list, tuple)): + for s in o: + for ss in to_strings(s): + yield ss + else: + if o is not None: + if isinstance(o, bool): + yield 'yes' if o else 'no' + elif isinstance(o, (str, int)): + yield str(o) + else: + raise ConfigureError('Unexpected value {} {}'.format(type(o), o)) -def emit(key, *value): +def emit(key, *value): print('{0}={1}'.format(key, ' '.join(to_strings(value)))) @@ -277,126 +277,126 @@ def emit_with_ignore_comment(key, *value): emit_with_comment('IGNORE YMAKE CONF CONTEXT', key, *value) -def append(key, *value): +def append(key, *value): print('{0}+={1}'.format(key, ' '.join(to_strings(value)))) -def emit_big(text): - prefix = None - first = True - for line in text.split('\n'): - if prefix is None: - if not line: - continue - - prefix = 0 - while prefix < len(line) and line[prefix] == ' ': - prefix += 1 - - if first: # Be pretty, prepend an empty line before the output +def emit_big(text): + prefix = None + first = True + for line in text.split('\n'): + if prefix is None: + if not line: + continue + + prefix = 0 + while prefix < len(line) and line[prefix] == ' ': + prefix += 1 + + if first: # Be pretty, prepend an empty line before the output print() - first = False - + first = False + print(line[prefix:]) - - -class Variables(dict): + + +class Variables(dict): def emit(self, with_ignore_comment=[]): with_ignore_comment_set = set(with_ignore_comment) - for k in sorted(self.keys()): + for k in sorted(self.keys()): if k in with_ignore_comment_set: emit_with_ignore_comment(k, self[k]) else: emit(k, self[k]) - - def update_from_presets(self): + + def update_from_presets(self): for k in six.iterkeys(self): - v = preset(k) - if v is not None: - self[k] = v - - def reset_if_any(self, value_check=None, reset_value=None): - if value_check is None: - def value_check(v_): - return v_ is None - + v = preset(k) + if v is not None: + self[k] = v + + def reset_if_any(self, value_check=None, reset_value=None): + if value_check is None: + def value_check(v_): + return v_ is None + if any(map(value_check, six.itervalues(self))): for k in six.iterkeys(self): - self[k] = reset_value - - -def format_env(env, list_separator=':'): - def format_value(value): - return value if isinstance(value, str) else ('\\' + list_separator).join(value) - - def format(kv): - return '${env:"%s=%s"}' % (kv[0], format_value(kv[1])) - + self[k] = reset_value + + +def format_env(env, list_separator=':'): + def format_value(value): + return value if isinstance(value, str) else ('\\' + list_separator).join(value) + + def format(kv): + return '${env:"%s=%s"}' % (kv[0], format_value(kv[1])) + return ' '.join(map(format, sorted(six.iteritems(env)))) - - -# TODO(somov): Проверить, используется ли это. Может быть, выпилить. -def userify_presets(presets, keys): - for key in keys: - user_key = 'USER_{}'.format(key) - values = [presets.pop(key, None), presets.get(user_key)] - presets[user_key] = ' '.join(filter(None, values)) - - -def preset(key, default=None): - return opts().presets.get(key, default) - - + + +# TODO(somov): Проверить, используется ли это. Может быть, выпилить. +def userify_presets(presets, keys): + for key in keys: + user_key = 'USER_{}'.format(key) + values = [presets.pop(key, None), presets.get(user_key)] + presets[user_key] = ' '.join(filter(None, values)) + + +def preset(key, default=None): + return opts().presets.get(key, default) + + def is_positive(key): - return is_positive_str(preset(key, '')) - - -def is_positive_str(s): - return s.lower() in ('yes', 'true', 'on', '1') + return is_positive_str(preset(key, '')) +def is_positive_str(s): + return s.lower() in ('yes', 'true', 'on', '1') + + def is_negative(key): - return is_negative_str(preset(key, '')) + return is_negative_str(preset(key, '')) -def is_negative_str(s): - return s.lower() in ('no', 'false', 'off', '0') - - -def to_bool(s, default=None): +def is_negative_str(s): + return s.lower() in ('no', 'false', 'off', '0') + + +def to_bool(s, default=None): if isinstance(s, six.string_types): - if is_positive_str(s): - return True - if is_negative_str(s): - return False - if default is None: - raise ConfigureError('{} is not a bool value'.format(s)) - return default - - -def select(selectors, default=None, no_default=False): - for enabled, value in selectors: - if enabled: - return value - if no_default: - raise ConfigureError() - return default - - -def select_multiple(selectors): - for enabled, value in selectors: - if enabled: - yield value - - -def unique(it): - known = set() - for i in it: - if i not in known: - known.add(i) - yield i - - + if is_positive_str(s): + return True + if is_negative_str(s): + return False + if default is None: + raise ConfigureError('{} is not a bool value'.format(s)) + return default + + +def select(selectors, default=None, no_default=False): + for enabled, value in selectors: + if enabled: + return value + if no_default: + raise ConfigureError() + return default + + +def select_multiple(selectors): + for enabled, value in selectors: + if enabled: + yield value + + +def unique(it): + known = set() + for i in it: + if i not in known: + known.add(i) + yield i + + class Options(object): def __init__(self, argv): def parse_presets(raw_presets): @@ -411,8 +411,8 @@ class Options(object): parser = optparse.OptionParser(add_help_option=False) opt_group = optparse.OptionGroup(parser, 'Conf script options') opt_group.add_option('--toolchain-params', dest='toolchain_params', action='store', help='Set toolchain params via file') - opt_group.add_option('-D', '--preset', dest='presets', action='append', default=[], help='set or override presets') - opt_group.add_option('-l', '--local-distbuild', dest='local_distbuild', action='store_true', default=False, help='conf for local distbuild') + opt_group.add_option('-D', '--preset', dest='presets', action='append', default=[], help='set or override presets') + opt_group.add_option('-l', '--local-distbuild', dest='local_distbuild', action='store_true', default=False, help='conf for local distbuild') parser.add_option_group(opt_group) self.options, self.arguments = parser.parse_args(argv) @@ -422,162 +422,162 @@ class Options(object): print('Usage: ArcRoot, --BuildType--, Verbosity, [Path to local.ymake]', file=sys.stderr) sys.exit(1) - self.arcadia_root = argv[1] - init_logger(argv[3] == 'verbose') - - # Эти переменные не надо использоваться напрямую. Их значения уже разбираются в других местах. + self.arcadia_root = argv[1] + init_logger(argv[3] == 'verbose') + + # Эти переменные не надо использоваться напрямую. Их значения уже разбираются в других местах. self.build_type = argv[2].lower() - self.local_distbuild = self.options.local_distbuild - self.toolchain_params = self.options.toolchain_params + self.local_distbuild = self.options.local_distbuild + self.toolchain_params = self.options.toolchain_params - self.presets = parse_presets(self.options.presets) - userify_presets(self.presets, ('CFLAGS', 'CXXFLAGS', 'CONLYFLAGS', 'LDFLAGS', 'GO_COMPILE_FLAGS', 'GO_LINK_FLAGS', 'USE_LOCAL_SWIG', 'SWIG_TOOL', 'SWIG_LIBRARY')) + self.presets = parse_presets(self.options.presets) + userify_presets(self.presets, ('CFLAGS', 'CXXFLAGS', 'CONLYFLAGS', 'LDFLAGS', 'GO_COMPILE_FLAGS', 'GO_LINK_FLAGS', 'USE_LOCAL_SWIG', 'SWIG_TOOL', 'SWIG_LIBRARY')) - Instance = None + Instance = None -def opts(): - if Options.Instance is None: - Options.Instance = Options(sys.argv) - return Options.Instance +def opts(): + if Options.Instance is None: + Options.Instance = Options(sys.argv) + return Options.Instance -class Profiler(object): - Generic = 'generic' - GProf = 'gprof' +class Profiler(object): + Generic = 'generic' + GProf = 'gprof' -class Arcadia(object): - def __init__(self, root): - self.root = root +class Arcadia(object): + def __init__(self, root): + self.root = root -class Build(object): - def __init__(self, arcadia, build_type, toolchain_params, force_ignore_local_files=False): - self.arcadia = arcadia - self.params = self._load_json_from_base64(toolchain_params) - self.build_type = build_type +class Build(object): + def __init__(self, arcadia, build_type, toolchain_params, force_ignore_local_files=False): + self.arcadia = arcadia + self.params = self._load_json_from_base64(toolchain_params) + self.build_type = build_type - platform = self.params['platform'] - self.host = Platform.from_json(platform['host']) - self.target = Platform.from_json(platform['target']) + platform = self.params['platform'] + self.host = Platform.from_json(platform['host']) + self.target = Platform.from_json(platform['target']) - self.tc = self._get_toolchain_options() + self.tc = self._get_toolchain_options() - # TODO(somov): Удалить, когда перестанет использоваться. - self.build_system = 'ymake' + # TODO(somov): Удалить, когда перестанет использоваться. + self.build_system = 'ymake' - self.ignore_local_files = False + self.ignore_local_files = False - dist_prefix = 'dist-' - if self.build_type.startswith(dist_prefix): - self.build_system = 'distbuild' - self.build_type = self.build_type[len(dist_prefix):] + dist_prefix = 'dist-' + if self.build_type.startswith(dist_prefix): + self.build_system = 'distbuild' + self.build_type = self.build_type[len(dist_prefix):] - if force_ignore_local_files: - self.ignore_local_files = True + if force_ignore_local_files: + self.ignore_local_files = True - if self.is_ide_build_type(self.build_type): - self.ignore_local_files = True + if self.is_ide_build_type(self.build_type): + self.ignore_local_files = True - self.pic = not is_positive('FORCE_NO_PIC') + self.pic = not is_positive('FORCE_NO_PIC') + + @property + def host_target(self): + return self.host, self.target + + def print_build(self): + self._print_build_settings() - @property - def host_target(self): - return self.host, self.target - - def print_build(self): - self._print_build_settings() - - host_os = System(self.host) - host_os.print_host_settings() + host_os = System(self.host) + host_os.print_host_settings() - target_os = System(self.target) - target_os.print_target_settings() + target_os = System(self.target) + target_os.print_target_settings() - if self.pic: - emit('PIC', 'yes') + if self.pic: + emit('PIC', 'yes') - emit('COMPILER_ID', self.tc.type.upper()) + emit('COMPILER_ID', self.tc.type.upper()) - if self.is_valgrind: - emit('WITH_VALGRIND', 'yes') + if self.is_valgrind: + emit('WITH_VALGRIND', 'yes') - toolchain_type, compiler_type, linker_type = Compilers[self.tc.type] - toolchain = toolchain_type(self.tc, self) - compiler = compiler_type(self.tc, self) - linker = linker_type(self.tc, self) + toolchain_type, compiler_type, linker_type = Compilers[self.tc.type] + toolchain = toolchain_type(self.tc, self) + compiler = compiler_type(self.tc, self) + linker = linker_type(self.tc, self) - toolchain.print_toolchain() - compiler.print_compiler() - linker.print_linker() + toolchain.print_toolchain() + compiler.print_compiler() + linker.print_linker() - self._print_other_settings(compiler) + self._print_other_settings(compiler) - def _print_build_settings(self): - emit('BUILD_TYPE', self.build_type.upper()) - emit('BT_' + self.build_type.upper().replace('-', '_'), 'yes') + def _print_build_settings(self): + emit('BUILD_TYPE', self.build_type.upper()) + emit('BT_' + self.build_type.upper().replace('-', '_'), 'yes') - if self.build_system == 'distbuild': - emit('DISTBUILD', 'yes') + if self.build_system == 'distbuild': + emit('DISTBUILD', 'yes') elif self.build_system != 'ymake': - raise ConfigureError() + raise ConfigureError() python_bin = preset('BUILD_PYTHON_BIN', '$(PYTHON)/python') emit('YMAKE_PYTHON', python_bin) emit('YMAKE_UNPICKLER', python_bin, '$ARCADIA_ROOT/build/plugins/_unpickler.py') - @property - def is_release(self): - # TODO(somov): Проверить, бывают ли тут суффиксы на самом деле + @property + def is_release(self): + # TODO(somov): Проверить, бывают ли тут суффиксы на самом деле return self.build_type in ('release', 'relwithdebinfo', 'minsizerel', 'profile', 'gprof') or self.build_type.endswith('-release') - @property - def is_debug(self): - return self.build_type in ('debug', 'debugnoasserts', 'fastdebug') or self.build_type.endswith('-debug') - - @property - def is_fast_debug(self): - return self.build_type == 'fastdebug' + @property + def is_debug(self): + return self.build_type in ('debug', 'debugnoasserts', 'fastdebug') or self.build_type.endswith('-debug') - @property + @property + def is_fast_debug(self): + return self.build_type == 'fastdebug' + + @property def is_size_optimized(self): return self.build_type == 'minsizerel' @property - def is_coverage(self): - return self.build_type == 'coverage' + def is_coverage(self): + return self.build_type == 'coverage' - @property + @property def is_sanitized(self): - sanitizer = preset('SANITIZER_TYPE') - return bool(sanitizer) and not is_negative_str(sanitizer) + sanitizer = preset('SANITIZER_TYPE') + return bool(sanitizer) and not is_negative_str(sanitizer) @property - def with_ndebug(self): + def with_ndebug(self): return self.build_type in ('release', 'minsizerel', 'valgrind-release', 'profile', 'gprof', 'debugnoasserts') - @property - def is_valgrind(self): - return self.build_type == 'valgrind' or self.build_type == 'valgrind-release' + @property + def is_valgrind(self): + return self.build_type == 'valgrind' or self.build_type == 'valgrind-release' - @property - def is_ide(self): - return self.is_ide_build_type(self.build_type) + @property + def is_ide(self): + return self.is_ide_build_type(self.build_type) - @property - def profiler_type(self): - if self.build_type == 'profile': - return Profiler.Generic - elif self.build_type == 'gprof': - return Profiler.GProf - else: - return None + @property + def profiler_type(self): + if self.build_type == 'profile': + return Profiler.Generic + elif self.build_type == 'gprof': + return Profiler.GProf + else: + return None - @staticmethod - def is_ide_build_type(build_type): - return build_type == 'nobuild' + @staticmethod + def is_ide_build_type(build_type): + return build_type == 'nobuild' def _configure_runtime_versions(self): res = subprocess.check_output(['xcrun', 'simctl', 'list', '--json', 'runtimes']) @@ -588,11 +588,11 @@ class Build(object): if "iOS" in runtime['identifier']: emit('DEFAULT_IOS_RUNTIME', '{}'.format(runtime['identifier'])) - def _get_toolchain_options(self): - type_ = self.params['params']['type'] + def _get_toolchain_options(self): + type_ = self.params['params']['type'] if self.params['params'].get('local') and type_ == 'xcode': - detector = CompilerDetector() + detector = CompilerDetector() detector.detect(self.params['params']['c_compiler'], self.params['params']['cxx_compiler']) emit('LOCAL_XCODE_TOOLS', 'yes') emit('XCODE', 'yes') @@ -601,28 +601,28 @@ class Build(object): self._configure_runtime_versions() elif type_ == 'system_cxx': detector = CompilerDetector() - detector.detect(self.params['params'].get('c_compiler'), self.params['params'].get('cxx_compiler')) - type_ = detector.type - else: - detector = None + detector.detect(self.params['params'].get('c_compiler'), self.params['params'].get('cxx_compiler')) + type_ = detector.type + else: + detector = None - if type_ == 'msvc': - return MSVCToolchainOptions(self, detector) - else: - return GnuToolchainOptions(self, detector) + if type_ == 'msvc': + return MSVCToolchainOptions(self, detector) + else: + return GnuToolchainOptions(self, detector) - def _print_other_settings(self, compiler): - host = self.host + def _print_other_settings(self, compiler): + host = self.host - emit('USE_LOCAL_TOOLS', 'no' if self.ignore_local_files else 'yes') + emit('USE_LOCAL_TOOLS', 'no' if self.ignore_local_files else 'yes') - ragel = Ragel() - ragel.configure_toolchain(self, compiler) - ragel.print_variables() + ragel = Ragel() + ragel.configure_toolchain(self, compiler) + ragel.print_variables() - perl = Perl() - perl.configure_local() - perl.print_variables('LOCAL_') + perl = Perl() + perl.configure_local() + perl.print_variables('LOCAL_') swiftc = SwiftCompiler(self) swiftc.configure() @@ -631,27 +631,27 @@ class Build(object): if host.is_linux or host.is_macos or host.is_cygwin: if is_negative('USE_ARCADIA_PYTHON'): python = Python(self.tc) - python.configure_posix() - python.print_variables() - + python.configure_posix() + python.print_variables() + cuda = Cuda(self) cuda.print_() CuDNN(cuda).print_() - - print_swig_config() - - if self.ignore_local_files or host.is_windows or is_positive('NO_SVN_DEPENDS'): + + print_swig_config() + + if self.ignore_local_files or host.is_windows or is_positive('NO_SVN_DEPENDS'): emit_with_ignore_comment('SVN_DEPENDS') emit_with_ignore_comment('SVN_DEPENDS_CACHE__NO_UID__') else: - def find_svn(): - for i in range(0, 3): + def find_svn(): + for i in range(0, 3): for path in (['.svn', 'wc.db'], ['.svn', 'entries'], ['.git', 'logs', 'HEAD']): path_parts = [os.pardir] * i + path full_path = os.path.join(self.arcadia.root, *path_parts) - # HACK(somov): No "normpath" here. ymake fails with the "source file name is outside the build tree" error - # when .svn/wc.db found in "trunk" instead of "arcadia". But $ARCADIA_ROOT/../.svn/wc.db is ok. - if os.path.exists(full_path): + # HACK(somov): No "normpath" here. ymake fails with the "source file name is outside the build tree" error + # when .svn/wc.db found in "trunk" instead of "arcadia". But $ARCADIA_ROOT/../.svn/wc.db is ok. + if os.path.exists(full_path): out_path = os.path.join('${ARCADIA_ROOT}', *path_parts) return '${input;hide:"%s"}' % out_path @@ -662,32 +662,32 @@ class Build(object): out_path = os.path.join('${ARCADIA_ROOT}', os.path.relpath(full_path, self.arcadia.root)) return '${input;hide:"%s"}' % out_path - return '' + return '' emit_with_ignore_comment('SVN_DEPENDS', find_svn()) emit_with_ignore_comment('SVN_DEPENDS_CACHE__NO_UID__', '${hide;kv:"disable_cache"}') @staticmethod - def _load_json_from_base64(base64str): - """ - :rtype: dict[str, Any] - """ + def _load_json_from_base64(base64str): + """ + :rtype: dict[str, Any] + """ - def un_unicode(o): + def un_unicode(o): if isinstance(o, six.text_type): return six.ensure_str(o) - if isinstance(o, list): - return [un_unicode(oo) for oo in o] - if isinstance(o, dict): + if isinstance(o, list): + return [un_unicode(oo) for oo in o] + if isinstance(o, dict): return {un_unicode(k): un_unicode(v) for k, v in six.iteritems(o)} - return o + return o - return un_unicode(json.loads(base64.b64decode(base64str))) + return un_unicode(json.loads(base64.b64decode(base64str))) -class YMake(object): - def __init__(self, arcadia): - self.arcadia = arcadia +class YMake(object): + def __init__(self, arcadia): + self.arcadia = arcadia def print_presets(self): presets = opts().presets @@ -716,73 +716,73 @@ class YMake(object): with open(path, 'r') as fin: print(fin.read()) - def print_core_conf(self): + def print_core_conf(self): emit('YMAKE_YNDEXER_IGNORE_BUILD_ROOT', 'yes') print('@import "${CONF_ROOT}/ymake.core.conf"') - def print_settings(self): + def print_settings(self): emit_with_ignore_comment('ARCADIA_ROOT', self.arcadia.root) - @staticmethod + @staticmethod def _find_conf(conf_file): - script_dir = os.path.dirname(__file__) + script_dir = os.path.dirname(__file__) full_path = os.path.join(script_dir, conf_file) - if os.path.exists(full_path): - return full_path - return None + if os.path.exists(full_path): + return full_path + return None def _find_core_conf(self): return self._find_conf('ymake.core.conf') -class System(object): - def __init__(self, platform): - """ - :type platform: Platform - """ - self.platform = platform +class System(object): + def __init__(self, platform): + """ + :type platform: Platform + """ + self.platform = platform - def print_windows_target_const(self): - # TODO(somov): Remove this variables, use generic OS/arch variables in makelists. - emit('WINDOWS', 'yes') - emit('WIN32', 'yes') - if self.platform.is_64_bit == 64: - emit('WIN64', 'yes') + def print_windows_target_const(self): + # TODO(somov): Remove this variables, use generic OS/arch variables in makelists. + emit('WINDOWS', 'yes') + emit('WIN32', 'yes') + if self.platform.is_64_bit == 64: + emit('WIN64', 'yes') - def print_nix_target_const(self): - emit('JAVA_INCLUDE', '-I{0}/include -I{0}/include/{1}'.format('/usr/lib/jvm/default-java', self.platform.os_compat)) + def print_nix_target_const(self): + emit('JAVA_INCLUDE', '-I{0}/include -I{0}/include/{1}'.format('/usr/lib/jvm/default-java', self.platform.os_compat)) - emit('UNIX', 'yes') - emit('REALPRJNAME') - emit('SONAME') + emit('UNIX', 'yes') + emit('REALPRJNAME') + emit('SONAME') - @staticmethod - def print_nix_host_const(): - emit('WRITE_COMMAND', '/bin/echo', '-e') + @staticmethod + def print_nix_host_const(): + emit('WRITE_COMMAND', '/bin/echo', '-e') print(''' -when ($USE_PYTHON) { - C_DEFINES+= -DUSE_PYTHON +when ($USE_PYTHON) { + C_DEFINES+= -DUSE_PYTHON }''') - @staticmethod - def print_linux_const(): + @staticmethod + def print_linux_const(): print(''' -when (($USEMPROF == "yes") || ($USE_MPROF == "yes")) { - C_SYSTEM_LIBRARIES_INTERCEPT+=-ldmalloc -} +when (($USEMPROF == "yes") || ($USE_MPROF == "yes")) { + C_SYSTEM_LIBRARIES_INTERCEPT+=-ldmalloc +} ''') - def print_target_settings(self): - emit('TARGET_PLATFORM', self.platform.os_compat) - emit('HARDWARE_ARCH', '32' if self.platform.is_32_bit else '64') - emit('HARDWARE_TYPE', self.platform.arch) + def print_target_settings(self): + emit('TARGET_PLATFORM', self.platform.os_compat) + emit('HARDWARE_ARCH', '32' if self.platform.is_32_bit else '64') + emit('HARDWARE_TYPE', self.platform.arch) - for variable in self.platform.arch_variables: - emit(variable, 'yes') + for variable in self.platform.arch_variables: + emit(variable, 'yes') - for variable in self.platform.os_variables: - emit(variable, 'yes') + for variable in self.platform.os_variables: + emit(variable, 'yes') if self.platform.is_armv7: emit('ARM7_FLOAT_ABI', self.platform.armv7_float_abi) @@ -790,191 +790,191 @@ when (($USEMPROF == "yes") || ($USE_MPROF == "yes")) { if self.platform.is_android: emit('ANDROID_API', str(self.platform.android_api)) - if self.platform.is_posix: - self.print_nix_target_const() - if self.platform.is_linux: - self.print_linux_const() - elif self.platform.is_windows: - self.print_windows_target_const() - - def print_host_settings(self): - emit('HOST_PLATFORM', self.platform.os_compat) - if not self.platform.is_windows: - self.print_nix_host_const() - - for variable in itertools.chain(self.platform.os_variables, self.platform.arch_variables): - emit('HOST_{var}'.format(var=variable), 'yes') - - -class CompilerDetector(object): - def __init__(self): - self.type = None - self.c_compiler = None - self.cxx_compiler = None - self.version_list = None - - @staticmethod - def preprocess_source(compiler, source): - # noinspection PyBroadException - try: - fd, path = tempfile.mkstemp(suffix='.cpp') - try: - with os.fdopen(fd, 'wb') as output: - output.write(source) - stdout, code = get_stdout_and_code([compiler, '-E', path]) - finally: - os.remove(path) - return stdout, code - - except Exception as e: - logger.debug('Preprocessing failed: %s', e) - return None, None - - @staticmethod - def get_compiler_vars(compiler, names): - prefix = '____YA_VAR_' - source = '\n'.join(['{prefix}{name}={name}\n'.format(prefix=prefix, name=n) for n in names]) - - # Некоторые препроцессоры возвращают ненулевой код возврата. Поэтому его проверять нельзя. - # Мы можем только удостовериться после разбора stdout, что в нём - # присутствовала хотя бы одна подставленная переменная. - # TODO(somov): Исследовать, можно ли проверять ограниченный набор кодов возврата. - stdout, _ = CompilerDetector.preprocess_source(compiler, source) - - if stdout is None: - return None - - vars_ = {} - for line in stdout.split('\n'): - parts = line.split('=', 1) - if len(parts) == 2 and parts[0].startswith(prefix): - name, value = parts[0][len(prefix):], parts[1] - if value == name: - continue # Preprocessor variable was not substituted - vars_[name] = value - - return vars_ - - def detect(self, c_compiler=None, cxx_compiler=None): - c_compiler = c_compiler or os.environ.get('CC') - cxx_compiler = cxx_compiler or os.environ.get('CXX') or c_compiler - c_compiler = c_compiler or cxx_compiler - - logger.debug('e=%s', os.environ) - if c_compiler is None: - raise ConfigureError('Custom compiler was requested but not specified') - - c_compiler_path = which(c_compiler) - - clang_vars = ['__clang_major__', '__clang_minor__', '__clang_patchlevel__'] - gcc_vars = ['__GNUC__', '__GNUC_MINOR__', '__GNUC_PATCHLEVEL__'] - msvc_vars = ['_MSC_VER'] - apple_var = '__apple_build_version__' - - compiler_vars = self.get_compiler_vars(c_compiler_path, clang_vars + [apple_var] + gcc_vars + msvc_vars) - - if not compiler_vars: - raise ConfigureError('Could not determine custom compiler version: {}'.format(c_compiler)) - - def version(version_names): - def iter_version(): - for name in version_names: - yield int(compiler_vars[name]) - - # noinspection PyBroadException - try: - return list(iter_version()) - except Exception: - return None - - clang_version = version(clang_vars) - apple_build = apple_var in compiler_vars - # TODO(somov): Учитывать номера версий сборки Apple компилятора Clang. - _ = apple_build - gcc_version = version(gcc_vars) - msvc_version = version(msvc_vars) - - if clang_version: - logger.debug('Detected Clang version %s', clang_version) - self.type = 'clang' - elif gcc_version: - logger.debug('Detected GCC version %s', gcc_version) - # TODO(somov): Переименовать в gcc. - self.type = 'gnu' - elif msvc_version: - logger.debug('Detected MSVC version %s', msvc_version) - self.type = 'msvc' - else: - raise ConfigureError('Could not determine custom compiler type: {}'.format(c_compiler)) - - self.version_list = clang_version or gcc_version or msvc_version - - self.c_compiler = c_compiler_path - self.cxx_compiler = cxx_compiler and which(cxx_compiler) or c_compiler_path - - -class ToolchainOptions(object): - def __init__(self, build, detector): - """ - :type build: Build - """ - self.host = build.host - self.target = build.target - - tc_json = build.params - - logger.debug('Toolchain host %s', self.host) - logger.debug('Toolchain target %s', self.target) - logger.debug('Toolchain json %s', DebugString(lambda: json.dumps(tc_json, indent=4, sort_keys=True))) - - self.params = tc_json['params'] - self._name = tc_json.get('name', 'theyknow') - - if detector: - self.type = detector.type + if self.platform.is_posix: + self.print_nix_target_const() + if self.platform.is_linux: + self.print_linux_const() + elif self.platform.is_windows: + self.print_windows_target_const() + + def print_host_settings(self): + emit('HOST_PLATFORM', self.platform.os_compat) + if not self.platform.is_windows: + self.print_nix_host_const() + + for variable in itertools.chain(self.platform.os_variables, self.platform.arch_variables): + emit('HOST_{var}'.format(var=variable), 'yes') + + +class CompilerDetector(object): + def __init__(self): + self.type = None + self.c_compiler = None + self.cxx_compiler = None + self.version_list = None + + @staticmethod + def preprocess_source(compiler, source): + # noinspection PyBroadException + try: + fd, path = tempfile.mkstemp(suffix='.cpp') + try: + with os.fdopen(fd, 'wb') as output: + output.write(source) + stdout, code = get_stdout_and_code([compiler, '-E', path]) + finally: + os.remove(path) + return stdout, code + + except Exception as e: + logger.debug('Preprocessing failed: %s', e) + return None, None + + @staticmethod + def get_compiler_vars(compiler, names): + prefix = '____YA_VAR_' + source = '\n'.join(['{prefix}{name}={name}\n'.format(prefix=prefix, name=n) for n in names]) + + # Некоторые препроцессоры возвращают ненулевой код возврата. Поэтому его проверять нельзя. + # Мы можем только удостовериться после разбора stdout, что в нём + # присутствовала хотя бы одна подставленная переменная. + # TODO(somov): Исследовать, можно ли проверять ограниченный набор кодов возврата. + stdout, _ = CompilerDetector.preprocess_source(compiler, source) + + if stdout is None: + return None + + vars_ = {} + for line in stdout.split('\n'): + parts = line.split('=', 1) + if len(parts) == 2 and parts[0].startswith(prefix): + name, value = parts[0][len(prefix):], parts[1] + if value == name: + continue # Preprocessor variable was not substituted + vars_[name] = value + + return vars_ + + def detect(self, c_compiler=None, cxx_compiler=None): + c_compiler = c_compiler or os.environ.get('CC') + cxx_compiler = cxx_compiler or os.environ.get('CXX') or c_compiler + c_compiler = c_compiler or cxx_compiler + + logger.debug('e=%s', os.environ) + if c_compiler is None: + raise ConfigureError('Custom compiler was requested but not specified') + + c_compiler_path = which(c_compiler) + + clang_vars = ['__clang_major__', '__clang_minor__', '__clang_patchlevel__'] + gcc_vars = ['__GNUC__', '__GNUC_MINOR__', '__GNUC_PATCHLEVEL__'] + msvc_vars = ['_MSC_VER'] + apple_var = '__apple_build_version__' + + compiler_vars = self.get_compiler_vars(c_compiler_path, clang_vars + [apple_var] + gcc_vars + msvc_vars) + + if not compiler_vars: + raise ConfigureError('Could not determine custom compiler version: {}'.format(c_compiler)) + + def version(version_names): + def iter_version(): + for name in version_names: + yield int(compiler_vars[name]) + + # noinspection PyBroadException + try: + return list(iter_version()) + except Exception: + return None + + clang_version = version(clang_vars) + apple_build = apple_var in compiler_vars + # TODO(somov): Учитывать номера версий сборки Apple компилятора Clang. + _ = apple_build + gcc_version = version(gcc_vars) + msvc_version = version(msvc_vars) + + if clang_version: + logger.debug('Detected Clang version %s', clang_version) + self.type = 'clang' + elif gcc_version: + logger.debug('Detected GCC version %s', gcc_version) + # TODO(somov): Переименовать в gcc. + self.type = 'gnu' + elif msvc_version: + logger.debug('Detected MSVC version %s', msvc_version) + self.type = 'msvc' + else: + raise ConfigureError('Could not determine custom compiler type: {}'.format(c_compiler)) + + self.version_list = clang_version or gcc_version or msvc_version + + self.c_compiler = c_compiler_path + self.cxx_compiler = cxx_compiler and which(cxx_compiler) or c_compiler_path + + +class ToolchainOptions(object): + def __init__(self, build, detector): + """ + :type build: Build + """ + self.host = build.host + self.target = build.target + + tc_json = build.params + + logger.debug('Toolchain host %s', self.host) + logger.debug('Toolchain target %s', self.target) + logger.debug('Toolchain json %s', DebugString(lambda: json.dumps(tc_json, indent=4, sort_keys=True))) + + self.params = tc_json['params'] + self._name = tc_json.get('name', 'theyknow') + + if detector: + self.type = detector.type self.from_arcadia = False - self.c_compiler = detector.c_compiler - self.cxx_compiler = detector.cxx_compiler - self.compiler_version_list = detector.version_list + self.c_compiler = detector.c_compiler + self.cxx_compiler = detector.cxx_compiler + self.compiler_version_list = detector.version_list self.compiler_version = '.'.join(map(lambda part: six.ensure_str(str(part)), self.compiler_version_list)) else: - self.type = self.params['type'] + self.type = self.params['type'] self.from_arcadia = True - self.c_compiler = self.params['c_compiler'] - self.cxx_compiler = self.params['cxx_compiler'] + self.c_compiler = self.params['c_compiler'] + self.cxx_compiler = self.params['cxx_compiler'] - # TODO(somov): Требовать номер версии всегда. - self.compiler_version = self.params.get('gcc_version') or self.params.get('version') or '0' + # TODO(somov): Требовать номер версии всегда. + self.compiler_version = self.params.get('gcc_version') or self.params.get('version') or '0' self.compiler_version_list = list(map(int, self.compiler_version.split('.'))) - # TODO(somov): Посмотреть, можно ли спрятать это поле. - self.name_marker = '$(%s)' % self.params.get('match_root', self._name.upper()) - - self.arch_opt = self.params.get('arch_opt', []) + # TODO(somov): Посмотреть, можно ли спрятать это поле. + self.name_marker = '$(%s)' % self.params.get('match_root', self._name.upper()) + + self.arch_opt = self.params.get('arch_opt', []) self.triplet_opt = self.params.get('triplet_opt', {}) - self.target_opt = self.params.get('target_opt', []) + self.target_opt = self.params.get('target_opt', []) - # TODO(somov): Убрать чтение настройки из os.environ. - self.werror_mode = preset('WERROR_MODE') or os.environ.get('WERROR_MODE') or self.params.get('werror_mode') or 'compiler_specific' + # TODO(somov): Убрать чтение настройки из os.environ. + self.werror_mode = preset('WERROR_MODE') or os.environ.get('WERROR_MODE') or self.params.get('werror_mode') or 'compiler_specific' # default C++ standard is set here, some older toolchains might need to redefine it in ya.conf.json self.cxx_std = self.params.get('cxx_std', 'c++20') - self._env = tc_json.get('env', {}) + self._env = tc_json.get('env', {}) self.android_ndk_version = self.params.get('android_ndk_version', None) - logger.debug('c_compiler=%s', self.c_compiler) - logger.debug('cxx_compiler=%s', self.cxx_compiler) + logger.debug('c_compiler=%s', self.c_compiler) + logger.debug('cxx_compiler=%s', self.cxx_compiler) self.compiler_platform_projects = self.target.find_in_dict(self.params.get('platform'), []) - def version_at_least(self, *args): - return args <= tuple(self.compiler_version_list) - + def version_at_least(self, *args): + return args <= tuple(self.compiler_version_list) + def version_exactly(self, *args): if not args or len(args) > len(self.compiler_version_list): return False @@ -983,14 +983,14 @@ class ToolchainOptions(object): return False return True - @property - def is_gcc(self): - return self.type == 'gnu' - - @property - def is_clang(self): + @property + def is_gcc(self): + return self.type == 'gnu' + + @property + def is_clang(self): return self.type in ('clang', 'xcode') - + @property def is_xcode(self): return self.type == 'xcode' @@ -999,44 +999,44 @@ class ToolchainOptions(object): def is_from_arcadia(self): return self.from_arcadia - def get_env(self, convert_list=None): - convert_list = convert_list or (lambda x: x) - r = {} + def get_env(self, convert_list=None): + convert_list = convert_list or (lambda x: x) + r = {} for k, v in six.iteritems(self._env): - if isinstance(v, str): - r[k] = v - elif isinstance(v, list): - r[k] = convert_list(v) - else: - logger.debug('Unexpected values in environment: %s', self._env) - raise ConfigureError('Internal error') - return r - - -class GnuToolchainOptions(ToolchainOptions): - def __init__(self, build, detector): - super(GnuToolchainOptions, self).__init__(build, detector) - - self.ar = self.params.get('ar') - self.ar_plugin = self.params.get('ar_plugin') - self.inplace_tools = self.params.get('inplace_tools', False) + if isinstance(v, str): + r[k] = v + elif isinstance(v, list): + r[k] = convert_list(v) + else: + logger.debug('Unexpected values in environment: %s', self._env) + raise ConfigureError('Internal error') + return r + + +class GnuToolchainOptions(ToolchainOptions): + def __init__(self, build, detector): + super(GnuToolchainOptions, self).__init__(build, detector) + + self.ar = self.params.get('ar') + self.ar_plugin = self.params.get('ar_plugin') + self.inplace_tools = self.params.get('inplace_tools', False) self.strip = self.params.get('strip') self.objcopy = self.params.get('objcopy') self.isystem = self.params.get('isystem') - - self.dwarf_tool = self.target.find_in_dict(self.params.get('dwarf_tool')) - - # TODO(somov): Унифицировать формат sys_lib - self.sys_lib = self.params.get('sys_lib', {}) - if isinstance(self.sys_lib, dict): - self.sys_lib = self.target.find_in_dict(self.sys_lib, []) - + + self.dwarf_tool = self.target.find_in_dict(self.params.get('dwarf_tool')) + + # TODO(somov): Унифицировать формат sys_lib + self.sys_lib = self.params.get('sys_lib', {}) + if isinstance(self.sys_lib, dict): + self.sys_lib = self.target.find_in_dict(self.sys_lib, []) + self.os_sdk = preset('OS_SDK') or self._default_os_sdk() self.os_sdk_local = self.os_sdk == 'local' def _default_os_sdk(self): if self.target.is_linux: - if self.target.is_armv8: + if self.target.is_armv8: return 'ubuntu-16' if self.target.is_armv7 and self.target.armv7_float_abi == 'hard': @@ -1046,46 +1046,46 @@ class GnuToolchainOptions(ToolchainOptions): return 'ubuntu-18' if self.target.is_powerpc: - return 'ubuntu-14' - + return 'ubuntu-14' + # Default OS SDK for Linux builds - return 'ubuntu-14' - - -class Toolchain(object): - def __init__(self, tc, build): - """ - :type tc: ToolchainOptions - :type build: Build - """ - self.tc = tc - self.build = build - self.platform_projects = self.tc.compiler_platform_projects - - def print_toolchain(self): - if self.platform_projects: - emit('COMPILER_PLATFORM', list(unique(self.platform_projects))) - - -class Compiler(object): - def __init__(self, tc, compiler_variable): - self.compiler_variable = compiler_variable - self.tc = tc - - def print_compiler(self): - # CLANG and CLANG_VER variables - emit(self.compiler_variable, 'yes') - emit('{}_VER'.format(self.compiler_variable), self.tc.compiler_version) + return 'ubuntu-14' + + +class Toolchain(object): + def __init__(self, tc, build): + """ + :type tc: ToolchainOptions + :type build: Build + """ + self.tc = tc + self.build = build + self.platform_projects = self.tc.compiler_platform_projects + + def print_toolchain(self): + if self.platform_projects: + emit('COMPILER_PLATFORM', list(unique(self.platform_projects))) + + +class Compiler(object): + def __init__(self, tc, compiler_variable): + self.compiler_variable = compiler_variable + self.tc = tc + + def print_compiler(self): + # CLANG and CLANG_VER variables + emit(self.compiler_variable, 'yes') + emit('{}_VER'.format(self.compiler_variable), self.tc.compiler_version) if self.tc.is_xcode: emit('XCODE', 'yes') -class GnuToolchain(Toolchain): - def __init__(self, tc, build): - """ - :type tc: GnuToolchainOptions - :type build: Build - """ +class GnuToolchain(Toolchain): + def __init__(self, tc, build): + """ + :type tc: GnuToolchainOptions + :type build: Build + """ def get_os_sdk(target): sdk_native_version = 10.11 if not preset('EXPERIMENTAL_MACOS_M1_SUPPORT') else '11.1' @@ -1095,18 +1095,18 @@ class GnuToolchain(Toolchain): return '$YOCTO_SDK_RESOURCE_GLOBAL' return '$OS_SDK_ROOT_RESOURCE_GLOBAL' - super(GnuToolchain, self).__init__(tc, build) - self.tc = tc - - host = build.host - target = build.target - - self.c_flags_platform = list(tc.target_opt) + super(GnuToolchain, self).__init__(tc, build) + self.tc = tc + + host = build.host + target = build.target + + self.c_flags_platform = list(tc.target_opt) self.default_os_sdk_root = get_os_sdk(target) - self.env = self.tc.get_env() - + self.env = self.tc.get_env() + self.env_go = {} if self.tc.is_clang: self.env_go = {'PATH': ['{}/bin'.format(self.tc.name_marker)]} @@ -1125,10 +1125,10 @@ class GnuToolchain(Toolchain): self.swift_flags_platform = [] self.swift_lib_path = None - if self.tc.is_from_arcadia: - for lib_path in build.host.library_path_variables: - self.env.setdefault(lib_path, []).append('{}/lib'.format(self.tc.name_marker)) - + if self.tc.is_from_arcadia: + for lib_path in build.host.library_path_variables: + self.env.setdefault(lib_path, []).append('{}/lib'.format(self.tc.name_marker)) + macos_version_min = '10.11' macos_arm64_version_min = '11.0' ios_version_min = '11.0' @@ -1154,7 +1154,7 @@ class GnuToolchain(Toolchain): (host.is_macos and not target.is_iossim and target.is_ios and (target.is_armv8 or target.is_armv7), '$SWIFT_XCODE_TOOLCHAIN_ROOT_RESOURCE_GLOBAL/usr/lib/swift/iphoneos'), ]) - if self.tc.is_clang: + if self.tc.is_clang: target_triple = self.tc.triplet_opt.get(target.arch, None) if not target_triple: target_triple = select(default=None, selectors=[ @@ -1175,15 +1175,15 @@ class GnuToolchain(Toolchain): (target.is_android and target.is_armv7, 'armv7a-linux-androideabi'), (target.is_android and target.is_armv8, 'aarch64-linux-android'), ]) - + if target.is_android: # Android NDK allows specification of API level in target triple, e.g.: # armv7a-linux-androideabi16, aarch64-linux-android21 target_triple += str(target.android_api) - if target_triple: - self.c_flags_platform.append('--target={}'.format(target_triple)) - + if target_triple: + self.c_flags_platform.append('--target={}'.format(target_triple)) + if self.tc.isystem: for root in list(self.tc.isystem): self.c_flags_platform.extend(['-isystem', root]) @@ -1216,23 +1216,23 @@ class GnuToolchain(Toolchain): # However, Arcadia requires char to be signed self.c_flags_platform.append('-fsigned-char') - if self.tc.is_clang or self.tc.is_gcc and self.tc.version_at_least(8, 2): - target_flags = select(default=[], selectors=[ + if self.tc.is_clang or self.tc.is_gcc and self.tc.version_at_least(8, 2): + target_flags = select(default=[], selectors=[ (target.is_linux and target.is_power8le, ['-mcpu=power8', '-mtune=power8', '-maltivec']), (target.is_linux and target.is_power9le, ['-mcpu=power9', '-mtune=power9', '-maltivec']), - (target.is_linux and target.is_armv8, ['-march=armv8a']), + (target.is_linux and target.is_armv8, ['-march=armv8a']), (target.is_macos_arm64, ['-mmacosx-version-min={}'.format(macos_arm64_version_min)]), (target.is_macos, ['-mmacosx-version-min={}'.format(macos_version_min)]), (target.is_ios and not target.is_iossim, ['-mios-version-min={}'.format(ios_version_min)]), (target.is_iossim, ['-mios-simulator-version-min={}'.format(ios_version_min)]), - (target.is_android and target.is_armv7, ['-march=armv7-a', '-mfloat-abi=softfp']), + (target.is_android and target.is_armv7, ['-march=armv7-a', '-mfloat-abi=softfp']), (target.is_android and target.is_armv8, ['-march=armv8-a']), (target.is_yocto and target.is_armv7, ['-march=armv7-a', '-mfpu=neon', '-mfloat-abi=hard', '-mcpu=cortex-a9', '-O1']) - ]) - - if target_flags: - self.c_flags_platform.extend(target_flags) - + ]) + + if target_flags: + self.c_flags_platform.extend(target_flags) + if target.is_ios: self.c_flags_platform.append('-D__IOS__=1') @@ -1244,24 +1244,24 @@ class GnuToolchain(Toolchain): if target.is_macos: self.setup_sdk(project='build/platform/macos_sdk', var='${MACOS_SDK_RESOURCE_GLOBAL}') self.platform_projects.append('build/platform/macos_system_stl') - - if not self.tc.inplace_tools: - self.setup_tools(project='build/platform/cctools', var='${CCTOOLS_ROOT_RESOURCE_GLOBAL}', bin='bin', ldlibs=None) - + + if not self.tc.inplace_tools: + self.setup_tools(project='build/platform/cctools', var='${CCTOOLS_ROOT_RESOURCE_GLOBAL}', bin='bin', ldlibs=None) + if target.is_linux: if not tc.os_sdk_local: self.setup_sdk(project='build/platform/linux_sdk', var='$OS_SDK_ROOT_RESOURCE_GLOBAL') - + if target.is_x86_64: - if host.is_linux and not self.tc.is_gcc: + if host.is_linux and not self.tc.is_gcc: self.setup_tools(project='build/platform/linux_sdk', var='$OS_SDK_ROOT_RESOURCE_GLOBAL', bin='usr/bin', ldlibs='usr/lib/x86_64-linux-gnu') elif host.is_macos: self.setup_tools(project='build/platform/binutils', var='$BINUTILS_ROOT_RESOURCE_GLOBAL', bin='x86_64-linux-gnu/bin', ldlibs=None) elif target.is_powerpc: self.setup_tools(project='build/platform/linux_sdk', var='$OS_SDK_ROOT_RESOURCE_GLOBAL', bin='usr/bin', ldlibs='usr/x86_64-linux-gnu/powerpc64le-linux-gnu/lib') - elif target.is_armv8: - self.setup_tools(project='build/platform/linux_sdk', var='$OS_SDK_ROOT_RESOURCE_GLOBAL', bin='usr/bin', ldlibs='usr/lib/x86_64-linux-gnu') - + elif target.is_armv8: + self.setup_tools(project='build/platform/linux_sdk', var='$OS_SDK_ROOT_RESOURCE_GLOBAL', bin='usr/bin', ldlibs='usr/lib/x86_64-linux-gnu') + if target.is_yocto: self.setup_sdk(project='build/platform/yocto_sdk/yocto_sdk', var='${YOCTO_SDK_ROOT_RESOURCE_GLOBAL}') elif self.tc.params.get('local'): @@ -1281,25 +1281,25 @@ class GnuToolchain(Toolchain): elif target.is_macos: self.env.setdefault('SDKROOT', subprocess.check_output(['xcrun', '-sdk', 'macosx', '--show-sdk-path']).strip()) - def setup_sdk(self, project, var): - self.platform_projects.append(project) - self.c_flags_platform.append('--sysroot={}'.format(var)) + def setup_sdk(self, project, var): + self.platform_projects.append(project) + self.c_flags_platform.append('--sysroot={}'.format(var)) self.swift_flags_platform += ['-sdk', var] - - # noinspection PyShadowingBuiltins - def setup_tools(self, project, var, bin, ldlibs): - self.platform_projects.append(project) - self.c_flags_platform.append('-B{}/{}'.format(var, bin)) - if ldlibs: + + # noinspection PyShadowingBuiltins + def setup_tools(self, project, var, bin, ldlibs): + self.platform_projects.append(project) + self.c_flags_platform.append('-B{}/{}'.format(var, bin)) + if ldlibs: for lib_path in self.build.host.library_path_variables: - self.env.setdefault(lib_path, []).append('{}/{}'.format(var, ldlibs)) - - def print_toolchain(self): - super(GnuToolchain, self).print_toolchain() - - emit('TOOLCHAIN_ENV', format_env(self.env, list_separator=':')) + self.env.setdefault(lib_path, []).append('{}/{}'.format(var, ldlibs)) + + def print_toolchain(self): + super(GnuToolchain, self).print_toolchain() + + emit('TOOLCHAIN_ENV', format_env(self.env, list_separator=':')) emit('_GO_TOOLCHAIN_ENV_PATH', format_env(self.env_go, list_separator=':')) - emit('C_FLAGS_PLATFORM', self.c_flags_platform) + emit('C_FLAGS_PLATFORM', self.c_flags_platform) emit('SWIFT_FLAGS_PLATFORM', self.swift_flags_platform) emit('SWIFT_LD_FLAGS', '-L{}'.format(self.swift_lib_path) if self.swift_lib_path else '') @@ -1307,22 +1307,22 @@ class GnuToolchain(Toolchain): if preset('OS_SDK') is None: emit('OS_SDK', self.tc.os_sdk) emit('OS_SDK_ROOT', None if self.tc.os_sdk_local else self.default_os_sdk_root) - - -class GnuCompiler(Compiler): - gcc_fstack = ['-fstack-protector'] - - def __init__(self, tc, build): - """ - :type tc: GnuToolchainOptions - :type build: Build - """ - compiler_variable = 'CLANG' if tc.is_clang else 'GCC' - super(GnuCompiler, self).__init__(tc, compiler_variable) - - self.build = build - self.host = self.build.host - self.target = self.build.target + + +class GnuCompiler(Compiler): + gcc_fstack = ['-fstack-protector'] + + def __init__(self, tc, build): + """ + :type tc: GnuToolchainOptions + :type build: Build + """ + compiler_variable = 'CLANG' if tc.is_clang else 'GCC' + super(GnuCompiler, self).__init__(tc, compiler_variable) + + self.build = build + self.host = self.build.host + self.target = self.build.target self.tc = tc self.c_foptions = [ @@ -1381,48 +1381,48 @@ class GnuCompiler(Compiler): '-D_LARGEFILE_SOURCE', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', ]) - if not self.target.is_android: - # There is no usable _FILE_OFFSET_BITS=64 support in Androids until API 21. And it's incomplete until at least API 24. - # https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md + if not self.target.is_android: + # There is no usable _FILE_OFFSET_BITS=64 support in Androids until API 21. And it's incomplete until at least API 24. + # https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md # Arcadia have API 16 for 32-bit Androids. - self.c_defines.append('-D_FILE_OFFSET_BITS=64') - + self.c_defines.append('-D_FILE_OFFSET_BITS=64') + if self.target.is_linux or self.target.is_android or self.target.is_cygwin: - self.c_defines.append('-D_GNU_SOURCE') + self.c_defines.append('-D_GNU_SOURCE') if self.tc.is_clang and self.target.is_linux and self.target.is_x86_64: self.c_defines.append('-D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE') - if self.target.is_ios: + if self.target.is_ios: self.c_defines.extend(['-D_XOPEN_SOURCE', '-D_DARWIN_C_SOURCE']) if preset('MAPSMOBI_BUILD_TARGET') and self.target.is_arm: self.c_foptions.append('-fembed-bitcode') - - self.extra_compile_opts = [] + + self.extra_compile_opts = [] self.c_flags = ['$CL_DEBUG_INFO', '$CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__'] self.c_flags += self.tc.arch_opt + ['-pipe'] - self.sfdl_flags = ['-E', '-C', '-x', 'c++'] - - if self.target.is_x86: - self.c_flags.append('-m32') - if self.target.is_x86_64: - self.c_flags.append('-m64') + self.sfdl_flags = ['-E', '-C', '-x', 'c++'] + if self.target.is_x86: + self.c_flags.append('-m32') + if self.target.is_x86_64: + self.c_flags.append('-m64') + self.debug_info_flags = ['-g'] if self.target.is_linux: self.debug_info_flags.append('-ggnu-pubnames') - self.cross_suffix = '' if is_positive('FORCE_NO_PIC') else '.pic' - - self.optimize = None + self.cross_suffix = '' if is_positive('FORCE_NO_PIC') else '.pic' - self.configure_build_type() + self.optimize = None - if self.tc.is_clang: - self.sfdl_flags.append('-Qunused-arguments') + self.configure_build_type() + if self.tc.is_clang: + self.sfdl_flags.append('-Qunused-arguments') + self.cxx_warnings += [ '-Wimport-preprocessor-directive-pedantic', '-Wno-undefined-var-template', @@ -1437,7 +1437,7 @@ class GnuCompiler(Compiler): '-Wno-ambiguous-reversed-operator', '-Wno-deprecated-volatile', ] - + self.c_warnings += [ '-Wno-implicit-const-int-float-conversion', # For nvcc to accept the above. @@ -1447,24 +1447,24 @@ class GnuCompiler(Compiler): elif self.tc.is_gcc: self.c_foptions.append('-fno-delete-null-pointer-checks') self.c_foptions.append('-fabi-version=8') - + # Split all functions and data into separate sections for DCE and ICF linker passes # NOTE: iOS build uses -fembed-bitcode which conflicts with -ffunction-sections (only relevant for ELF targets) if not self.target.is_ios: self.c_foptions.extend(['-ffunction-sections', '-fdata-sections']) - def configure_build_type(self): - if self.build.is_valgrind: - self.c_defines.append('-DWITH_VALGRIND=1') + def configure_build_type(self): + if self.build.is_valgrind: + self.c_defines.append('-DWITH_VALGRIND=1') - if self.build.is_debug: + if self.build.is_debug: self.c_foptions.append('$FSTACK') - if self.build.is_fast_debug: - self.c_flags.append('-Og') - - if self.build.is_release: - self.c_flags.append('$OPTIMIZE') + if self.build.is_fast_debug: + self.c_flags.append('-Og') + + if self.build.is_release: + self.c_flags.append('$OPTIMIZE') if self.build.is_size_optimized: # -Oz is clang's more size-aggressive version of -Os # For ARM specifically, clang -Oz is on par with gcc -Os: @@ -1480,72 +1480,72 @@ class GnuCompiler(Compiler): else: self.optimize = '-O3' - if self.build.with_ndebug: - self.c_defines.append('-DNDEBUG') - else: - self.c_defines.append('-UNDEBUG') + if self.build.with_ndebug: + self.c_defines.append('-DNDEBUG') + else: + self.c_defines.append('-UNDEBUG') - if self.build.profiler_type in (Profiler.Generic, Profiler.GProf): + if self.build.profiler_type in (Profiler.Generic, Profiler.GProf): self.c_foptions.append('-fno-omit-frame-pointer') - if self.build.profiler_type == Profiler.GProf: - self.c_flags.append('-pg') + if self.build.profiler_type == Profiler.GProf: + self.c_flags.append('-pg') - def print_compiler(self): - super(GnuCompiler, self).print_compiler() + def print_compiler(self): + super(GnuCompiler, self).print_compiler() - emit('C_COMPILER_UNQUOTED', self.tc.c_compiler) - emit('C_COMPILER', '${quo:C_COMPILER_UNQUOTED}') - emit('OPTIMIZE', self.optimize) - emit('WERROR_MODE', self.tc.werror_mode) - emit('FSTACK', self.gcc_fstack) + emit('C_COMPILER_UNQUOTED', self.tc.c_compiler) + emit('C_COMPILER', '${quo:C_COMPILER_UNQUOTED}') + emit('OPTIMIZE', self.optimize) + emit('WERROR_MODE', self.tc.werror_mode) + emit('FSTACK', self.gcc_fstack) append('C_DEFINES', self.c_defines) - emit('DUMP_DEPS') - emit('GCC_PREPROCESSOR_OPTS', '$DUMP_DEPS', '$C_DEFINES') + emit('DUMP_DEPS') + emit('GCC_PREPROCESSOR_OPTS', '$DUMP_DEPS', '$C_DEFINES') append('C_WARNING_OPTS', self.c_warnings) append('CXX_WARNING_OPTS', self.cxx_warnings) # PIE is only valid for executables, while PIC implies a shared library # `-pie` with a shared library is either ignored or fails to link - emit_big(''' + emit_big(''' when ($PIC == "yes") { CFLAGS+=-fPIC LDFLAGS+=-fPIC - } + } elsewhen ($PIE == "yes") { CFLAGS+=-fPIE LDFLAGS+=-fPIE -pie - }''') + }''') append('CFLAGS', self.c_flags, '$DEBUG_INFO_FLAGS', self.c_foptions, '$C_WARNING_OPTS', '$GCC_PREPROCESSOR_OPTS', '$USER_CFLAGS', '$USER_CFLAGS_GLOBAL') append('CXXFLAGS', '$CFLAGS', '-std=' + self.tc.cxx_std, '$CXX_WARNING_OPTS', '$USER_CXXFLAGS', '$USER_CXXFLAGS_GLOBAL') append('CONLYFLAGS', '$USER_CONLYFLAGS', '$USER_CONLYFLAGS_GLOBAL') - emit('CXX_COMPILER_UNQUOTED', self.tc.cxx_compiler) - emit('CXX_COMPILER', '${quo:CXX_COMPILER_UNQUOTED}') - emit('NOGCCSTACKCHECK', 'yes') - emit('SFDL_FLAG', self.sfdl_flags, '-o', '$SFDL_TMP_OUT') + emit('CXX_COMPILER_UNQUOTED', self.tc.cxx_compiler) + emit('CXX_COMPILER', '${quo:CXX_COMPILER_UNQUOTED}') + emit('NOGCCSTACKCHECK', 'yes') + emit('SFDL_FLAG', self.sfdl_flags, '-o', '$SFDL_TMP_OUT') emit('WERROR_FLAG', '-Werror') - # TODO(somov): Убрать чтение настройки из os.environ - emit('USE_ARC_PROFILE', 'yes' if preset('USE_ARC_PROFILE') or os.environ.get('USE_ARC_PROFILE') else 'no') + # TODO(somov): Убрать чтение настройки из os.environ + emit('USE_ARC_PROFILE', 'yes' if preset('USE_ARC_PROFILE') or os.environ.get('USE_ARC_PROFILE') else 'no') emit('DEBUG_INFO_FLAGS', self.debug_info_flags) - emit_big(''' + emit_big(''' when ($NO_WSHADOW == "yes") { C_WARNING_OPTS += -Wno-shadow } - when ($NO_COMPILER_WARNINGS == "yes") { + when ($NO_COMPILER_WARNINGS == "yes") { C_WARNING_OPTS = -w CXX_WARNING_OPTS = -Wno-everything - } - when ($NO_OPTIMIZE == "yes") { + } + when ($NO_OPTIMIZE == "yes") { OPTIMIZE = -O0 - } - when ($SAVE_TEMPS == "yes") { - CXXFLAGS += -save-temps - } - when ($NOGCCSTACKCHECK != "yes") { + } + when ($SAVE_TEMPS == "yes") { + CXXFLAGS += -save-temps + } + when ($NOGCCSTACKCHECK != "yes") { FSTACK += -fstack-check - }''') + }''') c_builtins = [ "-Wno-builtin-macro-redefined", @@ -1633,25 +1633,25 @@ class GnuCompiler(Compiler): yasm_debug_light=yasm_debug_map[0], # build_root substitution only macro=' '.join(c_builtins))) - # TODO(somov): Check whether this specific architecture is needed. - if self.target.arch == 'i386': - append('CFLAGS', '-march=pentiumpro') - append('CFLAGS', '-mtune=pentiumpro') - + # TODO(somov): Check whether this specific architecture is needed. + if self.target.arch == 'i386': + append('CFLAGS', '-march=pentiumpro') + append('CFLAGS', '-mtune=pentiumpro') + append('BC_CFLAGS', '$CFLAGS') append('BC_CXXFLAGS', '$CXXFLAGS') - append('C_DEFINES', '-D__LONG_LONG_SUPPORTED') + append('C_DEFINES', '-D__LONG_LONG_SUPPORTED') emit('OBJ_CROSS_SUF', '$OBJ_SUF%s' % self.cross_suffix) emit('OBJECT_SUF', '$OBJ_SUF%s.o' % self.cross_suffix) emit('GCC_COMPILE_FLAGS', '$EXTRA_C_FLAGS -c -o $_COMPILE_OUTPUTS', '${pre=-I:_C__INCLUDE}') - - if is_positive('DUMP_COMPILER_DEPS'): + + if is_positive('DUMP_COMPILER_DEPS'): emit('DUMP_DEPS', '-MD', '${output;hide;noauto;suf=${OBJ_SUF}.o.d:SRC}') - elif is_positive('DUMP_COMPILER_DEPS_FAST'): + elif is_positive('DUMP_COMPILER_DEPS_FAST'): emit('DUMP_DEPS', '-E', '-M', '-MF', '${output;noauto;suf=${OBJ_SUF}.o.d:SRC}') - + compiler_time_trace_requested = is_positive('TIME_TRACE') or is_positive('COMPILER_TIME_TRACE') compiler_supports_time_trace = self.tc.is_clang and self.tc.version_at_least(9) if compiler_time_trace_requested and compiler_supports_time_trace: @@ -1662,7 +1662,7 @@ class GnuCompiler(Compiler): emit('COMPILER_TIME_TRACE_FLAGS') emit('COMPILER_TIME_TRACE_POSTPROCESS') - append('EXTRA_OUTPUT') + append('EXTRA_OUTPUT') style = ['${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"p CC"} ${hide;kv:"pc green"}'] cxx_args = [ @@ -1742,18 +1742,18 @@ class SwiftCompiler(object): emit('SWIFT_COMPILER', self.compiler or '') -class Linker(object): +class Linker(object): BFD = 'bfd' LLD = 'lld' GOLD = 'gold' - def __init__(self, tc, build): - """ - :type tc: ToolchainOptions - :type build: Build - """ - self.tc = tc - self.build = build + def __init__(self, tc, build): + """ + :type tc: ToolchainOptions + :type build: Build + """ + self.tc = tc + self.build = build self.type = self._get_default_linker_type() def _get_default_linker_type(self): @@ -1772,56 +1772,56 @@ class Linker(object): return Linker.LLD else: # GCC et al. - - if self.tc.is_gcc and is_positive('MUSL'): - # See MUSL_BFD comment below - return Linker.BFD - + + if self.tc.is_gcc and is_positive('MUSL'): + # See MUSL_BFD comment below + return Linker.BFD + return Linker.GOLD - + # There is no linker choice on Darwin (ld64) or Windows (link.exe) return None - def print_linker(self): - self._print_linker_selector() + def print_linker(self): + self._print_linker_selector() - def _print_linker_selector(self): + def _print_linker_selector(self): # if self.type is None then _DEFAULT_LINKER is set to empty string value emit('_DEFAULT_LINKER_ID', self.type) - - -class LD(Linker): - def __init__(self, tc, build): - """ - :type tc: GnuToolchainOptions - :type build: Build - """ - super(LD, self).__init__(tc, build) - - self.build = build - self.host = self.build.host - self.target = self.build.target + + +class LD(Linker): + def __init__(self, tc, build): + """ + :type tc: GnuToolchainOptions + :type build: Build + """ + super(LD, self).__init__(tc, build) + + self.build = build + self.host = self.build.host + self.target = self.build.target self.tc = tc - target = self.target + target = self.target - self.ar = preset('AR') or self.tc.ar - self.ar_plugin = self.tc.ar_plugin + self.ar = preset('AR') or self.tc.ar + self.ar_plugin = self.tc.ar_plugin self.strip = self.tc.strip self.objcopy = self.tc.objcopy - + self.musl = Setting('MUSL', convert=to_bool) - if self.ar is None: - if target.is_apple: - # Use libtool. cctools ar does not understand -M needed for archive merging - self.ar = '${CCTOOLS_ROOT_RESOURCE_GLOBAL}/bin/libtool' + if self.ar is None: + if target.is_apple: + # Use libtool. cctools ar does not understand -M needed for archive merging + self.ar = '${CCTOOLS_ROOT_RESOURCE_GLOBAL}/bin/libtool' elif self.tc.is_from_arcadia: - if self.tc.is_clang: - self.ar = '{}/bin/llvm-ar'.format(self.tc.name_marker) - if self.tc.is_gcc: - self.ar = '{}/gcc/bin/gcc-ar'.format(self.tc.name_marker) - else: + if self.tc.is_clang: + self.ar = '{}/bin/llvm-ar'.format(self.tc.name_marker) + if self.tc.is_gcc: + self.ar = '{}/gcc/bin/gcc-ar'.format(self.tc.name_marker) + else: self.ar = 'ar' self.ar_type = 'GNU_AR' @@ -1837,7 +1837,7 @@ class LD(Linker): self.llvm_ar_format="gnu" self.ld_flags = [] - + # Save linker's stdout to an additional .txt output file # e.g. LLD writes `--print-gc-sections` or `--print-icf-sections` to stdout self.save_linker_output = False @@ -1869,17 +1869,17 @@ class LD(Linker): if self.musl.value: self.ld_flags.extend(['-Wl,--no-as-needed']) - if self.tc.is_gcc: - # MUSL_BFD: musl build uses --no-dynamic-linker linker flag - # which gold doesn't know about. And we can only specify linker - # type, not it's path as we do for Clang through linker selector. - self.ld_flags.append('-fuse-ld=bfd') + if self.tc.is_gcc: + # MUSL_BFD: musl build uses --no-dynamic-linker linker flag + # which gold doesn't know about. And we can only specify linker + # type, not it's path as we do for Clang through linker selector. + self.ld_flags.append('-fuse-ld=bfd') elif target.is_linux: - self.ld_flags.extend(['-ldl', '-lrt', '-Wl,--no-as-needed']) - if self.tc.is_gcc: - self.ld_flags.extend(('-Wl,-Bstatic', '-latomic', '-Wl,-Bdynamic')) + self.ld_flags.extend(['-ldl', '-lrt', '-Wl,--no-as-needed']) + if self.tc.is_gcc: + self.ld_flags.extend(('-Wl,-Bstatic', '-latomic', '-Wl,-Bdynamic')) elif target.is_android: - self.ld_flags.extend(['-ldl', '-Wl,--no-as-needed']) + self.ld_flags.extend(['-ldl', '-Wl,--no-as-needed']) if self.type == Linker.LLD and target.android_api < 29: # https://github.com/android/ndk/issues/1196 self.ld_flags.append('-Wl,--no-rosegment') @@ -1888,65 +1888,65 @@ class LD(Linker): if not self.tc.is_clang: self.ld_flags.append('-Wl,-no_compact_unwind') - self.thread_library = select([ + self.thread_library = select([ (target.is_linux or target.is_macos, '-lpthread'), - ]) + ]) self.ld_export_dynamic_flag = None - self.start_group = None - self.end_group = None + self.start_group = None + self.end_group = None self.whole_archive = None self.no_whole_archive = None - self.ld_stripflag = None - self.use_stdlib = None - self.soname_option = None - self.dwarf_command = None - self.libresolv = '-lresolv' if target.is_linux or target.is_macos or target.is_android else None + self.ld_stripflag = None + self.use_stdlib = None + self.soname_option = None + self.dwarf_command = None + self.libresolv = '-lresolv' if target.is_linux or target.is_macos or target.is_android else None if target.is_linux or target.is_android: self.ld_export_dynamic_flag = '-rdynamic' - self.use_stdlib = '-nodefaultlibs' + self.use_stdlib = '-nodefaultlibs' if target.is_linux or target.is_android or target.is_cygwin or target.is_none: - self.start_group = '-Wl,--start-group' - self.end_group = '-Wl,--end-group' + self.start_group = '-Wl,--start-group' + self.end_group = '-Wl,--end-group' self.whole_archive = '-Wl,--whole-archive' self.no_whole_archive = '-Wl,--no-whole-archive' - self.ld_stripflag = '-s' - self.soname_option = '-soname' + self.ld_stripflag = '-s' + self.soname_option = '-soname' - if target.is_macos or target.is_ios: - self.use_stdlib = '-nodefaultlibs' - self.soname_option = '-install_name' - if not preset('NO_DEBUGINFO'): + if target.is_macos or target.is_ios: + self.use_stdlib = '-nodefaultlibs' + self.soname_option = '-install_name' + if not preset('NO_DEBUGINFO'): self.dwarf_command = '$DWARF_TOOL $TARGET -o ${output;pre=$MODULE_PREFIX$REALPRJNAME.dSYM/Contents/Resources/DWARF/$MODULE_PREFIX:REALPRJNAME}' if self.target.is_ios and preset('MAPSMOBI_BUILD_TARGET') and self.target.is_arm: self.ld_flags.extend(('-fembed-bitcode', '-Wl,-bitcode_verify')) - if self.build.profiler_type == Profiler.GProf: - self.ld_flags.append('-pg') + if self.build.profiler_type == Profiler.GProf: + self.ld_flags.append('-pg') - # TODO(somov): Единое условие на coverage. + # TODO(somov): Единое условие на coverage. if self.build.is_coverage or is_positive('GCOV_COVERAGE') or is_positive('CLANG_COVERAGE') or self.build.is_sanitized: - self.use_stdlib = None + self.use_stdlib = None - self.ld_sdk = select(default=None, selectors=[ + self.ld_sdk = select(default=None, selectors=[ (target.is_macos_arm64, '-Wl,-sdk_version,11.0'), - (target.is_macos, '-Wl,-sdk_version,10.15'), + (target.is_macos, '-Wl,-sdk_version,10.15'), (not target.is_iossim and target.is_ios, '-Wl,-sdk_version,13.1'), (target.is_iossim, '-Wl,-sdk_version,14.5'), - ]) - - if self.ld_sdk: - self.ld_flags.append(self.ld_sdk) - - self.sys_lib = self.tc.sys_lib - - if target.is_android: - if target.is_armv7 and self.type != Linker.LLD: - self.sys_lib.append('-Wl,--fix-cortex-a8') - + ]) + + if self.ld_sdk: + self.ld_flags.append(self.ld_sdk) + + self.sys_lib = self.tc.sys_lib + + if target.is_android: + if target.is_armv7 and self.type != Linker.LLD: + self.sys_lib.append('-Wl,--fix-cortex-a8') + # NDK r23 onwards has stopped using libgcc: # - https://github.com/android/ndk/wiki/Changelog-r23#changes # - https://github.com/android/ndk/issues/1230 @@ -1963,23 +1963,23 @@ class LD(Linker): self.sys_lib.append('-lunwind') self.sys_lib.append('-lgcc') - if self.tc.is_clang and not self.tc.version_at_least(4, 0) and target.is_linux_x86_64: - self.sys_lib.append('-L/usr/lib/x86_64-linux-gnu') - - def print_linker(self): - super(LD, self).print_linker() - - emit('AR_TOOL', self.ar) + if self.tc.is_clang and not self.tc.version_at_least(4, 0) and target.is_linux_x86_64: + self.sys_lib.append('-L/usr/lib/x86_64-linux-gnu') + + def print_linker(self): + super(LD, self).print_linker() + + emit('AR_TOOL', self.ar) emit('AR_TYPE', self.ar_type) emit('STRIP_TOOL_VENDOR', self.strip) emit('OBJCOPY_TOOL_VENDOR', self.objcopy) append('LDFLAGS', '$USER_LDFLAGS', self.ld_flags) - append('LDFLAGS_GLOBAL', '') - - emit('LD_STRIP_FLAG', self.ld_stripflag) - emit('STRIP_FLAG') + append('LDFLAGS_GLOBAL', '') + + emit('LD_STRIP_FLAG', self.ld_stripflag) + emit('STRIP_FLAG') emit('LD_DCE_FLAG', self.ld_dce_flag) emit('DCE_FLAG') @@ -1987,41 +1987,41 @@ class LD(Linker): emit('LD_ICF_FLAG', self.ld_icf_flag) emit('ICF_FLAG') - emit('C_LIBRARY_PATH') - emit('C_SYSTEM_LIBRARIES_INTERCEPT') + emit('C_LIBRARY_PATH') + emit('C_SYSTEM_LIBRARIES_INTERCEPT') if self.musl.value: emit('C_SYSTEM_LIBRARIES', '-nostdlib') else: emit('C_SYSTEM_LIBRARIES', self.use_stdlib, self.thread_library, self.sys_lib, '-lc') - + emit('START_WHOLE_ARCHIVE_VALUE', self.whole_archive) emit('END_WHOLE_ARCHIVE_VALUE', self.no_whole_archive) if self.ld_sdk: emit('LD_SDK_VERSION', self.ld_sdk) - dwarf_tool = self.tc.dwarf_tool - if dwarf_tool is None and self.tc.is_clang and (self.target.is_macos or self.target.is_ios): + dwarf_tool = self.tc.dwarf_tool + if dwarf_tool is None and self.tc.is_clang and (self.target.is_macos or self.target.is_ios): dsymutil = '{}/bin/{}dsymutil'.format(self.tc.name_marker, '' if self.tc.version_at_least(7) else 'llvm-') dwarf_tool = '${YMAKE_PYTHON} ${input:"build/scripts/run_llvm_dsymutil.py"} ' + dsymutil - if self.tc.version_at_least(5, 0): - dwarf_tool += ' -flat' - - if dwarf_tool is not None: - emit('DWARF_TOOL', dwarf_tool) - emit('OBJADDE') - + if self.tc.version_at_least(5, 0): + dwarf_tool += ' -flat' + + if dwarf_tool is not None: + emit('DWARF_TOOL', dwarf_tool) + emit('OBJADDE') + emit('LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG', self.ld_export_dynamic_flag) - emit_big(''' + emit_big(''' NO_EXPORT_DYNAMIC_SYMBOLS= EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG - when ($EXPORTS_FILE) { + when ($EXPORTS_FILE) { EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG -Wl,--version-script=${input:EXPORTS_FILE} } when ($NO_EXPORT_DYNAMIC_SYMBOLS == "yes") { EXPORTS_VALUE= - }''') - + }''') + emit('LINKER_SCRIPT_VALUE', '${ext=.ld;pre=-T:SRCS_GLOBAL}') linker_time_trace_requested = is_positive('TIME_TRACE') or is_positive('LINKER_TIME_TRACE') @@ -2036,12 +2036,12 @@ class LD(Linker): else: emit('LINKER_TIME_TRACE_FLAG') - exe_flags = [ + exe_flags = [ '$C_FLAGS_PLATFORM', '$BEFORE_PEERS', self.start_group, '${rootrel:PEERS}', self.end_group, '$AFTER_PEERS', '$EXPORTS_VALUE $LINKER_SCRIPT_VALUE $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE $OBJADDE_LIB', '$C_LIBRARY_PATH $C_SYSTEM_LIBRARIES_INTERCEPT $C_SYSTEM_LIBRARIES $STRIP_FLAG $DCE_FLAG $ICF_FLAG $LINKER_TIME_TRACE_FLAG'] - arch_flag = '--arch={arch}'.format(arch=self.target.os_compat) + arch_flag = '--arch={arch}'.format(arch=self.target.os_compat) soname_flag = '-Wl,{option},${{_SONAME}}'.format(option=self.soname_option) shared_flag = '-shared' exec_shared_flag = '-pie -fPIE -Wl,--unresolved-symbols=ignore-all -rdynamic' if self.target.is_linux else '' @@ -2053,7 +2053,7 @@ class LD(Linker): ld_env_style = '${cwd:ARCADIA_BUILD_ROOT} $TOOLCHAIN_ENV ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}' - # Program + # Program emit( "GENERATE_MF_CMD", '$YMAKE_PYTHON', '${input:"build/scripts/generate_mf.py"}', @@ -2109,9 +2109,9 @@ class LD(Linker): ) emit('REAL_LINK_EXEC_DYN_LIB', '$REAL_LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE)') - # Shared Library + # Shared Library - emit('LINK_DYN_LIB_FLAGS') + emit('LINK_DYN_LIB_FLAGS') emit('REAL_LINK_DYN_LIB_CMDLINE', '$YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"}', '--target $TARGET', @@ -2154,7 +2154,7 @@ class LD(Linker): emit('LINK_LIB', '$GENERATE_MF &&', archiver, '$TARGET', tail_link_lib) emit('GLOBAL_LINK_LIB', archiver, '$GLOBAL_TARGET', tail_link_lib) - # "Fat Object" : pre-linked global objects and static library with all dependencies + # "Fat Object" : pre-linked global objects and static library with all dependencies def emit_link_fat_obj(cmd_name, need_wa_option, *extended_flags): prefix = ['$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP &&', '$YMAKE_PYTHON ${input:"build/scripts/link_fat_obj.py"} --build-root $ARCADIA_BUILD_ROOT'] @@ -2165,80 +2165,80 @@ class LD(Linker): '$TOOLCHAIN_ENV ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}'] emit(cmd_name, *(prefix + list(extended_flags) + suffix)) - # TODO(somov): Проверить, не нужны ли здесь все остальные флаги компоновки (LDFLAGS и т. д.). + # TODO(somov): Проверить, не нужны ли здесь все остальные флаги компоновки (LDFLAGS и т. д.). emit_link_fat_obj('LINK_FAT_OBJECT', True, '--obj=$TARGET', '--lib=${output:REALPRJNAME.a}') emit_link_fat_obj('LINK_RECURSIVE_LIBRARY', False, '--lib=$TARGET', '--with-own-obj', '--with-global-srcs') emit_link_fat_obj('LINK_FAT_OBJECT_LIBRARY', False, '--lib=$TARGET', '$FAT_OBJECT_ARGS', '$FAT_OBJECT_OUTS') - emit('LIBRT', '-lrt') - emit('MD5LIB', '-lcrypt') - emit('LIBRESOLV', self.libresolv) - emit('PROFFLAG', '-pg') - - -class MSVCToolchainOptions(ToolchainOptions): - def __init__(self, build, detector): - super(MSVCToolchainOptions, self).__init__(build, detector) - - # C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428 - self.vc_root = None - - # C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0 - self.kit_includes = None - - # C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0 - self.kit_libs = None - - self.under_wine = 'wine' in self.params - self.system_msvc = 'system_msvc' in self.params - self.ide_msvs = 'ide_msvs' in self.params - self.use_clang = self.params.get('use_clang', False) - self.use_arcadia_toolchain = self.params.get('use_arcadia_toolchain', False) - - self.sdk_version = None - - if build.host.is_windows: - self.under_wine = False - - if self.ide_msvs: - bindir = '$(VC_ExecutablePath_x64_x64)\\' - self.c_compiler = bindir + 'cl.exe' - self.cxx_compiler = self.c_compiler - - self.link = bindir + 'link.exe' - self.lib = bindir + 'lib.exe' - self.masm_compiler = bindir + 'ml64.exe' - - self.vc_root = None - - sdk_dir = '$(WindowsSdkDir)' - self.sdk_version = '$(WindowsTargetPlatformVersion)' - self.kit_includes = os.path.join(sdk_dir, 'Include', self.sdk_version) - self.kit_libs = os.path.join(sdk_dir, 'Lib', self.sdk_version) - - elif detector: - self.masm_compiler = which('ml64.exe') - self.link = which('link.exe') - self.lib = which('lib.exe') - - sdk_dir = os.environ.get('WindowsSdkDir') - self.sdk_version = os.environ.get('WindowsSDKVersion').replace('\\', '') - vc_install_dir = os.environ.get('VCToolsInstallDir') + emit('LIBRT', '-lrt') + emit('MD5LIB', '-lcrypt') + emit('LIBRESOLV', self.libresolv) + emit('PROFFLAG', '-pg') + + +class MSVCToolchainOptions(ToolchainOptions): + def __init__(self, build, detector): + super(MSVCToolchainOptions, self).__init__(build, detector) + + # C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428 + self.vc_root = None + + # C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0 + self.kit_includes = None + + # C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0 + self.kit_libs = None + + self.under_wine = 'wine' in self.params + self.system_msvc = 'system_msvc' in self.params + self.ide_msvs = 'ide_msvs' in self.params + self.use_clang = self.params.get('use_clang', False) + self.use_arcadia_toolchain = self.params.get('use_arcadia_toolchain', False) + + self.sdk_version = None + + if build.host.is_windows: + self.under_wine = False + + if self.ide_msvs: + bindir = '$(VC_ExecutablePath_x64_x64)\\' + self.c_compiler = bindir + 'cl.exe' + self.cxx_compiler = self.c_compiler + + self.link = bindir + 'link.exe' + self.lib = bindir + 'lib.exe' + self.masm_compiler = bindir + 'ml64.exe' + + self.vc_root = None + + sdk_dir = '$(WindowsSdkDir)' + self.sdk_version = '$(WindowsTargetPlatformVersion)' + self.kit_includes = os.path.join(sdk_dir, 'Include', self.sdk_version) + self.kit_libs = os.path.join(sdk_dir, 'Lib', self.sdk_version) + + elif detector: + self.masm_compiler = which('ml64.exe') + self.link = which('link.exe') + self.lib = which('lib.exe') + + sdk_dir = os.environ.get('WindowsSdkDir') + self.sdk_version = os.environ.get('WindowsSDKVersion').replace('\\', '') + vc_install_dir = os.environ.get('VCToolsInstallDir') # fix for cxx_std detection problem introduced in r7740071 when running in native VS toolkit commandline: # in that case ya make gets 'system_cxx' configuration name and cxx_std is obviously missing in that config # so default 'c++20' is substituted and we need to hotfix it here self.cxx_std = 'c++latest' - - if any([x is None for x in (sdk_dir, self.sdk_version, vc_install_dir)]): - raise ConfigureError('No %WindowsSdkDir%, %WindowsSDKVersion% or %VCINSTALLDIR% present. Please, run vcvars64.bat to setup preferred environment.') - - self.vc_root = os.path.normpath(vc_install_dir) - self.kit_includes = os.path.normpath(os.path.join(sdk_dir, 'Include', self.sdk_version)) - self.kit_libs = os.path.normpath(os.path.join(sdk_dir, 'Lib', self.sdk_version)) - - # TODO(somov): Определять автоматически self.version в этом случае - - else: + + if any([x is None for x in (sdk_dir, self.sdk_version, vc_install_dir)]): + raise ConfigureError('No %WindowsSdkDir%, %WindowsSDKVersion% or %VCINSTALLDIR% present. Please, run vcvars64.bat to setup preferred environment.') + + self.vc_root = os.path.normpath(vc_install_dir) + self.kit_includes = os.path.normpath(os.path.join(sdk_dir, 'Include', self.sdk_version)) + self.kit_libs = os.path.normpath(os.path.join(sdk_dir, 'Lib', self.sdk_version)) + + # TODO(somov): Определять автоматически self.version в этом случае + + else: if self.version_at_least(2019): self.sdk_version = '10.0.18362.0' sdk_dir = '$(WINDOWS_KITS-sbr:1939557911)' @@ -2247,109 +2247,109 @@ class MSVCToolchainOptions(ToolchainOptions): else: self.sdk_version = '10.0.16299.0' sdk_dir = '$(WINDOWS_KITS-sbr:1379398385)' - - self.vc_root = self.name_marker if not self.use_clang else '$MSVC_FOR_CLANG_RESOURCE_GLOBAL' - self.kit_includes = os.path.join(sdk_dir, 'Include', self.sdk_version) - self.kit_libs = os.path.join(sdk_dir, 'Lib', self.sdk_version) - - bindir = os.path.join(self.vc_root, 'bin', 'Hostx64') - - tools_name = select(selectors=[ - (build.target.is_x86, 'x86'), - (build.target.is_x86_64, 'x64'), - (build.target.is_armv7, 'arm'), - ]) - - asm_name = select(selectors=[ - (build.target.is_x86, 'ml.exe'), - (build.target.is_x86_64, 'ml64.exe'), - (build.target.is_armv7, 'armasm.exe'), - ]) - - def prefix(_type, _path): - if not self.under_wine: - return _path + + self.vc_root = self.name_marker if not self.use_clang else '$MSVC_FOR_CLANG_RESOURCE_GLOBAL' + self.kit_includes = os.path.join(sdk_dir, 'Include', self.sdk_version) + self.kit_libs = os.path.join(sdk_dir, 'Lib', self.sdk_version) + + bindir = os.path.join(self.vc_root, 'bin', 'Hostx64') + + tools_name = select(selectors=[ + (build.target.is_x86, 'x86'), + (build.target.is_x86_64, 'x64'), + (build.target.is_armv7, 'arm'), + ]) + + asm_name = select(selectors=[ + (build.target.is_x86, 'ml.exe'), + (build.target.is_x86_64, 'ml64.exe'), + (build.target.is_armv7, 'armasm.exe'), + ]) + + def prefix(_type, _path): + if not self.under_wine: + return _path return '{wine} {type} $WINE_ENV ${{ARCADIA_ROOT}} ${{ARCADIA_BUILD_ROOT}} {path}'.format( wine='${YMAKE_PYTHON} ${input:\"build/scripts/run_msvc_wine.py\"} $(WINE_TOOL-sbr:1093314933)/bin/wine64 -v140', type=_type, path=_path ) - - self.masm_compiler = prefix('masm', os.path.join(bindir, tools_name, asm_name)) - self.link = prefix('link', os.path.join(bindir, tools_name, 'link.exe')) - self.lib = prefix('lib', os.path.join(bindir, tools_name, 'lib.exe')) - - -class MSVC(object): - # noinspection PyPep8Naming - class WIN32_WINNT(object): - Macro = '_WIN32_WINNT' - Windows7 = '0x0601' - Windows8 = '0x0602' - - def __init__(self, tc, build): - """ - :type tc: MSVCToolchainOptions - :type build: Build - """ - if not isinstance(tc, MSVCToolchainOptions): - raise TypeError('Got {} ({}) instead of an MSVCToolchainOptions'.format(tc, type(tc))) - - self.build = build - self.tc = tc - - -class MSVCToolchain(MSVC, Toolchain): - def __init__(self, tc, build): - """ - :type tc: MSVCToolchainOptions - :param build: Build - """ - Toolchain.__init__(self, tc, build) - MSVC.__init__(self, tc, build) - - if self.tc.from_arcadia and not self.tc.ide_msvs: - self.platform_projects.append('build/platform/msvc') - if tc.under_wine: + + self.masm_compiler = prefix('masm', os.path.join(bindir, tools_name, asm_name)) + self.link = prefix('link', os.path.join(bindir, tools_name, 'link.exe')) + self.lib = prefix('lib', os.path.join(bindir, tools_name, 'lib.exe')) + + +class MSVC(object): + # noinspection PyPep8Naming + class WIN32_WINNT(object): + Macro = '_WIN32_WINNT' + Windows7 = '0x0601' + Windows8 = '0x0602' + + def __init__(self, tc, build): + """ + :type tc: MSVCToolchainOptions + :type build: Build + """ + if not isinstance(tc, MSVCToolchainOptions): + raise TypeError('Got {} ({}) instead of an MSVCToolchainOptions'.format(tc, type(tc))) + + self.build = build + self.tc = tc + + +class MSVCToolchain(MSVC, Toolchain): + def __init__(self, tc, build): + """ + :type tc: MSVCToolchainOptions + :param build: Build + """ + Toolchain.__init__(self, tc, build) + MSVC.__init__(self, tc, build) + + if self.tc.from_arcadia and not self.tc.ide_msvs: + self.platform_projects.append('build/platform/msvc') + if tc.under_wine: self.platform_projects.append('build/platform/wine') - - def print_toolchain(self): - super(MSVCToolchain, self).print_toolchain() - - emit('TOOLCHAIN_ENV', format_env(self.tc.get_env(), list_separator=';')) - - if self.tc.sdk_version: - emit('WINDOWS_KITS_VERSION', self.tc.sdk_version) - - # TODO(somov): Заглушка для тех мест, где C_FLAGS_PLATFORM используется - # для любых платформ. Нужно унифицировать с GnuToolchain. - emit('C_FLAGS_PLATFORM') - - if self.tc.under_wine: - emit('WINE_ENV', format_env({'WINEPREFIX_SUFFIX': '4.0'})) - - -class MSVCCompiler(MSVC, Compiler): - def __init__(self, tc, build): - Compiler.__init__(self, tc, 'MSVC') - MSVC.__init__(self, tc, build) - - def print_compiler(self): - super(MSVCCompiler, self).print_compiler() - - target = self.build.target - - win32_winnt = self.WIN32_WINNT.Windows7 - + + def print_toolchain(self): + super(MSVCToolchain, self).print_toolchain() + + emit('TOOLCHAIN_ENV', format_env(self.tc.get_env(), list_separator=';')) + + if self.tc.sdk_version: + emit('WINDOWS_KITS_VERSION', self.tc.sdk_version) + + # TODO(somov): Заглушка для тех мест, где C_FLAGS_PLATFORM используется + # для любых платформ. Нужно унифицировать с GnuToolchain. + emit('C_FLAGS_PLATFORM') + + if self.tc.under_wine: + emit('WINE_ENV', format_env({'WINEPREFIX_SUFFIX': '4.0'})) + + +class MSVCCompiler(MSVC, Compiler): + def __init__(self, tc, build): + Compiler.__init__(self, tc, 'MSVC') + MSVC.__init__(self, tc, build) + + def print_compiler(self): + super(MSVCCompiler, self).print_compiler() + + target = self.build.target + + win32_winnt = self.WIN32_WINNT.Windows7 + warns_enabled = [ - 4018, # 'expression' : signed/unsigned mismatch - 4265, # 'class' : class has virtual functions, but destructor is not virtual - 4296, # 'operator' : expression is always false - 4431, # missing type specifier - int assumed - ] - warns_as_error = [ - 4013, # 'function' undefined; assuming extern returning int + 4018, # 'expression' : signed/unsigned mismatch + 4265, # 'class' : class has virtual functions, but destructor is not virtual + 4296, # 'operator' : expression is always false + 4431, # missing type specifier - int assumed ] + warns_as_error = [ + 4013, # 'function' undefined; assuming extern returning int + ] warns_disabled = [ 4127, # conditional expression is constant 4200, # nonstandard extension used : zero-sized array in struct/union @@ -2373,8 +2373,8 @@ class MSVCCompiler(MSVC, Compiler): ] defines = [ - '/DARCADIA_ROOT=${ARCADIA_ROOT}', - '/DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT}', + '/DARCADIA_ROOT=${ARCADIA_ROOT}', + '/DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT}', '/DFAKEID=$CPP_FAKEID', '/DWIN32', '/D_WIN32', @@ -2397,29 +2397,29 @@ class MSVCCompiler(MSVC, Compiler): '/D_CRT_USE_BUILTIN_OFFSETOF', ] - if target.is_x86_64: + if target.is_x86_64: defines.extend(('/D_WIN64', '/DWIN64')) - - if target.is_armv7: + + if target.is_armv7: defines.extend(('/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE', '/D__arm__')) - - winapi_unicode = False - - emit_big(''' - MSVC_INLINE_OPTIMIZED=yes - when ($MSVC_INLINE_OPTIMIZED == "yes") { - MSVC_INLINE_FLAG=/Zc:inline - } - when ($MSVC_INLINE_OPTIMIZED == "no") { - MSVC_INLINE_FLAG=/Zc:inline- - }''') - + + winapi_unicode = False + + emit_big(''' + MSVC_INLINE_OPTIMIZED=yes + when ($MSVC_INLINE_OPTIMIZED == "yes") { + MSVC_INLINE_FLAG=/Zc:inline + } + when ($MSVC_INLINE_OPTIMIZED == "no") { + MSVC_INLINE_FLAG=/Zc:inline- + }''') + flags = [ '/nologo', '/Zm500', '/GR', '/bigobj', '/FC', '/EHs', '/errorReport:prompt', '$MSVC_INLINE_FLAG', '/utf-8', # enable standard conforming mode '/permissive-' ] - flags += self.tc.arch_opt + flags += self.tc.arch_opt c_warnings = ['/we{}'.format(code) for code in warns_as_error] c_warnings += ['/w1{}'.format(code) for code in warns_enabled] @@ -2448,33 +2448,33 @@ class MSVCCompiler(MSVC, Compiler): flags.append('-m32') if target.is_x86_64: flags.append('-m64') - - # Some warnings are getting triggered even when NO_COMPILER_WARNINGS is enabled - flags.extend(( - '-Wno-c++11-narrowing', - '-Wno-register', - )) - - c_warnings.extend(( - '-Wno-absolute-value', - '-Wno-bitwise-op-parentheses', - '-Wno-dll-attribute-on-redeclaration', - '-Wno-extern-initializer', - '-Wno-format', - '-Wno-ignored-pragma-optimize', - '-Wno-inconsistent-dllimport', - '-Wno-int-conversion', - '-Wno-int-to-void-pointer-cast', - '-Wno-invalid-noreturn', - '-Wno-logical-op-parentheses', - '-Wno-macro-redefined', - '-Wno-parentheses', - '-Wno-pragma-pack', - '-Wno-tautological-constant-out-of-range-compare', - '-Wno-unknown-argument', - '-Wno-unknown-warning-option', - )) - + + # Some warnings are getting triggered even when NO_COMPILER_WARNINGS is enabled + flags.extend(( + '-Wno-c++11-narrowing', + '-Wno-register', + )) + + c_warnings.extend(( + '-Wno-absolute-value', + '-Wno-bitwise-op-parentheses', + '-Wno-dll-attribute-on-redeclaration', + '-Wno-extern-initializer', + '-Wno-format', + '-Wno-ignored-pragma-optimize', + '-Wno-inconsistent-dllimport', + '-Wno-int-conversion', + '-Wno-int-to-void-pointer-cast', + '-Wno-invalid-noreturn', + '-Wno-logical-op-parentheses', + '-Wno-macro-redefined', + '-Wno-parentheses', + '-Wno-pragma-pack', + '-Wno-tautological-constant-out-of-range-compare', + '-Wno-unknown-argument', + '-Wno-unknown-warning-option', + )) + cxx_warnings += [ '-Woverloaded-virtual', '-Wno-register', # IGNIETFERRO-722 needed for contrib @@ -2507,47 +2507,47 @@ class MSVCCompiler(MSVC, Compiler): '-Wno-unused-command-line-argument', ] - if target.is_armv7: + if target.is_armv7: masm_io = '-o ${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC}' - else: + else: masm_io = '/nologo /c /Fo${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC}' emit('OBJ_CROSS_SUF', '$OBJ_SUF') emit('OBJECT_SUF', '$OBJ_SUF.obj') - emit('WIN32_WINNT', '{value}'.format(value=win32_winnt)) + emit('WIN32_WINNT', '{value}'.format(value=win32_winnt)) defines.append('/D{name}=$WIN32_WINNT'.format(name=self.WIN32_WINNT.Macro)) - - if winapi_unicode: + + if winapi_unicode: defines += ['/DUNICODE', '/D_UNICODE'] - else: + else: defines += ['/D_MBCS'] - - # https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx - if is_positive('DLL_RUNTIME'): # XXX - flags_debug += ['/MDd'] - flags_release += ['/MD'] - else: - flags_debug += ['/MTd'] - flags_release += ['/MT'] - + + # https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx + if is_positive('DLL_RUNTIME'): # XXX + flags_debug += ['/MDd'] + flags_release += ['/MD'] + else: + flags_debug += ['/MTd'] + flags_release += ['/MT'] + vc_include = os.path.join(self.tc.vc_root, 'include') if not self.tc.ide_msvs else "$(VC_VC_IncludePath.Split(';')[0].Replace('\\','/'))" - - if not self.tc.ide_msvs: - def include_flag(path): + + if not self.tc.ide_msvs: + def include_flag(path): return '{flag}"{path}"'.format(path=path, flag='/I ' if not self.tc.use_clang else '-imsvc') - - for name in ('shared', 'ucrt', 'um', 'winrt'): - flags.append(include_flag(os.path.join(self.tc.kit_includes, name))) - flags.append(include_flag(vc_include)) - + + for name in ('shared', 'ucrt', 'um', 'winrt'): + flags.append(include_flag(os.path.join(self.tc.kit_includes, name))) + flags.append(include_flag(vc_include)) + flags_msvs_only = [] - if self.tc.ide_msvs: + if self.tc.ide_msvs: if not self.tc.use_clang: flags_msvs_only += ['/FD', '/MP'] - debug_info_flags = '/Zi /FS' + debug_info_flags = '/Zi /FS' else: - debug_info_flags = '/Z7' + debug_info_flags = '/Z7' if self.tc.use_clang: emit('CLANG_CL', 'yes') @@ -2556,23 +2556,23 @@ class MSVCCompiler(MSVC, Compiler): if self.tc.use_arcadia_toolchain: emit('USE_ARCADIA_TOOLCHAIN', 'yes') - emit('CXX_COMPILER', self.tc.cxx_compiler) - emit('C_COMPILER', self.tc.c_compiler) - emit('MASM_COMPILER', self.tc.masm_compiler) - append('C_DEFINES', defines) - emit('CFLAGS_DEBUG', flags_debug) - emit('CFLAGS_RELEASE', flags_release) - emit('MASMFLAGS', '') - emit('DEBUG_INFO_FLAGS', debug_info_flags) + emit('CXX_COMPILER', self.tc.cxx_compiler) + emit('C_COMPILER', self.tc.c_compiler) + emit('MASM_COMPILER', self.tc.masm_compiler) + append('C_DEFINES', defines) + emit('CFLAGS_DEBUG', flags_debug) + emit('CFLAGS_RELEASE', flags_release) + emit('MASMFLAGS', '') + emit('DEBUG_INFO_FLAGS', debug_info_flags) append('C_WARNING_OPTS', c_warnings) append('CXX_WARNING_OPTS', cxx_warnings) - if self.build.is_release: - emit('CFLAGS_PER_TYPE', '$CFLAGS_RELEASE') - if self.build.is_debug: - emit('CFLAGS_PER_TYPE', '$CFLAGS_DEBUG') - if self.build.is_ide: - emit('CFLAGS_PER_TYPE', '@[debug|$CFLAGS_DEBUG]@[release|$CFLAGS_RELEASE]') + if self.build.is_release: + emit('CFLAGS_PER_TYPE', '$CFLAGS_RELEASE') + if self.build.is_debug: + emit('CFLAGS_PER_TYPE', '$CFLAGS_DEBUG') + if self.build.is_ide: + emit('CFLAGS_PER_TYPE', '@[debug|$CFLAGS_DEBUG]@[release|$CFLAGS_RELEASE]') append('CFLAGS', flags, flags_msvs_only, '$CFLAGS_PER_TYPE', '$DEBUG_INFO_FLAGS', '$C_WARNING_OPTS', '$C_DEFINES', '$USER_CFLAGS', '$USER_CFLAGS_GLOBAL') append('CXXFLAGS', '$CFLAGS', '/std:' + self.tc.cxx_std, cxx_flags, cxx_defines, '$CXX_WARNING_OPTS', '$USER_CXXFLAGS', '$USER_CXXFLAGS_GLOBAL') @@ -2582,13 +2582,13 @@ class MSVCCompiler(MSVC, Compiler): append('BC_CXXFLAGS', '$BC_CFLAGS', '$CXXFLAGS') ucrt_include = os.path.join(self.tc.kit_includes, 'ucrt') if not self.tc.ide_msvs else "$(UniversalCRT_IncludePath.Split(';')[0].Replace('\\','/'))" - - # clang-cl has '#include_next', and MSVC hasn't. It needs separately specified CRT and VC include directories for libc++ to include second in order standard C and C++ headers. - if not self.tc.use_clang: - append('CFLAGS', '/DY_UCRT_INCLUDE="%s"' % ucrt_include) - append('CFLAGS', '/DY_MSVC_INCLUDE="%s"' % vc_include) - - emit_big(''' + + # clang-cl has '#include_next', and MSVC hasn't. It needs separately specified CRT and VC include directories for libc++ to include second in order standard C and C++ headers. + if not self.tc.use_clang: + append('CFLAGS', '/DY_UCRT_INCLUDE="%s"' % ucrt_include) + append('CFLAGS', '/DY_MSVC_INCLUDE="%s"' % vc_include) + + emit_big(''' when ($NO_WSHADOW == "yes") { C_WARNING_OPTS += /wd4456 /wd4457 } @@ -2600,16 +2600,16 @@ class MSVCCompiler(MSVC, Compiler): OPTIMIZE = /Od }''') - emit('SFDL_FLAG', ['/E', '/C', '/P', '/TP', '/Fi$SFDL_TMP_OUT']) + emit('SFDL_FLAG', ['/E', '/C', '/P', '/TP', '/Fi$SFDL_TMP_OUT']) emit('WERROR_FLAG', '/WX') - emit('WERROR_MODE', self.tc.werror_mode) + emit('WERROR_MODE', self.tc.werror_mode) - if not self.tc.under_wine: - emit('CL_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'cl') - emit('ML_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'ml') + if not self.tc.under_wine: + emit('CL_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'cl') + emit('ML_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'ml') else: - emit('CL_WRAPPER') - emit('ML_WRAPPER') + emit('CL_WRAPPER') + emit('ML_WRAPPER') emit('_SRC_C_NODEPS_CMD', '${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo${OUTFILE} ${SRC} ${EXTRA_C_FLAGS} ${pre=/I :INC} ' @@ -2632,54 +2632,54 @@ class MSVCCompiler(MSVC, Compiler): ) -class MSVCLinker(MSVC, Linker): - def __init__(self, tc, build): - MSVC.__init__(self, tc, build) - Linker.__init__(self, tc, build) - - def print_linker(self): - super(MSVCLinker, self).print_linker() - - target = self.build.target - - linker = self.tc.link - linker_lib = self.tc.lib - - arch = select(no_default=True, selectors=( - (target.is_x86, 'x86'), - (target.is_x86_64, 'x64'), - (target.is_armv7, 'arm'), - )) - +class MSVCLinker(MSVC, Linker): + def __init__(self, tc, build): + MSVC.__init__(self, tc, build) + Linker.__init__(self, tc, build) + + def print_linker(self): + super(MSVCLinker, self).print_linker() + + target = self.build.target + + linker = self.tc.link + linker_lib = self.tc.lib + + arch = select(no_default=True, selectors=( + (target.is_x86, 'x86'), + (target.is_x86_64, 'x64'), + (target.is_armv7, 'arm'), + )) + libpaths = [] - if not self.tc.ide_msvs: - if self.tc.kit_libs: - libpaths.extend([os.path.join(self.tc.kit_libs, name, arch) for name in ('um', 'ucrt')]) - libpaths.append(os.path.join(self.tc.vc_root, 'lib', arch)) - + if not self.tc.ide_msvs: + if self.tc.kit_libs: + libpaths.extend([os.path.join(self.tc.kit_libs, name, arch) for name in ('um', 'ucrt')]) + libpaths.append(os.path.join(self.tc.vc_root, 'lib', arch)) + ignored_errors = [ 4221 ] - flag_machine = '/MACHINE:{}'.format(arch.upper()) - + flag_machine = '/MACHINE:{}'.format(arch.upper()) + flags_ignore = ['/IGNORE:{}'.format(code) for code in ignored_errors] flags_common = ['/NOLOGO', '/ERRORREPORT:PROMPT', '/SUBSYSTEM:CONSOLE', '/TLBID:1', '$MSVC_DYNAMICBASE', '/NXCOMPAT'] flags_common += flags_ignore - flags_common += [flag_machine] + flags_common += [flag_machine] flags_debug_only = [] flags_release_only = [] - if self.tc.ide_msvs: + if self.tc.ide_msvs: flags_common += ['/INCREMENTAL'] else: flags_common += ['/INCREMENTAL:NO'] - if self.tc.use_clang: - flags_debug_only.append('/STACK:4194304') - + if self.tc.use_clang: + flags_debug_only.append('/STACK:4194304') + if is_negative_str(preset('NO_DEBUGINFO', 'no')): if self.tc.ide_msvs: flags_debug_only.append('/DEBUG:FASTLINK' if not self.tc.use_clang else '/DEBUG') @@ -2688,14 +2688,14 @@ class MSVCLinker(MSVC, Linker): # No FASTLINK for ya make, because resulting PDB would require .obj files (build_root's) to persist flags_common.append('/DEBUG') - if not self.tc.ide_msvs: + if not self.tc.ide_msvs: flags_common += ['/LIBPATH:"{}"'.format(path) for path in libpaths] - link_flags_debug = flags_common + flags_debug_only - link_flags_release = flags_common + flags_release_only - link_flags_lib = flags_ignore + [flag_machine] + link_flags_debug = flags_common + flags_debug_only + link_flags_release = flags_common + flags_release_only + link_flags_lib = flags_ignore + [flag_machine] - stdlibs = [ + stdlibs = [ 'advapi32.lib', 'comdlg32.lib', 'crypt32.lib', @@ -2720,24 +2720,24 @@ class MSVCLinker(MSVC, Linker): 'ws2_32.lib', ] - emit('LINK_LIB_CMD', linker_lib) - emit('LINK_EXE_CMD', linker) - emit('LINK_LIB_FLAGS', link_flags_lib) - emit('LINK_EXE_FLAGS_RELEASE', link_flags_release) - emit('LINK_EXE_FLAGS_DEBUG', link_flags_debug) - emit('LINK_STDLIBS', stdlibs) - emit('LDFLAGS_GLOBAL', '') - emit('LDFLAGS', '') - emit('OBJADDE', '') - - if self.build.is_release: - emit('LINK_EXE_FLAGS_PER_TYPE', '$LINK_EXE_FLAGS_RELEASE') - if self.build.is_debug: - emit('LINK_EXE_FLAGS_PER_TYPE', '$LINK_EXE_FLAGS_DEBUG') - if self.build.is_ide and self.tc.ide_msvs: - emit('LINK_EXE_FLAGS_PER_TYPE', '@[debug|$LINK_EXE_FLAGS_DEBUG]@[release|$LINK_EXE_FLAGS_RELEASE]') - - emit('LINK_EXE_FLAGS', '$LINK_EXE_FLAGS_PER_TYPE') + emit('LINK_LIB_CMD', linker_lib) + emit('LINK_EXE_CMD', linker) + emit('LINK_LIB_FLAGS', link_flags_lib) + emit('LINK_EXE_FLAGS_RELEASE', link_flags_release) + emit('LINK_EXE_FLAGS_DEBUG', link_flags_debug) + emit('LINK_STDLIBS', stdlibs) + emit('LDFLAGS_GLOBAL', '') + emit('LDFLAGS', '') + emit('OBJADDE', '') + + if self.build.is_release: + emit('LINK_EXE_FLAGS_PER_TYPE', '$LINK_EXE_FLAGS_RELEASE') + if self.build.is_debug: + emit('LINK_EXE_FLAGS_PER_TYPE', '$LINK_EXE_FLAGS_DEBUG') + if self.build.is_ide and self.tc.ide_msvs: + emit('LINK_EXE_FLAGS_PER_TYPE', '@[debug|$LINK_EXE_FLAGS_DEBUG]@[release|$LINK_EXE_FLAGS_RELEASE]') + + emit('LINK_EXE_FLAGS', '$LINK_EXE_FLAGS_PER_TYPE') emit('LINK_IMPLIB_VALUE') emit('LINK_IMPLIB', '/IMPLIB:${output;noext;rootrel;pre=$MODULE_PREFIX:REALPRJNAME.lib}') @@ -2746,14 +2746,14 @@ class MSVCLinker(MSVC, Linker): else: emit('LINK_EXTRA_OUTPUT') - if not self.tc.under_wine: - emit('LIB_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'lib') - emit('LINK_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'link') + if not self.tc.under_wine: + emit('LIB_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'lib') + emit('LINK_WRAPPER', '${YMAKE_PYTHON}', '${input:"build/scripts/fix_msvc_output.py"}', 'link') else: - emit('LIB_WRAPPER') - emit('LINK_WRAPPER') + emit('LIB_WRAPPER') + emit('LINK_WRAPPER') - emit('LINK_WRAPPER_DYNLIB', '${YMAKE_PYTHON}', '${input:"build/scripts/link_dyn_lib.py"}', '--arch', 'WINDOWS', '--target', '$TARGET') + emit('LINK_WRAPPER_DYNLIB', '${YMAKE_PYTHON}', '${input:"build/scripts/link_dyn_lib.py"}', '--arch', 'WINDOWS', '--target', '$TARGET') emit_big(''' EXPORTS_VALUE= when ($EXPORTS_FILE) { @@ -2796,9 +2796,9 @@ class MSVCLinker(MSVC, Linker): ${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} --ya-end-command-file \ ${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"}') emit('LINK_EXE', '$LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE)') - + emit('LINK_DYN_LIB', '${GENERATE_MF} && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_DYN_LIB ${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"}') - + emit('LINK_EXEC_DYN_LIB_CMDLINE', '${GENERATE_MF} && $GENERATE_VCS_C_INFO_NODEP && ${TOOLCHAIN_ENV} ${cwd:ARCADIA_BUILD_ROOT} ${LINK_WRAPPER} ${LINK_WRAPPER_DYNLIB} ${LINK_EXE_CMD} \ /OUT:${qe;rootrel:TARGET} ${LINK_EXTRA_OUTPUT} ${EXPORTS_VALUE} \ ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ @@ -2807,307 +2807,307 @@ class MSVCLinker(MSVC, Linker): $LINK_EXE_FLAGS $LINK_STDLIBS $LDFLAGS $LDFLAGS_GLOBAL $OBJADDE --ya-end-command-file \ ${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"}') emit('LINK_EXEC_DYN_LIB', '$LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE)') - + emit('LINK_GLOBAL_FAT_OBJECT', '${TOOLCHAIN_ENV} ${cwd:ARCADIA_BUILD_ROOT} ${LIB_WRAPPER} ${LINK_LIB_CMD} /OUT:${qe;rootrel:TARGET} \ --ya-start-command-file ${qe;rootrel;ext=.lib:SRCS_GLOBAL} ${qe;rootrel;ext=.obj:SRCS_GLOBAL} ${qe;rootrel:AUTO_INPUT} $LINK_LIB_FLAGS --ya-end-command-file') emit('LINK_PEERS_FAT_OBJECT', '${TOOLCHAIN_ENV} ${cwd:ARCADIA_BUILD_ROOT} ${LIB_WRAPPER} ${LINK_LIB_CMD} /OUT:${qe;rootrel;output:REALPRJNAME.lib} \ --ya-start-command-file ${qe;rootrel:PEERS} $LINK_LIB_FLAGS --ya-end-command-file') emit('LINK_FAT_OBJECT', '${GENERATE_MF} && $GENERATE_VCS_C_INFO_NODEP && $LINK_GLOBAL_FAT_OBJECT && $LINK_PEERS_FAT_OBJECT ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}') # noqa E501 - -# TODO(somov): Rename! -Compilers = { - 'gnu': (GnuToolchain, GnuCompiler, LD), - 'clang': (GnuToolchain, GnuCompiler, LD), + +# TODO(somov): Rename! +Compilers = { + 'gnu': (GnuToolchain, GnuCompiler, LD), + 'clang': (GnuToolchain, GnuCompiler, LD), 'xcode': (GnuToolchain, GnuCompiler, LD), - 'msvc': (MSVCToolchain, MSVCCompiler, MSVCLinker), -} - - -class Ragel(object): - def __init__(self): - self.rlgen_flags = [] - self.ragel_flags = [] - self.ragel6_flags = [] - - def configure_toolchain(self, build, compiler): - if isinstance(compiler, MSVCCompiler): - self.set_default_flags(optimized=False) - elif isinstance(compiler, GnuCompiler): + 'msvc': (MSVCToolchain, MSVCCompiler, MSVCLinker), +} + + +class Ragel(object): + def __init__(self): + self.rlgen_flags = [] + self.ragel_flags = [] + self.ragel6_flags = [] + + def configure_toolchain(self, build, compiler): + if isinstance(compiler, MSVCCompiler): + self.set_default_flags(optimized=False) + elif isinstance(compiler, GnuCompiler): self.set_default_flags(optimized=build.is_release and not build.is_sanitized) - else: - raise ConfigureError('Unexpected compiler {}'.format(compiler)) + else: + raise ConfigureError('Unexpected compiler {}'.format(compiler)) - def set_default_flags(self, optimized): - if optimized: - self.rlgen_flags.append('-G2') - self.ragel6_flags.append('-CG2') - else: - self.rlgen_flags.append('-T0') - self.ragel6_flags.append('-CT0') + def set_default_flags(self, optimized): + if optimized: + self.rlgen_flags.append('-G2') + self.ragel6_flags.append('-CG2') + else: + self.rlgen_flags.append('-T0') + self.ragel6_flags.append('-CT0') - def print_variables(self): - emit('RLGEN_FLAGS', self.rlgen_flags) - emit('RAGEL_FLAGS', self.ragel_flags) - emit('RAGEL6_FLAGS', self.ragel6_flags) + def print_variables(self): + emit('RLGEN_FLAGS', self.rlgen_flags) + emit('RAGEL_FLAGS', self.ragel_flags) + emit('RAGEL6_FLAGS', self.ragel6_flags) -class Python(object): +class Python(object): def __init__(self, tc): - self.python = None - self.flags = None - self.ldflags = None - self.libraries = None - self.includes = None + self.python = None + self.flags = None + self.ldflags = None + self.libraries = None + self.includes = None self.tc = tc - def configure_posix(self, python=None, python_config=None): - python = python or preset('PYTHON_BIN') or which('python') - python_config = python_config or preset('PYTHON_CONFIG') or which('python-config') - - if python is None or python_config is None: - return - - # python-config dumps each option on one line in the specified order - config = get_stdout([python_config, '--cflags', '--ldflags', '--includes']) or '' - config = config.split('\n') - if len(config) < 3: - return - - self.python = python - self.flags = config[0] - self.ldflags = config[1] - self.includes = config[2] - # Do not split libraries from ldflags. - # They are not used separately and get overriden together, so it is safe. - # TODO(somov): Удалить эту переменную и PYTHON_LIBRARIES из makelist-ов. - self.libraries = '' + def configure_posix(self, python=None, python_config=None): + python = python or preset('PYTHON_BIN') or which('python') + python_config = python_config or preset('PYTHON_CONFIG') or which('python-config') + + if python is None or python_config is None: + return + + # python-config dumps each option on one line in the specified order + config = get_stdout([python_config, '--cflags', '--ldflags', '--includes']) or '' + config = config.split('\n') + if len(config) < 3: + return + + self.python = python + self.flags = config[0] + self.ldflags = config[1] + self.includes = config[2] + # Do not split libraries from ldflags. + # They are not used separately and get overriden together, so it is safe. + # TODO(somov): Удалить эту переменную и PYTHON_LIBRARIES из makelist-ов. + self.libraries = '' if preset('USE_ARCADIA_PYTHON') == 'no' and not preset('USE_SYSTEM_PYTHON') and not self.tc.os_sdk_local: raise Exception("Use fixed python (see https://clubs.at.yandex-team.ru/arcadia/15392) or set OS_SDK=local flag") - def print_variables(self): - variables = Variables({ - 'PYTHON_BIN': self.python, - 'PYTHON_FLAGS': self.flags, - 'PYTHON_LDFLAGS': self.ldflags, - 'PYTHON_LIBRARIES': self.libraries, - 'PYTHON_INCLUDE': self.includes - }) - - variables.update_from_presets() - variables.reset_if_any(reset_value='PYTHON-NOT-FOUND') - variables.emit() - - -class Perl(object): - # Parse (key, value) from "version='5.26.0';" lines - PERL_CONFIG_RE = re.compile(r"^(?P<key>\w+)='(?P<value>.*)';$", re.MULTILINE) - - def __init__(self): - self.perl = None - self.version = None - self.privlib = None - self.archlib = None - - def configure_local(self, perl=None): - self.perl = perl or preset('PERL') or which('perl') - if self.perl is None: - return - - # noinspection PyTypeChecker - config = dict(self._iter_config(['version', 'privlibexp', 'archlibexp'])) - self.version = config.get('version') - self.privlib = config.get('privlibexp') - self.archlib = config.get('archlibexp') - - def print_variables(self, prefix=''): - variables = Variables({ - prefix + 'PERL': self.perl, - prefix + 'PERL_VERSION': self.version, - prefix + 'PERL_PRIVLIB': self.privlib, - prefix + 'PERL_ARCHLIB': self.archlib, - }) - - variables.reset_if_any(reset_value='PERL-NOT-FOUND') + def print_variables(self): + variables = Variables({ + 'PYTHON_BIN': self.python, + 'PYTHON_FLAGS': self.flags, + 'PYTHON_LDFLAGS': self.ldflags, + 'PYTHON_LIBRARIES': self.libraries, + 'PYTHON_INCLUDE': self.includes + }) + + variables.update_from_presets() + variables.reset_if_any(reset_value='PYTHON-NOT-FOUND') + variables.emit() + + +class Perl(object): + # Parse (key, value) from "version='5.26.0';" lines + PERL_CONFIG_RE = re.compile(r"^(?P<key>\w+)='(?P<value>.*)';$", re.MULTILINE) + + def __init__(self): + self.perl = None + self.version = None + self.privlib = None + self.archlib = None + + def configure_local(self, perl=None): + self.perl = perl or preset('PERL') or which('perl') + if self.perl is None: + return + + # noinspection PyTypeChecker + config = dict(self._iter_config(['version', 'privlibexp', 'archlibexp'])) + self.version = config.get('version') + self.privlib = config.get('privlibexp') + self.archlib = config.get('archlibexp') + + def print_variables(self, prefix=''): + variables = Variables({ + prefix + 'PERL': self.perl, + prefix + 'PERL_VERSION': self.version, + prefix + 'PERL_PRIVLIB': self.privlib, + prefix + 'PERL_ARCHLIB': self.archlib, + }) + + variables.reset_if_any(reset_value='PERL-NOT-FOUND') variables.emit(with_ignore_comment=variables.keys()) - def _iter_config(self, config_keys): - # Run perl -V:version -V:etc... - perl_config = [self.perl] + ['-V:{}'.format(key) for key in config_keys] + def _iter_config(self, config_keys): + # Run perl -V:version -V:etc... + perl_config = [self.perl] + ['-V:{}'.format(key) for key in config_keys] config = six.ensure_str(get_stdout(perl_config) or '') - start = 0 - while True: - match = Perl.PERL_CONFIG_RE.search(config, start) - if match is None: - break - yield match.group('key', 'value') - start = match.end() + start = 0 + while True: + match = Perl.PERL_CONFIG_RE.search(config, start) + if match is None: + break + yield match.group('key', 'value') + start = match.end() -class Setting(object): +class Setting(object): def __init__(self, key, auto=None, convert=None, rewrite=False): - self.key = key - - self.auto = auto - self.convert = convert - - self.preset = preset(key) - self.from_user = self.preset is not None + self.key = key + + self.auto = auto + self.convert = convert + + self.preset = preset(key) + self.from_user = self.preset is not None self.rewrite = rewrite - - self._value = Setting.no_value - - @property - def value(self): - if self._value is Setting.no_value: - self._value = self.calculate_value() - return self._value - - def calculate_value(self): - if not self.from_user: - return self.auto if not callable(self.auto) else self.auto() - else: - return self.preset if not self.convert else self.convert(self.preset) - - @value.setter - def value(self, value): - if self.from_user: - raise ConfigureError("Variable {key} already set by user to {old}. Can not change it's value to {new}".format(key=self.key, old=self._value, new=value)) - self._value = value - - def emit(self): + + self._value = Setting.no_value + + @property + def value(self): + if self._value is Setting.no_value: + self._value = self.calculate_value() + return self._value + + def calculate_value(self): + if not self.from_user: + return self.auto if not callable(self.auto) else self.auto() + else: + return self.preset if not self.convert else self.convert(self.preset) + + @value.setter + def value(self, value): + if self.from_user: + raise ConfigureError("Variable {key} already set by user to {old}. Can not change it's value to {new}".format(key=self.key, old=self._value, new=value)) + self._value = value + + def emit(self): if not self.from_user or self.rewrite: - emit(self.key, self.value) - - no_value = object() - - -class Cuda(object): - def __init__(self, build): - """ - :type build: Build - """ - self.build = build - - self.have_cuda = Setting('HAVE_CUDA', auto=self.auto_have_cuda, convert=to_bool) - - self.cuda_root = Setting('CUDA_ROOT') + emit(self.key, self.value) + + no_value = object() + + +class Cuda(object): + def __init__(self, build): + """ + :type build: Build + """ + self.build = build + + self.have_cuda = Setting('HAVE_CUDA', auto=self.auto_have_cuda, convert=to_bool) + + self.cuda_root = Setting('CUDA_ROOT') self.cuda_version = Setting('CUDA_VERSION', auto=self.auto_cuda_version, convert=self.convert_major_version, rewrite=True) - self.use_arcadia_cuda = Setting('USE_ARCADIA_CUDA', auto=self.auto_use_arcadia_cuda, convert=to_bool) - self.use_arcadia_cuda_host_compiler = Setting('USE_ARCADIA_CUDA_HOST_COMPILER', auto=self.auto_use_arcadia_cuda_host_compiler, convert=to_bool) - self.cuda_use_clang = Setting('CUDA_USE_CLANG', auto=False, convert=to_bool) - self.cuda_host_compiler = Setting('CUDA_HOST_COMPILER', auto=self.auto_cuda_host_compiler) - self.cuda_host_compiler_env = Setting('CUDA_HOST_COMPILER_ENV') - self.cuda_host_msvc_version = Setting('CUDA_HOST_MSVC_VERSION') - self.cuda_nvcc_flags = Setting('CUDA_NVCC_FLAGS', auto=[]) - + self.use_arcadia_cuda = Setting('USE_ARCADIA_CUDA', auto=self.auto_use_arcadia_cuda, convert=to_bool) + self.use_arcadia_cuda_host_compiler = Setting('USE_ARCADIA_CUDA_HOST_COMPILER', auto=self.auto_use_arcadia_cuda_host_compiler, convert=to_bool) + self.cuda_use_clang = Setting('CUDA_USE_CLANG', auto=False, convert=to_bool) + self.cuda_host_compiler = Setting('CUDA_HOST_COMPILER', auto=self.auto_cuda_host_compiler) + self.cuda_host_compiler_env = Setting('CUDA_HOST_COMPILER_ENV') + self.cuda_host_msvc_version = Setting('CUDA_HOST_MSVC_VERSION') + self.cuda_nvcc_flags = Setting('CUDA_NVCC_FLAGS', auto=[]) + self.peerdirs = ['build/platform/cuda'] - + self.nvcc_std = '-std=c++14' if self.build.tc.type == 'msvc': self.nvcc_std = self.nvcc_std.replace('-std=', '/std:') self.nvcc_flags = [] - - if not self.have_cuda.value: - return - - if self.cuda_host_compiler.value: - self.nvcc_flags.append('--compiler-bindir=$CUDA_HOST_COMPILER') - - if self.use_arcadia_cuda.value: - self.cuda_root.value = '$CUDA_RESOURCE_GLOBAL' - - if self.build.target.is_linux_x86_64 and self.build.tc.is_clang: - # TODO(somov): Эта настройка должна приезжать сюда автоматически из другого места - self.nvcc_flags.append('-I$OS_SDK_ROOT/usr/include/x86_64-linux-gnu') - - def print_(self): - self.print_variables() - self.print_macros() - - def print_variables(self): - self.have_cuda.emit() - if not self.have_cuda.value: - return - - if self.use_arcadia_cuda.value and self.cuda_host_compiler.value is None: - logger.warning('$USE_ARCADIA_CUDA is set, but no $CUDA_HOST_COMPILER') - - self.setup_vc_root() - - self.cuda_root.emit() - self.cuda_version.emit() - self.use_arcadia_cuda.emit() - self.use_arcadia_cuda_host_compiler.emit() - self.cuda_use_clang.emit() - self.cuda_host_compiler.emit() - self.cuda_host_compiler_env.emit() - self.cuda_host_msvc_version.emit() - self.cuda_nvcc_flags.emit() - - emit('NVCC_UNQUOTED', self.build.host.exe('$CUDA_ROOT', 'bin', 'nvcc')) - emit('NVCC', '${quo:NVCC_UNQUOTED}') + + if not self.have_cuda.value: + return + + if self.cuda_host_compiler.value: + self.nvcc_flags.append('--compiler-bindir=$CUDA_HOST_COMPILER') + + if self.use_arcadia_cuda.value: + self.cuda_root.value = '$CUDA_RESOURCE_GLOBAL' + + if self.build.target.is_linux_x86_64 and self.build.tc.is_clang: + # TODO(somov): Эта настройка должна приезжать сюда автоматически из другого места + self.nvcc_flags.append('-I$OS_SDK_ROOT/usr/include/x86_64-linux-gnu') + + def print_(self): + self.print_variables() + self.print_macros() + + def print_variables(self): + self.have_cuda.emit() + if not self.have_cuda.value: + return + + if self.use_arcadia_cuda.value and self.cuda_host_compiler.value is None: + logger.warning('$USE_ARCADIA_CUDA is set, but no $CUDA_HOST_COMPILER') + + self.setup_vc_root() + + self.cuda_root.emit() + self.cuda_version.emit() + self.use_arcadia_cuda.emit() + self.use_arcadia_cuda_host_compiler.emit() + self.cuda_use_clang.emit() + self.cuda_host_compiler.emit() + self.cuda_host_compiler_env.emit() + self.cuda_host_msvc_version.emit() + self.cuda_nvcc_flags.emit() + + emit('NVCC_UNQUOTED', self.build.host.exe('$CUDA_ROOT', 'bin', 'nvcc')) + emit('NVCC', '${quo:NVCC_UNQUOTED}') emit('NVCC_STD', self.nvcc_std) - emit('NVCC_FLAGS', self.nvcc_flags, '$CUDA_NVCC_FLAGS') + emit('NVCC_FLAGS', self.nvcc_flags, '$CUDA_NVCC_FLAGS') emit('NVCC_OBJ_EXT', '.o' if not self.build.target.is_windows else '.obj') - - def print_macros(self): - if not self.cuda_use_clang.value: + + def print_macros(self): + if not self.cuda_use_clang.value: cmd = '$YMAKE_PYTHON ${input:"build/scripts/compile_cuda.py"} ${tool:"tools/mtime0"} $NVCC $NVCC_FLAGS -c ${input:SRC} -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:SRC} ${pre=-I:_C__INCLUDE} --cflags $C_FLAGS_PLATFORM $CXXFLAGS $NVCC_STD $SRCFLAGS ${input;hide:"build/platform/cuda/cuda_runtime_include.h"} $CUDA_HOST_COMPILER_ENV ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"}' # noqa E501 - else: + else: cmd = '$CXX_COMPILER --cuda-path=$CUDA_ROOT $C_FLAGS_PLATFORM -c ${input:SRC} -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:SRC} ${pre=-I:_C__INCLUDE} $CXXFLAGS $SRCFLAGS $TOOLCHAIN_ENV ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p CU"} ${kv;hide:"pc green"}' # noqa E501 - + emit('_SRC_CU_CMD', cmd) emit('_SRC_CU_PEERDIR', ' '.join(sorted(self.peerdirs))) - - def have_cuda_in_arcadia(self): - host, target = self.build.host_target - + + def have_cuda_in_arcadia(self): + host, target = self.build.host_target + if not any((host.is_linux_x86_64, host.is_macos_x86_64, host.is_windows_x86_64, host.is_linux_powerpc)): - return False - - if host != target: + return False + + if host != target: if not(host.is_linux_x86_64 and target.is_linux_armv8): return False if not self.cuda_version.from_user: return False if self.cuda_version.value not in ('11.3',): raise ConfigureError('Only CUDA 11.3 are available for cross compilation from linux-x86 to linux-aarch64.\nUse -DCUDA_VERSION=11.3 flag.') - + if self.cuda_version.value in ('8.0', '9.0', '9.1', '9.2', '10.0'): raise ConfigureError('CUDA versions 8.x, 9.x and 10.0 are no longer supported.\nSee DEVTOOLS-7108.') - + if self.cuda_version.value in ('10.1', '11.0', '11.1', '11.2', '11.3', '11.4'): - return True - - return False - - def auto_have_cuda(self): - if is_positive('MUSL'): - return False - if self.build.is_sanitized: - return False - return self.cuda_root.from_user or self.use_arcadia_cuda.value and self.have_cuda_in_arcadia() - - def auto_cuda_version(self): - if self.use_arcadia_cuda.value: - return '10.1' - + return True + + return False + + def auto_have_cuda(self): + if is_positive('MUSL'): + return False + if self.build.is_sanitized: + return False + return self.cuda_root.from_user or self.use_arcadia_cuda.value and self.have_cuda_in_arcadia() + + def auto_cuda_version(self): + if self.use_arcadia_cuda.value: + return '10.1' + if not self.have_cuda.value: return None - nvcc_exe = self.build.host.exe(os.path.expanduser(self.cuda_root.value), 'bin', 'nvcc') - - def error(): - raise ConfigureError('Failed to get CUDA version from {}'.format(nvcc_exe)) - - version_output = get_stdout([nvcc_exe, '--version']) or error() + nvcc_exe = self.build.host.exe(os.path.expanduser(self.cuda_root.value), 'bin', 'nvcc') + + def error(): + raise ConfigureError('Failed to get CUDA version from {}'.format(nvcc_exe)) + + version_output = get_stdout([nvcc_exe, '--version']) or error() match = re.search(r'^Cuda compilation tools, release (\d+)\.\d+,', version_output, re.MULTILINE) or error() - - return match.group(1) - + + return match.group(1) + def convert_major_version(self, value): if value == '10': return '10.1' @@ -3116,66 +3116,66 @@ class Cuda(object): else: return value - def auto_use_arcadia_cuda(self): - return not self.cuda_root.from_user - - def auto_use_arcadia_cuda_host_compiler(self): - return not self.cuda_host_compiler.from_user and not self.cuda_use_clang.value - - def auto_cuda_host_compiler(self): - if not self.use_arcadia_cuda_host_compiler.value: - return None - - host, target = self.build.host_target - - if host.is_windows_x86_64 and target.is_windows_x86_64: - return self.cuda_windows_host_compiler() - - return select(( - (host.is_linux_x86_64 and target.is_linux_x86_64, '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/bin/clang'), + def auto_use_arcadia_cuda(self): + return not self.cuda_root.from_user + + def auto_use_arcadia_cuda_host_compiler(self): + return not self.cuda_host_compiler.from_user and not self.cuda_use_clang.value + + def auto_cuda_host_compiler(self): + if not self.use_arcadia_cuda_host_compiler.value: + return None + + host, target = self.build.host_target + + if host.is_windows_x86_64 and target.is_windows_x86_64: + return self.cuda_windows_host_compiler() + + return select(( + (host.is_linux_x86_64 and target.is_linux_x86_64, '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/bin/clang'), (host.is_linux_x86_64 and target.is_linux_armv8, '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/bin/clang'), (host.is_linux_powerpc and target.is_linux_powerpc, '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/bin/clang'), - (host.is_macos_x86_64 and target.is_macos_x86_64, '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/usr/bin/clang'), - )) - - def cuda_windows_host_compiler(self): + (host.is_macos_x86_64 and target.is_macos_x86_64, '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/usr/bin/clang'), + )) + + def cuda_windows_host_compiler(self): vc_version = '14.28.29910' - - env = { - 'Y_VC_Version': vc_version, + + env = { + 'Y_VC_Version': vc_version, 'Y_VC_Root': '$CUDA_HOST_TOOLCHAIN_RESOURCE_GLOBAL/VC/Tools/MSVC/{}'.format(vc_version), - 'Y_SDK_Version': self.build.tc.sdk_version, - 'Y_SDK_Root': '$WINDOWS_KITS_RESOURCE_GLOBAL', - } - + 'Y_SDK_Version': self.build.tc.sdk_version, + 'Y_SDK_Root': '$WINDOWS_KITS_RESOURCE_GLOBAL', + } + if not self.build.tc.ide_msvs: self.peerdirs.append('build/platform/msvc') - self.cuda_host_compiler_env.value = format_env(env) - self.cuda_host_msvc_version.value = vc_version - return '%(Y_VC_Root)s/bin/HostX64/x64/cl.exe' % env - - def setup_vc_root(self): - if not self.cuda_host_compiler.from_user: - return # Already set in cuda_windows_host_compiler() - - if self.cuda_host_compiler_env.from_user: - return # We won't override user setting - - def is_root(dir): - return all(os.path.isdir(os.path.join(dir, name)) for name in ('bin', 'include', 'lib')) - - def get_root(): - path, old_path = os.path.normpath(self.cuda_host_compiler.value), None - while path != old_path: - if is_root(path): - return path - path, old_path = os.path.dirname(path), path - - vc_root = get_root() - if vc_root: - self.cuda_host_compiler_env.value = format_env({'Y_VC_Root': vc_root}) - - + self.cuda_host_compiler_env.value = format_env(env) + self.cuda_host_msvc_version.value = vc_version + return '%(Y_VC_Root)s/bin/HostX64/x64/cl.exe' % env + + def setup_vc_root(self): + if not self.cuda_host_compiler.from_user: + return # Already set in cuda_windows_host_compiler() + + if self.cuda_host_compiler_env.from_user: + return # We won't override user setting + + def is_root(dir): + return all(os.path.isdir(os.path.join(dir, name)) for name in ('bin', 'include', 'lib')) + + def get_root(): + path, old_path = os.path.normpath(self.cuda_host_compiler.value), None + while path != old_path: + if is_root(path): + return path + path, old_path = os.path.dirname(path), path + + vc_root = get_root() + if vc_root: + self.cuda_host_compiler_env.value = format_env({'Y_VC_Root': vc_root}) + + class CuDNN(object): def __init__(self, cuda): """ @@ -3196,50 +3196,50 @@ class CuDNN(object): self.cudnn_version.emit() -def print_swig_config(): - def get_swig_tool(): - tool = preset('USER_SWIG_TOOL') - if not tool: - tool = which('swig') - if not tool: - raise ConfigureError('SWIG_TOOL is not specified and "swig" is not found in PATH') - return os.path.abspath(tool) - - def get_swig_library(tool): - library = preset('USER_SWIG_LIBRARY') - if not library: - library, code = get_stdout_and_code((tool, '-swiglib')) - if code != 0: - raise ConfigureError('SWIG_LIBRARY is not specified and "{} -swiglib" failed'.format(tool)) - library = library.split('\n')[0] - return os.path.abspath(library) - - use_local_swig = to_bool(preset('USER_USE_LOCAL_SWIG'), False) or bool(preset('USER_SWIG_TOOL')) - if use_local_swig: - tool = get_swig_tool() - library = get_swig_library(tool) - - emit('USE_LOCAL_SWIG', True) - emit('SWIG_TOOL', tool) - emit('SWIG_LIBRARY', library) - - +def print_swig_config(): + def get_swig_tool(): + tool = preset('USER_SWIG_TOOL') + if not tool: + tool = which('swig') + if not tool: + raise ConfigureError('SWIG_TOOL is not specified and "swig" is not found in PATH') + return os.path.abspath(tool) + + def get_swig_library(tool): + library = preset('USER_SWIG_LIBRARY') + if not library: + library, code = get_stdout_and_code((tool, '-swiglib')) + if code != 0: + raise ConfigureError('SWIG_LIBRARY is not specified and "{} -swiglib" failed'.format(tool)) + library = library.split('\n')[0] + return os.path.abspath(library) + + use_local_swig = to_bool(preset('USER_USE_LOCAL_SWIG'), False) or bool(preset('USER_SWIG_TOOL')) + if use_local_swig: + tool = get_swig_tool() + library = get_swig_library(tool) + + emit('USE_LOCAL_SWIG', True) + emit('SWIG_TOOL', tool) + emit('SWIG_LIBRARY', library) + + def main(): - options = opts() + options = opts() - arcadia = Arcadia(options.arcadia_root) + arcadia = Arcadia(options.arcadia_root) - ymake = YMake(arcadia) + ymake = YMake(arcadia) - ymake.print_core_conf() - ymake.print_presets() - ymake.print_settings() + ymake.print_core_conf() + ymake.print_presets() + ymake.print_settings() - build = Build(arcadia, options.build_type, options.toolchain_params, force_ignore_local_files=not options.local_distbuild) - build.print_build() + build = Build(arcadia, options.build_type, options.toolchain_params, force_ignore_local_files=not options.local_distbuild) + build.print_build() emit_with_ignore_comment('CONF_SCRIPT_DEPENDS', __file__) -if __name__ == '__main__': +if __name__ == '__main__': main() |