From d6ee06eb544629968dc80f9619d4a1631d0ce2a9 Mon Sep 17 00:00:00 2001 From: Myaamori Date: Tue, 27 Oct 2020 17:09:32 +0000 Subject: [PATCH] meson: add ICU wrap --- meson.build | 19 +- subprojects/icu.wrap | 11 + subprojects/packagefiles/icu/meson.build | 32 +++ .../icu/source/common/meson.build | 202 +++++++++++++++ .../icu/source/data/generate_icupkg_inc.py | 53 ++++ .../packagefiles/icu/source/data/meson.build | 44 ++++ .../packagefiles/icu/source/i18n/meson.build | 239 ++++++++++++++++++ .../packagefiles/icu/source/io/meson.build | 18 ++ .../packagefiles/icu/source/meson.build | 80 ++++++ .../icu/source/stubdata/meson.build | 1 + .../icu/source/tools/ctestfw/meson.build | 18 ++ .../icu/source/tools/icupkg/meson.build | 3 + .../icu/source/tools/pkgdata/meson.build | 3 + .../icu/source/tools/toolutil/meson.build | 30 +++ 14 files changed, 736 insertions(+), 17 deletions(-) create mode 100644 subprojects/icu.wrap create mode 100644 subprojects/packagefiles/icu/meson.build create mode 100644 subprojects/packagefiles/icu/source/common/meson.build create mode 100755 subprojects/packagefiles/icu/source/data/generate_icupkg_inc.py create mode 100644 subprojects/packagefiles/icu/source/data/meson.build create mode 100644 subprojects/packagefiles/icu/source/i18n/meson.build create mode 100644 subprojects/packagefiles/icu/source/io/meson.build create mode 100644 subprojects/packagefiles/icu/source/meson.build create mode 100644 subprojects/packagefiles/icu/source/stubdata/meson.build create mode 100644 subprojects/packagefiles/icu/source/tools/ctestfw/meson.build create mode 100644 subprojects/packagefiles/icu/source/tools/icupkg/meson.build create mode 100644 subprojects/packagefiles/icu/source/tools/pkgdata/meson.build create mode 100644 subprojects/packagefiles/icu/source/tools/toolutil/meson.build diff --git a/meson.build b/meson.build index afcf8e247..3e5301c82 100644 --- a/meson.build +++ b/meson.build @@ -115,23 +115,8 @@ else # this will only be hit with msvc endif endif -icu_uc_dep = dependency('icu-uc', version: '>=4.8.1.1', required: cxx.get_id() != 'msvc') -icu_i18n_dep = dependency('icu-i18n', version: '>=4.8.1.1', required: cxx.get_id() != 'msvc') -if not (icu_uc_dep.found() and icu_i18n_dep.found()) - if get_option('icu_path') != '' - deps_inc += include_directories(get_option('icu_path') / 'include') - else - error('ICU not found and no icu_path defined.') - endif -endif -if not icu_uc_dep.found() - icu_uc_dep = cxx.find_library('icuuc', dirs: get_option('icu_path') / 'lib64') -endif -deps += icu_uc_dep -if not icu_i18n_dep.found() - icu_i18n_dep = cxx.find_library('icuin', dirs: get_option('icu_path') / 'lib64') -endif -deps += icu_i18n_dep +deps += dependency('icu-uc', version: '>=4.8.1.1') +deps += dependency('icu-i18n', version: '>=4.8.1.1') dep_avail = [] foreach dep: [ diff --git a/subprojects/icu.wrap b/subprojects/icu.wrap new file mode 100644 index 000000000..3aaf822c6 --- /dev/null +++ b/subprojects/icu.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = icu +source_url = https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz +source_filename = icu4c-67_1-src.tgz +source_hash = 94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc +patch_directory = icu + +[provide] +icu-uc = icuuc_dep +icu-io = icuio_dep +icu-i18n = icui18n_dep diff --git a/subprojects/packagefiles/icu/meson.build b/subprojects/packagefiles/icu/meson.build new file mode 100644 index 000000000..11e1cc25b --- /dev/null +++ b/subprojects/packagefiles/icu/meson.build @@ -0,0 +1,32 @@ +project('icu', 'c', 'cpp', + version: '67.1', + meson_version: '>=0.55.0', + default_options: 'cpp_std=c++17') + +cpp = meson.get_compiler('cpp') + +if host_machine.system() == 'windows' + add_project_arguments('-DWIN32', '-DWIN64', '-D_MBCS', '/utf-8', language : 'cpp') + add_project_arguments('-DWIN32', '-DWIN64', '-D_MBCS', '/utf-8', language : 'c') +endif + +if cpp.has_header('elf.h') + add_project_arguments('-DU_HAVE_ELF_H=1', language: 'c') + add_project_arguments('-DU_HAVE_ELF_H=1', language: 'cpp') +endif + +dl_dep = cpp.find_library('dl', required: false) +thread_dep = dependency('threads') + +# Compiler flags the users of this library must use. +usage_args = [] + +if get_option('default_library') == 'static' + add_project_arguments('-DU_STATIC_IMPLEMENTATION', language : 'c') + add_project_arguments('-DU_STATIC_IMPLEMENTATION', language : 'cpp') + usage_args = ['-DU_STATIC_IMPLEMENTATION'] +elif host_machine.system() == 'windows' + error('Shared library build not supported on Windows. Set default_library to static.') +endif + +subdir('source') diff --git a/subprojects/packagefiles/icu/source/common/meson.build b/subprojects/packagefiles/icu/source/common/meson.build new file mode 100644 index 000000000..6dad1a77a --- /dev/null +++ b/subprojects/packagefiles/icu/source/common/meson.build @@ -0,0 +1,202 @@ +uc_sources = files( + 'errorcode.cpp', + 'putil.cpp', + 'umath.cpp', + 'utypes.cpp', + 'uinvchar.cpp', + 'umutex.cpp', + 'ucln_cmn.cpp', + 'uinit.cpp', + 'uobject.cpp', + 'cmemory.cpp', + 'charstr.cpp', + 'cstr.cpp', + 'udata.cpp', + 'ucmndata.cpp', + 'udatamem.cpp', + 'umapfile.cpp', + 'udataswp.cpp', + 'utrie_swap.cpp', + 'ucol_swp.cpp', + 'utrace.cpp', + 'uhash.cpp', + 'uhash_us.cpp', + 'uenum.cpp', + 'ustrenum.cpp', + 'uvector.cpp', + 'ustack.cpp', + 'uvectr32.cpp', + 'uvectr64.cpp', + 'ucnv.cpp', + 'ucnv_bld.cpp', + 'ucnv_cnv.cpp', + 'ucnv_io.cpp', + 'ucnv_cb.cpp', + 'ucnv_err.cpp', + 'ucnvlat1.cpp', + 'ucnv_u7.cpp', + 'ucnv_u8.cpp', + 'ucnv_u16.cpp', + 'ucnv_u32.cpp', + 'ucnvscsu.cpp', + 'ucnvbocu.cpp', + 'ucnv_ext.cpp', + 'ucnvmbcs.cpp', + 'ucnv2022.cpp', + 'ucnvhz.cpp', + 'ucnv_lmb.cpp', + 'ucnvisci.cpp', + 'ucnvdisp.cpp', + 'ucnv_set.cpp', + 'ucnv_ct.cpp', + 'resource.cpp', + 'uresbund.cpp', + 'ures_cnv.cpp', + 'uresdata.cpp', + 'resbund.cpp', + 'resbund_cnv.cpp', + 'ucurr.cpp', + 'localebuilder.cpp', + 'localeprioritylist.cpp', + 'messagepattern.cpp', + 'ucat.cpp', + 'locmap.cpp', + 'uloc.cpp', + 'locid.cpp', + 'locutil.cpp', + 'locavailable.cpp', + 'locdispnames.cpp', + 'locdspnm.cpp', + 'loclikely.cpp', + 'locresdata.cpp', + 'lsr.cpp', + 'loclikelysubtags.cpp', + 'locdistance.cpp', + 'localematcher.cpp', + 'bytestream.cpp', + 'stringpiece.cpp', + 'bytesinkutil.cpp', + 'stringtriebuilder.cpp', + 'bytestriebuilder.cpp', + 'bytestrie.cpp', + 'bytestrieiterator.cpp', + 'ucharstrie.cpp', + 'ucharstriebuilder.cpp', + 'ucharstrieiterator.cpp', + 'dictionarydata.cpp', + 'edits.cpp', + 'appendable.cpp', + 'ustr_cnv.cpp', + 'unistr_cnv.cpp', + 'unistr.cpp', + 'unistr_case.cpp', + 'unistr_props.cpp', + 'utf_impl.cpp', + 'ustring.cpp', + 'ustrcase.cpp', + 'ucasemap.cpp', + 'ucasemap_titlecase_brkiter.cpp', + 'cstring.cpp', + 'ustrfmt.cpp', + 'ustrtrns.cpp', + 'ustr_wcs.cpp', + 'utext.cpp', + 'unistr_case_locale.cpp', + 'ustrcase_locale.cpp', + 'unistr_titlecase_brkiter.cpp', + 'ustr_titlecase_brkiter.cpp', + 'normalizer2impl.cpp', + 'normalizer2.cpp', + 'filterednormalizer2.cpp', + 'normlzr.cpp', + 'unorm.cpp', + 'unormcmp.cpp', + 'loadednormalizer2impl.cpp', + 'chariter.cpp', + 'schriter.cpp', + 'uchriter.cpp', + 'uiter.cpp', + 'patternprops.cpp', + 'uchar.cpp', + 'uprops.cpp', + 'ucase.cpp', + 'propname.cpp', + 'ubidi_props.cpp', + 'characterproperties.cpp', + 'ubidi.cpp', + 'ubidiwrt.cpp', + 'ubidiln.cpp', + 'ushape.cpp', + 'uscript.cpp', + 'uscript_props.cpp', + 'usc_impl.cpp', + 'unames.cpp', + 'utrie.cpp', + 'utrie2.cpp', + 'utrie2_builder.cpp', + 'ucptrie.cpp', + 'umutablecptrie.cpp', + 'bmpset.cpp', + 'unisetspan.cpp', + 'uset_props.cpp', + 'uniset_props.cpp', + 'uniset_closure.cpp', + 'uset.cpp', + 'uniset.cpp', + 'usetiter.cpp', + 'ruleiter.cpp', + 'caniter.cpp', + 'unifilt.cpp', + 'unifunct.cpp', + 'uarrsort.cpp', + 'brkiter.cpp', + 'ubrk.cpp', + 'brkeng.cpp', + 'dictbe.cpp', + 'filteredbrk.cpp', + 'rbbi.cpp', + 'rbbidata.cpp', + 'rbbinode.cpp', + 'rbbirb.cpp', + 'rbbiscan.cpp', + 'rbbisetb.cpp', + 'rbbistbl.cpp', + 'rbbitblb.cpp', + 'rbbi_cache.cpp', + 'serv.cpp', + 'servnotf.cpp', + 'servls.cpp', + 'servlk.cpp', + 'servlkf.cpp', + 'servrbf.cpp', + 'servslkf.cpp', + 'uidna.cpp', + 'usprep.cpp', + 'uts46.cpp', + 'punycode.cpp', + 'util.cpp', + 'util_props.cpp', + 'parsepos.cpp', + 'locbased.cpp', + 'cwchar.cpp', + 'wintz.cpp', + 'dtintrv.cpp', + 'ucnvsel.cpp', + 'propsvec.cpp', + 'ulist.cpp', + 'uloc_tag.cpp', + 'icudataver.cpp', + 'icuplug.cpp', + 'sharedobject.cpp', + 'simpleformatter.cpp', + 'unifiedcache.cpp', + 'uloc_keytype.cpp', + 'ubiditransform.cpp', + 'pluralmap.cpp', + 'static_unicode_sets.cpp', + 'restrace.cpp', +) + +uc_args = ['-DU_COMMON_IMPLEMENTATION'] +uc_link = [] +uc_deps = dl_dep diff --git a/subprojects/packagefiles/icu/source/data/generate_icupkg_inc.py b/subprojects/packagefiles/icu/source/data/generate_icupkg_inc.py new file mode 100755 index 000000000..c4265c686 --- /dev/null +++ b/subprojects/packagefiles/icu/source/data/generate_icupkg_inc.py @@ -0,0 +1,53 @@ +import json +import sys + +host = sys.argv[1] +cpu_family = sys.argv[2] +outfile = sys.argv[3] + +with open('meson-info/intro-targets.json', 'r') as f: + targets = json.load(f) + +def get_arguments(name): + target = next(target for target in targets + if target['name'] == name) + sources = next(sources for sources in target['target_sources'] + if sources['language'] == 'c') + return sources['compiler'] + sources['parameters'] + +def quote(arguments): + return " ".join(json.dumps(arg) for arg in arguments) + +obj_arguments = get_arguments("pkgdata") + ['-c'] +lib_arguments = get_arguments("icutest") + ['-Wl,-Bsymbolic'] + +config = { + 'A': 'a', + 'LIBPREFIX': 'lib', + 'LIB_EXT_ORDER': '.', + 'COMPILE': quote(obj_arguments), + 'LIBFLAGS': '', # already included in COMPILE + 'LDICUDTFLAGS': '-nodefaultlibs -nostdlib', + 'RPATH_FLAGS': '', + 'BIR_LDFLAGS': '-Wl,-Bsymbolic', + 'AR': 'ar', + 'ARFLAGS': 'r', + 'RANLIB': 'ranlib', + 'LD_SONAME': '', + 'INSTALL_CMD': '' +} + +if host == 'darwin': + config['GENCCODE_ASSEMBLY_TYPE'] = '-a gcc-darwin' + config['SO'] = 'dylib' + config['SOBJ'] = 'dylib' + config['GENLIB'] = quote(lib_arguments + ['-dynamiclib', '-dynamic']) +else: + config['GENCCODE_ASSEMBLY_TYPE'] = '-a gcc' + config['SO'] = 'so' + config['SOBJ'] = 'so' + config['GENLIB'] = quote(lib_arguments + ['-shared']) + +with open(outfile, 'w') as f: + for k, v in config.items(): + f.write("{}={}\n".format(k, v)) diff --git a/subprojects/packagefiles/icu/source/data/meson.build b/subprojects/packagefiles/icu/source/data/meson.build new file mode 100644 index 000000000..ebac3b413 --- /dev/null +++ b/subprojects/packagefiles/icu/source/data/meson.build @@ -0,0 +1,44 @@ +icudata_lst = custom_target('icudata.lst', + # not sure how to ensure that @PRIVATE_DIR@ exists + #command: [icupkg, '-d', '@PRIVATE_DIR@', '--list', '-x', '*', '@INPUT@', '-o', '@OUTPUT@'], + command: [icupkg, '-d', '@OUTDIR@', '--list', '-x', '*', '@INPUT@', '-o', '@OUTPUT@'], + input: files('in/icudt67l.dat'), + output: 'icudata.lst') + +is_static = get_option('default_library') == 'static' + +if host_machine.system() == 'windows' # only msvc supported + data_lib_static = custom_target( + 'icudata_static', command: [pkgdata, '-q', '-c', '-e', 'icudt67', '-L', 'icudata_static', + '-d', '@OUTDIR@', '-s', '@OUTDIR@', '-p', 'icudt67l', + '-m', 'static', '@INPUT@'], + input: icudata_lst, output: 'icudata_static.lib') +else + if host_machine.system() == 'darwin' + suffix = is_static ? '.a' : '.dylib' + else + suffix = is_static ? '.a' : '.so' + endif + suffix = '.a' + + icupkg_inc = custom_target('icupkg.inc', + command: [python3, '@INPUT@', host_machine.system(), + host_machine.cpu_family(), '@OUTPUT@'], + input: 'generate_icupkg_inc.py', + output: 'icupkg.inc') + data_lib_static = custom_target( + 'icudata_static', command: [pkgdata, '-q', '-c', '-e', 'icudt67', '-L', 'icudata_static', + '-d', '@OUTDIR@', '-s', '@OUTDIR@', + '-p', 'icudt67l', '-O', icupkg_inc, + '-m', 'static', '@INPUT@'], + input: icudata_lst, output: 'libicudata_static' + suffix) +endif + +if is_static + data_lib = data_lib_static +else + # convert to proper library object to make sure rpath gets set properly + data_lib = library('icudata', link_whole: data_lib_static) +endif + +# -nodefaultlibs -nostdlib for stubdata diff --git a/subprojects/packagefiles/icu/source/i18n/meson.build b/subprojects/packagefiles/icu/source/i18n/meson.build new file mode 100644 index 000000000..916e39622 --- /dev/null +++ b/subprojects/packagefiles/icu/source/i18n/meson.build @@ -0,0 +1,239 @@ +i18n_sources = files( + 'ucln_in.cpp', + 'fmtable.cpp', + 'format.cpp', + 'msgfmt.cpp', + 'umsg.cpp', + 'numfmt.cpp', + 'unum.cpp', + 'decimfmt.cpp', + 'dcfmtsym.cpp', + 'fmtable_cnv.cpp', + 'choicfmt.cpp', + 'datefmt.cpp', + 'smpdtfmt.cpp', + 'reldtfmt.cpp', + 'dtfmtsym.cpp', + 'udat.cpp', + 'dtptngen.cpp', + 'udatpg.cpp', + 'nfrs.cpp', + 'nfrule.cpp', + 'nfsubs.cpp', + 'rbnf.cpp', + 'numsys.cpp', + 'unumsys.cpp', + 'ucsdet.cpp', + 'ucal.cpp', + 'calendar.cpp', + 'gregocal.cpp', + 'timezone.cpp', + 'simpletz.cpp', + 'olsontz.cpp', + 'astro.cpp', + 'taiwncal.cpp', + 'buddhcal.cpp', + 'persncal.cpp', + 'islamcal.cpp', + 'japancal.cpp', + 'gregoimp.cpp', + 'hebrwcal.cpp', + 'indiancal.cpp', + 'chnsecal.cpp', + 'cecal.cpp', + 'coptccal.cpp', + 'dangical.cpp', + 'ethpccal.cpp', + 'coleitr.cpp', + 'coll.cpp', + 'sortkey.cpp', + 'bocsu.cpp', + 'ucoleitr.cpp', + 'ucol.cpp', + 'ucol_res.cpp', + 'ucol_sit.cpp', + 'collation.cpp', + 'collationsettings.cpp', + 'collationdata.cpp', + 'collationtailoring.cpp', + 'collationdatareader.cpp', + 'collationdatawriter.cpp', + 'collationfcd.cpp', + 'collationiterator.cpp', + 'utf16collationiterator.cpp', + 'utf8collationiterator.cpp', + 'uitercollationiterator.cpp', + 'collationsets.cpp', + 'collationcompare.cpp', + 'collationfastlatin.cpp', + 'collationkeys.cpp', + 'rulebasedcollator.cpp', + 'collationroot.cpp', + 'collationrootelements.cpp', + 'collationdatabuilder.cpp', + 'collationweights.cpp', + 'collationruleparser.cpp', + 'collationbuilder.cpp', + 'collationfastlatinbuilder.cpp', + 'listformatter.cpp', + 'ulistformatter.cpp', + 'strmatch.cpp', + 'usearch.cpp', + 'search.cpp', + 'stsearch.cpp', + 'translit.cpp', + 'utrans.cpp', + 'esctrn.cpp', + 'unesctrn.cpp', + 'funcrepl.cpp', + 'strrepl.cpp', + 'tridpars.cpp', + 'cpdtrans.cpp', + 'rbt.cpp', + 'rbt_data.cpp', + 'rbt_pars.cpp', + 'rbt_rule.cpp', + 'rbt_set.cpp', + 'nultrans.cpp', + 'remtrans.cpp', + 'casetrn.cpp', + 'titletrn.cpp', + 'tolowtrn.cpp', + 'toupptrn.cpp', + 'anytrans.cpp', + 'name2uni.cpp', + 'uni2name.cpp', + 'nortrans.cpp', + 'quant.cpp', + 'transreg.cpp', + 'brktrans.cpp', + 'regexcmp.cpp', + 'rematch.cpp', + 'repattrn.cpp', + 'regexst.cpp', + 'regextxt.cpp', + 'regeximp.cpp', + 'uregex.cpp', + 'uregexc.cpp', + 'ulocdata.cpp', + 'measfmt.cpp', + 'currfmt.cpp', + 'curramt.cpp', + 'currunit.cpp', + 'measure.cpp', + 'utmscale.cpp', + 'csdetect.cpp', + 'csmatch.cpp', + 'csr2022.cpp', + 'csrecog.cpp', + 'csrmbcs.cpp', + 'csrsbcs.cpp', + 'csrucode.cpp', + 'csrutf8.cpp', + 'inputext.cpp', + 'wintzimpl.cpp', + 'windtfmt.cpp', + 'winnmfmt.cpp', + 'basictz.cpp', + 'dtrule.cpp', + 'rbtz.cpp', + 'tzrule.cpp', + 'tztrans.cpp', + 'vtzone.cpp', + 'zonemeta.cpp', + 'standardplural.cpp', + 'upluralrules.cpp', + 'plurrule.cpp', + 'plurfmt.cpp', + 'selfmt.cpp', + 'dtitvfmt.cpp', + 'dtitvinf.cpp', + 'udateintervalformat.cpp', + 'tmunit.cpp', + 'tmutamt.cpp', + 'tmutfmt.cpp', + 'currpinf.cpp', + 'uspoof.cpp', + 'uspoof_impl.cpp', + 'uspoof_build.cpp', + 'uspoof_conf.cpp', + 'smpdtfst.cpp', + 'ztrans.cpp', + 'zrule.cpp', + 'vzone.cpp', + 'fphdlimp.cpp', + 'fpositer.cpp', + 'ufieldpositer.cpp', + 'decNumber.cpp', + 'decContext.cpp', + 'alphaindex.cpp', + 'tznames.cpp', + 'tznames_impl.cpp', + 'tzgnames.cpp', + 'tzfmt.cpp', + 'compactdecimalformat.cpp', + 'gender.cpp', + 'region.cpp', + 'scriptset.cpp', + 'uregion.cpp', + 'reldatefmt.cpp', + 'quantityformatter.cpp', + 'measunit.cpp', + 'measunit_extra.cpp', + 'sharedbreakiterator.cpp', + 'scientificnumberformatter.cpp', + 'dayperiodrules.cpp', + 'nounit.cpp', + 'number_affixutils.cpp', + 'number_compact.cpp', + 'number_decimalquantity.cpp', + 'number_decimfmtprops.cpp', + 'number_fluent.cpp', + 'number_formatimpl.cpp', + 'number_grouping.cpp', + 'number_integerwidth.cpp', + 'number_longnames.cpp', + 'number_modifiers.cpp', + 'number_notation.cpp', + 'number_output.cpp', + 'number_padding.cpp', + 'number_patternmodifier.cpp', + 'number_patternstring.cpp', + 'number_rounding.cpp', + 'number_scientific.cpp', + 'number_utils.cpp', + 'number_asformat.cpp', + 'number_mapper.cpp', + 'number_multiplier.cpp', + 'number_currencysymbols.cpp', + 'number_skeletons.cpp', + 'number_capi.cpp', + 'double-conversion-string-to-double.cpp', + 'double-conversion-double-to-string.cpp', + 'double-conversion-bignum-dtoa.cpp', + 'double-conversion-bignum.cpp', + 'double-conversion-cached-powers.cpp', + 'double-conversion-fast-dtoa.cpp', + 'double-conversion-strtod.cpp', + 'string_segment.cpp', + 'numparse_parsednumber.cpp', + 'numparse_impl.cpp', + 'numparse_symbols.cpp', + 'numparse_decimal.cpp', + 'numparse_scientific.cpp', + 'numparse_currency.cpp', + 'numparse_affixes.cpp', + 'numparse_compositions.cpp', + 'numparse_validators.cpp', + 'numrange_fluent.cpp', + 'numrange_impl.cpp', + 'erarules.cpp', + 'formattedvalue.cpp', + 'formattedval_iterimpl.cpp', + 'formattedval_sbimpl.cpp', + 'formatted_string_builder.cpp', +) + +i18n_args = '-DU_I18N_IMPLEMENTATION' +i18n_link = ['uc'] +i18n_deps = [] diff --git a/subprojects/packagefiles/icu/source/io/meson.build b/subprojects/packagefiles/icu/source/io/meson.build new file mode 100644 index 000000000..514c0924d --- /dev/null +++ b/subprojects/packagefiles/icu/source/io/meson.build @@ -0,0 +1,18 @@ +io_sources = files( + 'locbund.cpp', + 'ufile.cpp', + 'ufmt_cmn.cpp', + 'uprintf.cpp', + 'uprntf_p.cpp', + 'uscanf.cpp', + 'uscanf_p.cpp', + 'ustdio.cpp', + 'sprintf.cpp', + 'sscanf.cpp', + 'ustream.cpp', + 'ucln_io.cpp', +) + +io_args = '-DU_IO_IMPLEMENTATION' +io_link = ['i18n', 'uc'] +io_deps = [] diff --git a/subprojects/packagefiles/icu/source/meson.build b/subprojects/packagefiles/icu/source/meson.build new file mode 100644 index 000000000..a144c9db3 --- /dev/null +++ b/subprojects/packagefiles/icu/source/meson.build @@ -0,0 +1,80 @@ +python3 = import('python').find_installation('python3') + +incdir = include_directories('common', 'i18n') +toolinc = include_directories('tools/toolutil') +ctestinc = include_directories('tools/ctestfw') + +subdir('stubdata') + +# get sources and dependencies for required libraries +subdir('common') +subdir('i18n') +subdir('io') +subdir('tools/toolutil') + +# create [library name]_lib_stub artifacts linking against stub data +icu_libs = ['uc', 'i18n', 'io', 'tu'] +foreach lib: icu_libs + liblinks = [] + foreach link: get_variable(lib + '_link') + liblinks += get_variable(link + '_lib_stub') + endforeach + set_variable(lib + '_lib_stub', library( + 'icu' + lib + '_stub', + get_variable(lib + '_sources'), + include_directories: incdir, + c_args: get_variable(lib + '_args'), + cpp_args: get_variable(lib + '_args'), + link_with: liblinks + [stubdata_lib], + dependencies: get_variable(lib + '_deps') + )) +endforeach + +# build tools and full data library using the libraries linked with the stub library +subdir('tools/icupkg') +subdir('tools/pkgdata') +subdir('data') + +# rebuild libraries linking with the full data library +foreach lib: icu_libs + liblinks = [] + foreach link: get_variable(lib + '_link') + liblinks += get_variable(link + '_lib') + endforeach + set_variable(lib + '_lib', library( + 'icu' + lib, + get_variable(lib + '_sources'), + include_directories: incdir, + c_args: get_variable(lib + '_args'), + cpp_args: get_variable(lib + '_args'), + link_with: liblinks + [data_lib], + dependencies: get_variable(lib + '_deps') + )) +endforeach + +# icutest not needed for bootstrapping, link with non-boostrap libs +subdir('tools/ctestfw') + +icudata_dep = declare_dependency(link_with: [data_lib], + compile_args: usage_args, + include_directories: incdir) + +icuuc_dep = declare_dependency(link_with: [uc_lib], + compile_args: usage_args, + include_directories: incdir) + +icuio_dep = declare_dependency(link_with: [io_lib], + compile_args: usage_args, + include_directories: incdir) + +icui18n_dep = declare_dependency(link_with: [i18n_lib], + compile_args: usage_args, + include_directories: incdir) + +icutu_dep = declare_dependency(link_with: [tu_lib], + compile_args: usage_args, + include_directories: incdir) + +icutest_dep = declare_dependency(link_with: [test_lib], + compile_args: usage_args, + include_directories: [incdir, ctestinc]) diff --git a/subprojects/packagefiles/icu/source/stubdata/meson.build b/subprojects/packagefiles/icu/source/stubdata/meson.build new file mode 100644 index 000000000..599aac88c --- /dev/null +++ b/subprojects/packagefiles/icu/source/stubdata/meson.build @@ -0,0 +1 @@ +stubdata_lib = library('icudata', 'stubdata.cpp', include_directories: incdir) diff --git a/subprojects/packagefiles/icu/source/tools/ctestfw/meson.build b/subprojects/packagefiles/icu/source/tools/ctestfw/meson.build new file mode 100644 index 000000000..0deee6d85 --- /dev/null +++ b/subprojects/packagefiles/icu/source/tools/ctestfw/meson.build @@ -0,0 +1,18 @@ +test_sources = files( + 'ctest.c', + 'tstdtmod.cpp', + 'testdata.cpp', + 'datamap.cpp', + 'uperf.cpp', + 'ucln_ct.c', +) + +test_args = '-DT_CTEST_IMPLEMENTATION' + +test_lib = library('icutest', + test_sources, + include_directories: [incdir, toolinc], + c_args: test_args, + cpp_args: test_args, + link_with: [data_lib, tu_lib, uc_lib], +) diff --git a/subprojects/packagefiles/icu/source/tools/icupkg/meson.build b/subprojects/packagefiles/icu/source/tools/icupkg/meson.build new file mode 100644 index 000000000..ef96ae33a --- /dev/null +++ b/subprojects/packagefiles/icu/source/tools/icupkg/meson.build @@ -0,0 +1,3 @@ +icupkg = executable('icupkg', 'icupkg.cpp', + include_directories: [incdir, toolinc], + link_with: [tu_lib_stub, i18n_lib_stub, uc_lib_stub, stubdata_lib]) diff --git a/subprojects/packagefiles/icu/source/tools/pkgdata/meson.build b/subprojects/packagefiles/icu/source/tools/pkgdata/meson.build new file mode 100644 index 000000000..2bacac6ac --- /dev/null +++ b/subprojects/packagefiles/icu/source/tools/pkgdata/meson.build @@ -0,0 +1,3 @@ +pkgdata = executable('pkgdata', 'pkgdata.cpp', 'pkgtypes.c', + include_directories: [incdir, toolinc], + link_with: [tu_lib_stub, i18n_lib_stub, uc_lib_stub, stubdata_lib]) diff --git a/subprojects/packagefiles/icu/source/tools/toolutil/meson.build b/subprojects/packagefiles/icu/source/tools/toolutil/meson.build new file mode 100644 index 000000000..cdbecb231 --- /dev/null +++ b/subprojects/packagefiles/icu/source/tools/toolutil/meson.build @@ -0,0 +1,30 @@ +tu_sources = files( + 'filestrm.cpp', + 'package.cpp', + 'pkgitems.cpp', + 'swapimpl.cpp', + 'toolutil.cpp', + 'unewdata.cpp', + 'collationinfo.cpp', + 'denseranges.cpp', + 'ucm.cpp', + 'ucmstate.cpp', + 'uoptions.cpp', + 'uparse.cpp', + 'ucbuf.cpp', + 'xmlparser.cpp', + 'writesrc.cpp', + 'pkg_icu.cpp', + 'pkg_genc.cpp', + 'pkg_gencmn.cpp', + 'ppucd.cpp', + 'flagparser.cpp', + 'filetools.cpp', + 'udbgutil.cpp', + 'dbgutil.cpp', + 'ucln_tu.cpp', +) + +tu_args = ['-DU_TOOLUTIL_IMPLEMENTATION'] +tu_link = ['uc', 'i18n'] +tu_deps = []