[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/11] capstone: Convert Makefile bits to meson bits
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 01/11] capstone: Convert Makefile bits to meson bits |
Date: |
Mon, 14 Sep 2020 15:28:24 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 14/09/20 02:01, Richard Henderson wrote:
>
> case "$capstone" in
> - git | internal)
> + git)
> if test "$capstone" = git; then
> git_submodules="${git_submodules} capstone"
> fi
> - mkdir -p capstone
> - if test "$mingw32" = "yes"; then
> - LIBCAPSTONE=capstone.lib
> - else
> - LIBCAPSTONE=libcapstone.a
> - fi
> - capstone_libs="-Lcapstone -lcapstone"
> - capstone_cflags="-I${source_path}/capstone/include"
> ;;
>
> - system)
> - capstone_libs="$($pkg_config --libs capstone)"
> - capstone_cflags="$($pkg_config --cflags capstone)"
> + internal | system | no)
> ;;
>
> - no)
> - ;;
> *)
> error_exit "Unknown state for capstone: $capstone"
> ;;
We can simplify it further if we move the selection logic to
meson.build. Here in configure the whole capstone stanza
is replaced by
capstone=auto
...
case "$capstone" in
auto|git)
# Simpler to always update submodule, even if not needed
if test -e "${source_path}/.git" && test $git_update = 'yes' ; then
git_submodules="${git_submodules} capstone"
fi
test "$capstone" = git && capstone=internal
;;
esac
and in meson.build:
capstone = not_found
build_internal_capstone = false
if get_option('capstone') != 'no'
if get_option('capstone') != 'internal'
capstone = dependency('capstone',
required: get_option('capstone') == 'system',
method: 'pkg-config',
static: enable_static)
endif
build_internal_capstone = not capstone.found()
endif
...
if build_internal_capstone
...
capstone = declare_dependency(...)
endif
> +option('capstone', type: 'string', value: 'no',
> + description: 'capstone support')
That would become:
+option('capstone', type: 'combo', value: 'auto',
+ choices: ['auto', 'system', 'internal', 'no'],
+ description: 'How to find the capstone library')
Thanks,
Paolo
- [PATCH 00/11] capstone + disassembler patches, Richard Henderson, 2020/09/13
- [PATCH 02/11] capstone: Update to upstream "next" branch, Richard Henderson, 2020/09/13
- [PATCH 03/11] disas: Move host asm annotations to tb_gen_code, Richard Henderson, 2020/09/13
- [PATCH 05/11] disas: Use qemu/bswap.h for bfd endian loads, Richard Henderson, 2020/09/13
- [PATCH 04/11] disas: Clean up CPUDebug initialization, Richard Henderson, 2020/09/13
- [PATCH 06/11] disas: Cleanup plugin_disas, Richard Henderson, 2020/09/13