| 1 |
pixbufloader_sources = files( |
| 2 |
'Cargo.toml', |
| 3 |
'src/lib.rs', |
| 4 |
) |
| 5 |
|
| 6 |
prefix = get_option('prefix') |
| 7 |
|
| 8 |
pixbufloader = custom_target( |
| 9 |
'pixbufloader-svg', |
| 10 |
build_by_default: true, |
| 11 |
output: ['@0@pixbufloader_svg.@1@'.format(cargo_dylib_prefix, ext_dynamic)], |
| 12 |
console: true, |
| 13 |
install: true, |
| 14 |
install_dir: pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_moduledir', pkgconfig_define: ['prefix', prefix]), |
| 15 |
depends: librsvg_rust_dep, |
| 16 |
depend_files: pixbufloader_sources, |
| 17 |
env: extra_env, |
| 18 |
command: [ |
| 19 |
cargo_wrapper, |
| 20 |
cargo_wrapper_args, |
| 21 |
'--command=build', |
| 22 |
'--current-build-dir', '@OUTDIR@', |
| 23 |
'--current-source-dir', meson.current_source_dir(), |
| 24 |
'--packages', 'pixbufloader-svg', |
| 25 |
'--extension', ext_dynamic |
| 26 |
] |
| 27 |
) |
| 28 |
|
| 29 |
pixbuf_thumbnailer = configure_file( |
| 30 |
input: 'librsvg.thumbnailer.in', |
| 31 |
output: 'librsvg.thumbnailer', |
| 32 |
configuration: { |
| 33 |
'bindir': get_option('prefix') / get_option('bindir') |
| 34 |
}, |
| 35 |
install: true, |
| 36 |
install_dir: get_option('datadir') / 'thumbnailers' |
| 37 |
) |
| 38 |
|
| 39 |
if meson.can_run_host_binaries() |
| 40 |
gdk_pixbuf_query_loaders = find_program(pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_query_loaders', default_value: 'gdk-pixbuf-query-loaders')).path() |
| 41 |
else |
| 42 |
gdk_pixbuf_query_loaders = pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_query_loaders', pkgconfig_define: ['prefix', prefix]) |
| 43 |
endif |
| 44 |
|
| 45 |
pixbufloader_svg_install_args = [ |
| 46 |
'--gdk-pixbuf-moduledir', |
| 47 |
pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_moduledir', pkgconfig_define: ['prefix', prefix]), |
| 48 |
gdk_pixbuf_query_loaders, |
| 49 |
pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_cache_file', pkgconfig_define: ['prefix', prefix]) |
| 50 |
] |
| 51 |
|
| 52 |
# Tell people to run gdk-pixbuf-query-loaders manually for cross builds |
| 53 |
if not meson.can_run_host_binaries() |
| 54 |
pixbufloader_svg_install_args += '--show-cross-message' |
| 55 |
endif |
| 56 |
|
| 57 |
meson.add_install_script( |
| 58 |
find_program('meson_install.py', native: true), |
| 59 |
pixbufloader_svg_install_args |
| 60 |
) |
| 61 |
|
| 62 |
if build_tests |
| 63 |
test( |
| 64 |
'Rust tests (pixbufloader-svg)', |
| 65 |
cargo_wrapper, |
| 66 |
timeout: -1, # no timeout |
| 67 |
args: [ |
| 68 |
cargo_wrapper_args, |
| 69 |
'--current-build-dir', meson.current_build_dir(), |
| 70 |
'--command=test', |
| 71 |
'--current-source-dir', meson.current_source_dir(), |
| 72 |
'--packages', 'pixbufloader-svg', |
| 73 |
], |
| 74 |
env: extra_env, |
| 75 |
depends: pixbufloader |
| 76 |
) |
| 77 |
endif |