summaryrefslogtreecommitdiff
path: root/libicuio
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-12-26 23:05:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-01-27 22:47:56 +0300
commit7f235e1d24ce525a2bd032cefa82d96ccfdc8a19 (patch)
treeb0df84d85c53aae6718e76af8ce3bdd557270f0c /libicuio
parentbda94b275036150b568364fe3e5f96e04ed41fc3 (diff)
Add implementation
Diffstat (limited to 'libicuio')
-rw-r--r--libicuio/.gitignore20
-rw-r--r--libicuio/INSTALL7
l---------libicuio/LICENSE1
-rw-r--r--libicuio/README21
-rw-r--r--libicuio/README-DEV7
-rw-r--r--libicuio/build/.gitignore3
-rw-r--r--libicuio/build/bootstrap.build18
-rw-r--r--libicuio/build/export.build10
-rw-r--r--libicuio/build/root.build19
-rw-r--r--libicuio/buildfile10
-rw-r--r--libicuio/libicuio/buildfile106
l---------libicuio/libicuio/io1
-rw-r--r--libicuio/manifest21
-rw-r--r--libicuio/tests/.gitignore3
-rw-r--r--libicuio/tests/basic/buildfile8
-rw-r--r--libicuio/tests/basic/driver.cpp90
-rw-r--r--libicuio/tests/basic/testscript8
-rw-r--r--libicuio/tests/build/.gitignore3
-rw-r--r--libicuio/tests/build/bootstrap.build9
-rw-r--r--libicuio/tests/build/root.build24
-rw-r--r--libicuio/tests/buildfile5
21 files changed, 394 insertions, 0 deletions
diff --git a/libicuio/.gitignore b/libicuio/.gitignore
new file mode 100644
index 0000000..4c4fec7
--- /dev/null
+++ b/libicuio/.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/libicuio/INSTALL b/libicuio/INSTALL
new file mode 100644
index 0000000..5f6778d
--- /dev/null
+++ b/libicuio/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 libicuio
+
+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/libicuio/LICENSE b/libicuio/LICENSE
new file mode 120000
index 0000000..3e197da
--- /dev/null
+++ b/libicuio/LICENSE
@@ -0,0 +1 @@
+../upstream/icu4c/LICENSE \ No newline at end of file
diff --git a/libicuio/README b/libicuio/README
new file mode 100644
index 0000000..1264925
--- /dev/null
+++ b/libicuio/README
@@ -0,0 +1,21 @@
+International Components for Unicode (ICU) is a set of cross-platform Unicode-
+based globalization libraries with libicuio C/C++ library providing
+input/output support (writing Unicode string to std::ostream, etc). For more
+information see:
+
+http://site.icu-project.org/
+
+This package contains the original libicuio 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 libicuio for build2 is tracked in a Git repository at:
+
+https://git.build2.org/cgit/packaging/icu/
diff --git a/libicuio/README-DEV b/libicuio/README-DEV
new file mode 100644
index 0000000..0e048ef
--- /dev/null
+++ b/libicuio/README-DEV
@@ -0,0 +1,7 @@
+This document describes how libicuio 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 libicuio/:
+
+$ ln -s ../../upstream/icu4c/source/io libicuio
diff --git a/libicuio/build/.gitignore b/libicuio/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libicuio/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libicuio/build/bootstrap.build b/libicuio/build/bootstrap.build
new file mode 100644
index 0000000..fd58532
--- /dev/null
+++ b/libicuio/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 = libicuio
+
+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/libicuio/build/export.build b/libicuio/build/export.build
new file mode 100644
index 0000000..2559f4e
--- /dev/null
+++ b/libicuio/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 libicuio/
+}
+
+export $out_root/libicuio/$import.target
diff --git a/libicuio/build/root.build b/libicuio/build/root.build
new file mode 100644
index 0000000..aba4fb6
--- /dev/null
+++ b/libicuio/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/libicuio/buildfile b/libicuio/buildfile
new file mode 100644
index 0000000..d929850
--- /dev/null
+++ b/libicuio/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/libicuio/libicuio/buildfile b/libicuio/libicuio/buildfile
new file mode 100644
index 0000000..90630f4
--- /dev/null
+++ b/libicuio/libicuio/buildfile
@@ -0,0 +1,106 @@
+# file : libicuio/buildfile
+# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd
+# license : Unicode License; see accompanying LICENSE file
+
+import int_libs = libicui18n%lib{icui18n}
+import int_libs += libicuuc%lib{icuuc}
+
+lib{icuio}: {hxx cxx}{**} $int_libs
+
+tclass = $cxx.target.class
+tsys = $cxx.target.system
+
+windows = ($tclass == 'windows')
+
+# Build options.
+#
+cxx.poptions += -DU_IO_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/io"
+
+if $windows
+ obja{*}: cxx.poptions += -DU_STATIC_IMPLEMENTATION
+
+switch $cxx.class, $tsys
+{
+ case 'gcc'
+ cxx.coptions += -fvisibility=hidden
+
+ case 'msvc'
+ cxx.coptions += /utf-8 /Zc:wchar_t /GF /Gy \
+ /wd4996 # Disable warnings that pop up with /W3.
+}
+
+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{icuio}:
+{
+ cc.export.poptions = "-I$src_base/io"
+ cc.export.libs = $int_libs
+}
+
+# See bootstrap.build for details.
+#
+if $version.pre_release
+ lib{icuio}: bin.lib.version = @"-$version.project_id"
+else
+ lib{icuio}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version"
+
+# Install headers from the io/unicode/ subdirectory only.
+#
+hxx{*}: install = false
+io/unicode/hxx{*}: install = include/unicode/
diff --git a/libicuio/libicuio/io b/libicuio/libicuio/io
new file mode 120000
index 0000000..a9c6524
--- /dev/null
+++ b/libicuio/libicuio/io
@@ -0,0 +1 @@
+../../upstream/icu4c/source/io \ No newline at end of file
diff --git a/libicuio/manifest b/libicuio/manifest
new file mode 100644
index 0000000..34afae0
--- /dev/null
+++ b/libicuio/manifest
@@ -0,0 +1,21 @@
+: 1
+name: libicuio
+version: 65.1.0-a.0.z
+upstream-version: 65.1
+project: icu
+summary: ICU input/output C/C++ library
+license: Unicode, BSD3, BSD2 ; Unicode for the most of original files.
+topics: C, C++, Unicode, internationalization, input/output
+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/libicuio/
+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 == $
+depends: libicui18n == $
diff --git a/libicuio/tests/.gitignore b/libicuio/tests/.gitignore
new file mode 100644
index 0000000..2e508a9
--- /dev/null
+++ b/libicuio/tests/.gitignore
@@ -0,0 +1,3 @@
+driver
+test/
+test-*/
diff --git a/libicuio/tests/basic/buildfile b/libicuio/tests/basic/buildfile
new file mode 100644
index 0000000..df0f552
--- /dev/null
+++ b/libicuio/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 = libicuio%lib{icuio}
+import libs += libicuuc%lib{icuuc}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
diff --git a/libicuio/tests/basic/driver.cpp b/libicuio/tests/basic/driver.cpp
new file mode 100644
index 0000000..8c87b4b
--- /dev/null
+++ b/libicuio/tests/basic/driver.cpp
@@ -0,0 +1,90 @@
+// file : tests/basic/driver.cpp
+// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
+// license : Unicode License; see accompanying LICENSE file
+
+#include <ios>
+#include <string>
+#include <cassert>
+#include <cstdint>
+#include <iostream>
+#include <stdexcept> // runtime_error
+
+#include <unicode/ucnv.h>
+#include <unicode/utypes.h>
+#include <unicode/uclean.h>
+#include <unicode/ustdio.h> // u_strFromUTF8()
+#include <unicode/ustring.h> // u_fprintf(), u_get_stdout()
+
+#include <unicode/unistr.h> // UnicodeString
+#include <unicode/ustream.h> // operator<<(std::ostream)
+
+// Usage: argv[0]
+//
+// Read UTF-8 encoded lines from stdin and print them to stdout using C and
+// C++ APIs.
+//
+int
+main ()
+{
+ using namespace std;
+ using namespace icu;
+
+ ucnv_setDefaultName ("UTF-8");
+
+ cin.exceptions (ios::badbit);
+ cout.exceptions (ios::badbit | ios::failbit);
+
+ int r (0);
+
+ try
+ {
+ for (string l; getline (cin, l); )
+ {
+ // Print using C API.
+ //
+ {
+ // Make sure the converted input string is always NUL-terminated.
+ //
+ UChar buf[1024 + 1];
+ buf[1024] = 0x0;
+
+ int32_t n;
+ UErrorCode e (U_ZERO_ERROR);
+
+ auto validate = [&e] (const char* what)
+ {
+ if (U_FAILURE (e))
+ throw runtime_error (
+ string (what) + " failed: " + u_errorName (e));
+ };
+
+ u_strFromUTF8 (buf, 1024, &n,
+ l.c_str (), static_cast<int32_t> (l.size ()),
+ &e);
+
+ validate ("u_strFromUTF8()");
+
+ assert (n <= 1024);
+
+ u_fprintf (u_get_stdout (), "%S\n", buf);
+ }
+
+ // Print using C++ API.
+ //
+ cout << UnicodeString::fromUTF8 (l) << 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/libicuio/tests/basic/testscript b/libicuio/tests/basic/testscript
new file mode 100644
index 0000000..1d9ea51
--- /dev/null
+++ b/libicuio/tests/basic/testscript
@@ -0,0 +1,8 @@
+# file : tests/basic/testscript
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : Unicode License; see accompanying LICENSE file
+
+$* <"Mitteleuropäische Sommerzeit" >>EOO
+Mitteleuropäische Sommerzeit
+Mitteleuropäische Sommerzeit
+EOO
diff --git a/libicuio/tests/build/.gitignore b/libicuio/tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libicuio/tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libicuio/tests/build/bootstrap.build b/libicuio/tests/build/bootstrap.build
new file mode 100644
index 0000000..17797c1
--- /dev/null
+++ b/libicuio/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/libicuio/tests/build/root.build b/libicuio/tests/build/root.build
new file mode 100644
index 0000000..e8283ae
--- /dev/null
+++ b/libicuio/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/libicuio/tests/buildfile b/libicuio/tests/buildfile
new file mode 100644
index 0000000..d976635
--- /dev/null
+++ b/libicuio/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/}