build.ym 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {% extends '//builtin/pycargo.ym' %}
  2. {% block mod_name %}
  3. cryptography_rust
  4. {% endblock %}
  5. {% block arcadia_tools %}
  6. {{super()}}
  7. devtools/yamaker/libym2/scripts/python3
  8. {% endblock %}
  9. {% block platforms %}
  10. x86_64-unknown-linux-gnu
  11. x86_64-unknown-linux-musl
  12. {% endblock %}
  13. {% block py_register %}
  14. _rust
  15. _openssl
  16. {% endblock %}
  17. {% block current_version %}41.0.6{% endblock %}
  18. {% block current_url %}https://github.com/pyca/cryptography/archive/refs/tags/{{self.version().strip()}}.tar.gz{% endblock %}
  19. {% block patch_source %}
  20. {{super()}}
  21. sed -e 's|cdylib|staticlib|' -i Cargo.toml
  22. {% endblock %}
  23. {% block build_source %}
  24. {% for p in self.platforms().strip().split('\n') %}
  25. export CC_{{p.replace('-', '_')}}=target-cc
  26. {% endfor %}
  27. export CC_x86_64_unknown_linux_musl=musl-gcc
  28. export DEP_OPENSSL_INCLUDE={{arcadia_root}}/contrib/libs/openssl/include
  29. export PYO3_CROSS_PYTHON_VERSION=3.12
  30. rm -rf docs vectors tests
  31. cd src/rust
  32. {{super()}}
  33. rm -r .git
  34. {% endblock %}
  35. {% block sanitize_output %}
  36. {{super()}}
  37. {% for p in self.platforms().strip().split('\n') %}
  38. rm -rf ${OUTPUT}/a/{{p}}/release/build
  39. {% endfor %}
  40. {% endblock %}
  41. {% block prepare_env %}
  42. {{super()}}
  43. export CLANG=$(ya tool c++ --print-path)
  44. cat << EOF > ${BIN}/musl-gcc
  45. #!/usr/bin/env sh
  46. exec ${CLANG} -DUSE_PYTHON3 -I{{arcadia_root}} -I{{arcadia_root}}/contrib/libs/python/Include -I{{arcadia_root}}/contrib/libs/openssl/include -x c "\${@}"
  47. EOF
  48. cat << EOF > ${BIN}/target-cc
  49. #!/usr/bin/env sh
  50. exec ${CLANG} -DUSE_PYTHON3 -I{{arcadia_root}} -I{{arcadia_root}}/contrib/libs/python/Include -I{{arcadia_root}}/contrib/libs/openssl/include -x c "\${@}"
  51. EOF
  52. chmod +x ${BIN}/musl-gcc ${BIN}/target-cc
  53. {% endblock %}