build: Add minimal ICU VAPI for UBreakIterator
This commit is contained in:
parent
58cae0ae40
commit
2f81fdf146
5 changed files with 106 additions and 11 deletions
95
bindings/vapi/icu-uc.vapi
Normal file
95
bindings/vapi/icu-uc.vapi
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// Based on icu-uc.vapi from the Dino project.
|
||||
|
||||
[CCode (cprefix="u_")]
|
||||
namespace Icu {
|
||||
|
||||
[CCode (cname = "UChar")]
|
||||
[IntegerType (rank = 5, min = 0, max = 65535)]
|
||||
struct Char {}
|
||||
|
||||
[CCode (cname = "UErrorCode", cprefix = "U_", cheader_filename = "unicode/utypes.h")]
|
||||
enum ErrorCode {
|
||||
ZERO_ERROR,
|
||||
INVALID_CHAR_FOUND,
|
||||
INDEX_OUTOFBOUNDS_ERROR,
|
||||
BUFFER_OVERFLOW_ERROR,
|
||||
STRINGPREP_PROHIBITED_ERROR,
|
||||
UNASSIGNED_CODE_POINT_FOUND,
|
||||
IDNA_STD3_ASCII_RULES_ERROR;
|
||||
|
||||
[CCode (cname = "u_errorName")]
|
||||
public unowned string errorName();
|
||||
|
||||
[CCode (cname = "U_SUCCESS")]
|
||||
public bool is_success();
|
||||
|
||||
[CCode (cname = "U_FAILURE")]
|
||||
public bool is_failure();
|
||||
}
|
||||
|
||||
[CCode (cname = "UParseError", cprefix = "U_", cheader_filename = "unicode/parseerr.h")]
|
||||
struct ParseError {}
|
||||
|
||||
[CCode (cname = "UText", cprefix = "utext_", free_function = "utext_close", cheader_filename = "unicode/utext.h")]
|
||||
[Compact]
|
||||
class Text {
|
||||
[CCode (cname="utext_openUTF8")]
|
||||
public static Text open_utf8(Text* existing, [CCode (array_length_type = "int64_t")] uint8[] text, ref ErrorCode status);
|
||||
}
|
||||
|
||||
[CCode (cname = "UBreakIterator", cprefix = "ubrk_", free_function = "ubrk_close", cheader_filename = "unicode/ubrk.h")]
|
||||
[Compact]
|
||||
class BreakIterator {
|
||||
|
||||
[CCode (cname = "UBRK_DONE")]
|
||||
public const int32 DONE;
|
||||
|
||||
[CCode (cname = "UBreakIteratorType", cprefix = "UBRK_")]
|
||||
public enum Type {
|
||||
CHARACTER,
|
||||
WORD,
|
||||
LINE,
|
||||
SENTENCE;
|
||||
}
|
||||
|
||||
[CCode (cname = "UWordBreak", cprefix = "UBRK_WORD_")]
|
||||
enum WordBreak {
|
||||
NONE,
|
||||
NONE_LIMIT,
|
||||
NUMBER,
|
||||
NUMBER_LIMIT,
|
||||
LETTER,
|
||||
LETTER_LIMIT,
|
||||
KANA,
|
||||
KANA_LIMIT,
|
||||
IDEO,
|
||||
IDEO_LIMIT;
|
||||
}
|
||||
|
||||
public static BreakIterator open(Type type, string locale, Char* text, int32 text_len, ref ErrorCode status);
|
||||
|
||||
public int32 current {
|
||||
[CCode (cname="ubrk_current")] get;
|
||||
}
|
||||
public int32 rule_status {
|
||||
[CCode (cname="ubrk_getRuleStatus")] get;
|
||||
}
|
||||
|
||||
[CCode (cname="ubrk_isBoundary")]
|
||||
public bool is_boundary(int32 offset);
|
||||
|
||||
public int32 first();
|
||||
public int32 last();
|
||||
|
||||
public int32 next();
|
||||
public int32 previous();
|
||||
|
||||
public int32 proceeding(int32 offset);
|
||||
public int32 following(int32 offset);
|
||||
|
||||
[CCode (cname="ubrk_setUText")]
|
||||
public void set_utext(Text text, ref ErrorCode status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
16
meson.build
16
meson.build
|
|
@ -111,6 +111,13 @@ webkit2gtk_web_extension = dependency('webkit2gtk-web-extension-4.0', version: '
|
|||
# following libraries, but the declared dependency is what we actually
|
||||
# build against so we can include the custom VAPI correctly.
|
||||
|
||||
icu_uc = declare_dependency(
|
||||
dependencies: [
|
||||
valac.find_library('icu-uc', dirs: [vapi_dir]),
|
||||
cc.find_library('icuuc'),
|
||||
],
|
||||
)
|
||||
|
||||
if libunwind_dep.found()
|
||||
# We need to add native lib to the search path for these so Flatpak
|
||||
# builds can find it.
|
||||
|
|
@ -131,15 +138,6 @@ libstemmer = declare_dependency(
|
|||
],
|
||||
)
|
||||
|
||||
# Faux ICU dependency to prevent ICU being passed to valac as a
|
||||
# package by meson
|
||||
icu = declare_dependency(
|
||||
dependencies: [
|
||||
cc.find_library('icuuc'),
|
||||
cc.find_library('icudata'),
|
||||
],
|
||||
)
|
||||
|
||||
# Optional dependencies
|
||||
appstream_util = find_program('appstream-util', required: false)
|
||||
desktop_file_validate = find_program('desktop-file-validate', required: false)
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ client_dependencies = [
|
|||
goa,
|
||||
gspell,
|
||||
gtk,
|
||||
icu_uc,
|
||||
javascriptcoregtk,
|
||||
json_glib,
|
||||
libhandy,
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ engine_dependencies = [
|
|||
gio,
|
||||
glib,
|
||||
gmime,
|
||||
icu,
|
||||
icu_uc,
|
||||
libmath,
|
||||
libstemmer,
|
||||
libxml,
|
||||
|
|
@ -416,7 +416,7 @@ engine_internal_dep = declare_dependency(
|
|||
# command line app can still be used.
|
||||
tokeniser_lib = shared_library('geary-tokeniser',
|
||||
files('imap-db/imap-db-fts5-tokeniser.c'),
|
||||
dependencies: [ glib, icu, sqlite ],
|
||||
dependencies: [ glib, icu_uc, sqlite ],
|
||||
c_args: [
|
||||
# Enable GLib structured logging
|
||||
'-DG_LOG_USE_STRUCTURED',
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ foreach dep : valadoc_dependencies
|
|||
valadoc_dep_args += '--pkg'
|
||||
valadoc_dep_args += dep.name()
|
||||
endforeach
|
||||
valadoc_dep_args += [ '--pkg', 'icu-uc' ]
|
||||
valadoc_dep_args += [ '--pkg', 'libstemmer' ]
|
||||
valadoc_dep_args += [ '--pkg', 'posix' ]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue