Skip to content

Commit

Permalink
uapi: rename subdir uapi -> src
Browse files Browse the repository at this point in the history
this is not the standard layout, even for Cargo
  • Loading branch information
fvalette-ledger committed Nov 27, 2024
1 parent 37008de commit f0219e9
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

project('sentry-kernel', 'c',
meson_version: '>=1.3.0',
meson_version: '>=1.4.0',
default_options: [
'c_std=gnu11', 'cpp_std=gnu++20',
'warning_level=3', 'optimization=s',
Expand Down
3 changes: 0 additions & 3 deletions uapi/uapi/Cargo.toml → uapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ license = "Apache 2.0"
description = "Sentry kernel user API implementation"
categories = ["os::api"]

[lib]
path = "lib.rs"

[dependencies]

[dev-dependencies]
Expand Down
29 changes: 5 additions & 24 deletions uapi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,18 @@ rust_toolchain_config = configuration_data()
rust_toolchain_config.set('channel', get_option('rust-channel'))
rust_toolchain_config.set('target', kconfig_data.get_unquoted('CONFIG_RUSTC_TARGET'))

rust_edition = '2021'
uapi_rust_std = 'rust_std=' + rust_edition

global_rust_build_args = [
'@' + fs.parent(kconfig_rustargs) / fs.name(kconfig_rustargs),
target_rustargs,
'-C', 'lto=true', '-C', 'relocation-model=pic', '-C', 'link-args=--emit-relocs'
]

subdir('include/uapi')
subdir('uapi')

py3 = pymod.find_installation('python3', modules: ['git'])

# XXX:
# This deps is designed for userspace (libshied) only
# As in linux kernel, uapi headers are not used w/ a kernel name and/or uapi
# prefix. So, add the uapi include subdir in "include_directories".
sentry_c_uapi_dep = declare_dependency(
link_with: uapi_lib,
sources: [ uapi_h ],
compile_args: [ global_build_args, target_arch_args ],
include_directories: [ userspace_uapi_include_dir ],
)
rust_edition = '2021'
uapi_rust_std = 'rust_std=' + rust_edition
uapi_manifest = files('Cargo.toml')

pkg_config = import('pkgconfig')
pkg_config.generate(
uapi_lib,
filebase: 'uapi',
extra_cflags: [ global_build_args, target_arch_args ],
)
subdir('include/uapi')
subdir('src')

install_data(
'task.Kconfig',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 19 additions & 3 deletions uapi/uapi/meson.build → uapi/src/meson.build
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# SPDX-FileCopyrightText: 2023-2024 Ledger SAS
# SPDX-License-Identifier: Apache-2.0

rust = import('rust')

uapi_manifest = files('Cargo.toml')
uapi_libfile = files('lib.rs')

# XXX:
Expand All @@ -29,6 +26,25 @@ uapi_lib = static_library(
install: true,
)

# XXX:
# This deps is designed for userspace (libshied) only
# As in linux kernel, uapi headers are not used w/ a kernel name and/or uapi
# prefix. So, add the uapi include subdir in "include_directories".
sentry_c_uapi_dep = declare_dependency(
link_with: uapi_lib,
sources: [ uapi_h ],
compile_args: [ global_build_args, target_arch_args ],
include_directories: [ userspace_uapi_include_dir ],
)

# Generate pkg config file uapi.pc for C app using c_ffi static library
pkg_config = import('pkgconfig')
pkg_config.generate(
uapi_lib,
filebase: 'uapi',
extra_cflags: [ global_build_args, target_arch_args ],
)

cargo = find_program('cargo', required: true)

if with_doc_opt
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f0219e9

Please sign in to comment.