Skip to content

Commit

Permalink
use raw-line instead of catting
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Apr 29, 2024
1 parent a2c95a8 commit cebea0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions ribus/gen.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/bin/sh
# install or clone header files of `libxcb-keysyms1-dev`
#!/bin/bash

# These ones are troublesome that bindgen cannot generate correctly.
CUSTOME="\
pub type gsize = usize;
pub const FALSE: gboolean = 0;
pub const TRUE: gboolean = !FALSE;"

OUT=ribus/src/ffi/ibus.rs
bindgen \
/usr/include/ibus-1.0/ibus.h \
--output "$OUT" \
--raw-line "$CUSTOME" \
--opaque-type '_IBus[A-DF-NP-Z].*|_G[A-KM-RT-Z].*|_IBusEngineDesc.*|_IBusObserved.*' \
--allowlist-function 'ibus_(bus|component|engine|engine_desc|factory|text).*' \
--allowlist-function 'ibus_main|ibus_quit|ibus_init' \
Expand All @@ -24,9 +30,3 @@ bindgen \
-- \
--std=c99 \
$(pkg-config --cflags ibus-1.0)

cat << EOF >> "$OUT"
pub type gsize = usize;
pub const FALSE: gboolean = 0;
pub const TRUE: gboolean = !FALSE;
EOF
7 changes: 4 additions & 3 deletions ribus/src/ffi/ibus.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* automatically generated by rust-bindgen 0.69.4 */

pub type gsize = usize;
pub const FALSE: gboolean = 0;
pub const TRUE: gboolean = !FALSE;

pub const IBUS_KEY_BackSpace: u32 = 65288;
pub const IBUS_KEY_Tab: u32 = 65289;
pub const IBUS_KEY_Return: u32 = 65293;
Expand Down Expand Up @@ -866,6 +870,3 @@ extern "C" {
pub fn ibus_bus_request_name_reply_get_type() -> GType;
pub fn ibus_bus_start_service_by_name_reply_get_type() -> GType;
}
pub type gsize = usize;
pub const FALSE: gboolean = 0;
pub const TRUE: gboolean = !FALSE;

0 comments on commit cebea0a

Please sign in to comment.