generate_dump.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/usr/bin/env bash
  2. set -e
  3. TMP_FOLDER='/tmp/ydb-build-dump'
  4. rm -rf $TMP_FOLDER
  5. mkdir $TMP_FOLDER
  6. PLATFORM=$1
  7. TARGET_PLATFORM=$2
  8. PARAMS_FILE=$TMP_FOLDER/params.json
  9. UNIX_TEMPLATE=$TMP_FOLDER/unix_template.txt
  10. WIN_TEMPLATE=$TMP_FOLDER/win_template.txt
  11. cat <<'EOF'>$UNIX_TEMPLATE
  12. {
  13. "env": {
  14. "CPATH": [""],
  15. "LIBRARY_PATH": [""],
  16. "SDKROOT": [""]
  17. },
  18. "params": {
  19. "c_compiler": "$$($platform)/bin/clang",
  20. "cxx_compiler": "$$($platform)/bin/clang++",
  21. "gcc_version": "14.0",
  22. "llvm-symbolizer": "$$($platform)/bin/llvm-symbolizer",
  23. "match_root": "$platform",
  24. "objcopy": "$$($platform)/bin/llvm-objcopy",
  25. "strip": "$$($platform)/bin/llvm-strip",
  26. "type": "clang",
  27. "werror_mode": "all"
  28. },
  29. "platform": {
  30. "host": {
  31. "arch": "$arch",
  32. "os": "$os",
  33. "toolchain": "default",
  34. "visible_name": "clang14"
  35. },
  36. "target": {
  37. "arch": "$arch",
  38. "os": "$os",
  39. "toolchain": "default",
  40. "visible_name": "clang14"
  41. }
  42. }
  43. }
  44. EOF
  45. cat <<'EOF'>$WIN_TEMPLATE
  46. {
  47. "params": {
  48. "c_compiler": "$$($platform)/bin/Hostx64/x64/cl.exe",
  49. "cxx_compiler": "$$($platform)/bin/Hostx64/x64/cl.exe",
  50. "cxx_std": "c++latest",
  51. "for_ide": "msvs2019",
  52. "match_root": "$platform",
  53. "type": "msvc",
  54. "version": "2019",
  55. "werror_mode": "compiler_specific"
  56. },
  57. "platform": {
  58. "host": {
  59. "arch": "$arch",
  60. "os": "$os",
  61. "toolchain": "default",
  62. "visible_name": "msvc2019"
  63. },
  64. "target": {
  65. "arch": "$arch",
  66. "os": "$os",
  67. "toolchain": "default",
  68. "visible_name": "msvc2019"
  69. }
  70. }
  71. }
  72. EOF
  73. if [[ $PLATFORM = win* ]]
  74. then
  75. TEMPLATE=$WIN_TEMPLATE
  76. else
  77. TEMPLATE=$UNIX_TEMPLATE
  78. fi
  79. DUMP_EXPORT_PATH="$TMP_FOLDER/ymake.$PLATFORM.conf"
  80. # generate params for ymake_conf.py
  81. if base64 --help | grep -q -e '^\s*-w,';then
  82. base64cmd='base64 -w0'
  83. else
  84. base64cmd='base64'
  85. fi
  86. python3 -c "import sys, string as s; v=sys.argv; p = v[1].replace('-', '_'); o, a = v[2].split('-'); print(s.Template(open('$TEMPLATE').read()).substitute(platform=p.upper(), arch=a, os=o.upper()))" $TARGET_PLATFORM $PLATFORM >$DUMP_EXPORT_PATH.params
  87. PARAMS=`cat $DUMP_EXPORT_PATH.params | $base64cmd`
  88. ARCADIA=`realpath .`
  89. python3 $ARCADIA/build/ymake_conf.py $ARCADIA release no --toolchain-params $PARAMS \
  90. -D NO_SVN_DEPENDS=yes -D REPORT_CONFIGURE_PROGRESS=yes -D EXPORT_CMAKE=yes -D TRAVERSE_RECURSE=yes -D TRAVERSE_RECURSE_FOR_TESTS=yes \
  91. -D BUILD_LANGUAGES=CPP -D EXPORTED_BUILD_SYSTEM_SOURCE_ROOT='${CMAKE_SOURCE_DIR}' -D EXPORTED_BUILD_SYSTEM_BUILD_ROOT='${CMAKE_BINARY_DIR}' \
  92. -D OPENSOURCE=yes -D OPENSOURCE_PROJECT=ydb -D HAVE_CUDA=no -D CUDA_VERSION=0.0 -D USE_PREBUILT_TOOLS=no >$DUMP_EXPORT_PATH
  93. # append new line
  94. echo >>$DUMP_EXPORT_PATH
  95. cat $DUMP_EXPORT_PATH
  96. # cp $DUMP_EXPORT_PATH .
  97. # rm -rf $TMP_FOLDER