Skip to content

Commit

Permalink
Fixups for the c_std-options
Browse files Browse the repository at this point in the history
Also removed an arg that is not allowed in muon and ignored by meson
  • Loading branch information
amibranch committed Oct 20, 2024
1 parent ee20a0e commit d1b1bf2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
11 changes: 7 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ endif

if cc.has_argument('--std=gnu99')
add_project_arguments('--std=gnu99', language: ['c', 'cpp'])
lang_opt = 'c_std=gnu99'
elif cc.has_argument('--std=c99')
add_project_arguments('--std=c99', language: ['c', 'cpp'])
lang_opt = 'c_std=c99'
endif

# Sanitize correct usage of rz_strf()
Expand Down Expand Up @@ -173,15 +175,15 @@ endforeach
cmake_package_relative_path = run_command(py3_exe, cmake_package_prefix_dir_py, rizin_prefix, rizin_cmakedir / 'xxx', check: true).stdout().strip()

# handle capstone dependency
capstone_dep = dependency('capstone', version: '>=3.0.4', required: get_option('use_sys_capstone'), static: is_static_build)
capstone_dep = dependency('capstone', version: '>=3.0.4', required: get_option('use_sys_capstone'), static: is_static_build, default_options: [lang_opt])
if not capstone_dep.found()
capstone_version = get_option('use_capstone_version')
if fs.is_file('subprojects/capstone-' + capstone_version + '.wrap')
r = run_command(py3_exe, check_meson_subproject_py, 'capstone-' + capstone_version, check: false)
if r.returncode() == 1 and get_option('subprojects_check')
error('Subprojects are not updated. Please run `git clean -dxff subprojects/` to delete all local subprojects directories. If you want to compile against current subprojects then set option `subprojects_check=false`.')
endif
capstone_proj = subproject('capstone-' + capstone_version, default_options: ['default_library=static'])
capstone_proj = subproject('capstone-' + capstone_version, default_options: ['default_library=static', lang_opt])
else
error('Wrong capstone version selected. Please use one of the supported versions.')
endif
Expand Down Expand Up @@ -313,7 +315,7 @@ foreach it : ccs
have_pthread = it_th.found() and it_machine.system() != 'windows'
if it_machine.system() == 'sunos'
# workaround for Solaris until https://github.com/mesonbuild/meson/issues/4328 is fixed
it_mth = declare_dependency(link_args: '-lm', native: it_native)
it_mth = declare_dependency(link_args: '-lm')
else
it_mth = it_cc.find_library('m', required: false, static: is_static_build)
endif
Expand Down Expand Up @@ -564,12 +566,13 @@ if r.returncode() == 1 and get_option('subprojects_check')
error('Subprojects are not updated. Please run `git clean -dxff subprojects/` to delete all local subprojects directories. If you want to compile against current subprojects then set option `subprojects_check=false`.')
endif

libzip_dep = dependency('libzip', required: get_option('use_sys_libzip'), static: is_static_build)
libzip_dep = dependency('libzip', required: get_option('use_sys_libzip'), static: is_static_build, default_options: [ lang_opt ])
if not libzip_dep.found()
libzip_proj = subproject('libzip', default_options: [
'default_library=static',
'static_runtime=@0@'.format(is_static_build),
'use_sys_openssl=@0@'.format(get_option('use_sys_libzip_openssl')),
lang_opt,
])
libzip_dep = libzip_proj.get_variable('libzip_dep')
endif
Expand Down
11 changes: 8 additions & 3 deletions subprojects/rzar/meson.build
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
project('rzar', 'c',
license: 'LGPL-3.0-only',
meson_version: '>=0.55.0',
default_options: [
'c_std=c99',
]
)

# handle ar dependency
ar_files = [
'ar.c'
]

cc = meson.get_compiler('c')

if cc.has_argument('--std=gnu99')
add_project_arguments('--std=gnu99', language: ['c', 'cpp'])
elif cc.has_argument('--std=c99')
add_project_arguments('--std=c99', language: ['c', 'cpp'])
endif

rz_util_dep = dependency('rz_util')
ar_inc = [include_directories(['.'])]

Expand Down
9 changes: 6 additions & 3 deletions subprojects/rzwinkd/meson.build
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
project('rzwinkd', 'c',
license: 'LGPL-3.0-only',
meson_version: '>=0.55.0',
default_options: [
'c_std=c99',
]
)

cc = meson.get_compiler('c')
Expand All @@ -16,6 +13,12 @@ winkd_files = [
'winkd.c',
]

if cc.has_argument('--std=gnu99')
add_project_arguments('--std=gnu99', language: ['c', 'cpp'])
else
add_project_arguments('--std=c99', language: ['c', 'cpp'])
endif

winkd_inc = [include_directories('.')]

rz_util_dep = dependency('rz_util')
Expand Down

0 comments on commit d1b1bf2

Please sign in to comment.