-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbindgen.sh
26 lines (22 loc) · 1.18 KB
/
bindgen.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
#!/bin/bash
BINDGEN_VERSION=$(bindgen --version | grep -v -e '^cargo')
bindgen -o src/ffi.rs \
--raw-line "/// Generated with: ${BINDGEN_VERSION}" \
--whitelist-var "LUA.*" \
--whitelist-var "LUAJIT.*" \
--whitelist-type "lua_.*" \
--whitelist-type "luaL_.*" \
--whitelist-function "lua_.*" \
--whitelist-function "luaL_.*" \
--whitelist-function "luaJIT.*" \
--ctypes-prefix "libc" \
--use-core \
--impl-debug \
ffi.h -- -I luajit/src
sed -i -e 's/pub fn \(luaJIT_[^\(]*\)/\/\/\/ <https:\/\/luajit.org\/ext_c_api.html> \n pub fn \1/' src/ffi.rs
sed -i -e 's/pub fn \(lua_[^\(]*\)/\/\/\/ <https\:\/\/www.lua.org\/manual\/5.1\/manual.html#\1> \n pub fn \1/' src/ffi.rs
sed -i -e 's/pub fn \(luaL_[^\(]*\)/\/\/\/ <https\:\/\/www.lua.org\/manual\/5.1\/manual.html#\1> \n pub fn \1/' src/ffi.rs
sed -i -e 's/pub type \(lua_[^\=]*\)/\/\/\/ <https\:\/\/www.lua.org\/manual\/5.1\/manual.html#\1> \n pub type \1/' src/ffi.rs
sed -i -e 's/pub struct \(lua_[^\{]*\)/\/\/\/ <https\:\/\/www.lua.org\/manual\/5.1\/manual.html#\1> \n pub struct \1/' src/ffi.rs
sed -i -e 's/pub struct \(luaL_[^\{]*\)/\/\/\/ <https\:\/\/www.lua.org\/manual\/5.1\/manual.html#\1> \n pub struct \1/' src/ffi.rs
cargo +stable fmt