From 7f235e1d24ce525a2bd032cefa82d96ccfdc8a19 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 26 Dec 2019 23:05:57 +0300 Subject: Add implementation --- libicui18n/.gitignore | 20 ++++++ libicui18n/INSTALL | 7 ++ libicui18n/LICENSE | 1 + libicui18n/README | 21 ++++++ libicui18n/README-DEV | 7 ++ libicui18n/build/.gitignore | 3 + libicui18n/build/bootstrap.build | 18 +++++ libicui18n/build/export.build | 10 +++ libicui18n/build/root.build | 19 +++++ libicui18n/buildfile | 10 +++ libicui18n/libicui18n/buildfile | 127 +++++++++++++++++++++++++++++++++ libicui18n/libicui18n/i18n | 1 + libicui18n/manifest | 20 ++++++ libicui18n/tests/.gitignore | 3 + libicui18n/tests/basic/buildfile | 8 +++ libicui18n/tests/basic/driver.cpp | 85 ++++++++++++++++++++++ libicui18n/tests/basic/testscript | 7 ++ libicui18n/tests/build/.gitignore | 3 + libicui18n/tests/build/bootstrap.build | 9 +++ libicui18n/tests/build/root.build | 24 +++++++ libicui18n/tests/buildfile | 5 ++ 21 files changed, 408 insertions(+) create mode 100644 libicui18n/.gitignore create mode 100644 libicui18n/INSTALL create mode 120000 libicui18n/LICENSE create mode 100644 libicui18n/README create mode 100644 libicui18n/README-DEV create mode 100644 libicui18n/build/.gitignore create mode 100644 libicui18n/build/bootstrap.build create mode 100644 libicui18n/build/export.build create mode 100644 libicui18n/build/root.build create mode 100644 libicui18n/buildfile create mode 100644 libicui18n/libicui18n/buildfile create mode 120000 libicui18n/libicui18n/i18n create mode 100644 libicui18n/manifest create mode 100644 libicui18n/tests/.gitignore create mode 100644 libicui18n/tests/basic/buildfile create mode 100644 libicui18n/tests/basic/driver.cpp create mode 100644 libicui18n/tests/basic/testscript create mode 100644 libicui18n/tests/build/.gitignore create mode 100644 libicui18n/tests/build/bootstrap.build create mode 100644 libicui18n/tests/build/root.build create mode 100644 libicui18n/tests/buildfile (limited to 'libicui18n') diff --git a/libicui18n/.gitignore b/libicui18n/.gitignore new file mode 100644 index 0000000..4c4fec7 --- /dev/null +++ b/libicui18n/.gitignore @@ -0,0 +1,20 @@ +# Compiler/linker output. +# +*.d +*.t +*.i +*.ii +*.o +*.obj +*.so +*.so.* +*.dll +*.a +*.lib +*.exp +*.pdb +*.ilk +*.exe +*.exe.dlls/ +*.exe.manifest +*.pc diff --git a/libicui18n/INSTALL b/libicui18n/INSTALL new file mode 100644 index 0000000..9c938a4 --- /dev/null +++ b/libicui18n/INSTALL @@ -0,0 +1,7 @@ +The aim of this package is to make reading the INSTALL file unnecessary. So +next time try running: + +$ bpkg build libicui18n + +But if you don't want to use the package manager, then you can also build this +package manually using the standard build2 build system. diff --git a/libicui18n/LICENSE b/libicui18n/LICENSE new file mode 120000 index 0000000..3e197da --- /dev/null +++ b/libicui18n/LICENSE @@ -0,0 +1 @@ +../upstream/icu4c/LICENSE \ No newline at end of file diff --git a/libicui18n/README b/libicui18n/README new file mode 100644 index 0000000..280e02d --- /dev/null +++ b/libicui18n/README @@ -0,0 +1,21 @@ +International Components for Unicode (ICU) is a set of cross-platform Unicode- +based globalization libraries with libicui18n C/C++ library providing high- +level internationalization support (formatting, collation, etc). For more +information see: + +http://site.icu-project.org/ + +This package contains the original libicui18n library source code overlaid +with the build2-based build system and packaged for the build2 package manager +(bpkg). + +See the INSTALL file for the prerequisites and installation instructions. + +Send questions, bug reports, or any other feedback about library itself to the +ICU mailing lists. Send build system and packaging-related feedback to the +packaging@build2.org mailing list (see https://lists.build2.org for posting +guidelines, etc). + +The packaging of libicui18n for build2 is tracked in a Git repository at: + +https://git.build2.org/cgit/packaging/icu/ diff --git a/libicui18n/README-DEV b/libicui18n/README-DEV new file mode 100644 index 0000000..3744292 --- /dev/null +++ b/libicui18n/README-DEV @@ -0,0 +1,7 @@ +This document describes how libicui18n was packaged for build2. In particular, +this understanding will be useful when upgrading to a new upstream version. +See ../README-DEV for general notes on ICU packaging. + +Symlink the required upstream directories into libicui18n/: + +$ ln -s ../../upstream/icu4c/source/i18n libicui18n diff --git a/libicui18n/build/.gitignore b/libicui18n/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/libicui18n/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/libicui18n/build/bootstrap.build b/libicui18n/build/bootstrap.build new file mode 100644 index 0000000..e8cef12 --- /dev/null +++ b/libicui18n/build/bootstrap.build @@ -0,0 +1,18 @@ +# file : build/root.build +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +project = libicui18n + +using version +using config +using test +using install +using dist + +# Sync with the libicuuc library ABI version (see libicuuc's bootstrap.build +# for details). +# +abi_version_major = "$version.major" +abi_version_patch = ($version.patch != 0 ? ".$version.patch" : "") +abi_version = "$abi_version_major.$version.minor$abi_version_patch" diff --git a/libicui18n/build/export.build b/libicui18n/build/export.build new file mode 100644 index 0000000..b3f4e81 --- /dev/null +++ b/libicui18n/build/export.build @@ -0,0 +1,10 @@ +# file : build/root.build +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +$out_root/ +{ + include libicui18n/ +} + +export $out_root/libicui18n/$import.target diff --git a/libicui18n/build/root.build b/libicui18n/build/root.build new file mode 100644 index 0000000..aba4fb6 --- /dev/null +++ b/libicui18n/build/root.build @@ -0,0 +1,19 @@ +# file : build/root.build +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +# Note that upstream compiles with -std=c++11 but this ends up with the 'auto +# return without trailing return type' error for Clang targeting MSVC runtime. +# +cxx.std = latest + +using cxx + +hxx{*}: extension = h +cxx{*}: extension = cpp + +if ($cxx.target.system == 'win32-msvc') + cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS + +if ($cxx.class == 'msvc') + cxx.coptions += /wd4251 /wd4275 /wd4800 diff --git a/libicui18n/buildfile b/libicui18n/buildfile new file mode 100644 index 0000000..d929850 --- /dev/null +++ b/libicui18n/buildfile @@ -0,0 +1,10 @@ +# file : buildfile +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +./: {*/ -build/} doc{LICENSE INSTALL README} manifest + +# Don't install tests or the INSTALL file. +# +tests/: install = false +doc{INSTALL}@./: install = false diff --git a/libicui18n/libicui18n/buildfile b/libicui18n/libicui18n/buildfile new file mode 100644 index 0000000..1c0690c --- /dev/null +++ b/libicui18n/libicui18n/buildfile @@ -0,0 +1,127 @@ +# file : libicui18n/buildfile +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +import int_libs = libicuuc%lib{icuuc} + +lib{icui18n}: {hxx cxx}{**} $int_libs + +tclass = $cxx.target.class +tsys = $cxx.target.system + +windows = ($tclass == 'windows') + +# Build options. +# +cxx.poptions += -DU_I18N_IMPLEMENTATION -DU_ATTRIBUTE_DEPRECATED= + +if! $windows + cxx.poptions += -DU_HAVE_STRTOD_L=1 +else + cxx.poptions += -DU_HAVE_STRTOD_L=0 -DHAVE_DLOPEN=0 -DU_HAVE_MMAP=0 -DWIN32 + +switch $tclass, $tsys +{ + case 'linux' + cxx.poptions += -D_REENTRANT -DU_HAVE_ELF_H -DU_HAVE_XLOCALE_H=0 + + case 'bsd' + cxx.poptions += -D_REENTRANT -DU_HAVE_ELF_H -DU_HAVE_XLOCALE_H=1 \ + -DU_HAVE_TIMEZONE=0 -DU_HAVE_STRING_VIEW=1 + + case 'macos' + cxx.poptions += -DU_HAVE_XLOCALE_H=1 -DU_HAVE_STRING_VIEW=1 + + case 'windows', 'mingw32' + cxx.poptions += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 \ + -D_MT # Used instead of -mthreads. + + case 'windows' + cxx.poptions += -DU_HAVE_DIRENT_H=0 -DU_HAVE_POPEN=0 -DU_HAVE_TZNAME=0 +} + +cxx.poptions =+ "-I$src_base/i18n" + +if $windows + obja{*}: cxx.poptions += -DU_STATIC_IMPLEMENTATION + +switch $cxx.class, $tsys +{ + case 'gcc' + { + cxx.coptions += -fvisibility=hidden + + # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem + # to care about these and it is not easy to disable specific warnings in a + # way that works across compilers/version (some -Wno-* options are only + # recognized in newer versions). + # + cxx.coptions += -Wno-all -Wno-extra + + # Disable the Clang targeting MSVC warnings. + # + if ($cxx.id == 'clang' && $tsys == 'win32-msvc') + cxx.coptions += -Wno-ignored-pragma-optimize + } + case 'msvc' + { + cxx.coptions += /utf-8 /Zc:wchar_t /GF /Gy + + # Disable warnings that pop up with /W3. + # + cxx.coptions += /wd4244 /wd4996 + } +} + +switch $tclass, $tsys +{ + case 'linux' + { + cxx.loptions += -Wl,-Bsymbolic \ + -Wl,--no-undefined # Make sure all symbols are resolvable. + + cxx.libs += -lpthread -ldl -lm + } + case 'bsd' + { + cxx.loptions += -Wl,-Bsymbolic + cxx.libs += -lpthread -lm + } + case 'macos' + { + cxx.libs += -lpthread -lm + } + case 'windows', 'mingw32' + { + cxx.loptions += -Wl,-Bsymbolic -Wl,--enable-auto-import + cxx.libs += -lpthread -lm + } + case 'windows' + { + cxx.libs += advapi32.lib + } +} + +# Export options. +# +lib{icui18n}: +{ + cc.export.poptions = "-I$src_base/i18n" + cc.export.libs = $int_libs +} + +# See bootstrap.build for details. +# +# Note that on Windows and POSIX the library is named quite differently as +# icuin65.dll and libicui18n.so.65.1, respectivelly. We name it consistently +# as libicui18n-65.dll and libicui18n-65.so. +# +if $version.pre_release + lib{icui18n}: bin.lib.version = @"-$version.project_id" +else + lib{icui18n}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version" + +# Install headers from the i18n/unicode/ subdirectory only. +# +hxx{*}: install = false +i18n/unicode/hxx{*}: install = include/unicode/ diff --git a/libicui18n/libicui18n/i18n b/libicui18n/libicui18n/i18n new file mode 120000 index 0000000..9fca0c0 --- /dev/null +++ b/libicui18n/libicui18n/i18n @@ -0,0 +1 @@ +../../upstream/icu4c/source/i18n \ No newline at end of file diff --git a/libicui18n/manifest b/libicui18n/manifest new file mode 100644 index 0000000..f37b2ab --- /dev/null +++ b/libicui18n/manifest @@ -0,0 +1,20 @@ +: 1 +name: libicui18n +version: 65.1.0-a.0.z +upstream-version: 65.1 +project: icu +summary: ICU high-level internationalization C/C++ library +license: Unicode, BSD3, BSD2 ; Unicode for the most of original files. +topics: C, C++, Unicode, internationalization +description-file: README +url: http://site.icu-project.org/ +doc-url: https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/ +src-url: https://git.build2.org/cgit/packaging/icu/icu/tree/libicui18n/ +package-url: https://git.build2.org/cgit/packaging/icu/ +email: icu-support@lists.sourceforge.net ; Mailing list. +package-email: packaging@build2.org ; Mailing list. +build-email: builds@build2.org +builds: all +depends: * build2 >= 0.12.0 +depends: * bpkg >= 0.12.0 +depends: libicuuc == $ diff --git a/libicui18n/tests/.gitignore b/libicui18n/tests/.gitignore new file mode 100644 index 0000000..2e508a9 --- /dev/null +++ b/libicui18n/tests/.gitignore @@ -0,0 +1,3 @@ +driver +test/ +test-*/ diff --git a/libicui18n/tests/basic/buildfile b/libicui18n/tests/basic/buildfile new file mode 100644 index 0000000..d4e9ead --- /dev/null +++ b/libicui18n/tests/basic/buildfile @@ -0,0 +1,8 @@ +# file : tests/basic/buildfile +# copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC +# license : Unicode License; see accompanying LICENSE file + +import libs = libicui18n%lib{icui18n} +import libs += libicuuc%lib{icuuc} + +exe{driver}: {hxx cxx}{*} $libs testscript diff --git a/libicui18n/tests/basic/driver.cpp b/libicui18n/tests/basic/driver.cpp new file mode 100644 index 0000000..f9bf704 --- /dev/null +++ b/libicui18n/tests/basic/driver.cpp @@ -0,0 +1,85 @@ +// file : tests/basic/driver.cpp +// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC +// license : Unicode License; see accompanying LICENSE file + +#include +#include // unique_ptr +#include +#include +#include // runtime_error + +#include +#include + +#include +#include +#include +#include + +// Usage: argv[0] +// +// Print the full 01/01/2020 00:00 time in Berlin's timezone using the +// specified locale. +// +int +main (int argc, char* argv[]) +{ + using namespace std; + using namespace icu; + + assert (argc == 2); + const char* locale (argv[1]); + + UErrorCode e (U_ZERO_ERROR); + + auto validate = [&e] (const char* what) + { + if (U_FAILURE (e)) + throw runtime_error (string (what) + " failed: " + u_errorName (e)); + }; + + int r (0); + + try + { + unique_ptr cal (Calendar::createInstance (e)); + validate ("Calendar::createInstance()"); + + cal->adoptTimeZone (TimeZone::createTimeZone ("Europe/Berlin")); + cal->clear (); + cal->set (2020, Calendar::JANUARY, 1); + + UDate date (cal->getTime (e)); + validate ("Calendar::getTime()"); + + unique_ptr fmt ( + DateFormat::createDateTimeInstance (DateFormat::kFull, + DateFormat::kFull, + locale)); + + fmt->setCalendar (*cal); + + UnicodeString us; + fmt->format(date, us, e); + validate ("DateFormat::format()"); + + string s; + StringByteSink bs (&s); + us.toUTF8 (bs); + + cout << s << endl; + } + catch (const runtime_error& e) + { + cerr << e.what () << endl; + + r = 1; + } + + // Free any heap storage that has been potentially allocated and held by the + // ICU library. + // + u_cleanup (); + + return r; +} diff --git a/libicui18n/tests/basic/testscript b/libicui18n/tests/basic/testscript new file mode 100644 index 0000000..dc6fad8 --- /dev/null +++ b/libicui18n/tests/basic/testscript @@ -0,0 +1,7 @@ +# file : tests/basic/testscript +# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +$* "de" >>EOO +Mittwoch, 1. Januar 2020 um 00:00:00 Mitteleuropäische Normalzeit +EOO diff --git a/libicui18n/tests/build/.gitignore b/libicui18n/tests/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/libicui18n/tests/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/libicui18n/tests/build/bootstrap.build b/libicui18n/tests/build/bootstrap.build new file mode 100644 index 0000000..17797c1 --- /dev/null +++ b/libicui18n/tests/build/bootstrap.build @@ -0,0 +1,9 @@ +# file : tests/build/bootstrap.build +# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +project = # Unnamed subproject. + +using config +using dist +using test diff --git a/libicui18n/tests/build/root.build b/libicui18n/tests/build/root.build new file mode 100644 index 0000000..e8283ae --- /dev/null +++ b/libicui18n/tests/build/root.build @@ -0,0 +1,24 @@ +# file : tests/build/root.build +# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +cxx.std = 14 + +using cxx + +hxx{*}: extension = h +cxx{*}: extension = cpp + +if ($cxx.target.system == 'win32-msvc') + cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS + +if ($cxx.class == 'msvc') + cxx.coptions += /wd4251 /wd4275 /wd4800 + +# Every exe{} in this subproject is by default a test. +# +exe{*}: test = true + +# Specify the test target for cross-testing. +# +test.target = $cxx.target diff --git a/libicui18n/tests/buildfile b/libicui18n/tests/buildfile new file mode 100644 index 0000000..d976635 --- /dev/null +++ b/libicui18n/tests/buildfile @@ -0,0 +1,5 @@ +# file : tests/buildfile +# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd +# license : Unicode License; see accompanying LICENSE file + +./: {*/ -build/} -- cgit v1.1