aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/cryptography/next/rust/.yandex_meta/build.ym
blob: ef3eba3d8e6230855e2e6d00e32202a3ef502ee8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{% extends '//builtin/pycargo.ym' %}

{% block mod_name %}
cryptography_rust
{% endblock %}

{% block arcadia_tools %}
{{super()}}
devtools/yamaker/libym2/scripts/python3
{% endblock %}

{% block platforms %}
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
{% endblock %}

{% block py_register %}
_rust
_openssl
{% endblock %}

{% block current_version %}41.0.6{% endblock %}
{% block current_url %}https://github.com/pyca/cryptography/archive/refs/tags/{{self.version().strip()}}.tar.gz{% endblock %}

{% block patch_source %}
{{super()}}
sed -e 's|cdylib|staticlib|' -i Cargo.toml
{% endblock %}

{% block build_source %}
{% for p in self.platforms().strip().split('\n') %}
export CC_{{p.replace('-', '_')}}=target-cc
{% endfor %}
export CC_x86_64_unknown_linux_musl=musl-gcc
export DEP_OPENSSL_INCLUDE={{arcadia_root}}/contrib/libs/openssl/include
export PYO3_CROSS_PYTHON_VERSION=3.12
rm -rf docs vectors tests
cd src/rust
{{super()}}
rm -r .git
{% endblock %}

{% block sanitize_output %}
{{super()}}
{% for p in self.platforms().strip().split('\n') %}
rm -rf ${OUTPUT}/a/{{p}}/release/build
{% endfor %}
{% endblock %}

{% block prepare_env %}
{{super()}}
export CLANG=$(ya tool c++ --print-path)

cat << EOF > ${BIN}/musl-gcc
#!/usr/bin/env sh
exec ${CLANG} -DUSE_PYTHON3 -I{{arcadia_root}} -I{{arcadia_root}}/contrib/libs/python/Include -I{{arcadia_root}}/contrib/libs/openssl/include -x c "\${@}"
EOF

cat << EOF > ${BIN}/target-cc
#!/usr/bin/env sh
exec ${CLANG} -DUSE_PYTHON3 -I{{arcadia_root}} -I{{arcadia_root}}/contrib/libs/python/Include -I{{arcadia_root}}/contrib/libs/openssl/include -x c "\${@}"
EOF

chmod +x ${BIN}/musl-gcc ${BIN}/target-cc
{% endblock %}