Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
project('sentry-kernel', 'c',
meson_version: '>=1.4.0',
default_options: [
'c_std=gnu11', 'cpp_std=gnu++20',
'c_std=gnu11', 'cpp_std=gnu++20', 'rust_std=2024',
'warning_level=3', 'optimization=s',
'default_library=static', 'b_pie=false', 'b_staticpic=false',
'licensedir=share/info/sentry-kernel',
Expand All @@ -28,6 +28,18 @@ project('sentry-kernel', 'c',
license_files: [ 'LICENSE' ],
)

with_uapi_opt = get_option('with_uapi')
with_kernel_opt = get_option('with_kernel')
with_idle_opt = get_option('with_idle')
with_doc_opt = get_option('with_doc')
with_tests = get_option('with_tests')
with_tools = get_option('with_tools')
with_proof = get_option('with_proof')

if with_idle_opt or with_autotest
with_uapi_opt = true
endif

meson.add_dist_script('support/meson/version.sh', 'set-dist', meson.project_version())

compiler = meson.get_compiler('c', native: false)
Expand All @@ -43,9 +55,17 @@ ssmod = import('sourceset')
py3 = pymod.find_installation('python3')

kconfig_file = meson.current_source_dir() / 'Kconfig'
kconfig_proj = subproject('kconfig', default_options: ['kconfig=@0@'.format(kconfig_file)])
kconfig_proj = subproject('kconfig',
default_options: [
'kconfig=@0@'.format(kconfig_file),
'with_rlib=@0@'.format(with_uapi_opt)
],
)

kconfig_h = kconfig_proj.get_variable('kconfig_h')
kconfig_rustargs = kconfig_proj.get_variable('kconfig_rustargs')
kconfig_rust_env = kconfig_proj.get_variable('kconfig_rust_env')
kconfig_rust_dep = kconfig_proj.get_variable('kconfig_rust_dep')
kconfig_data = kconfig_proj.get_variable('kconfig_data')

# Testing high security flags of cross compiler. These are gcc 13-14 hardening flags.
Expand Down Expand Up @@ -171,18 +191,7 @@ dtsgen = generator(dts2src,

# all sources are there, sentry source set is populated in each subdir

with_uapi_opt = get_option('with_uapi')
with_kernel_opt = get_option('with_kernel')
with_idle_opt = get_option('with_idle')
with_doc_opt = get_option('with_doc')
with_autotest = kconfig_data.get('CONFIG_BUILD_TARGET_AUTOTEST', 0) == 1
with_tests = get_option('with_tests')
with_tools = get_option('with_tools')
with_proof = get_option('with_proof')

if with_idle_opt or with_autotest
with_uapi_opt = true
endif

# Keep subdir order as-is, do not sort them.
# In order to guanrantee build order and reproducibility,
Expand Down
4 changes: 3 additions & 1 deletion uapi/src/exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use crate::systypes::shm::ShmInfo;
use crate::systypes::{ExchangeHeader, ShmHandle, Status};
use core::ptr::*;

const EXCHANGE_AREA_LEN: usize = 128; // TODO: replace by CONFIG-defined value
use kconfig;

const EXCHANGE_AREA_LEN: usize = kconfig::get!("CONFIG_SVC_EXCHANGE_AREA_LEN", usize);

/// The effective kernelspace/userspace exchange zone, set in a dedicated section
///
Expand Down
3 changes: 3 additions & 0 deletions uapi/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ uapi_modules = files([

subdir('arch')

meson.add_devenv(kconfig_rust_env)

uapi_lib = static_library(
'uapi',
sources : uapi_libfile,
Expand All @@ -23,6 +25,7 @@ uapi_lib = static_library(
override_options: [uapi_rust_std],
extra_files: uapi_modules,
install: true,
dependencies: [kconfig_rust_dep],
)

# XXX:
Expand Down
Loading