170 lines
4.3 KiB
Meson
170 lines
4.3 KiB
Meson
project('saltywitch', 'c',
|
|
version: 'trunk',
|
|
license: 'BSD-3-Clause',
|
|
meson_version: '>=1.1.0',
|
|
default_options: [
|
|
'c_std=c99',
|
|
'b_asneeded=true',
|
|
'b_lto=true',
|
|
'b_lundef=false',
|
|
'b_ndebug=if-release',
|
|
'b_pie=true',
|
|
'b_staticpic=true',
|
|
'warning_level=2',
|
|
'werror=false',
|
|
],
|
|
)
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
# Default Flags
|
|
add_project_arguments(
|
|
cc.get_supported_arguments([
|
|
'-Walloca',
|
|
'-Warith-conversion',
|
|
'-Warray-bounds-pointer-arithmetic',
|
|
'-Warray-bounds=2',
|
|
'-Wbad-function-cast',
|
|
'-Wbitwise-instead-of-logical',
|
|
'-Wcast-align=strict',
|
|
'-Wcomma',
|
|
'-Wconditional-uninitialized',
|
|
'-Wconversion',
|
|
'-Wdate-time',
|
|
'-Wduplicated-branches',
|
|
'-Wduplicated-cond',
|
|
'-Wendif-labels',
|
|
'-Wenum-int-mismatch',
|
|
'-Wfloat-equal',
|
|
'-Wformat-overflow=2',
|
|
'-Wformat-security',
|
|
'-Wformat-truncation=2',
|
|
'-Wformat-type-confusion',
|
|
'-Wformat=2',
|
|
'-Wimplicit-fallthrough=5',
|
|
'-Wimplicit-int',
|
|
'-Winit-self',
|
|
'-Wjump-misses-init',
|
|
'-Wliteral-range',
|
|
'-Wlogical-op',
|
|
'-Wloop-analysis',
|
|
'-Wmaybe-unitialized',
|
|
'-Wmisleading-indentation',
|
|
'-Wmissing-include-dirs',
|
|
'-Wmissing-noreturn',
|
|
'-Wmissing-prototypes',
|
|
'-Wnested-externs',
|
|
'-Wno-format-nonliteral',
|
|
'-Wno-missing-braces',
|
|
'-Wno-missing-field-initializers',
|
|
'-Wno-typedef-redefinition',
|
|
'-Wnull-dereference',
|
|
'-Woverflow',
|
|
'-Wredundant-decls',
|
|
'-Wshadow',
|
|
'-Wshift-sign-overflow',
|
|
'-Wshorten-64-to-32',
|
|
'-Wsign-conversion',
|
|
'-Wsizeof-pointer-memaccess',
|
|
'-Wstack-usage=1000000',
|
|
'-Wstrict-overflow=3',
|
|
'-Wstrict-prototypes',
|
|
'-Wswitch-enum',
|
|
'-Wtautological-constant-in-range-compare',
|
|
'-Wthread-safety',
|
|
'-Wtraditional-conversion',
|
|
'-Wtrampolines',
|
|
'-Wundef',
|
|
'-Wuninitialized',
|
|
'-Wunused-but-set-variable',
|
|
'-Wuse-after-free=3',
|
|
'-Wvla',
|
|
'-Wwrite-strings',
|
|
|
|
'-Wno-error=#warnings',
|
|
'-Wno-error=attribute-warning',
|
|
'-Wno-error=unknown-attributes',
|
|
'-Wno-error=unknown-pragmas',
|
|
'-Wno-error=unused-parameter',
|
|
|
|
'-fcf-protection=full',
|
|
'-fno-common',
|
|
'-fno-delete-null-pointer-checks',
|
|
'-fno-strict-aliasing',
|
|
'-fstack-clash-protection',
|
|
'-fstack-protector',
|
|
'-fstack-protector-strong',
|
|
'-fwrapv',
|
|
'-fzero-call-used-regs=all',
|
|
]), language: 'c'
|
|
)
|
|
|
|
if get_option('buildtype') != 'debug'
|
|
add_project_arguments(
|
|
cc.get_supported_arguments([
|
|
'-ffunction-sections',
|
|
'-fdata-sections',
|
|
]), language: 'c'
|
|
)
|
|
|
|
add_project_link_arguments(
|
|
cc.get_supported_link_arguments([
|
|
'-Wl,--gc-sections',
|
|
'-Wl,-z,noexecstack',
|
|
'-Wl,-z,noexecheap',
|
|
'-Wl,-z,now',
|
|
'-Wl,-z,relro',
|
|
'-Wl,-z,separate-code',
|
|
]), language: 'c'
|
|
)
|
|
|
|
add_project_arguments([
|
|
'-D_FORTIFY_SOURCE=3',
|
|
], language: 'c'
|
|
)
|
|
endif
|
|
|
|
add_project_arguments([
|
|
'-D_DEFAULT_SOURCE',
|
|
], language: 'c'
|
|
)
|
|
|
|
erts_inc = get_option('erts_include_dir')
|
|
erl_interface_inc = get_option('erl_interface_include_dir')
|
|
erl_interface_lib_dir = get_option('erl_interface_lib_dir')
|
|
|
|
erl_interface_dep = cc.find_library('ei', dirs: [erl_interface_lib_dir], static: true, required: true)
|
|
|
|
sodium_dep = dependency('libsodium', version: '1.0.18', required: true)
|
|
|
|
saltywitch_src = files([
|
|
'c_src/saltywitch.c',
|
|
|
|
'c_src/atoms.c',
|
|
'c_src/auth.c',
|
|
'c_src/generichash.c',
|
|
'c_src/kx.c',
|
|
'c_src/pwhash.c',
|
|
'c_src/random.c',
|
|
'c_src/secretbox.c',
|
|
'c_src/shorthash.c',
|
|
])
|
|
|
|
saltywitch = shared_library(
|
|
'saltywitch',
|
|
saltywitch_src,
|
|
gnu_symbol_visibility: 'hidden',
|
|
include_directories: [ erl_interface_inc, erts_inc ],
|
|
dependencies: [ erl_interface_dep, sodium_dep ],
|
|
name_prefix: '',
|
|
install: true,
|
|
install_dir: 'priv',
|
|
)
|
|
|
|
summary(
|
|
{
|
|
'C compiler' : cc.get_id(),
|
|
'C linker' : cc.get_linker_id(),
|
|
}, bool_yn: true
|
|
)
|