| 1 |
fontations = get_option('fontations') |
| 2 |
|
| 3 |
if (fontations.enabled()) |
| 4 |
rust = import('rust') |
| 5 |
|
| 6 |
generated_fontconfig = rust.bindgen( |
| 7 |
input: fontconfig_h, |
| 8 |
output: 'fontconfig.rs', |
| 9 |
include_directories: incbase, |
| 10 |
args: [ |
| 11 |
'--merge-extern-blocks', |
| 12 |
'--allowlist-item=(FcCharSet.*|FC_(SLANT|WEIGHT|WIDTH)_.*|FcFontSet(Add|Create|Destroy).*|FcLangSet(Create|Destroy|Copy|Add|HasLang)|FcWeightFromOpenType.*|FC_DUAL|FC_MONO)', |
| 13 |
'--raw-line=#![allow(nonstandard_style,unused)]', |
| 14 |
], |
| 15 |
# FC_NO_MT=1 is added here to reduce required headers in bindings generation. |
| 16 |
# It does not mean a functional change in multi-threading behavior. |
| 17 |
c_args: ['-DBINDGEN_IGNORE_VISIBILITY=1', '-DFC_NO_MT=1'], |
| 18 |
) |
| 19 |
|
| 20 |
generated_fcint = rust.bindgen( |
| 21 |
input: ['../src/fcint.h', fclang_h], |
| 22 |
output: 'fcint.rs', |
| 23 |
include_directories: incbase, |
| 24 |
args: [ |
| 25 |
'--merge-extern-blocks', |
| 26 |
'--allowlist-item=(FcPattern.*|FcRange.*|FC_.*_OBJECT|FcCharSet.*|FcLangSetFromCharSet)', |
| 27 |
'--blocklist-type=(FcCharSet|FcLangSet)', |
| 28 |
'--raw-line=#![allow(nonstandard_style,unused)]', |
| 29 |
'--raw-line=extern crate fontconfig_bindings;', |
| 30 |
'--raw-line=pub use fontconfig_bindings::FcCharSet; pub use fontconfig_bindings::FcLangSet;', |
| 31 |
], |
| 32 |
# FC_NO_MT=1 is added here to reduce required headers in bindings generation. |
| 33 |
# It does not mean a functional change in multi-threading behavior. |
| 34 |
c_args: ['-DBINDGEN_IGNORE_VISIBILITY=1', '-DFC_NO_MT=1'], |
| 35 |
) |
| 36 |
|
| 37 |
fontations_bindings_lib = static_library( |
| 38 |
'fontconfig_bindings', |
| 39 |
sources: [generated_fontconfig], |
| 40 |
rust_abi: 'rust', |
| 41 |
) |
| 42 |
|
| 43 |
fcint_bindings_lib = static_library( |
| 44 |
'fcint_bindings', |
| 45 |
sources: [generated_fcint], |
| 46 |
rust_abi: 'rust', |
| 47 |
link_with: [fontations_bindings_lib], |
| 48 |
) |
| 49 |
|
| 50 |
fontations_query_lib = static_library( |
| 51 |
'fc_fontations_query', |
| 52 |
include_directories: incbase, |
| 53 |
sources: ['../src/fcfontations.c', fcstdint_h, fclang_h, alias_headers], |
| 54 |
) |
| 55 |
|
| 56 |
fc_fontations = static_library( |
| 57 |
'fc_fontations', |
| 58 |
sources: ['mod.rs'], |
| 59 |
link_with: [ |
| 60 |
fontations_bindings_lib, |
| 61 |
fcint_bindings_lib, |
| 62 |
pattern_lib, |
| 63 |
fontations_query_lib, |
| 64 |
], |
| 65 |
rust_abi: 'c', |
| 66 |
dependencies: [ |
| 67 |
dependency('skrifa-0.31-rs'), |
| 68 |
dependency('read-fonts-0.29-rs'), |
| 69 |
dependency('font-types-0.9-rs'), |
| 70 |
dependency('libc-0.2-rs'), |
| 71 |
], |
| 72 |
install: true, |
| 73 |
|
| 74 |
) |
| 75 |
|
| 76 |
endif |