Simplify meson logic and use ole's PR to fix Windows ##build

* Kudos to @oleavr for reproducing, spotting and fixing the bug!
* Context https://github.com/mesonbuild/meson/pull/9918
This commit is contained in:
pancake 2022-01-31 23:54:00 +01:00 committed by GitHub
parent feaa4e7f73
commit 50bf4d5918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 401 additions and 384 deletions

View File

@ -41,6 +41,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
# with:
# python-version: '3.7'
- name: Preparing nmake
uses: ilammy/msvc-dev-cmd@v1
with:
@ -48,7 +50,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install meson ninja r2pipe wget
pip install git+https://github.com/frida/meson.git@f7f25b19a8d71cebf8e2934733eb041eb6862eee
pip install ninja r2pipe wget
- name: Extract r2 version
run: echo "##[set-output name=branch;]$( cd sys; python version.py )"
id: r2v
@ -59,7 +62,7 @@ jobs:
call configure
call make
- name: Test executable
continue-on-error: true
# continue-on-error: true
shell: cmd
run: |
cd prefix\bin
@ -71,10 +74,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
# with:
# python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install meson ninja r2pipe wget
pip install git+https://github.com/frida/meson.git@f7f25b19a8d71cebf8e2934733eb041eb6862eee
pip install ninja r2pipe wget
- name: Extract r2 version
run: echo "##[set-output name=branch;]$( cd sys;python version.py )"
id: r2v
@ -110,6 +116,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
# with:
# python-version: '3.7'
- name: Preparing nmake
uses: ilammy/msvc-dev-cmd@v1
with:
@ -117,7 +125,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install meson ninja r2pipe wget
pip install git+https://github.com/frida/meson.git@f7f25b19a8d71cebf8e2934733eb041eb6862eee
pip install ninja r2pipe wget
- name: Extract r2 version
run: echo "##[set-output name=branch;]$( cd sys; python version.py )"
id: r2v

28
binr/meson.build Normal file
View File

@ -0,0 +1,28 @@
cli_option = get_option('cli')
if cli_option.auto()
cli_enabled = not meson.is_subproject()
else
cli_enabled = cli_option.enabled()
endif
if cli_enabled
if get_option('blob')
subdir('blob')
else
subdir('rahash2')
subdir('rarun2')
subdir('rasm2')
subdir('rabin2')
subdir('radare2')
subdir('ragg2')
subdir('r2agent')
subdir('radiff2')
subdir('rafind2')
subdir('rasign2')
subdir('ravc2')
subdir('rax2')
endif
subdir('r2pm')
subdir('r2r')
endif

View File

@ -26,6 +26,7 @@ r_cons = library('r_cons', r_cons_sources,
include_directories: [platform_inc],
c_args: library_cflags,
dependencies: [r_util_dep],
link_with: [r_util],
install: true,
implicit_include_directories: false,
install_rpath: rpath_lib,

View File

@ -25,6 +25,7 @@ r_crypto_sources = [
r_crypto = library('r_crypto', r_crypto_sources,
include_directories: [platform_inc],
dependencies: [r_util_dep],
link_with: [r_util],
c_args: library_cflags,
install: true,
implicit_include_directories: false,

View File

@ -82,6 +82,7 @@ endif
r_io = library('r_io', r_io_sources,
include_directories: platform_inc,
link_with: [r_util, r_socket],
dependencies: r_io_deps,
c_args: library_cflags,
install: true,

View File

@ -10,15 +10,16 @@ r_socket_sources = [
'run.c',
]
dependencies = [utl, r_util_dep, platform_deps]
r_util_deps = [utl, r_util_dep, platform_deps]
if use_sys_openssl
dependencies += [sys_openssl]
r_util_deps += [sys_openssl]
endif
r_socket = library('r_socket', r_socket_sources,
include_directories: [platform_inc],
dependencies: dependencies,
dependencies: r_util_deps,
link_with: [r_util],
c_args: library_cflags,
install: true,
implicit_include_directories: false,

View File

@ -87,9 +87,9 @@ r_util_sources = [
'sys_w32.c',
'zip.c',
'protobuf.c',
join_paths('regex','regcomp.c'),
join_paths('regex','regexec.c'),
join_paths('regex','regerror.c')
'regex/regcomp.c',
'regex/regexec.c',
'regex/regerror.c'
]
if get_option('sdb_cgen')
@ -120,8 +120,8 @@ r_util = library('r_util', r_util_sources,
)
r_util_dep = declare_dependency(link_with: r_util,
include_directories: platform_inc,
dependencies: r_util_deps)
include_directories: platform_inc,
dependencies: r_util_deps)
pkgconfig_mod.generate(r_util,
subdirs: ['libr', 'libr/sdb'],

View File

@ -4,6 +4,7 @@ if "%*" == "clean" (
wsl rm -rf b vs
exit /b 0
)
call ninja.exe --version > NUL 2> NUL && (
if EXIST b (
REM meson compile -C b

View File

@ -97,7 +97,7 @@ else
endif
platform_deps = []
platform_inc = ['.', join_paths('libr','include')]
platform_inc = ['.', 'libr/include']
if host_machine.system() == 'windows'
platform_deps = [cc.find_library('ws2_32'), cc.find_library('wininet'), cc.find_library('psapi')]
endif
@ -117,6 +117,7 @@ if get_option('wasan')
# add_project_arguments('/Z7', language: 'c') # generate .symbols instead of .pdb
# add_project_arguments('/guard:cf', language: 'c')
endif
if cc.get_id() == 'clang-cl'
add_project_arguments('-D__STDC__=1', language: 'c')
add_project_arguments('-D_CRT_DECLARE_NONSTDC_NAMES ', language: 'c')
@ -125,7 +126,7 @@ if cc.get_id() == 'clang-cl'
endif
if get_option('default_library') == 'shared'
if host_machine.system() != 'windows' or cc.get_id()!='msvc' and cc.get_id()!='clang-cl'
if host_machine.system() != 'windows' or cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
add_project_arguments('-fvisibility=hidden', language: 'c')
endif
endif
@ -135,7 +136,7 @@ library_cflags = ['-DR2_PLUGIN_INCORE=1']
if host_machine.system() == 'windows'
r2_prefix = '.'
r2_libdir = 'lib'
r2_incdir = join_paths('include', 'libr')
r2_incdir = 'include/libr'
r2_datdir = 'share'
opts1 = [
@ -235,7 +236,7 @@ conf_data.set('plugins_parse', '&r_parse_plugin_' + ', &r_parse_plugin_'.join(pa
#)
config_h = configure_file(
input: join_paths('libr','config.h.in'),
input: 'libr/config.h.in',
output: 'config.h',
configuration: conf_data
)
@ -385,10 +386,10 @@ foreach item : [
endforeach
r_userconf_h = configure_file(
input: join_paths('libr','include','r_userconf.h.acr'),
input: 'libr/include/r_userconf.h.acr',
output: 'r_userconf.h',
configuration: userconf,
install_dir: join_paths(r2_incdir)
install_dir: r2_incdir
)
versionconf = configuration_data()
@ -406,7 +407,7 @@ r_version_h = configure_file(
input: 'libr/include/r_version.h.in',
output: 'r_version.h',
configuration: versionconf,
install_dir: join_paths(r2_incdir)
install_dir: r2_incdir
)
# Copy missing header
@ -423,75 +424,39 @@ libr_pc = configure_file(
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
)
# handle zlib dependency
zlib_dep = dependency('zlib', required: false)
if not zlib_dep.found() or not get_option('use_sys_zlib')
message('Use bundled zlib')
zlib_files = [
join_paths('shlr','zip','zlib','adler32.c'),
join_paths('shlr','zip','zlib','compress.c'),
join_paths('shlr','zip','zlib','crc32.c'),
join_paths('shlr','zip','zlib','deflate.c'),
join_paths('shlr','zip','zlib','gzclose.c'),
join_paths('shlr','zip','zlib','gzlib.c'),
join_paths('shlr','zip','zlib','gzread.c'),
join_paths('shlr','zip','zlib','gzwrite.c'),
join_paths('shlr','zip','zlib','infback.c'),
join_paths('shlr','zip','zlib','inffast.c'),
join_paths('shlr','zip','zlib','inflate.c'),
join_paths('shlr','zip','zlib','inftrees.c'),
join_paths('shlr','zip','zlib','trees.c'),
join_paths('shlr','zip','zlib','uncompr.c'),
join_paths('shlr','zip','zlib','zutil.c')
]
zlib_inc = [platform_inc, include_directories(join_paths('shlr','zip','zlib'))]
libr2zlib = static_library('r2zlib', zlib_files,
include_directories: zlib_inc,
implicit_include_directories: false
)
zlib_dep = declare_dependency(
link_with: libr2zlib,
include_directories: zlib_inc
)
else
message('Use system-provided zlib library')
endif
subdir('shlr/zip')
# handle sdb dependency
# NOTE: copying most of the stuff from sdb to here for the moment, since we
# should use subpackages to handle this well
sdb_files = [
join_paths('shlr','sdb','src','array.c'),
join_paths('shlr','sdb','src','base64.c'),
join_paths('shlr','sdb','src','buffer.c'),
join_paths('shlr','sdb','src','set.c'),
join_paths('shlr','sdb','src','cdb.c'),
join_paths('shlr','sdb','src','cdb_make.c'),
join_paths('shlr','sdb','src','dict.c'),
join_paths('shlr','sdb','src','diff.c'),
join_paths('shlr','sdb','src','disk.c'),
join_paths('shlr','sdb','src','fmt.c'),
join_paths('shlr','sdb','src','ht_uu.c'),
join_paths('shlr','sdb','src','ht_up.c'),
join_paths('shlr','sdb','src','ht_pp.c'),
join_paths('shlr','sdb','src','ht_pu.c'),
join_paths('shlr','sdb','src','journal.c'),
join_paths('shlr','sdb','src','json.c'),
join_paths('shlr','sdb','src','lock.c'),
join_paths('shlr','sdb','src','ls.c'),
join_paths('shlr','sdb','src','match.c'),
join_paths('shlr','sdb','src','ns.c'),
join_paths('shlr','sdb','src','num.c'),
join_paths('shlr','sdb','src','query.c'),
join_paths('shlr','sdb','src','sdb.c'),
join_paths('shlr','sdb','src','sdbht.c'),
join_paths('shlr','sdb','src','util.c'),
join_paths('shlr','sdb','src','text.c')
'shlr/sdb/src/array.c',
'shlr/sdb/src/base64.c',
'shlr/sdb/src/buffer.c',
'shlr/sdb/src/set.c',
'shlr/sdb/src/cdb.c',
'shlr/sdb/src/cdb_make.c',
'shlr/sdb/src/dict.c',
'shlr/sdb/src/diff.c',
'shlr/sdb/src/disk.c',
'shlr/sdb/src/fmt.c',
'shlr/sdb/src/ht_uu.c',
'shlr/sdb/src/ht_up.c',
'shlr/sdb/src/ht_pp.c',
'shlr/sdb/src/ht_pu.c',
'shlr/sdb/src/journal.c',
'shlr/sdb/src/json.c',
'shlr/sdb/src/lock.c',
'shlr/sdb/src/ls.c',
'shlr/sdb/src/match.c',
'shlr/sdb/src/ns.c',
'shlr/sdb/src/num.c',
'shlr/sdb/src/query.c',
'shlr/sdb/src/sdb.c',
'shlr/sdb/src/sdbht.c',
'shlr/sdb/src/util.c',
'shlr/sdb/src/text.c'
]
sdb_inc = [platform_inc, include_directories(join_paths('shlr','sdb','src'))]
@ -506,22 +471,22 @@ endif
run_command(py3_exe, '-c', 'with open("shlr/sdb/src/sdb_version.h", "w") as f: f.write("#define SDB_VERSION \"' + sdb_version + '\"")')
sdb_inc_files = [
join_paths('shlr','sdb','src','buffer.h'),
join_paths('shlr','sdb','src','cdb.h'),
join_paths('shlr','sdb','src','set.h'),
join_paths('shlr','sdb','src','cdb_make.h'),
join_paths('shlr','sdb','src','config.h'),
join_paths('shlr','sdb','src','dict.h'),
join_paths('shlr','sdb','src','ht_inc.h'),
join_paths('shlr','sdb','src','ht_pp.h'),
join_paths('shlr','sdb','src','ht_up.h'),
join_paths('shlr','sdb','src','ht_uu.h'),
join_paths('shlr','sdb','src','ht_pu.h'),
join_paths('shlr','sdb','src','ls.h'),
join_paths('shlr','sdb','src','sdb.h'),
join_paths('shlr','sdb','src','sdbht.h'),
join_paths('shlr','sdb','src','sdb_version.h'),
join_paths('shlr','sdb','src','types.h')
'shlr/sdb/src/buffer.h',
'shlr/sdb/src/cdb.h',
'shlr/sdb/src/set.h',
'shlr/sdb/src/cdb_make.h',
'shlr/sdb/src/config.h',
'shlr/sdb/src/dict.h',
'shlr/sdb/src/ht_inc.h',
'shlr/sdb/src/ht_pp.h',
'shlr/sdb/src/ht_up.h',
'shlr/sdb/src/ht_uu.h',
'shlr/sdb/src/ht_pu.h',
'shlr/sdb/src/ls.h',
'shlr/sdb/src/sdb.h',
'shlr/sdb/src/sdbht.h',
'shlr/sdb/src/sdb_version.h',
'shlr/sdb/src/types.h'
]
install_headers(sdb_inc_files, install_dir: join_paths(r2_incdir, 'sdb'))
@ -536,9 +501,9 @@ sdb_dep = declare_dependency(
include_directories: sdb_inc
)
sdb_exe = executable('sdb', [join_paths('shlr','sdb','src','main.c')] + sdb_files,
sdb_exe = executable('sdb', ['shlr/sdb/src/main.c'] + sdb_files,
include_directories: [
include_directories([join_paths('shlr','sdb','src')])
include_directories('shlr/sdb/src')
],
implicit_include_directories: false,
native: true,
@ -562,7 +527,7 @@ sdb_gen_cmd = [
# handle spp dependency
spp_files = [
join_paths('shlr','spp','spp.c')
'shlr/spp/spp.c'
]
spp_inc = [platform_inc, include_directories(join_paths('shlr','spp'))]
@ -586,6 +551,9 @@ endif
if get_option('b_sanitize').contains('undefined')
pkgcfg_sanitize_libs += ' -lubsan'
endif
if get_option('b_sanitize').contains('thread')
pkgcfg_sanitize_libs += ' -fsanitize=thread'
endif
rpath_exe = ''
rpath_lib = ''
@ -618,43 +586,12 @@ subdir('libr/egg')
subdir('libr/fs')
subdir('libr/debug')
subdir('libr/core')
# subdir(join_paths('libr','anal','d'))
# subdir(join_paths('libr','asm','d'))
#subdir(join_paths('libr','bin','d'))
# subdir(join_paths('libr','syscall','d'))
subdir('libr/cons/d')
subdir('libr/magic/d')
subdir('libr/flag/d')
subdir('libr/main')
cli_option = get_option('cli')
if cli_option.auto()
cli_enabled = not meson.is_subproject()
else
cli_enabled = cli_option.enabled()
endif
if cli_enabled
if get_option('blob')
subdir('binr/blob')
else
subdir('binr/rahash2')
subdir('binr/rarun2')
subdir('binr/rasm2')
subdir('binr/rabin2')
subdir('binr/radare2')
subdir('binr/ragg2')
subdir('binr/r2agent')
subdir('binr/radiff2')
subdir('binr/rafind2')
subdir('binr/rasign2')
subdir('binr/ravc2')
subdir('binr/rax2')
endif
subdir('binr/r2pm')
subdir('binr/r2r')
endif
subdir('binr')
if meson.is_subproject()
libr2_dep = declare_dependency(
dependencies: [
@ -682,13 +619,13 @@ if meson.is_subproject()
r_syscall_dep,
r_util_dep
],
include_directories: include_directories('.', join_paths('libr','include')),
include_directories: include_directories('.', 'libr/include'),
version: r2_version
)
endif
if get_option('use_webui')
install_subdir(join_paths('shlr','www'),
install_subdir('shlr/www',
install_dir: r2_wwwroot,
strip_directory: true
)
@ -697,27 +634,27 @@ endif
subdir('test/unit')
install_data(
join_paths('doc','fortunes.fun'),
join_paths('doc','fortunes.tips'),
'doc/fortunes.fun',
'doc/fortunes.tips',
install_dir: r2_fortunes
)
if cli_enabled
install_man(
join_paths('man','r2agent.1'),
join_paths('man','r2-docker.1'),
join_paths('man','r2pm.1'),
join_paths('man','rabin2.1'),
join_paths('man','radare2.1'),
join_paths('man','radiff2.1'),
join_paths('man','rafind2.1'),
join_paths('man','ragg2.1'),
join_paths('man','rahash2.1'),
join_paths('man','rarun2.1'),
join_paths('man','rasm2.1'),
join_paths('man','rax2.1'),
join_paths('man','ravc2.1'),
join_paths('man','esil.7')
'man/r2agent.1',
'man/r2-docker.1',
'man/r2pm.1',
'man/rabin2.1',
'man/radare2.1',
'man/radiff2.1',
'man/rafind2.1',
'man/ragg2.1',
'man/rahash2.1',
'man/rarun2.1',
'man/rasm2.1',
'man/rax2.1',
'man/ravc2.1',
'man/esil.7'
)
install_data('doc/hud',
@ -726,19 +663,19 @@ if cli_enabled
)
install_data(
join_paths('doc','zsh','_r2'),
join_paths('doc','zsh','_rabin2'),
join_paths('doc','zsh','_radiff2'),
join_paths('doc','zsh','_rafind2'),
join_paths('doc','zsh','_ragg2'),
join_paths('doc','zsh','_rahash2'),
join_paths('doc','zsh','_rasm2'),
join_paths('doc','zsh','_rax2'),
'doc/zsh/_r2',
'doc/zsh/_rabin2',
'doc/zsh/_radiff2',
'doc/zsh/_rafind2',
'doc/zsh/_ragg2',
'doc/zsh/_rahash2',
'doc/zsh/_rasm2',
'doc/zsh/_rax2',
install_dir: r2_zsh_compdir
)
if host_machine.system() == 'windows'
meson.add_install_script(join_paths('sys','create_r2.bat'))
meson.add_install_script('sys/create_r2.bat')
else
meson.add_install_script('sys/create_r2.sh')
endif

View File

@ -39,13 +39,12 @@ option('use_sys_openssl', type: 'boolean', value: false)
option('static_sys_openssl', type: 'boolean', value: false)
option('use_libuv', type: 'boolean', value: true)
option('use_fork', type: 'boolean', value: true)
option('sdb_cgen', type: 'boolean', value: true)
# host_machine.system() != 'windows')
option('sdb_cgen', type: 'boolean', value: false)
option('use_dylink', type: 'boolean', value: true)
option('debugger', type: 'boolean', value: true)
option('want_ptrace_wrap', type: 'boolean', value: true)
option('nogpl', type: 'boolean', value: false)
option('use_webui', type: 'boolean', value: false, description: 'install different WebUIs for radare2')
option('use_webui', type: 'boolean', value: 'true', description: 'install different WebUIs for radare2')
option('enable_tests', type: 'boolean', value: true, description: 'Build unit tests in test/unit')
option('enable_r2r', type: 'boolean', value: true, description: 'Build r2r executable for regression ')

View File

@ -35,7 +35,9 @@ if %ERRORLEVEL% == 0 (
if %ERRORLEVEL% == 0 (
echo FOUND
) else (
pip install -UI pip meson ninja
pip install -UI pip ninja
REM meson==0.59.1
pip install git+https://github.com/frida/meson.git@f7f25b19a8d71cebf8e2934733eb041eb6862eee
preconfigure.bat
exit /b 0
)

View File

@ -69,42 +69,42 @@ if not capstone_dep.found() or not get_option('use_sys_capstone')
endif
rel_cs_files = [
join_paths('arch','AArch64','AArch64BaseInfo.c'),
join_paths('arch','AArch64','AArch64Disassembler.c'),
join_paths('arch','AArch64','AArch64InstPrinter.c'),
join_paths('arch','AArch64','AArch64Mapping.c'),
join_paths('arch','AArch64','AArch64Module.c'),
join_paths('arch','ARM','ARMDisassembler.c'),
join_paths('arch','ARM','ARMInstPrinter.c'),
join_paths('arch','ARM','ARMMapping.c'),
join_paths('arch','ARM','ARMModule.c'),
join_paths('arch','Mips','MipsDisassembler.c'),
join_paths('arch','Mips','MipsInstPrinter.c'),
join_paths('arch','Mips','MipsMapping.c'),
join_paths('arch','Mips','MipsModule.c'),
join_paths('arch','PowerPC','PPCDisassembler.c'),
join_paths('arch','PowerPC','PPCInstPrinter.c'),
join_paths('arch','PowerPC','PPCMapping.c'),
join_paths('arch','PowerPC','PPCModule.c'),
join_paths('arch','Sparc','SparcDisassembler.c'),
join_paths('arch','Sparc','SparcInstPrinter.c'),
join_paths('arch','Sparc','SparcMapping.c'),
join_paths('arch','Sparc','SparcModule.c'),
join_paths('arch','SystemZ','SystemZDisassembler.c'),
join_paths('arch','SystemZ','SystemZInstPrinter.c'),
join_paths('arch','SystemZ','SystemZMapping.c'),
join_paths('arch','SystemZ','SystemZMCTargetDesc.c'),
join_paths('arch','SystemZ','SystemZModule.c'),
join_paths('arch','X86','X86ATTInstPrinter.c'),
join_paths('arch','X86','X86Disassembler.c'),
join_paths('arch','X86','X86DisassemblerDecoder.c'),
join_paths('arch','X86','X86IntelInstPrinter.c'),
join_paths('arch','X86','X86Mapping.c'),
join_paths('arch','X86','X86Module.c'),
join_paths('arch','XCore','XCoreDisassembler.c'),
join_paths('arch','XCore','XCoreInstPrinter.c'),
join_paths('arch','XCore','XCoreMapping.c'),
join_paths('arch','XCore','XCoreModule.c'),
'arch/AArch64/AArch64BaseInfo.c',
'arch/AArch64/AArch64Disassembler.c',
'arch/AArch64/AArch64InstPrinter.c',
'arch/AArch64/AArch64Mapping.c',
'arch/AArch64/AArch64Module.c',
'arch/ARM/ARMDisassembler.c',
'arch/ARM/ARMInstPrinter.c',
'arch/ARM/ARMMapping.c',
'arch/ARM/ARMModule.c',
'arch/Mips/MipsDisassembler.c',
'arch/Mips/MipsInstPrinter.c',
'arch/Mips/MipsMapping.c',
'arch/Mips/MipsModule.c',
'arch/PowerPC/PPCDisassembler.c',
'arch/PowerPC/PPCInstPrinter.c',
'arch/PowerPC/PPCMapping.c',
'arch/PowerPC/PPCModule.c',
'arch/Sparc/SparcDisassembler.c',
'arch/Sparc/SparcInstPrinter.c',
'arch/Sparc/SparcMapping.c',
'arch/Sparc/SparcModule.c',
'arch/SystemZ/SystemZDisassembler.c',
'arch/SystemZ/SystemZInstPrinter.c',
'arch/SystemZ/SystemZMapping.c',
'arch/SystemZ/SystemZMCTargetDesc.c',
'arch/SystemZ/SystemZModule.c',
'arch/X86/X86ATTInstPrinter.c',
'arch/X86/X86Disassembler.c',
'arch/X86/X86DisassemblerDecoder.c',
'arch/X86/X86IntelInstPrinter.c',
'arch/X86/X86Mapping.c',
'arch/X86/X86Module.c',
'arch/XCore/XCoreDisassembler.c',
'arch/XCore/XCoreInstPrinter.c',
'arch/XCore/XCoreMapping.c',
'arch/XCore/XCoreModule.c',
'cs.c',
'MCInst.c',
'MCInstrDesc.c',
@ -113,24 +113,24 @@ if not capstone_dep.found() or not get_option('use_sys_capstone')
'utils.c',
]
rel_cs4_files = [
join_paths('arch','M680X','M680XDisassembler.c'),
join_paths('arch','M680X','M680XInstPrinter.c'),
join_paths('arch','M680X','M680XModule.c'),
join_paths('arch','M68K','M68KDisassembler.c'),
join_paths('arch','M68K','M68KInstPrinter.c'),
join_paths('arch','M68K','M68KModule.c'),
join_paths('arch','TMS320C64x','TMS320C64xDisassembler.c'),
join_paths('arch','TMS320C64x','TMS320C64xInstPrinter.c'),
join_paths('arch','TMS320C64x','TMS320C64xMapping.c'),
join_paths('arch','TMS320C64x','TMS320C64xModule.c'),
'arch/M680X/M680XDisassembler.c',
'arch/M680X/M680XInstPrinter.c',
'arch/M680X/M680XModule.c',
'arch/M68K/M68KDisassembler.c',
'arch/M68K/M68KInstPrinter.c',
'arch/M68K/M68KModule.c',
'arch/TMS320C64x/TMS320C64xDisassembler.c',
'arch/TMS320C64x/TMS320C64xInstPrinter.c',
'arch/TMS320C64x/TMS320C64xMapping.c',
'arch/TMS320C64x/TMS320C64xModule.c',
]
rel_cs5_files = [
join_paths('arch','X86','X86InstPrinterCommon.c'),
'arch/X86/X86InstPrinterCommon.c',
# Add riscv files
join_paths('arch','RISCV','RISCVMapping.c'),
join_paths('arch','RISCV','RISCVModule.c'),
join_paths('arch','RISCV','RISCVInstPrinter.c'),
join_paths('arch','RISCV','RISCVDisassembler.c')
'arch/RISCV/RISCVMapping.c',
'arch/RISCV/RISCVModule.c',
'arch/RISCV/RISCVInstPrinter.c',
'arch/RISCV/RISCVDisassembler.c'
]
user_plugins = get_option('plugins').split(',')
@ -230,10 +230,10 @@ bochs_dep = declare_dependency(
# handle java dependency
java_files = [
join_paths('java','class.c'),
join_paths('java','code.c'),
join_paths('java','dsojson.c'),
join_paths('java','ops.c'),
'java/class.c',
'java/code.c',
'java/dsojson.c',
'java/ops.c',
#'java/main.c',
]
@ -253,14 +253,14 @@ java_dep = declare_dependency(
# handle qnx dependency
qnx_files = [
join_paths('qnx','src','core.c'),
join_paths('qnx','src','libqnxr.c'),
join_paths('qnx','src','packet.c'),
join_paths('qnx','src','sigutil.c'),
join_paths('qnx','src','utils.c'),
'qnx/src/core.c',
'qnx/src/libqnxr.c',
'qnx/src/packet.c',
'qnx/src/sigutil.c',
'qnx/src/utils.c',
]
qnx_inc = [platform_inc, include_directories(join_paths('qnx','include'))]
qnx_inc = [platform_inc, include_directories('qnx/include')]
libr2qnx = static_library('r2qnx', qnx_files,
dependencies: [r_socket_dep],
@ -273,7 +273,6 @@ qnx_dep = declare_dependency(
include_directories: qnx_inc
)
# handle lz4 dependency (unused?)
lz4_dep = dependency('liblz4', required: false)
if not lz4_dep.found() or not get_option('use_sys_lz4')
@ -298,112 +297,6 @@ else
endif
# handle zip dependency
zip_dep = dependency('libzip', required: false)
if not zip_dep.found() or not get_option('use_sys_zip')
message('Use bundled zip')
zip_files = [
join_paths('zip','zip','zip_add.c'),
join_paths('zip','zip','zip_add_dir.c'),
join_paths('zip','zip','zip_add_entry.c'),
join_paths('zip','zip','zip_close.c'),
join_paths('zip','zip','zip_delete.c'),
join_paths('zip','zip','zip_dir_add.c'),
join_paths('zip','zip','zip_dirent.c'),
join_paths('zip','zip','zip_discard.c'),
join_paths('zip','zip','zip_entry.c'),
join_paths('zip','zip','zip_err_str.c'),
join_paths('zip','zip','zip_error.c'),
#join_paths('zip','zip','zip_error_clear.c'),
join_paths('zip','zip','zip_error_get.c'),
join_paths('zip','zip','zip_error_get_sys_type.c'),
join_paths('zip','zip','zip_error_strerror.c'),
join_paths('zip','zip','zip_error_to_str.c'),
join_paths('zip','zip','zip_extra_field.c'),
join_paths('zip','zip','zip_extra_field_api.c'),
join_paths('zip','zip','zip_fclose.c'),
join_paths('zip','zip','zip_fdopen.c'),
join_paths('zip','zip','zip_file_add.c'),
#join_paths('zip','zip','zip_file_error_clear.c'),
join_paths('zip','zip','zip_file_error_get.c'),
join_paths('zip','zip','zip_file_get_comment.c'),
join_paths('zip','zip','zip_file_get_offset.c'),
join_paths('zip','zip','zip_file_rename.c'),
join_paths('zip','zip','zip_file_replace.c'),
join_paths('zip','zip','zip_file_set_comment.c'),
join_paths('zip','zip','zip_file_strerror.c'),
join_paths('zip','zip','zip_filerange_crc.c'),
join_paths('zip','zip','zip_fopen.c'),
join_paths('zip','zip','zip_fopen_encrypted.c'),
join_paths('zip','zip','zip_fopen_index.c'),
join_paths('zip','zip','zip_fopen_index_encrypted.c'),
join_paths('zip','zip','zip_fread.c'),
join_paths('zip','zip','zip_get_archive_comment.c'),
join_paths('zip','zip','zip_get_archive_flag.c'),
join_paths('zip','zip','zip_get_compression_implementation.c'),
join_paths('zip','zip','zip_get_encryption_implementation.c'),
join_paths('zip','zip','zip_get_file_comment.c'),
join_paths('zip','zip','zip_get_name.c'),
join_paths('zip','zip','zip_get_num_entries.c'),
join_paths('zip','zip','zip_get_num_files.c'),
join_paths('zip','zip','zip_name_locate.c'),
join_paths('zip','zip','zip_new.c'),
join_paths('zip','zip','zip_open.c'),
join_paths('zip','zip','zip_rename.c'),
join_paths('zip','zip','zip_replace.c'),
join_paths('zip','zip','zip_set_archive_comment.c'),
join_paths('zip','zip','zip_set_archive_flag.c'),
join_paths('zip','zip','zip_set_default_password.c'),
join_paths('zip','zip','zip_set_file_comment.c'),
join_paths('zip','zip','zip_set_file_compression.c'),
join_paths('zip','zip','zip_set_name.c'),
join_paths('zip','zip','zip_source_buffer.c'),
join_paths('zip','zip','zip_source_close.c'),
join_paths('zip','zip','zip_source_crc.c'),
join_paths('zip','zip','zip_source_deflate.c'),
join_paths('zip','zip','zip_source_error.c'),
join_paths('zip','zip','zip_source_file.c'),
join_paths('zip','zip','zip_source_filep.c'),
join_paths('zip','zip','zip_source_free.c'),
join_paths('zip','zip','zip_source_function.c'),
join_paths('zip','zip','zip_source_layered.c'),
join_paths('zip','zip','zip_source_open.c'),
join_paths('zip','zip','zip_source_pkware.c'),
join_paths('zip','zip','zip_source_pop.c'),
join_paths('zip','zip','zip_source_read.c'),
join_paths('zip','zip','zip_source_stat.c'),
join_paths('zip','zip','zip_source_window.c'),
join_paths('zip','zip','zip_source_zip.c'),
join_paths('zip','zip','zip_source_zip_new.c'),
join_paths('zip','zip','zip_stat.c'),
join_paths('zip','zip','zip_stat_index.c'),
join_paths('zip','zip','zip_stat_init.c'),
join_paths('zip','zip','zip_strerror.c'),
join_paths('zip','zip','zip_string.c'),
join_paths('zip','zip','zip_unchange.c'),
join_paths('zip','zip','zip_unchange_all.c'),
join_paths('zip','zip','zip_unchange_archive.c'),
join_paths('zip','zip','zip_unchange_data.c'),
join_paths('zip','zip','zip_utf-8.c')
]
zip_inc = [platform_inc, include_directories('zip/include')]
libr2zip = static_library('r2zip', zip_files,
include_directories: zip_inc,
implicit_include_directories: false,
dependencies: zlib_dep
)
zip_dep = declare_dependency(
link_with: libr2zip,
include_directories: zip_inc
)
else
message('Use system-provided zip library')
endif
# handle grub dependency
grub_files = [
@ -413,52 +306,52 @@ grub_files = [
#'grub/fs/befs.c',
#'grub/fs/befs_be.c',
#'grub/fs/btrfs.c',
join_paths('grub','fs','cpio.c'),
join_paths('grub','fs','ext2.c'),
join_paths('grub','fs','fat.c'),
join_paths('grub','fs','fb.c'),
join_paths('grub','fs','fshelp.c'),
join_paths('grub','fs','hfs.c'),
join_paths('grub','fs','hfsplus.c'),
join_paths('grub','fs','iso9660.c'),
join_paths('grub','fs','jfs.c'),
join_paths('grub','fs','minix.c'),
#join_paths('grub','fs','minix2.c'),
#join_paths('grub','fs','nilfs2.c'),
join_paths('grub','fs','ntfs.c'),
join_paths('grub','fs','ntfscomp.c'),
join_paths('grub','fs','reiserfs.c'),
join_paths('grub','fs','sfs.c'),
join_paths('grub','fs','tar.c'),
join_paths('grub','fs','udf.c'),
join_paths('grub','fs','ufs.c'),
join_paths('grub','fs','ufs2.c'),
join_paths('grub','fs','xfs.c'),
join_paths('grub','grubfs.c'),
join_paths('grub','kern','device.c'),
join_paths('grub','kern','disk.c'),
join_paths('grub','kern','env.c'),
join_paths('grub','kern','err.c'),
join_paths('grub','kern','file.c'),
join_paths('grub','kern','fs.c'),
join_paths('grub','kern','list.c'),
join_paths('grub','kern','misc.c'),
join_paths('grub','kern','mm.c'),
join_paths('grub','kern','partition.c'),
join_paths('grub','kern','term.c'),
join_paths('grub','kern','time.c'),
#join_paths('grub','main.c'),
#join_paths('grub','partmap','acorn.c'),
join_paths('grub','partmap','amiga.c'),
join_paths('grub','partmap','apple.c'),
join_paths('grub','partmap','bsdlabel.c'),
join_paths('grub','partmap','gpt.c'),
join_paths('grub','partmap','msdos.c'),
join_paths('grub','partmap','sun.c'),
join_paths('grub','partmap','sunpc.c'),
'grub/fs/cpio.c',
'grub/fs/ext2.c',
'grub/fs/fat.c',
'grub/fs/fb.c',
'grub/fs/fshelp.c',
'grub/fs/hfs.c',
'grub/fs/hfsplus.c',
'grub/fs/iso9660.c',
'grub/fs/jfs.c',
'grub/fs/minix.c',
#'grub/fs/minix2.c',
#'grub/fs/nilfs2.c',
'grub/fs/ntfs.c',
'grub/fs/ntfscomp.c',
'grub/fs/reiserfs.c',
'grub/fs/sfs.c',
'grub/fs/tar.c',
'grub/fs/udf.c',
'grub/fs/ufs.c',
'grub/fs/ufs2.c',
'grub/fs/xfs.c',
'grub/grubfs.c',
'grub/kern/device.c',
'grub/kern/disk.c',
'grub/kern/env.c',
'grub/kern/err.c',
'grub/kern/file.c',
'grub/kern/fs.c',
'grub/kern/list.c',
'grub/kern/misc.c',
'grub/kern/mm.c',
'grub/kern/partition.c',
'grub/kern/term.c',
'grub/kern/time.c',
#'grub/main.c',
#'grub/partmap/acorn.c',
'grub/partmap/amiga.c',
'grub/partmap/apple.c',
'grub/partmap/bsdlabel.c',
'grub/partmap/gpt.c',
'grub/partmap/msdos.c',
'grub/partmap/sun.c',
'grub/partmap/sunpc.c',
]
grub_inc = [platform_inc, include_directories('grub', join_paths('grub','include'))]
grub_inc = [platform_inc, include_directories('grub', 'grub/include')]
libr2grub = static_library('r2grub', grub_files,
dependencies: [r_util_dep],
@ -473,11 +366,11 @@ grub_dep = declare_dependency(
# handle winkd dependency
winkd_files = [
join_paths('winkd','iob_pipe.c'),
join_paths('winkd','iob_net.c'),
join_paths('winkd','kd.c'),
join_paths('winkd','transport.c'),
join_paths('winkd','winkd.c'),
'winkd/iob_pipe.c',
'winkd/iob_net.c',
'winkd/kd.c',
'winkd/transport.c',
'winkd/winkd.c',
]
winkd_inc = [platform_inc, include_directories('winkd')]
@ -514,7 +407,7 @@ ar_dep = declare_dependency(
# handle mpc dependency
mpc_files = [
join_paths('mpc','mpc.c')
'mpc/mpc.c'
]
mpc_inc = [platform_inc, include_directories(['mpc'])]
@ -531,7 +424,7 @@ mpc_dep = declare_dependency(
# handle yxml dependency
yxml_files = [
join_paths('yxml','yxml.c')
'yxml/yxml.c'
]
yxml_inc = [platform_inc, include_directories(['yxml'])]

144
shlr/zip/meson.build Normal file
View File

@ -0,0 +1,144 @@
# handle zlib dependency
zlib_dep = dependency('zlib', required: false)
if not zlib_dep.found() or not get_option('use_sys_zlib')
message('Use bundled zlib')
zlib_files = [
join_paths('zlib','adler32.c'),
join_paths('zlib','compress.c'),
join_paths('zlib','crc32.c'),
join_paths('zlib','deflate.c'),
join_paths('zlib','gzclose.c'),
join_paths('zlib','gzlib.c'),
join_paths('zlib','gzread.c'),
join_paths('zlib','gzwrite.c'),
join_paths('zlib','infback.c'),
join_paths('zlib','inffast.c'),
join_paths('zlib','inflate.c'),
join_paths('zlib','inftrees.c'),
join_paths('zlib','trees.c'),
join_paths('zlib','uncompr.c'),
join_paths('zlib','zutil.c')
]
zlib_inc = [platform_inc, include_directories(join_paths('zlib'))]
libr2zlib = static_library('r2zlib', zlib_files,
include_directories: zlib_inc,
implicit_include_directories: false
)
zlib_dep = declare_dependency(
link_with: libr2zlib,
include_directories: zlib_inc
)
else
message('Use system-provided zlib library')
endif
# handle zip dependency
zip_dep = dependency('libzip', required: false)
if not zip_dep.found() or not get_option('use_sys_zip')
message('Use bundled zip')
zip_files = [
join_paths('zip','zip_add.c'),
join_paths('zip','zip_add_dir.c'),
join_paths('zip','zip_add_entry.c'),
join_paths('zip','zip_close.c'),
join_paths('zip','zip_delete.c'),
join_paths('zip','zip_dir_add.c'),
join_paths('zip','zip_dirent.c'),
join_paths('zip','zip_discard.c'),
join_paths('zip','zip_entry.c'),
join_paths('zip','zip_err_str.c'),
join_paths('zip','zip_error.c'),
#join_paths('zip','zip_error_clear.c'),
join_paths('zip','zip_error_get.c'),
join_paths('zip','zip_error_get_sys_type.c'),
join_paths('zip','zip_error_strerror.c'),
join_paths('zip','zip_error_to_str.c'),
join_paths('zip','zip_extra_field.c'),
join_paths('zip','zip_extra_field_api.c'),
join_paths('zip','zip_fclose.c'),
join_paths('zip','zip_fdopen.c'),
join_paths('zip','zip_file_add.c'),
#join_paths('zip','zip_file_error_clear.c'),
join_paths('zip','zip_file_error_get.c'),
join_paths('zip','zip_file_get_comment.c'),
join_paths('zip','zip_file_get_offset.c'),
join_paths('zip','zip_file_rename.c'),
join_paths('zip','zip_file_replace.c'),
join_paths('zip','zip_file_set_comment.c'),
join_paths('zip','zip_file_strerror.c'),
join_paths('zip','zip_filerange_crc.c'),
join_paths('zip','zip_fopen.c'),
join_paths('zip','zip_fopen_encrypted.c'),
join_paths('zip','zip_fopen_index.c'),
join_paths('zip','zip_fopen_index_encrypted.c'),
join_paths('zip','zip_fread.c'),
join_paths('zip','zip_get_archive_comment.c'),
join_paths('zip','zip_get_archive_flag.c'),
join_paths('zip','zip_get_compression_implementation.c'),
join_paths('zip','zip_get_encryption_implementation.c'),
join_paths('zip','zip_get_file_comment.c'),
join_paths('zip','zip_get_name.c'),
join_paths('zip','zip_get_num_entries.c'),
join_paths('zip','zip_get_num_files.c'),
join_paths('zip','zip_name_locate.c'),
join_paths('zip','zip_new.c'),
join_paths('zip','zip_open.c'),
join_paths('zip','zip_rename.c'),
join_paths('zip','zip_replace.c'),
join_paths('zip','zip_set_archive_comment.c'),
join_paths('zip','zip_set_archive_flag.c'),
join_paths('zip','zip_set_default_password.c'),
join_paths('zip','zip_set_file_comment.c'),
join_paths('zip','zip_set_file_compression.c'),
join_paths('zip','zip_set_name.c'),
join_paths('zip','zip_source_buffer.c'),
join_paths('zip','zip_source_close.c'),
join_paths('zip','zip_source_crc.c'),
join_paths('zip','zip_source_deflate.c'),
join_paths('zip','zip_source_error.c'),
join_paths('zip','zip_source_file.c'),
join_paths('zip','zip_source_filep.c'),
join_paths('zip','zip_source_free.c'),
join_paths('zip','zip_source_function.c'),
join_paths('zip','zip_source_layered.c'),
join_paths('zip','zip_source_open.c'),
join_paths('zip','zip_source_pkware.c'),
join_paths('zip','zip_source_pop.c'),
join_paths('zip','zip_source_read.c'),
join_paths('zip','zip_source_stat.c'),
join_paths('zip','zip_source_window.c'),
join_paths('zip','zip_source_zip.c'),
join_paths('zip','zip_source_zip_new.c'),
join_paths('zip','zip_stat.c'),
join_paths('zip','zip_stat_index.c'),
join_paths('zip','zip_stat_init.c'),
join_paths('zip','zip_strerror.c'),
join_paths('zip','zip_string.c'),
join_paths('zip','zip_unchange.c'),
join_paths('zip','zip_unchange_all.c'),
join_paths('zip','zip_unchange_archive.c'),
join_paths('zip','zip_unchange_data.c'),
join_paths('zip','zip_utf-8.c')
]
zip_inc = [platform_inc, include_directories('include')]
libr2zip = static_library('r2zip', zip_files,
include_directories: zip_inc,
implicit_include_directories: false,
dependencies: zlib_dep
)
zip_dep = declare_dependency(
link_with: libr2zip,
include_directories: zip_inc
)
else
message('Use system-provided zip library')
endif