Meson: some cleanup (#9753)

This commit is contained in:
Paul I 2018-03-23 09:47:46 +03:00 committed by xarkes
parent 57cab6fe34
commit 4e73ad7d19
23 changed files with 310 additions and 273 deletions

View File

@ -115,14 +115,14 @@ r_anal = library('r_anal', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_anal],
subdirs: 'libr',
version: r2version,
name: 'r_anal',
filebase: 'r_anal',
requires: [
'r_util', 'r_reg', 'r_asm', 'r_syscall', 'r_search', 'r_cons', 'r_flag'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_anal],
subdirs: 'libr',
version: r2version,
name: 'r_anal',
filebase: 'r_anal',
requires: [
'r_util', 'r_reg', 'r_asm', 'r_syscall', 'r_search', 'r_cons', 'r_flag'
],
description: 'radare foundation libraries'
)

View File

@ -170,14 +170,14 @@ r_asm = library('r_asm', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_asm],
subdirs: 'libr',
version: r2version,
name: 'r_asm',
filebase: 'r_asm',
requires: [
'r_util', 'r_syscall', 'r_parse', 'r_lang', 'r_flag', 'r_socket'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_asm],
subdirs: 'libr',
version: r2version,
name: 'r_asm',
filebase: 'r_asm',
requires: [
'r_util', 'r_syscall', 'r_parse', 'r_lang', 'r_flag', 'r_socket'
],
description: 'radare foundation libraries'
)

View File

@ -125,13 +125,14 @@ r_bin = library('r_bin', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_bin],
subdirs: 'libr',
version: r2version,
name: 'r_bin',
filebase: 'r_bin',
requires: [
'r_util', 'r_io', 'r_socket', 'r_magic'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_bin],
subdirs: 'libr',
version: r2version,
name: 'r_bin',
filebase: 'r_bin',
requires: [
'r_util', 'r_io', 'r_socket', 'r_magic'
],
description: 'radare foundation libraries'
)

View File

@ -20,14 +20,14 @@ r_bp = library('r_bp', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_bp],
subdirs: 'libr',
version: r2version,
name: 'r_bp',
filebase: 'r_bp',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_bp],
subdirs: 'libr',
version: r2version,
name: 'r_bp',
filebase: 'r_bp',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -10,14 +10,14 @@ r_config = library('r_config', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_config],
subdirs: 'libr',
version: r2version,
name: 'r_config',
filebase: 'r_config',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_config],
subdirs: 'libr',
version: r2version,
name: 'r_config',
filebase: 'r_config',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -24,14 +24,14 @@ r_cons = library('r_cons', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_cons],
subdirs: 'libr',
version: r2version,
name: 'r_cons',
filebase: 'r_cons',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_cons],
subdirs: 'libr',
version: r2version,
name: 'r_cons',
filebase: 'r_cons',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -82,15 +82,16 @@ r_core = library('r_core', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_core],
subdirs: 'libr',
version: r2version,
name: 'r_core',
filebase: 'r_core',
requires: [
'r_util', 'r_reg', 'r_syscall', 'r_search', 'r_cons', 'r_anal', 'r_socket', 'r_io', 'r_fs',
'r_lang', 'r_hash', 'r_flag', 'r_parse', 'r_egg', 'r_debug', 'r_magic', 'r_crypto', 'r_config',
'r_bin', 'r_asm', 'r_bp'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_core],
subdirs: 'libr',
version: r2version,
name: 'r_core',
filebase: 'r_core',
requires: [
'r_util', 'r_reg', 'r_syscall', 'r_search', 'r_cons', 'r_anal', 'r_socket', 'r_io', 'r_fs',
'r_lang', 'r_hash', 'r_flag', 'r_parse', 'r_egg', 'r_debug', 'r_magic', 'r_crypto', 'r_config',
'r_bin', 'r_asm', 'r_bp'
],
description: 'radare foundation libraries'
)

View File

@ -31,19 +31,20 @@ files = [
'trace.c',
]
if host_os == 'linux'
if host_machine.system() == 'linux'
files += [
'p/native/linux/linux_debug.c',
'p/native/linux/linux_coredump.c'
]
endif
if host_os != 'windows'
if host_machine.system() != 'windows'
files += [
'p/native/procfs.c'
]
endif
if host_os == 'darwin'
if host_machine.system() == 'darwin'
files += [
'p/native/xnu/xnu_debug.c',
#'p/native/xnu/trap_arm.c',
@ -71,15 +72,15 @@ r_debug = library('r_debug', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_debug],
subdirs: 'libr',
version: r2version,
name: 'r_debug',
filebase: 'r_debug',
requires: [
'r_util', 'r_hash', 'r_reg', 'r_syscall', 'r_anal', 'r_flag', 'r_io', 'r_bp', 'r_search',
'r_cons', 'r_lang', 'r_egg', 'r_socket'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_debug],
subdirs: 'libr',
version: r2version,
name: 'r_debug',
filebase: 'r_debug',
requires: [
'r_util', 'r_hash', 'r_reg', 'r_syscall', 'r_anal', 'r_flag', 'r_io', 'r_bp', 'r_search',
'r_cons', 'r_lang', 'r_egg', 'r_socket'
],
description: 'radare foundation libraries'
)

View File

@ -23,14 +23,14 @@ r_egg = library('r_egg', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_egg],
subdirs: 'libr',
version: r2version,
name: 'r_egg',
filebase: 'r_egg',
requires: [
'r_util', 'r_asm', 'r_syscall'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_egg],
subdirs: 'libr',
version: r2version,
name: 'r_egg',
filebase: 'r_egg',
requires: [
'r_util', 'r_asm', 'r_syscall'
],
description: 'radare foundation libraries'
)

View File

@ -12,14 +12,14 @@ r_flag = library('r_flag', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_flag],
subdirs: 'libr',
version: r2version,
name: 'r_flag',
filebase: 'r_flag',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_flag],
subdirs: 'libr',
version: r2version,
name: 'r_flag',
filebase: 'r_flag',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -36,14 +36,14 @@ r_fs = library('r_fs', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_fs],
subdirs: 'libr',
version: r2version,
name: 'r_fs',
filebase: 'r_fs',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_fs],
subdirs: 'libr',
version: r2version,
name: 'r_fs',
filebase: 'r_fs',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -22,14 +22,14 @@ r_hash = library('r_hash', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_hash],
subdirs: 'libr',
version: r2version,
name: 'r_hash',
filebase: 'r_hash',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_hash],
subdirs: 'libr',
version: r2version,
name: 'r_hash',
filebase: 'r_hash',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -41,18 +41,18 @@ files = [
'p/io_zip.c',
]
if host_os == 'linux'
files += [
'p/io_r2k_linux.c',
]
if host_machine.system() == 'linux'
files += [
'p/io_r2k_linux.c',
]
endif
if host_os == 'windows'
files += [
'p/io_r2k_windows.c',
'p/io_w32.c',
'p/io_w32dbg.c',
]
if host_machine.system() == 'windows'
files += [
'p/io_r2k_windows.c',
'p/io_w32.c',
'p/io_w32dbg.c',
]
endif
r_io = library('r_io', files,
@ -75,14 +75,14 @@ r_io = library('r_io', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_io],
subdirs: 'libr',
version: r2version,
name: 'r_io',
filebase: 'r_io',
requires: [
'r_util', 'r_socket'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_io],
subdirs: 'libr',
version: r2version,
name: 'r_io',
filebase: 'r_io',
requires: [
'r_util', 'r_socket'
],
description: 'radare foundation libraries'
)

View File

@ -16,14 +16,14 @@ r_lang = library('r_lang', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_lang],
subdirs: 'libr',
version: r2version,
name: 'r_lang',
filebase: 'r_lang',
requires: [
'r_util', 'r_cons'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_lang],
subdirs: 'libr',
version: r2version,
name: 'r_lang',
filebase: 'r_lang',
requires: [
'r_util', 'r_cons'
],
description: 'radare foundation libraries'
)

View File

@ -17,14 +17,14 @@ r_magic = library('r_magic', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_magic],
subdirs: 'libr',
version: r2version,
name: 'r_magic',
filebase: 'r_magic',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_magic],
subdirs: 'libr',
version: r2version,
name: 'r_magic',
filebase: 'r_magic',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -243,7 +243,7 @@ io = [
'winedbg'
]
if host_os == 'windows'
if host_machine.system() == 'windows'
io += [
'w32dbg',
'w32',
@ -267,3 +267,40 @@ parse = [
'avr_pseudo',
'x86_pseudo',
]
include_files = run_command(glob_cmd + ['include/*.h']).stdout().strip().split(';')
install_headers(include_files, subdir: 'libr')
r_util_files = run_command(glob_cmd + ['include/r_util/*.h']).stdout().strip().split(';')
install_headers(r_util_files, subdir: 'libr/r_util')
sdb_files = run_command(glob_cmd + ['include/sdb/*.h']).stdout().strip().split(';')
install_headers(sdb_files, subdir: 'libr/sdb')
sflib_common_files = [
'include/sflib/common/sftypes.h',
'include/sflib/common/sfsocketcall.h'
]
sflib_arch = [
'linux-x86-64',
'linux-x86-32',
'linux-arm-64',
'linux-arm-32',
'darwin-x86-64',
'darwin-x86-32',
'darwin-arm-64'
]
sflib_arch_files = [
'sflib.h',
'sfsyscall.h',
'sfsysnr.h'
]
install_headers(sflib_common_files, subdir: 'libr/sflib/common')
foreach arch : sflib_arch
foreach file : sflib_arch_files
install_headers(join_paths('include/sflib', arch, file), subdir: join_paths('libr/sflib', arch))
endforeach
endforeach

View File

@ -30,14 +30,14 @@ r_parse = library('r_parse', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_parse],
subdirs: 'libr',
version: r2version,
name: 'r_parse',
filebase: 'r_parse',
requires: [
'r_util', 'r_flag', 'r_syscall', 'r_reg'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_parse],
subdirs: 'libr',
version: r2version,
name: 'r_parse',
filebase: 'r_parse',
requires: [
'r_util', 'r_flag', 'r_syscall', 'r_reg'
],
description: 'radare foundation libraries'
)

View File

@ -14,14 +14,14 @@ r_reg = library('r_reg', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_reg],
subdirs: 'libr',
version: r2version,
name: 'r_reg',
filebase: 'r_reg',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_reg],
subdirs: 'libr',
version: r2version,
name: 'r_reg',
filebase: 'r_reg',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -17,14 +17,14 @@ r_search = library('r_search', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_search],
subdirs: 'libr',
version: r2version,
name: 'r_search',
filebase: 'r_search',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_search],
subdirs: 'libr',
version: r2version,
name: 'r_search',
filebase: 'r_search',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -18,14 +18,14 @@ r_socket = library('r_socket', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_socket],
subdirs: 'libr',
version: r2version,
name: 'r_socket',
filebase: 'r_socket',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_socket],
subdirs: 'libr',
version: r2version,
name: 'r_socket',
filebase: 'r_socket',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -10,14 +10,13 @@ r_syscall = library('r_syscall', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_syscall],
subdirs: 'libr',
version: r2version,
name: 'r_syscall',
filebase: 'r_syscall',
requires: [
'r_util'
],
description: 'radare foundation libraries')
pkgconfig_mod.generate(libraries: [r_syscall],
subdirs: 'libr',
version: r2version,
name: 'r_syscall',
filebase: 'r_syscall',
requires: [
'r_util'
],
description: 'radare foundation libraries'
)

View File

@ -93,12 +93,11 @@ r_util = library('r_util', files,
implicit_include_directories: false
)
pkg = import('pkgconfig')
pkg.generate(libraries: [r_util],
subdirs: 'libr',
version: r2version,
name: 'r_util',
filebase: 'r_util',
description: 'radare foundation libraries')
pkgconfig_mod.generate(
libraries: [r_util],
subdirs: 'libr',
version: r2version,
name: 'r_util',
filebase: 'r_util',
description: 'radare foundation libraries'
)

View File

@ -2,6 +2,8 @@ project('radare2', 'c', meson_version: '>=0.45.0')
py3_exe = import('python3').find_python()
git_exe = find_program('git')
pkgconfig_mod = import('pkgconfig')
glob_cmd = [py3_exe, '-c', 'from sys import argv; print(";".join(__import__("glob").glob(argv[1])))']
# Get r2 version
r2version = run_command(py3_exe, 'sys/version.py')
@ -68,19 +70,11 @@ pth = cc.find_library('pthread', required: false)
utl = cc.find_library('util', required: false)
mth = cc.find_library('m', required: false)
# detect OS
if cc.get_define('__linux__') == '1'
host_os = 'linux'
else
host_os = 'darwin'
endif
platform_deps = []
platform_inc = include_directories(['.', 'libr/include'])
if host_machine.system() == 'windows'
platform_deps = [cc.find_library('ws2_32')]
platform_inc = include_directories(['.', 'libr/include', 'libr/include/msvc'])
host_os = 'windows'
if get_option('default_library') == 'static'
if get_option('buildtype') == 'release' and not meson.is_subproject()
add_project_arguments('/MT', language: 'c')
@ -113,9 +107,11 @@ conf_data.set('plugins_debug', '&r_debug_plugin_' + ',&r_debug_plugin_'.join(deb
conf_data.set('plugins_egg', '&r_egg_plugin_' + ',&r_egg_plugin_'.join(egg) + ', 0')
conf_data.set('plugins_lang', '&r_lang_plugin_' + ',&r_lang_plugin_'.join(lang) + ', 0')
conf_data.set('plugins_parse', '&r_parse_plugin_' + ',&r_parse_plugin_'.join(parse) + ', 0')
config_h = configure_file(input: 'libr/config.h.in',
output: 'config.h',
configuration: conf_data)
config_h = configure_file(
input: 'libr/config.h.in',
output: 'config.h',
configuration: conf_data
)
userconf = configuration_data()
userconf.set('DEBUGGER', 1)
@ -133,9 +129,11 @@ if host_machine.system() == 'windows'
else
userconf.set('HAVE_JEMALLOC', 1)
endif
r_userconf_h = configure_file(input: 'libr/include/r_userconf.h.in',
output: 'r_userconf.h',
configuration: userconf)
r_userconf_h = configure_file(
input: 'libr/include/r_userconf.h.in',
output: 'r_userconf.h',
configuration: userconf
)
install_headers(r_userconf_h, subdir: 'libr')
versionconf = configuration_data()
@ -144,9 +142,11 @@ versionconf.set('R2_VERSION', r2version)
versionconf.set('R2_GITTAP', gittap)
versionconf.set('R2_GITTIP', gittip)
versionconf.set('R2_BIRTH', r2birth)
r_version_h = configure_file(input: 'libr/include/r_version.h.in',
output: 'r_version.h',
configuration: versionconf)
r_version_h = configure_file(
input: 'libr/include/r_version.h.in',
output: 'r_version.h',
configuration: versionconf
)
install_headers(r_version_h, subdir: 'libr')
# Copy missing header
@ -154,14 +154,17 @@ run_command(py3_exe, '-c', '__import__("shutil").copyfile("shlr/spp/config.def.h
pcconf = configuration_data()
pcconf.set('PREFIX', get_option('prefix'))
pcconf.set('LIBDIR', get_option('libdir'))
pcconf.set('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
pcconf.set('VERSION', r2version)
libr_pc = configure_file(input: 'libr/libr.pc.acr',
output: 'libr.pc',
configuration: userconf)
libr_pc = configure_file(
input: 'libr/libr.pc.acr',
output: 'libr.pc',
configuration: userconf
)
install_data(libr_pc, install_dir: join_paths(get_option('libdir'), 'pkgconfig'))
subdir('shlr/')
subdir('libr/util')
subdir('libr/hash')
subdir('libr/crypto')
@ -185,14 +188,12 @@ subdir('libr/fs')
subdir('libr/debug')
subdir('libr/core')
subdir('libr/include')
subdir('shlr/sdb')
subdir('libr/anal/d')
subdir('libr/asm/d')
subdir('libr/bin/d')
subdir('libr/syscall/d')
subdir('libr/cons/d')
subdir('libr/magic/d')
@ -225,19 +226,17 @@ install_subdir('shlr/www',
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'radare2', r2version)
)
patterned_filelist = [py3_exe, '-c', 'from sys import argv; print(";".join(__import__("glob").glob(argv[1])))']
fortunes_files = run_command(patterned_filelist + ['doc/fortunes.*']).stdout().strip().split(';')
fortunes_files = run_command(glob_cmd + ['doc/fortunes.*']).stdout().strip().split(';')
install_data(fortunes_files,
install_dir: join_paths(get_option('datadir'), 'doc/radare2')
)
man1_files = run_command(patterned_filelist + ['man/*.1']).stdout().strip().split(';')
man1_files = run_command(glob_cmd + ['man/*.1']).stdout().strip().split(';')
install_data(man1_files,
install_dir: join_paths(get_option('mandir'), 'man1')
)
man7_files = run_command(patterned_filelist + ['man/*.7']).stdout().strip().split(';')
man7_files = run_command(glob_cmd + ['man/*.7']).stdout().strip().split(';')
install_data(man7_files,
install_dir: join_paths(get_option('mandir'), 'man7')
)