-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update icu to version 76.1 and use Meson
- Loading branch information
Showing
23 changed files
with
798 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2021 The Meson development team | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
project( | ||
'icu', | ||
'c', | ||
'cpp', | ||
version: '76.1', | ||
meson_version: '>=0.57.0', | ||
default_options: 'cpp_std=c++17', | ||
) | ||
|
||
U_ICU_VERSION = meson.project_version() | ||
PACKAGE_ICU_DESCRIPTION = 'International Components for Unicode' | ||
PACKAGE_ICU_URL = 'http://icu-project.org' | ||
|
||
cpp = meson.get_compiler('cpp') | ||
cpp_native = meson.get_compiler('cpp', native: true) | ||
|
||
have_elf_h = cpp.has_header('elf.h') | ||
|
||
if host_machine.system() == 'windows' | ||
add_project_arguments('-DU_PLATFORM_USES_ONLY_WIN32_API', language: 'cpp') | ||
add_project_arguments('-DWIN32', '-DWIN64', '-D_MBCS', language: 'cpp') | ||
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'cpp') | ||
add_project_arguments('-DWINVER=0x0601', '-D_WIN32_WINNT=0x0601' , language: 'cpp') | ||
add_project_arguments('-DU_PLATFORM_USES_ONLY_WIN32_API', language: 'c') | ||
add_project_arguments('-DWIN32', '-DWIN64', '-D_MBCS', language: 'c') | ||
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c') | ||
add_project_arguments('-DWINVER=0x0601', '-D_WIN32_WINNT=0x0601' , language: 'c') | ||
endif | ||
|
||
# per icudefs.mk.in: | ||
# "U_ATTRIBUTE_DEPRECATED is defined to hide warnings about deprecated API warnings." | ||
add_project_arguments('-DU_ATTRIBUTE_DEPRECATED=', language: 'cpp') | ||
if meson.version().version_compare('>= 0.62') | ||
dl_dep = dependency('dl', required: false) | ||
dl_native_dep = dependency('dl', required: false, native: true) | ||
else | ||
dl_dep = cpp.find_library('dl', required: false) | ||
dl_native_dep = cpp_native.find_library('dl', required: false, native: true) | ||
endif | ||
|
||
windows = import('windows') | ||
pkg = import('pkgconfig') | ||
|
||
# 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'] | ||
if cpp.get_argument_syntax() == 'msvc' | ||
library_prefix = '' | ||
library_suffix = '' | ||
else | ||
library_prefix = 's' | ||
if get_option('buildtype') == 'debug' | ||
library_suffix = 'd' | ||
else | ||
library_suffix = '' | ||
endif | ||
endif | ||
else | ||
library_prefix = '' | ||
library_suffix = '' | ||
endif | ||
|
||
subdir('source') |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
fs = import('fs') | ||
sources = fs.read('sources.txt').split() | ||
|
||
if host_machine.system() == 'windows' | ||
sources += windows.compile_resources('common.rc', include_directories: incdir) | ||
endif | ||
|
||
icuuc_name = '@0@icuuc@1@'.format(library_prefix, library_suffix) | ||
|
||
common_lib = library( | ||
icuuc_name, | ||
sources, | ||
include_directories: incdir, | ||
c_args: '-DU_COMMON_IMPLEMENTATION', | ||
cpp_args: '-DU_COMMON_IMPLEMENTATION', | ||
link_with: stubdata_lib, | ||
dependencies: dl_dep, | ||
version: U_ICU_VERSION, | ||
install: true, | ||
) | ||
|
||
if meson.can_run_host_binaries() | ||
common_native_lib = common_lib | ||
else | ||
common_native_lib = library( | ||
'@0@-native'.format(icuuc_name), | ||
sources, | ||
include_directories: incdir, | ||
c_args: '-DU_COMMON_IMPLEMENTATION', | ||
cpp_args: '-DU_COMMON_IMPLEMENTATION', | ||
link_with: stubdata_native_lib, | ||
dependencies: dl_native_dep, | ||
version: U_ICU_VERSION, | ||
native: true, | ||
) | ||
endif | ||
|
||
icuuc_dep = declare_dependency( | ||
link_with: common_lib, | ||
compile_args: usage_args, | ||
include_directories: incdir, | ||
dependencies: dl_dep, | ||
) | ||
|
||
icuuc_native_dep = declare_dependency( | ||
link_with: common_native_lib, | ||
compile_args: usage_args, | ||
include_directories: incdir, | ||
dependencies: dl_native_dep, | ||
) | ||
|
||
if meson.version().version_compare('>=0.54.0') | ||
meson.override_dependency('icu-uc', icuuc_dep) | ||
endif | ||
|
||
headers = files( | ||
'unicode/appendable.h', | ||
'unicode/brkiter.h', | ||
'unicode/bytestream.h', | ||
'unicode/bytestrie.h', | ||
'unicode/bytestriebuilder.h', | ||
'unicode/caniter.h', | ||
'unicode/casemap.h', | ||
'unicode/char16ptr.h', | ||
'unicode/chariter.h', | ||
'unicode/dbbi.h', | ||
'unicode/docmain.h', | ||
'unicode/dtintrv.h', | ||
'unicode/edits.h', | ||
'unicode/enumset.h', | ||
'unicode/errorcode.h', | ||
'unicode/filteredbrk.h', | ||
'unicode/icudataver.h', | ||
'unicode/icuplug.h', | ||
'unicode/idna.h', | ||
'unicode/localebuilder.h', | ||
'unicode/localematcher.h', | ||
'unicode/localpointer.h', | ||
'unicode/locdspnm.h', | ||
'unicode/locid.h', | ||
'unicode/messagepattern.h', | ||
'unicode/normalizer2.h', | ||
'unicode/normlzr.h', | ||
'unicode/parseerr.h', | ||
'unicode/parsepos.h', | ||
'unicode/platform.h', | ||
'unicode/ptypes.h', | ||
'unicode/putil.h', | ||
'unicode/rbbi.h', | ||
'unicode/rep.h', | ||
'unicode/resbund.h', | ||
'unicode/schriter.h', | ||
'unicode/simpleformatter.h', | ||
'unicode/std_string.h', | ||
'unicode/strenum.h', | ||
'unicode/stringoptions.h', | ||
'unicode/stringpiece.h', | ||
'unicode/stringtriebuilder.h', | ||
'unicode/symtable.h', | ||
'unicode/ubidi.h', | ||
'unicode/ubiditransform.h', | ||
'unicode/ubrk.h', | ||
'unicode/ucasemap.h', | ||
'unicode/ucat.h', | ||
'unicode/uchar.h', | ||
'unicode/ucharstrie.h', | ||
'unicode/ucharstriebuilder.h', | ||
'unicode/uchriter.h', | ||
'unicode/uclean.h', | ||
'unicode/ucnv.h', | ||
'unicode/ucnv_cb.h', | ||
'unicode/ucnv_err.h', | ||
'unicode/ucnvsel.h', | ||
'unicode/uconfig.h', | ||
'unicode/ucpmap.h', | ||
'unicode/ucptrie.h', | ||
'unicode/ucurr.h', | ||
'unicode/udata.h', | ||
'unicode/udisplaycontext.h', | ||
'unicode/uenum.h', | ||
'unicode/uidna.h', | ||
'unicode/uiter.h', | ||
'unicode/uldnames.h', | ||
'unicode/uloc.h', | ||
'unicode/umachine.h', | ||
'unicode/umisc.h', | ||
'unicode/umutablecptrie.h', | ||
'unicode/unifilt.h', | ||
'unicode/unifunct.h', | ||
'unicode/unimatch.h', | ||
'unicode/uniset.h', | ||
'unicode/unistr.h', | ||
'unicode/unorm.h', | ||
'unicode/unorm2.h', | ||
'unicode/uobject.h', | ||
'unicode/urename.h', | ||
'unicode/urep.h', | ||
'unicode/ures.h', | ||
'unicode/uscript.h', | ||
'unicode/uset.h', | ||
'unicode/usetiter.h', | ||
'unicode/ushape.h', | ||
'unicode/usprep.h', | ||
'unicode/ustring.h', | ||
'unicode/ustringtrie.h', | ||
'unicode/utext.h', | ||
'unicode/utf.h', | ||
'unicode/utf16.h', | ||
'unicode/utf32.h', | ||
'unicode/utf8.h', | ||
'unicode/utf_old.h', | ||
'unicode/utrace.h', | ||
'unicode/utypes.h', | ||
'unicode/uvernum.h', | ||
'unicode/uversion.h', | ||
) | ||
|
||
install_headers( | ||
headers, | ||
subdir: 'unicode', | ||
) | ||
|
||
pkg.generate( | ||
common_lib, | ||
name: 'icu-uc', | ||
description: '@0@: Common and Data libraries'.format(PACKAGE_ICU_DESCRIPTION), | ||
url: PACKAGE_ICU_URL, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
# SPDX-FileCopyrightText: 2022 L. E. Segovia <[email protected]> | ||
# SPDX-License-Identifier: MIT | ||
|
||
from argparse import ArgumentParser, FileType | ||
from sys import stdout | ||
|
||
if __name__ == "__main__": | ||
parser = ArgumentParser() | ||
parser.add_argument("symbol", type=str, help="Symbol to export") | ||
parser.add_argument( | ||
"outfile", | ||
nargs="?", | ||
type=FileType("w", encoding="utf-8"), | ||
default=stdout, | ||
help="Module definition file", | ||
) | ||
args = parser.parse_args() | ||
|
||
with args.outfile as f: | ||
f.write("EXPORTS\n") | ||
f.write(f"\t{args.symbol}\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
U_ICUDATA_NAME = 'icudt@0@'.format(U_ICU_VERSION.split('.')[0]) | ||
|
||
icudata_command = [ | ||
genccode_native_exe, | ||
'-d', | ||
'@OUTDIR@', | ||
'-e', | ||
U_ICUDATA_NAME, | ||
'-f', | ||
U_ICUDATA_NAME, | ||
'@CURRENT_SOURCE_DIR@/in/@[email protected]'.format(U_ICUDATA_NAME), | ||
] | ||
|
||
if host_machine.system() == 'windows' and get_option('default_library') == 'static' | ||
icudata_command += ['--skip-dll-export'] | ||
endif | ||
|
||
if cpp.get_argument_syntax() == 'msvc' | ||
## Uncomment if you want to use MASM (>= 0.64), but be aware | ||
## it is Very Slow to build. | ||
# if add_languages('masm', required: false) | ||
# icudata_asm_output = '@[email protected]'.format(U_ICUDATA_NAME) | ||
# icudata_command += ['-a', 'masm'] | ||
# else | ||
icudata_asm_output = '@[email protected]'.format(U_ICUDATA_NAME) | ||
# endif | ||
elif host_machine.system() == 'cygwin' | ||
icudata_asm_output = '@[email protected]'.format(U_ICUDATA_NAME) | ||
icudata_command += ['-a', 'gcc-cygwin'] | ||
elif host_machine.system() == 'darwin' | ||
icudata_asm_output = '@[email protected]'.format(U_ICUDATA_NAME) | ||
icudata_command += ['-a', 'gcc-darwin'] | ||
elif cpp.get_argument_syntax() == 'gcc' | ||
icudata_asm_output = '@[email protected]'.format(U_ICUDATA_NAME) | ||
if host_machine.system() == 'windows' | ||
if host_machine.cpu_family() == 'x86' | ||
icudata_command += ['-a', 'gcc-cygwin'] | ||
else | ||
icudata_command += ['-a', 'gcc-mingw64'] | ||
endif | ||
else | ||
icudata_command += ['-a', 'gcc'] | ||
endif | ||
else | ||
icudata_asm_output = '@[email protected]'.format(U_ICUDATA_NAME) | ||
endif | ||
|
||
icudata_asm = custom_target( | ||
'icudata_asm', | ||
command: icudata_command, | ||
output: icudata_asm_output, | ||
) | ||
|
||
sources = [icudata_asm] | ||
|
||
python_exe = find_program('python3') | ||
|
||
icudata_exports = custom_target( | ||
'icudata_exports', | ||
command: [python_exe, '@INPUT@', '@0@_dat'.format(U_ICUDATA_NAME), '@OUTDIR@/module.def'], | ||
input: 'export_module.py', | ||
output: 'module.def', | ||
) | ||
|
||
if host_machine.system() == 'windows' | ||
sources += windows.compile_resources('misc/icudata.rc', include_directories: incdir) | ||
endif | ||
|
||
if cpp.get_argument_syntax() != 'msvc' | ||
icudata = library( | ||
icudata_name, | ||
sources, | ||
include_directories: incdir, | ||
version: U_ICU_VERSION, | ||
vs_module_defs: icudata_exports, | ||
install: true, | ||
) | ||
|
||
icudata_dep = declare_dependency( | ||
link_with: icudata, | ||
include_directories: incdir, | ||
compile_args: usage_args, | ||
) | ||
|
||
if meson.version().version_compare('>=0.54.0') | ||
meson.override_dependency('icu-data', icudata_dep) | ||
endif | ||
endif |
Oops, something went wrong.