rz_bin_sources = [
  'bin.c',
  'bin_write.c',
  'dbginfo.c',
  'demangle.c',
  'dwarf.c',
  'blang.c',
  'filter.c',
  'bfile.c',
  'bobj.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_cgc.c',
  'p/bin_coff.c',
  'p/bin_dbginfo_dex.c',
  'p/bin_dbginfo_elf.c',
  'p/bin_dbginfo_elf64.c',
  'p/bin_dex.c',
  'p/bin_dmp64.c',
  'p/bin_dol.c',
  'p/bin_dyldcache.c',
  'p/bin_elf.c',
  'p/bin_elf64.c',
  'p/bin_java.c',
  'p/bin_ldr_linux.c',
  'p/bin_le.c',
  'p/bin_mach0.c',
  'p/bin_mach064.c',
  'p/bin_mbn.c',
  'p/bin_mdmp.c',
  'p/bin_menuet.c',
  'p/bin_mz.c',
  'p/bin_ne.c',
  'p/bin_nes.c',
  'p/bin_nin3ds.c',
  'p/bin_ninds.c',
  'p/bin_ningb.c',
  'p/bin_ningba.c',
  'p/bin_nro.c',
  'p/bin_nso.c',
  'p/bin_omf.c',
  'p/bin_p9.c',
  'p/bin_pe.c',
  'p/bin_pe64.c',
  'p/bin_pebble.c',
  'p/bin_prg.c',
  'p/bin_psxexe.c',
  'p/bin_pyc.c',
  'p/bin_qnx.c',
  'p/bin_sfc.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_write_elf.c',
  'p/bin_write_elf64.c',
  'p/bin_write_mach0.c',
  'p/bin_write_mach064.c',
  'p/bin_write_pe.c',
  'p/bin_write_pe64.c',
  'p/bin_xbe.c',
  'p/bin_xnu_kernelcache.c',
  'p/bin_xtr_dyldcache.c',
  'p/bin_xtr_fatmach0.c',
  'p/bin_xtr_pemixed.c',
  'p/bin_xtr_sep64.c',
  'p/bin_z64.c',
  'p/bin_zimg.c',


  'format/bflt/bflt.c',
  'format/coff/coff.c',
  'format/dex/dex.c',
  'format/dmp/dmp64.c',
  'format/elf/elf.c',
  'format/elf/elf64.c',
  'format/elf/elf64_write.c',
  'format/elf/elf_write.c',
  'format/mach0/coresymbolication.c',
  'format/mach0/dyldcache.c',
  'format/mach0/fatmach0.c',
  'format/mach0/mach0.c',
  'format/mach0/mach064.c',
  'format/xnu/rz_cf_dict.c',
  'format/mdmp/mdmp.c',
  'format/mdmp/mdmp_pe.c',
  'format/mdmp/mdmp_pe64.c',
  'format/le/le.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/p9/p9bin.c',
  'format/pe/pe.c',
  'format/pe/pe64.c',
  'format/pe/pe64_write.c',
  'format/pe/pe_write.c',
  'format/pe/pemixed.c',
  'format/pyc/marshal.c',
  'format/pyc/pyc.c',
  'format/pyc/pyc_magic.c',
  'format/te/te.c',
  'format/wasm/wasm.c',
  'format/zimg/zimg.c',

  'mangling/cxx.c',
  'mangling/cxx/cp-demangle.c',
  'mangling/demangler.c',
  'mangling/rust.c',
  'mangling/java.c',
  'mangling/microsoft_demangle.c',
  'mangling/msvc.c',
  'mangling/objc.c',
  'mangling/swift-sd.c',
  'mangling/swift.c',

  'pdb/dbi.c',
  'pdb/fpo.c',
  'pdb/gdata.c',
  'pdb/omap.c',
  'pdb/pdb.c',
  'pdb/pdb_downloader.c',
  'pdb/stream_file.c',
  'pdb/stream_pe.c',
  'pdb/tpi.c'
]

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

rz_bin = library('rz_bin', rz_bin_sources,
  include_directories: rz_bin_inc,
  c_args: ['-DRZ_API_BIN_ONLY=1'] + library_cflags,
  dependencies: [
    rz_util_dep,
    rz_io_dep,
    rz_socket_dep,
    rz_magic_dep,
    rz_hash_dep,
    rz_syscall_dep,
    rz_cons_dep,
    rz_crypto_dep,
    java_dep,
    lz4_dep,
    yxml_dep
  ],
  install: true,
  implicit_include_directories: false,
  install_rpath: rpath_lib,
  soversion: rizin_libversion
)

rz_bin_dep = declare_dependency(link_with: rz_bin,
                               include_directories: rz_bin_inc)

pkgconfig_mod.generate(rz_bin,
  subdirs: 'librz',
  version: rizin_version,
  name: 'rz_bin',
  filebase: 'rz_bin',
  libraries: pkgcfg_sanitize_libs,
  requires: pkgconfig_magic_requires + [
    'rz_util',
    'rz_io',
    'rz_socket',
    'rz_syscall'
  ],
  description: 'rizin foundation libraries'
)
