From cebea0af3f6b9783a4c112b4c02f825de23345fe Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Tue, 30 Apr 2024 05:31:35 +0700 Subject: [PATCH] use raw-line instead of catting --- ribus/gen.sh | 16 ++++++++-------- ribus/src/ffi/ibus.rs | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ribus/gen.sh b/ribus/gen.sh index 51234d6..a79a2ae 100644 --- a/ribus/gen.sh +++ b/ribus/gen.sh @@ -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' \ @@ -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 diff --git a/ribus/src/ffi/ibus.rs b/ribus/src/ffi/ibus.rs index 2839a6d..6a3de7c 100644 --- a/ribus/src/ffi/ibus.rs +++ b/ribus/src/ffi/ibus.rs @@ -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; @@ -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;