From 564e64be3ef5498da38f843d5e5ecc1cd1ded716 Mon Sep 17 00:00:00 2001 From: Riccardo Schirone Date: Fri, 18 Dec 2020 11:28:19 +0100 Subject: [PATCH] Improve meson information, structure and move fortunes (#213) * Simplify a bit meson.build * Use meson summary and move fortunes install dir * Use 0.55.0 meson version * Use /CURRENTUSER to select local installation --- .github/workflows/ci.yml | 2 +- meson.build | 209 +++++++++++++++++++-------------------- meson_options.txt | 21 ++-- shlr/meson.build | 6 -- 4 files changed, 115 insertions(+), 123 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4ef1980ff..c1342cab12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -702,7 +702,7 @@ jobs: path: ./ - name: Install rizin.exe shell: pwsh - run: Start-Process -Wait -FilePath .\rizin.exe -ArgumentList "/SP- /SILENT" -PassThru + run: Start-Process -Wait -FilePath .\rizin.exe -ArgumentList "/SP- /SILENT /CURRENTUSER" -PassThru - name: Check that installed rizin runs shell: pwsh run: ~\AppData\Local\Programs\rizin\bin\rizin.exe -qcq .\rizin.exe diff --git a/meson.build b/meson.build index 8c26567008..5401379c37 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('rizin', 'c', license: 'LGPL3', meson_version: '>=0.50.1') +project('rizin', 'c', license: 'LGPL3', meson_version: '>=0.55.0') py3_exe = import('python').find_installation() git_exe = find_program('git', required: false) @@ -147,80 +147,54 @@ endif library_cflags = ['-DRZ_PLUGIN_INCORE=1'] +rizin_prefix = get_option('prefix') +rizin_libdir = get_option('libdir') +rizin_incdir = get_option('includedir') / 'librz' +rizin_datdir = get_option('datadir') if host_machine.system() == 'windows' - rizin_prefix = '.' - rizin_libdir = 'lib' - rizin_incdir = join_paths('include', 'librz') - rizin_datdir = 'share' - - opts1 = [ - 'rizin_libdir', - 'rizin_incdir', - 'rizin_datdir' - ] - foreach opt : opts1 - val = get_option(opt) - if val != '' - set_variable(opt, val) - endif - endforeach - - rizin_wwwroot = join_paths(rizin_datdir, 'www') - rizin_sdb = join_paths(rizin_datdir) - rizin_zigns = join_paths(rizin_datdir, 'zigns') - rizin_themes = join_paths(rizin_datdir, 'cons') - rizin_fortunes = join_paths(rizin_datdir, 'doc') - rizin_flags = join_paths(rizin_datdir, 'flag') - rizin_hud = join_paths(rizin_datdir, 'hud') - - opts2 = [ - 'rizin_wwwroot', - 'rizin_sdb', - 'rizin_zigns', - 'rizin_themes', - 'rizin_fortunes', - 'rizin_flags', - 'rizin_hud' - ] - foreach opt : opts2 - val = get_option(opt) - if val != '' - set_variable(opt, val) - endif - endforeach - - opts3 = [ - 'rizin_plugins', - 'rizin_extras', - 'rizin_bindings' - ] - rizin_plugins = join_paths(rizin_libdir, 'plugins') - rizin_extras = join_paths(rizin_libdir, 'extras') - rizin_bindings = join_paths(rizin_libdir, 'bindings') - - foreach opt : opts1 + opts2 + opts3 - val = get_variable(opt) - val = '\\\\'.join(val.split('/')) - set_variable(opt, val) - endforeach + rizin_wwwroot = rizin_datdir / 'www' + rizin_sdb = rizin_datdir + rizin_zigns = rizin_datdir / 'zigns' + rizin_themes = rizin_datdir / 'cons' + rizin_fortunes = rizin_datdir / 'fortunes' + rizin_flags = rizin_datdir / 'flag' + rizin_hud = rizin_datdir / 'hud' + rizin_plugins = rizin_libdir / 'plugins' + rizin_extras = rizin_libdir / 'extras' + rizin_bindings = rizin_libdir / 'bindings' else - rizin_prefix = get_option('prefix') - rizin_libdir = get_option('libdir') - rizin_incdir = join_paths(get_option('includedir'), 'librz') - rizin_datdir = get_option('datadir') - rizin_datdir_rz = join_paths(rizin_datdir, 'rizin') - rizin_wwwroot = join_paths(rizin_datdir_rz, rizin_version, 'www') - rizin_sdb = join_paths(rizin_datdir_rz, rizin_version) - rizin_zigns = join_paths(rizin_datdir_rz, rizin_version, 'zigns') - rizin_themes = join_paths(rizin_datdir_rz, rizin_version, 'cons') - rizin_fortunes = join_paths(rizin_datdir, 'doc', 'rizin') - rizin_flags = join_paths(rizin_datdir_rz, rizin_version, 'flag') - rizin_hud = join_paths(rizin_datdir_rz, rizin_version, 'hud') - rizin_plugins = join_paths(rizin_libdir, 'rizin', rizin_version) - rizin_extras = join_paths(rizin_libdir, 'rizin-extras', rizin_version) - rizin_bindings = join_paths(rizin_libdir, 'rizin-bindings', rizin_version) + rizin_datdir_rz = rizin_datdir / 'rizin' + rizin_wwwroot = rizin_datdir_rz / rizin_version / 'www' + rizin_sdb = rizin_datdir_rz / rizin_version + rizin_zigns = rizin_datdir_rz / rizin_version / 'zigns' + rizin_themes = rizin_datdir_rz / rizin_version / 'cons' + rizin_fortunes = rizin_datdir_rz / rizin_version / 'fortunes' + rizin_flags = rizin_datdir_rz / rizin_version / 'flag' + rizin_hud = rizin_datdir_rz / rizin_version / 'hud' + rizin_plugins = rizin_libdir / 'rizin' / rizin_version + rizin_extras = rizin_libdir / 'rizin-extras' / rizin_version + rizin_bindings = rizin_libdir / 'rizin-bindings' / rizin_version endif +opts_overwrite = [ + 'rizin_wwwroot', + 'rizin_sdb', + 'rizin_zigns', + 'rizin_themes', + 'rizin_fortunes', + 'rizin_flags', + 'rizin_hud', + 'rizin_plugins', + 'rizin_extras', + 'rizin_bindings' +] +foreach opt : opts_overwrite + val = get_option(opt) + if val != '' + set_variable(opt, val) + endif +endforeach + # load plugin configuration subdir('librz') @@ -258,23 +232,11 @@ use_sys_xxhash = false if not sys_xxhash.found() sys_xxhash = cc.find_library('xxhash', required: false) endif - -if sys_xxhash.found() and get_option('use_sys_xxhash') - message('Using system xxhash library') - use_sys_xxhash = true -else - message('Using bundled xxhash library') -endif +use_sys_xxhash = sys_xxhash.found() and get_option('use_sys_xxhash') # handle openssl library sys_openssl = dependency('openssl', required: false) -use_sys_openssl = false -if sys_openssl.found() and get_option('use_sys_openssl') - message('Using system openssl library') - use_sys_openssl = true -else - message('Using bundled openssl code') -endif +use_sys_openssl = sys_openssl.found() and get_option('use_sys_openssl') # handle libuv library if get_option('use_libuv') @@ -287,12 +249,6 @@ else use_libuv = false endif -if use_libuv - message('Using libuv') -else - message('Not using libuv, thus using fallback server implementations') -endif - has_debugger = get_option('debugger') have_ptrace = not ['windows', 'cygwin', 'sunos'].contains(host_machine.system()) use_ptrace_wrap = ['linux'].contains(host_machine.system()) @@ -328,13 +284,13 @@ if host_machine.system() == 'windows' userconf.set('DATADIR_R2', rizin_datdir) userconf.set10('HAVE_JEMALLOC', false) else - userconf.set('LIBDIR', join_paths(rizin_prefix, rizin_libdir)) - userconf.set('INCLUDEDIR', join_paths(rizin_prefix, rizin_incdir)) + userconf.set('LIBDIR', rizin_prefix / rizin_libdir) + userconf.set('INCLUDEDIR', rizin_prefix / rizin_incdir) userconf.set('DATADIR_R2', rizin_datdir_rz) userconf.set10('HAVE_JEMALLOC', true) endif -userconf.set('DATADIR', join_paths(rizin_prefix, rizin_datdir)) -userconf.set('WWWROOT', join_paths(rizin_prefix, rizin_wwwroot)) +userconf.set('DATADIR', rizin_prefix / rizin_datdir) +userconf.set('WWWROOT', rizin_prefix / rizin_wwwroot) userconf.set('SDB', rizin_sdb) userconf.set('ZIGNS', rizin_zigns) userconf.set('THEMES', rizin_themes) @@ -391,7 +347,7 @@ rz_userconf_h = configure_file( input: 'librz/include/rz_userconf.h.acr', output: 'rz_userconf.h', configuration: userconf, - install_dir: join_paths(rizin_incdir) + install_dir: rizin_incdir ) versionconf = configuration_data() @@ -409,28 +365,25 @@ rz_version_h = configure_file( input: 'librz/include/rz_version.h.in', output: 'rz_version.h', configuration: versionconf, - install_dir: join_paths(rizin_incdir) + install_dir: rizin_incdir ) # Copy missing header run_command(py3_exe, '-c', '__import__("shutil").copyfile("shlr/spp/config.def.h", "shlr/spp/config.h")') pcconf = configuration_data() -pcconf.set('PREFIX', get_option('prefix')) -pcconf.set('LIBDIR', join_paths(get_option('prefix'), get_option('libdir'))) +pcconf.set('PREFIX', rizin_prefix) pcconf.set('VERSION', rizin_version) libr_pc = configure_file( input: 'librz/librz.pc.acr', output: 'librz.pc', configuration: pcconf, - install_dir: join_paths(get_option('libdir'), 'pkgconfig') + install_dir: 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 = [ 'shlr/zip/zlib/adler32.c', 'shlr/zip/zlib/compress.c', @@ -460,8 +413,6 @@ if not zlib_dep.found() or not get_option('use_sys_zlib') link_with: librzzlib, include_directories: zlib_inc ) -else - message('Use system-provided zlib library') endif @@ -524,7 +475,7 @@ sdb_inc_files = [ 'shlr/sdb/src/sdb_version.h', 'shlr/sdb/src/types.h' ] -install_headers(sdb_inc_files, install_dir: join_paths(rizin_incdir, 'sdb')) +install_headers(sdb_inc_files, install_dir: rizin_incdir / 'sdb') librzsdb = static_library('rzsdb', sdb_files, include_directories: sdb_inc, @@ -722,3 +673,51 @@ if cli_enabled rename: 'main' ) endif + +summary({ + 'prefix': rizin_prefix, + 'libdir': rizin_libdir, + 'includedir': rizin_incdir, + 'datadir': rizin_datdir, + 'wwwroot': rizin_wwwroot, + 'sdb': rizin_sdb, + 'zigns': rizin_zigns, + 'themes': rizin_themes, + 'fortunes': rizin_fortunes, + 'flags': rizin_flags, + 'hud': rizin_hud, + 'plugins': rizin_plugins, + 'extras': rizin_extras, + 'bindings': rizin_bindings, +}, section: 'Directories') + +summary({ + 'Debugger enabled': has_debugger, + 'System magic library': use_syslib_magic, + 'System xxhash library': use_sys_xxhash, + 'System openssl library': use_sys_openssl, + 'System libuv library': libuv_dep.type_name() != 'internal' and libuv_dep.found(), + 'System capstone library': capstone_dep.type_name() != 'internal', + 'System tree-sitter library': tree_sitter_dep.type_name() != 'internal', + 'System lz4 library': lz4_dep.type_name() != 'internal', + 'System zlib library': zlib_dep.type_name() != 'internal', + 'System zip library': zip_dep.type_name() != 'internal', + 'Use ptrace-wrap': use_ptrace_wrap, + 'Use RPATH': use_rpath, +}, section: 'Configuration', bool_yn: true) + +summary({ + 'Analysis Plugins': analysis_plugins, + 'Assembler Plugins': asm_plugins, + 'Binary Plugins': bin_plugins, + 'BinLdr Plugins': bin_ldr_plugins, + 'BinXtr Plugins': bin_xtr_plugins, + 'Breakpoint Plugins': bp_plugins, + 'Core Plugins': core_plugins, + 'Crypto Plugins': crypto_plugins, + 'Debug Plugins': debug_plugins, + 'Egg Plugins': egg_plugins, + 'IO Plugins': io_plugins, + 'Lang Plugins': lang_plugins, + 'Parse Plugins': parse_plugins, +}, section: 'Plugins', list_sep: ', ') \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt index 4746a3a113..0e943873fd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,17 +3,16 @@ option('static_runtime', type: 'boolean', value: false) option('local', type: 'feature', value: 'auto', description: 'Adds support for local/side-by-side installation (sets rpath if needed)') option('blob', type: 'boolean', value: false, description: 'Compile just one binary which dispatch to the right handlers based on the name used to call it') -# For Windows -option('rizin_libdir', type: 'string', value: '') -option('rizin_incdir', type: 'string', value: '') -option('rizin_datdir', type: 'string', value: '') -option('rizin_wwwroot', type: 'string', value: '') -option('rizin_sdb', type: 'string', value: '') -option('rizin_zigns', type: 'string', value: '') -option('rizin_themes', type: 'string', value: '') -option('rizin_fortunes', type: 'string', value: '') -option('rizin_flags', type: 'string', value: '') -option('rizin_hud', type: 'string', value: '') +option('rizin_wwwroot', type: 'string', value: '', description: 'Install path for www files') +option('rizin_sdb', type: 'string', value: '', description: '') +option('rizin_zigns', type: 'string', value: '', description: 'Install path for zignatures files') +option('rizin_themes', type: 'string', value: '', description: 'Install path for themes (colors, etc.)') +option('rizin_fortunes', type: 'string', value: '', description: 'Install path for fortunes displayed when starting') +option('rizin_flags', type: 'string', value: '', description: 'Install path for flags tags') +option('rizin_hud', type: 'string', value: '', description: 'Install path for hud file (V!/)') +option('rizin_plugins', type: 'string', value: '', description: 'Path where plugins are expected to be found') +option('rizin_extras', type: 'string', value: '', description: 'Path where extras are expected to be found') +option('rizin_bindings', type: 'string', value: '', description: 'Path where rizin bindings are expected to be found') option('rizin_version_commit', type: 'string', value: '') option('rizin_gittap', type: 'string', value: '') diff --git a/shlr/meson.build b/shlr/meson.build index 04187d0cb8..2d2d3f7d07 100644 --- a/shlr/meson.build +++ b/shlr/meson.build @@ -1,8 +1,6 @@ # handle capstone dependency capstone_dep = dependency('capstone', version: '>=3.0.4', required: false) if not capstone_dep.found() or not get_option('use_sys_capstone') - message('Use bundled capstone') - if get_option('capstone_in_builddir') capstone_path = join_paths(meson.current_build_dir(), 'capstone') else @@ -176,8 +174,6 @@ if not capstone_dep.found() or not get_option('use_sys_capstone') link_with: librzcapstone, include_directories: capstone_includes ) -else - message('Use system-provided capstone library') endif @@ -212,8 +208,6 @@ if not tree_sitter_dep.found() or not get_option('use_sys_tree_sitter') link_with: libtree_sitter, include_directories: tree_sitter_inc ) -else - message('Use system-provided tree-sitter library') endif