-
Notifications
You must be signed in to change notification settings - Fork 7
/
generate.sh
executable file
·43 lines (36 loc) · 1.22 KB
/
generate.sh
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
#!/usr/bin/bash
set -euo pipefail
cd "${0%/*}"
SCRIPT_DIR="$(pwd)"
# The first step we need to do is build a XED kit. XED doesn't provide a way
# to build just the headers but luckily they are quite consistent between
# different architectures.
cd xed
python3 -B mfile.py install \
--jobs=$(nproc) \
--silent \
--install-dir=../target/xed \
--build-dir=../target/xed-build
cd ..
# Now we generate the bindgen bindings. We use the experimental --wrap-static-fns
# flag in order to also generate bindings for static functions along with a
# source file that forwards to the C definitions.
BINDGEN_ARGS=(
--rust-target 1.64
--allowlist-type 'xed3?_.*'
--allowlist-function '(str2)?xed3?_.*'
--allowlist-var '(XED|xed)_.*'
--blocklist-item 'XED_.*_DEFINED'
--disable-header-comment
--use-core
--no-prepend-enum-name
--impl-debug
--experimental
--wrap-static-fns
--wrap-static-fns-path src/xed-static.c
--wrap-static-fns-suffix _xed_sys_inline
)
bindgen xed.h -o src/bindings.rs \
"${BINDGEN_ARGS[@]}" \
-- \
-Itarget/xed/include