bin_plugins_list = [
  'any',
  'art',
  'avr',
  'bf',
  'bflt',
  'bios',
  'bootimg',
  'c166',
  'cgc',
  'coff',
  'dex',
  'dmp64',
  'dol',
  'dyldcache',
  'ecoff',
  'elf',
  'elf64',
  'gns1',
  'hunk',
  'java',
  'le',
  'luac',
  'mach0',
  'mach064',
  'mbn',
  'md1img',
  'mdmp',
  'mdt',
  'mtk',
  'menuet',
  'mz',
  'ne',
  'nes',
  'nin3ds',
  'ninds',
  'ningb',
  'ningba',
  'nro',
  'nso',
  'omf',
  'omf166',
  'p9',
  'pe',
  'pe64',
  'pebble',
  'pef',
  'prg',
  'psxexe',
  'pyc',
  'qnx',
  'sfc',
  'smd',
  'sms',
  'spc700',
  'symbols',
  'te',
  'vsf',
  'wasm',
  'xbe',
  'xnu_kernelcache',
  'z64',
  'zimg',
]

bin_xtr_plugins_list = [
  'cart',
  'fatmach0',
  'sep64',
  # this was never built.
  # 'pemixed',
]

bin_plugins = {
  'base_name': 'rz_bin',
  'base_struct': 'RzBinPlugin',
  'list': bin_plugins_list,
}

bin_xtr_plugins = {
  'base_name': 'rz_bin_xtr',
  'base_struct': 'RzBinXtrPlugin',
  'list': bin_xtr_plugins_list,
}

rz_bin_sources = [
  'bfile.c',
  'bfile_string.c',
  'bin.c',
  'bin_demangle.c',
  'bin_language.c',
  'bobj.c',
  'bobj_process.c',
  'bobj_process_class.c',
  'bobj_process_entry.c',
  'bobj_process_field.c',
  'bobj_process_file.c',
  'bobj_process_import.c',
  'bobj_process_map.c',
  'bobj_process_section.c',
  'bobj_process_string.c',
  'bobj_process_symbol.c',
  'bobj_process_reloc.c',
  'dbginfo.c',
  'filter.c',
  'golang.c',
  'relocs_patch.c',
  'stabs.c',
  'p/bin_any.c',
  'p/bin_art.c',
  'p/bin_avr.c',
  'p/bin_bf.c',
  'p/bin_bflt.c',
  'p/bin_bios.c',
  'p/bin_bootimg.c',
  'p/bin_c166.c',
  'p/bin_cgc.c',
  'p/bin_coff.c',
  'p/bin_dex.c',
  'p/bin_dmp64.c',
  'p/bin_dol.c',
  'p/bin_dyldcache.c',
  'p/bin_ecoff.c',
  'p/bin_elf.c',
  'p/bin_elf64.c',
  'p/bin_gns1.c',
  'p/bin_hunk.c',
  'p/bin_java.c',
  'p/bin_le.c',
  'p/bin_luac.c',
  'p/bin_mach0.c',
  'p/bin_mach064.c',
  'p/bin_mbn.c',
  'p/bin_mdmp.c',
  'p/bin_md1img.c',
  'p/bin_mdt.c',
  'p/bin_mtk.c',
  'p/bin_menuet.c',
  'p/bin_mz.c',
  'p/bin_ne.c',
  'p/bin_nes.c',
  'p/bin_nin3ds.c',
  'p/bin_nin64.c',
  'p/bin_ninds.c',
  'p/bin_ningb.c',
  'p/bin_ningba.c',
  'p/bin_ninsnes.c',
  'p/bin_nro.c',
  'p/bin_nso.c',
  'p/bin_omf.c',
  'p/bin_omf166.c',
  'p/bin_p9.c',
  'p/bin_pe.c',
  'p/bin_pe64.c',
  'p/bin_pebble.c',
  'p/bin_pef.c',
  'p/bin_prg.c',
  'p/bin_psxexe.c',
  'p/bin_pyc.c',
  'p/bin_qnx.c',
  'p/bin_smd.c',
  'p/bin_sms.c',
  'p/bin_spc700.c',
  'p/bin_symbols.c',
  'p/bin_te.c',
  'p/bin_vsf.c',
  'p/bin_wasm.c',
  'p/bin_xbe.c',
  'p/bin_xnu_kernelcache.c',
  'p/bin_xtr_cart.c',
  'p/bin_xtr_fatmach0.c',
  # this was never built.
  # 'p/bin_xtr_pemixed.c',
  'p/bin_xtr_sep64.c',
  'p/bin_zimg.c',


  'format/bflt/bflt.c',
  'format/coff/coff.c',
  'format/coff/coff_reloc.c',
  'format/dex/dex.c',
  'format/dmp/dmp64.c',
  'format/ecoff/ecoff.c',
  'format/elf/elf.c',
  'format/elf/elf64.c',
  'format/elf/elf_arm.c',
  'format/elf/elf64_arm.c',
  'format/elf/elf_corefile.c',
  'format/elf/elf64_corefile.c',
  'format/elf/elf_dynamic.c',
  'format/elf/elf64_dynamic.c',
  'format/elf/elf_ehdr.c',
  'format/elf/elf64_ehdr.c',
  'format/elf/elf_hash.c',
  'format/elf/elf64_hash.c',
  'format/elf/elf_imports.c',
  'format/elf/elf64_imports.c',
  'format/elf/elf_map.c',
  'format/elf/elf64_map.c',
  'format/elf/elf_info.c',
  'format/elf/elf64_info.c',
  'format/elf/elf_misc.c',
  'format/elf/elf64_misc.c',
  'format/elf/elf_notes.c',
  'format/elf/elf64_notes.c',
  'format/elf/elf_parser.c',
  'format/elf/elf64_parser.c',
  'format/elf/elf_relocs_addend.c',
  'format/elf/elf64_relocs_addend.c',
  'format/elf/elf_relocs.c',
  'format/elf/elf64_relocs.c',
  'format/elf/elf_relocs_conversion.c',
  'format/elf/elf64_relocs_conversion.c',
  'format/elf/elf_relocs_patching.c',
  'format/elf/elf64_relocs_patching.c',
  'format/elf/elf_sections.c',
  'format/elf/elf64_sections.c',
  'format/elf/elf_segments.c',
  'format/elf/elf64_segments.c',
  'format/elf/elf_strtab.c',
  'format/elf/elf64_strtab.c',
  'format/elf/elf_symbols.c',
  'format/elf/elf64_symbols.c',
  'format/gns1/gns1.c',
  'format/java/class_attribute.c',
  'format/java/class_const_pool.c',
  'format/java/class_interface.c',
  'format/java/class_bin.c',
  'format/java/class_field.c',
  'format/java/class_method.c',
  'format/mach0/mach0_common.c',
  'format/mach0/dyldcache.c',
  'format/mach0/dyldcache_rebase.c',
  'format/mach0/coresymbolication.c',
  'format/mach0/fatmach0.c',
  'format/mach0/kernelcache.c',
  'format/mach0/mach0.c',
  'format/mach0/mach0_relocs.c',
  'format/mach0/mach0_chained_fixups.c',
  'format/mach0/mach064.c',
  'format/mach0/mach064_relocs.c',
  'format/mach0/mach064_chained_fixups.c',
  'format/mbn/mbn.c',
  'format/xnu/rz_cf_dict.c',
  'format/mdmp/mdmp.c',
  'format/mdmp/mdmp_pe.c',
  'format/mdmp/mdmp_pe64.c',
  'format/mdt/mdt.c',
  'format/mtk/md1img.c',
  'format/mtk/mtk.c',
  'format/le/le.c',
  'format/luac/luac_common.c',
  'format/luac/luac_bin.c',
  'format/luac/parse.c',
  'format/luac/luajit/luajit_private.c',
  'format/luac/luajit/luajit.c',
  'format/ne/ne.c',
  'format/mz/mz.c',
  'format/nxo/nxo.c',
  'format/objc/mach064_classes.c',
  'format/objc/mach0_classes.c',
  'format/omf/omf.c',
  'format/omf/omf166.c',
  'format/p9/p9bin.c',
  'format/pe/dotnet.c',
  'format/pe/pe.c',
  'format/pe/pe64.c',
  'format/pe/pe_info.c',
  'format/pe/pe64_info.c',
  'format/pe/pe_overlay.c',
  'format/pe/pe64_overlay.c',
  'format/pe/pe_hdr.c',
  'format/pe/pe64_hdr.c',
  'format/pe/pe_imports.c',
  'format/pe/pe64_imports.c',
  'format/pe/pe_relocs.c',
  'format/pe/pe64_relocs.c',
  'format/pe/pe_exports.c',
  'format/pe/pe64_exports.c',
  'format/pe/pe_rsrc.c',
  'format/pe/pe64_rsrc.c',
  'format/pe/pe_tls.c',
  'format/pe/pe64_tls.c',
  'format/pe/pe_security.c',
  'format/pe/pe64_security.c',
  'format/pe/pe_section.c',
  'format/pe/pe64_section.c',
  'format/pe/pe_clr.c',
  'format/pe/pe64_clr.c',
  'format/pe/pe_debug.c',
  'format/pe/pe64_debug.c',
  'format/pe/pemixed.c',
  'format/pyc/marshal.c',
  'format/pyc/pyc.c',
  'format/pyc/pyc_magic.c',
  'format/cart/cart.c',
  'format/te/te.c',
  'format/wasm/wasm.c',

  'pdb/cab_extract.c',
  'pdb/dbi.c',
  'pdb/gdata.c',
  'pdb/omap.c',
  'pdb/pdb.c',
  'pdb/pdb_downloader.c',
  'pdb/stream_pe.c',
  'pdb/tpi.c',
  'pdb/symbol.c',
  'pdb/modi.c',

  'dwarf/abbrev.c',
  'dwarf/addr.c',
  'dwarf/aranges.c',
  'dwarf/attr.c',
  'dwarf/block.c',
  'dwarf/enum.c',
  'dwarf/endian_reader.c',
  'dwarf/lists.c',
  'dwarf/line.c',
  'dwarf/line_str.c',
  'dwarf/loclists.c',
  'dwarf/op.c',
  'dwarf/rnglists.c',
  'dwarf/unit.c',
  'dwarf/value.c',
  'dwarf/str.c',
  'dwarf/str_offsets.c',
  'dwarf/dwarf.c',
]

rz_bin_inc = [platform_inc, include_directories('format')]

rz_bin = library('rz_bin', rz_bin_sources,
  include_directories: rz_bin_inc,
  c_args: ['-DRZ_API_BIN_ONLY=1'],
  dependencies: [
    lz4_dep,
    libzstd_dep,
    yxml_dep,
    rz_util_dep,
    rz_demangler_dep,
    rz_socket_dep,
    rz_magic_dep,
    rz_hash_dep,
    rz_syscall_dep,
    rz_search_dep,
    rz_cons_dep,
    rz_io_dep,
    rz_crypto_dep,
    rz_type_dep,
    libmspack_dep,
  ],
  install: true,
  implicit_include_directories: false,
  install_rpath: rpath_lib,
  soversion: rizin_libversion,
  version: rizin_version,
  name_suffix: lib_name_suffix,
  name_prefix: lib_name_prefix,
)

rz_bin_dep = declare_dependency(link_with: rz_bin,
                               include_directories: rz_bin_inc)
meson.override_dependency('rz_bin', rz_bin_dep)

modules += { 'rz_bin': {
    'target': rz_bin,
    'dependencies': [
      'rz_magic',
      'rz_util',
      'rz_io',
      'rz_search',
      'rz_socket',
      'rz_syscall',
      'rz_type'
    ],
    'plugins': [bin_plugins, bin_xtr_plugins]
}}

subdir('d')
