sources = files(
  'alphaindex.cpp',
  'anytrans.cpp',
  'astro.cpp',
  'basictz.cpp',
  'bocsu.cpp',
  'brktrans.cpp',
  'buddhcal.cpp',
  'calendar.cpp',
  'casetrn.cpp',
  'cecal.cpp',
  'chnsecal.cpp',
  'choicfmt.cpp',
  'coleitr.cpp',
  'coll.cpp',
  'collation.cpp',
  'collationbuilder.cpp',
  'collationcompare.cpp',
  'collationdata.cpp',
  'collationdatabuilder.cpp',
  'collationdatareader.cpp',
  'collationdatawriter.cpp',
  'collationfastlatin.cpp',
  'collationfastlatinbuilder.cpp',
  'collationfcd.cpp',
  'collationiterator.cpp',
  'collationkeys.cpp',
  'collationroot.cpp',
  'collationrootelements.cpp',
  'collationruleparser.cpp',
  'collationsets.cpp',
  'collationsettings.cpp',
  'collationtailoring.cpp',
  'collationweights.cpp',
  'compactdecimalformat.cpp',
  'coptccal.cpp',
  'cpdtrans.cpp',
  'csdetect.cpp',
  'csmatch.cpp',
  'csr2022.cpp',
  'csrecog.cpp',
  'csrmbcs.cpp',
  'csrsbcs.cpp',
  'csrucode.cpp',
  'csrutf8.cpp',
  'curramt.cpp',
  'currfmt.cpp',
  'currpinf.cpp',
  'currunit.cpp',
  'dangical.cpp',
  'datefmt.cpp',
  'dayperiodrules.cpp',
  'dcfmtsym.cpp',
  'decContext.cpp',
  # 'decNumber.cpp',
  'decimfmt.cpp',
  'displayoptions.cpp',
  'double-conversion-bignum-dtoa.cpp',
  'double-conversion-bignum.cpp',
  'double-conversion-cached-powers.cpp',
  'double-conversion-double-to-string.cpp',
  'double-conversion-fast-dtoa.cpp',
  'double-conversion-string-to-double.cpp',
  'double-conversion-strtod.cpp',
  'dtfmtsym.cpp',
  'dtitvfmt.cpp',
  'dtitvinf.cpp',
  'dtptngen.cpp',
  'dtrule.cpp',
  'erarules.cpp',
  'esctrn.cpp',
  'ethpccal.cpp',
  'fmtable.cpp',
  'fmtable_cnv.cpp',
  'format.cpp',
  'formatted_string_builder.cpp',
  'formattedval_iterimpl.cpp',
  'formattedval_sbimpl.cpp',
  'formattedvalue.cpp',
  'fphdlimp.cpp',
  'fpositer.cpp',
  'funcrepl.cpp',
  'gender.cpp',
  'gregocal.cpp',
  'gregoimp.cpp',
  'hebrwcal.cpp',
  'indiancal.cpp',
  'inputext.cpp',
  'islamcal.cpp',
  'japancal.cpp',
  'listformatter.cpp',
  'measfmt.cpp',
  'measunit.cpp',
  'measunit_extra.cpp',
  'measure.cpp',
  'msgfmt.cpp',
  'name2uni.cpp',
  'nfrs.cpp',
  'nfrule.cpp',
  'nfsubs.cpp',
  'nortrans.cpp',
  'nultrans.cpp',
  'number_affixutils.cpp',
  'number_asformat.cpp',
  'number_capi.cpp',
  'number_compact.cpp',
  'number_currencysymbols.cpp',
  'number_decimalquantity.cpp',
  'number_decimfmtprops.cpp',
  'number_fluent.cpp',
  'number_formatimpl.cpp',
  'number_formatimpl.cpp',
  'number_grouping.cpp',
  'number_integerwidth.cpp',
  'number_longnames.cpp',
  'number_mapper.cpp',
  'number_modifiers.cpp',
  'number_multiplier.cpp',
  'number_notation.cpp',
  'number_output.cpp',
  'number_padding.cpp',
  'number_patternmodifier.cpp',
  'number_patternstring.cpp',
  'number_rounding.cpp',
  'number_scientific.cpp',
  'number_skeletons.cpp',
  'number_symbolswrapper.cpp',
  'number_usageprefs.cpp',
  'number_utils.cpp',
  'numfmt.cpp',
  'numparse_affixes.cpp',
  'numparse_compositions.cpp',
  'numparse_currency.cpp',
  'numparse_decimal.cpp',
  'numparse_impl.cpp',
  'numparse_parsednumber.cpp',
  'numparse_scientific.cpp',
  'numparse_symbols.cpp',
  'numparse_validators.cpp',
  'numrange_capi.cpp',
  'numrange_fluent.cpp',
  'numrange_impl.cpp',
  'numsys.cpp',
  'olsontz.cpp',
  'persncal.cpp',
  'pluralranges.cpp',
  'plurfmt.cpp',
  'plurrule.cpp',
  'quant.cpp',
  'quantityformatter.cpp',
  'rbnf.cpp',
  'rbt.cpp',
  'rbt_data.cpp',
  'rbt_pars.cpp',
  'rbt_rule.cpp',
  'rbt_set.cpp',
  'rbtz.cpp',
  'regexcmp.cpp',
  'regeximp.cpp',
  'regexst.cpp',
  'regextxt.cpp',
  'region.cpp',
  'reldatefmt.cpp',
  'reldtfmt.cpp',
  'rematch.cpp',
  'remtrans.cpp',
  'repattrn.cpp',
  'rulebasedcollator.cpp',
  'scientificnumberformatter.cpp',
  'scriptset.cpp',
  'search.cpp',
  'selfmt.cpp',
  'sharedbreakiterator.cpp',
  'simpletz.cpp',
  'smpdtfmt.cpp',
  'smpdtfst.cpp',
  'sortkey.cpp',
  'standardplural.cpp',
  'string_segment.cpp',
  'strmatch.cpp',
  'strrepl.cpp',
  'stsearch.cpp',
  'taiwncal.cpp',
  'timezone.cpp',
  'titletrn.cpp',
  'tmunit.cpp',
  'tmutamt.cpp',
  'tmutfmt.cpp',
  'tolowtrn.cpp',
  'toupptrn.cpp',
  'translit.cpp',
  'transreg.cpp',
  'tridpars.cpp',
  'tzfmt.cpp',
  'tzgnames.cpp',
  'tznames.cpp',
  'tznames_impl.cpp',
  'tzrule.cpp',
  'tztrans.cpp',
  'ucal.cpp',
  'ucln_in.cpp',
  'ucol.cpp',
  'ucol_res.cpp',
  'ucol_sit.cpp',
  'ucoleitr.cpp',
  'ucsdet.cpp',
  'udat.cpp',
  'udateintervalformat.cpp',
  'udatpg.cpp',
  'ufieldpositer.cpp',
  'uitercollationiterator.cpp',
  'ulistformatter.cpp',
  'ulocdata.cpp',
  'umsg.cpp',
  'unesctrn.cpp',
  'uni2name.cpp',
  'units_complexconverter.cpp',
  'units_converter.cpp',
  'units_data.cpp',
  'units_router.cpp',
  'unum.cpp',
  'unumsys.cpp',
  'upluralrules.cpp',
  'uregex.cpp',
  'uregexc.cpp',
  'uregion.cpp',
  'usearch.cpp',
  'uspoof.cpp',
  'uspoof_build.cpp',
  'uspoof_conf.cpp',
  'uspoof_impl.cpp',
  'utf16collationiterator.cpp',
  'utf8collationiterator.cpp',
  'utmscale.cpp',
  'utrans.cpp',
  'vtzone.cpp',
  'vzone.cpp',
  'windtfmt.cpp',
  'winnmfmt.cpp',
  'wintzimpl.cpp',
  'zonemeta.cpp',
  'zrule.cpp',
  'ztrans.cpp',
  #  'decimalformatpattern.cpp',
  #  'ucurr.cpp',
  #  'digitlst.cpp',
  #  'uspoof_wsconf.cpp',
  #  'decfmtst.cpp',
  #  'locdspnm.cpp',
  #  'identifier_info.cpp',
  #  'filteredbrk.cpp',
)

if host_machine.system() == 'windows'
  sources += windows.compile_resources('i18n.rc', include_directories: incdir)
endif

if host_machine.system() == 'windows'
  i18n_name = '@0@icuin@1@'.format(library_prefix, library_suffix)
else
  i18n_name = '@0@icui18n@1@'.format(library_prefix, library_suffix)
endif

i18n_lib = library(
  i18n_name,
  sources,
  dependencies: icuuc_dep,
  c_args: '-DU_I18N_IMPLEMENTATION',
  cpp_args: '-DU_I18N_IMPLEMENTATION',
  version: U_ICU_VERSION,
  install: true,
)

# if meson.can_run_host_binaries()
  i18n_native_lib = i18n_lib
# else
#   i18n_native_lib = library(
#     '@0@-native'.format(i18n_name),
#     sources,
#     dependencies: icuuc_native_dep,
#     c_args: '-DU_I18N_IMPLEMENTATION',
#     cpp_args: '-DU_I18N_IMPLEMENTATION',
#     version: U_ICU_VERSION,
#     native: true,
#   )
# endif

i18ninc = include_directories('.')

icui18n_dep = declare_dependency(
  include_directories: i18ninc,
  link_with: i18n_lib,
  dependencies: icuuc_dep,
)

# icui18n_native_dep = declare_dependency(
#   include_directories: i18ninc,
#   link_with: i18n_native_lib,
#   dependencies: icuuc_native_dep,
# )

if meson.version().version_compare('>=0.54.0')
  meson.override_dependency('icu-i18n', icui18n_dep)
endif

headers = files(
  'unicode/alphaindex.h',
  'unicode/basictz.h',
  'unicode/calendar.h',
  'unicode/choicfmt.h',
  'unicode/coleitr.h',
  'unicode/coll.h',
  'unicode/compactdecimalformat.h',
  'unicode/curramt.h',
  'unicode/currpinf.h',
  'unicode/currunit.h',
  'unicode/datefmt.h',
  'unicode/dcfmtsym.h',
  'unicode/decimfmt.h',
  'unicode/displayoptions.h',
  'unicode/dtfmtsym.h',
  'unicode/dtitvfmt.h',
  'unicode/dtitvinf.h',
  'unicode/dtptngen.h',
  'unicode/dtrule.h',
  'unicode/fieldpos.h',
  'unicode/fmtable.h',
  'unicode/format.h',
  'unicode/formattedvalue.h',
  'unicode/fpositer.h',
  'unicode/gender.h',
  'unicode/gregocal.h',
  'unicode/listformatter.h',
  'unicode/measfmt.h',
  'unicode/measunit.h',
  'unicode/measure.h',
  'unicode/msgfmt.h',
  'unicode/nounit.h',
  'unicode/numberformatter.h',
  'unicode/numberrangeformatter.h',
  'unicode/numfmt.h',
  'unicode/numsys.h',
  'unicode/plurfmt.h',
  'unicode/plurrule.h',
  'unicode/rbnf.h',
  'unicode/rbtz.h',
  'unicode/regex.h',
  'unicode/region.h',
  'unicode/reldatefmt.h',
  'unicode/scientificnumberformatter.h',
  'unicode/search.h',
  'unicode/selfmt.h',
  'unicode/simpletz.h',
  'unicode/smpdtfmt.h',
  'unicode/sortkey.h',
  'unicode/stsearch.h',
  'unicode/tblcoll.h',
  'unicode/timezone.h',
  'unicode/tmunit.h',
  'unicode/tmutamt.h',
  'unicode/tmutfmt.h',
  'unicode/translit.h',
  'unicode/tzfmt.h',
  'unicode/tznames.h',
  'unicode/tzrule.h',
  'unicode/tztrans.h',
  'unicode/ucal.h',
  'unicode/ucol.h',
  'unicode/ucoleitr.h',
  'unicode/ucsdet.h',
  'unicode/udat.h',
  'unicode/udateintervalformat.h',
  'unicode/udatpg.h',
  'unicode/udisplayoptions.h',
  'unicode/ufieldpositer.h',
  'unicode/uformattable.h',
  'unicode/uformattedvalue.h',
  'unicode/ugender.h',
  'unicode/ulistformatter.h',
  'unicode/ulocdata.h',
  'unicode/umsg.h',
  'unicode/unirepl.h',
  'unicode/unum.h',
  'unicode/unumberformatter.h',
  'unicode/unumberrangeformatter.h',
  'unicode/unumsys.h',
  'unicode/upluralrules.h',
  'unicode/uregex.h',
  'unicode/uregion.h',
  'unicode/ureldatefmt.h',
  'unicode/usearch.h',
  'unicode/uspoof.h',
  'unicode/utmscale.h',
  'unicode/utrans.h',
  'unicode/vtzone.h',
)

install_headers(
  headers,
  subdir: 'unicode',
)

pkg.generate(
  i18n_lib,
  name: 'icu-i18n',
  description: '@0@: Internationalization library'.format(PACKAGE_ICU_DESCRIPTION),
  url: PACKAGE_ICU_URL,
)
