rusticl, meson: Move libc functions to their own crate

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21305>
This commit is contained in:
Antonio Gomes 2023-09-14 19:16:56 -03:00 committed by Marge Bot
parent 84db4d5698
commit bcd7538d03
4 changed files with 33 additions and 5 deletions

View file

@ -2,6 +2,7 @@ use crate::compiler::nir::*;
use crate::pipe::screen::*;
use crate::util::disk_cache::*;
use libc_rust_gen::malloc;
use mesa_rust_gen::*;
use mesa_rust_util::serialize::*;
use mesa_rust_util::string::*;

View file

@ -1,3 +1,4 @@
use libc_rust_gen::free;
use mesa_rust_gen::*;
use std::ffi::{c_void, CString};

View file

@ -1,4 +1,4 @@
# Copyright ©
# Copyright ©
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -221,6 +221,23 @@ rusticl_mesa_bindings_inline_wrapper = static_library(
],
)
rusticl_libc_bindings_rs = rust.bindgen(
input : 'rusticl_libc_bindings.h',
output : 'rusticl_libc_bindings.rs',
dependencies: [
dep_valgrind,
],
c_args : [
rusticl_bindgen_c_args,
pre_args,
],
args : [
rusticl_bindgen_args,
'--allowlist-function', 'free',
'--allowlist-function', 'malloc',
]
)
rusticl_mesa_bindings_rs = rust.bindgen(
input : 'rusticl_mesa_bindings.h',
output : 'rusticl_mesa_bindings.rs',
@ -240,10 +257,6 @@ rusticl_mesa_bindings_rs = rust.bindgen(
],
args : [
rusticl_bindgen_args,
# libc
'--allowlist-function', 'free',
'--allowlist-function', 'malloc',
# mesa utils
'--allowlist-function', 'blob_.*',
'--allowlist-function', 'disk_cache_.*',
@ -324,6 +337,16 @@ libmesa_rust_gen = static_library(
],
)
libc_rust_gen = static_library(
'libc_rust_gen',
rusticl_libc_bindings_rs,
gnu_symbol_visibility : 'hidden',
rust_crate_type : 'rlib',
rust_args : [
rusticl_gen_args,
],
)
libmesa_rust_util = static_library(
'mesa_rust_util',
[libmesa_rust_util_files],
@ -343,6 +366,7 @@ libmesa_rust = static_library(
rusticl_args,
],
link_with : [
libc_rust_gen,
libmesa_rust_gen,
libmesa_rust_util,
rusticl_mesa_bindings_inline_wrapper,
@ -368,6 +392,7 @@ librusticl = static_library(
rusticl_args,
],
link_with : [
libc_rust_gen,
libmesa_rust,
libmesa_rust_gen,
libmesa_rust_util,

View file

@ -0,0 +1 @@
#include <stdlib.h>