Skip to content

Commit 3697e6e

Browse files
committed
Replace ICU dependency with embedded Unicode tables
1 parent 032c34e commit 3697e6e

22 files changed

Lines changed: 7794 additions & 559 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
coverage: "nocov"
2626
detectcpuflags: "ignore"
2727
boost: "--build-boost"
28-
icu: ""
2928
llvm: ""
3029
secp256k1: "--build-secp256k1"
3130
cc: "clang-18"
@@ -42,7 +41,6 @@ jobs:
4241
coverage: "nocov"
4342
detectcpuflags: "ignore"
4443
boost: "--build-boost"
45-
icu: "--build-icu --with-icu"
4644
llvm: ""
4745
secp256k1: "--build-secp256k1"
4846
cc: "clang-18"
@@ -59,7 +57,6 @@ jobs:
5957
coverage: "nocov"
6058
detectcpuflags: "ignore"
6159
boost: "--build-boost"
62-
icu: ""
6360
llvm: ""
6461
secp256k1: "--build-secp256k1"
6562
cc: "gcc-12"
@@ -76,7 +73,6 @@ jobs:
7673
coverage: "cov"
7774
detectcpuflags: "detect"
7875
boost: "--build-boost"
79-
icu: "--build-icu --with-icu"
8076
llvm: ""
8177
secp256k1: "--build-secp256k1"
8278
cc: "gcc"
@@ -93,14 +89,13 @@ jobs:
9389
coverage: "nocov"
9490
detectcpuflags: "ignore"
9591
boost: "--build-boost"
96-
icu: "--with-icu"
9792
llvm: ""
9893
secp256k1: "--build-secp256k1"
9994
cc: "clang"
10095
flags: "-Os -fPIE"
10196
options: "--enable-isystem"
10297
packager: "brew"
103-
packages: "icu4c"
98+
packages: ""
10499

105100
- os: macos-latest
106101
cxx: "clang++"
@@ -110,7 +105,6 @@ jobs:
110105
coverage: "nocov"
111106
detectcpuflags: "ignore"
112107
boost: "--build-boost"
113-
icu: "--build-icu --with-icu"
114108
llvm: ""
115109
secp256k1: "--build-secp256k1"
116110
cc: "clang"
@@ -214,7 +208,6 @@ jobs:
214208
${{ env.ASSERT_NDEBUG }}
215209
${{ env.CPU_SUPPORTED_FLAGS }}
216210
${{ matrix.boost }}
217-
${{ matrix.icu }}
218211
${{ matrix.secp256k1 }}
219212
220213
- name: Coveralls Calculation
@@ -296,7 +289,6 @@ jobs:
296289
coverage: "nocov"
297290
detectcpuflags: "ignore"
298291
boost: "--build-boost"
299-
icu: ""
300292
llvm: ""
301293
secp256k1: "--build-secp256k1"
302294
cc: "clang-18"
@@ -313,7 +305,6 @@ jobs:
313305
coverage: "nocov"
314306
detectcpuflags: "ignore"
315307
boost: "--build-boost"
316-
icu: "--build-icu --with-icu"
317308
llvm: ""
318309
secp256k1: "--build-secp256k1"
319310
cc: "clang-18"
@@ -330,7 +321,6 @@ jobs:
330321
coverage: "nocov"
331322
detectcpuflags: "ignore"
332323
boost: "--build-boost"
333-
icu: ""
334324
llvm: ""
335325
secp256k1: "--build-secp256k1"
336326
cc: "gcc-12"
@@ -347,7 +337,6 @@ jobs:
347337
coverage: "nocov"
348338
detectcpuflags: "ignore"
349339
boost: "--build-boost"
350-
icu: "--build-icu --with-icu"
351340
llvm: ""
352341
secp256k1: "--build-secp256k1"
353342
cc: "gcc-12"
@@ -364,14 +353,13 @@ jobs:
364353
coverage: "nocov"
365354
detectcpuflags: "ignore"
366355
boost: "--build-boost"
367-
icu: "--with-icu"
368356
llvm: ""
369357
secp256k1: "--build-secp256k1"
370358
cc: "clang"
371359
flags: "-Os -fPIE"
372360
options: ""
373361
packager: "brew"
374-
packages: "icu4c"
362+
packages: ""
375363

376364
- os: macos-latest
377365
cxx: "clang++"
@@ -381,7 +369,6 @@ jobs:
381369
coverage: "nocov"
382370
detectcpuflags: "ignore"
383371
boost: "--build-boost"
384-
icu: "--build-icu --with-icu"
385372
llvm: ""
386373
secp256k1: "--build-secp256k1"
387374
cc: "clang"
@@ -488,7 +475,6 @@ jobs:
488475
${{ env.ASSERT_NDEBUG }}
489476
${{ env.CPU_SUPPORTED_FLAGS }}
490477
${{ matrix.boost }}
491-
${{ matrix.icu }}
492478
${{ matrix.secp256k1 }}
493479
494480
- name: Coveralls Calculation
@@ -581,7 +567,6 @@ jobs:
581567
coverage: "nocov"
582568
detectcpuflags: "ignore"
583569
boost: "--build-boost"
584-
icu: ""
585570
llvm: ""
586571
secp256k1: "--build-secp256k1"
587572
cc: "clang-18"
@@ -599,7 +584,6 @@ jobs:
599584
coverage: "nocov"
600585
detectcpuflags: "ignore"
601586
boost: "--build-boost"
602-
icu: "--build-icu --with-icu"
603587
llvm: ""
604588
secp256k1: "--build-secp256k1"
605589
cc: "clang-18"
@@ -617,7 +601,6 @@ jobs:
617601
coverage: "nocov"
618602
detectcpuflags: "ignore"
619603
boost: "--build-boost"
620-
icu: ""
621604
llvm: ""
622605
secp256k1: "--build-secp256k1"
623606
cc: "gcc-12"
@@ -725,7 +708,6 @@ jobs:
725708
${{ env.ASSERT_NDEBUG }}
726709
${{ env.CPU_SUPPORTED_FLAGS }}
727710
${{ matrix.boost }}
728-
${{ matrix.icu }}
729711
${{ matrix.secp256k1 }}
730712
731713
- name: Coveralls Calculation

Makefile.am

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ doc_DATA = \
3232
# src/libbitcoin-system.la => ${libdir}
3333
#------------------------------------------------------------------------------
3434
lib_LTLIBRARIES = src/libbitcoin-system.la
35-
src_libbitcoin_system_la_CPPFLAGS = -I${srcdir}/include ${icu} ${boost_BUILD_CPPFLAGS} ${icu_i18n_BUILD_CPPFLAGS} ${secp256k1_BUILD_CPPFLAGS}
35+
src_libbitcoin_system_la_CPPFLAGS = -I${srcdir}/include ${boost_BUILD_CPPFLAGS} ${secp256k1_BUILD_CPPFLAGS}
3636
src_libbitcoin_system_la_LDFLAGS = ${boost_LDFLAGS}
37-
src_libbitcoin_system_la_LIBADD = ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_program_options_LIBS} ${boost_thread_LIBS} ${boost_url_LIBS} ${icu_i18n_LIBS} ${secp256k1_LIBS}
37+
src_libbitcoin_system_la_LIBADD = ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_program_options_LIBS} ${boost_thread_LIBS} ${boost_url_LIBS} ${secp256k1_LIBS}
3838
src_libbitcoin_system_la_SOURCES = \
3939
src/arena.cpp \
4040
src/define.cpp \
@@ -116,6 +116,7 @@ src_libbitcoin_system_la_SOURCES = \
116116
src/unicode/code_points.cpp \
117117
src/unicode/conversion.cpp \
118118
src/unicode/normalization.cpp \
119+
src/unicode/unicode_tables.cpp \
119120
src/unicode/utf8_everywhere/console_streambuf.cpp \
120121
src/unicode/utf8_everywhere/environment.cpp \
121122
src/unicode/utf8_everywhere/ifstream.cpp \
@@ -193,9 +194,9 @@ src_libbitcoin_system_la_SOURCES = \
193194
if WITH_EXAMPLES
194195

195196
noinst_PROGRAMS = examples/libbitcoin-system-examples
196-
examples_libbitcoin_system_examples_CPPFLAGS = -I${srcdir}/include ${icu} ${boost_BUILD_CPPFLAGS} ${icu_i18n_BUILD_CPPFLAGS} ${secp256k1_BUILD_CPPFLAGS}
197+
examples_libbitcoin_system_examples_CPPFLAGS = -I${srcdir}/include ${boost_BUILD_CPPFLAGS} ${secp256k1_BUILD_CPPFLAGS}
197198
examples_libbitcoin_system_examples_LDFLAGS = ${boost_LDFLAGS}
198-
examples_libbitcoin_system_examples_LDADD = src/libbitcoin-system.la ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_program_options_LIBS} ${boost_thread_LIBS} ${boost_url_LIBS} ${icu_i18n_LIBS} ${secp256k1_LIBS}
199+
examples_libbitcoin_system_examples_LDADD = src/libbitcoin-system.la ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_program_options_LIBS} ${boost_thread_LIBS} ${boost_url_LIBS} ${secp256k1_LIBS}
199200
examples_libbitcoin_system_examples_SOURCES = \
200201
examples/main.cpp
201202

@@ -208,9 +209,9 @@ if WITH_TESTS
208209
TESTS = libbitcoin-system-test_runner.sh
209210

210211
check_PROGRAMS = test/libbitcoin-system-test
211-
test_libbitcoin_system_test_CPPFLAGS = -I${srcdir}/include ${icu} ${boost_BUILD_CPPFLAGS} ${icu_i18n_BUILD_CPPFLAGS} ${secp256k1_BUILD_CPPFLAGS}
212+
test_libbitcoin_system_test_CPPFLAGS = -I${srcdir}/include ${boost_BUILD_CPPFLAGS} ${secp256k1_BUILD_CPPFLAGS}
212213
test_libbitcoin_system_test_LDFLAGS = ${boost_LDFLAGS}
213-
test_libbitcoin_system_test_LDADD = src/libbitcoin-system.la ${boost_unit_test_framework_LIBS} ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_program_options_LIBS} ${boost_thread_LIBS} ${boost_url_LIBS} ${icu_i18n_LIBS} ${secp256k1_LIBS}
214+
test_libbitcoin_system_test_LDADD = src/libbitcoin-system.la ${boost_unit_test_framework_LIBS} ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_program_options_LIBS} ${boost_thread_LIBS} ${boost_url_LIBS} ${secp256k1_LIBS}
214215
test_libbitcoin_system_test_SOURCES = \
215216
test/allocator.cpp \
216217
test/arena.cpp \
@@ -903,7 +904,8 @@ include_bitcoin_system_unicode_HEADERS = \
903904
include/bitcoin/system/unicode/code_points.hpp \
904905
include/bitcoin/system/unicode/conversion.hpp \
905906
include/bitcoin/system/unicode/normalization.hpp \
906-
include/bitcoin/system/unicode/unicode.hpp
907+
include/bitcoin/system/unicode/unicode.hpp \
908+
include/bitcoin/system/unicode/unicode_tables.hpp
907909

908910
include_bitcoin_system_unicode_utf8_everywheredir = ${includedir}/bitcoin/system/unicode/utf8_everywhere
909911
include_bitcoin_system_unicode_utf8_everywhere_HEADERS = \

builds/cmake/CMakeLists.txt

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,9 @@ set( with-tests "yes" CACHE BOOL "Compile with unit tests." )
148148
#------------------------------------------------------------------------------
149149
set( with-examples "yes" CACHE BOOL "Compile with examples." )
150150

151-
# Implement -Dwith-icu and define WITH_ICU and output ${icu}.
151+
# Implement -Dwith-normalization-demo and declare with-normalization-demo.
152152
#------------------------------------------------------------------------------
153-
set( with-icu "no" CACHE BOOL "Compile with International Components for Unicode." )
154-
155-
if (with-icu)
156-
add_definitions( -DWITH_ICU )
157-
endif()
158-
159-
if (with-icu)
160-
set( icu "-DWITH_ICU" )
161-
endif()
153+
set( with-normalization-demo "no" CACHE BOOL "Compile the Unicode normalization demo (examples/normalization_demo.cpp)." )
162154

163155
# Implement -Denable-avx2.
164156
#------------------------------------------------------------------------------
@@ -340,48 +332,36 @@ set( Boost_LIBRARY_DIR $<IF:$<BOOL:${enable-ndebug}>,"${Boost_LIBRARY_DIR_RELEAS
340332
set( boost_CPPFLAGS "-I${Boost_INCLUDE_DIR}" )
341333
set( boost_LDFLAGS "-L${Boost_LIBRARY_DIR}" )
342334

343-
# Find icu-i18n
344-
#------------------------------------------------------------------------------
345-
if (with-icu)
346-
find_package( Icu-I18N 55.2 REQUIRED )
347-
endif()
348-
349335
# Find secp256k1
350336
#------------------------------------------------------------------------------
351337
find_package( Secp256K1 0.5.1.0 REQUIRED )
352338

353339
# Define project common includes for build.
354340
#------------------------------------------------------------------------------
355341
if (BUILD_SHARED_LIBS)
356-
set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_INCLUDE_DIRS} CACHE STRING "Placeholder" )
357342
set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_INCLUDE_DIRS} CACHE STRING "Placeholder" )
358343
else()
359-
set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" )
360344
set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" )
361345
endif()
362346

363347
# Define project common includes directories
364348
#------------------------------------------------------------------------------
365349
include_directories( SYSTEM
366350
${Boost_INCLUDE_DIR}
367-
${icu_i18n_FOR_BUILD_INCLUDE_DIRS}
368351
${secp256k1_FOR_BUILD_INCLUDE_DIRS} )
369352

370353
# Define project common library directories for build.
371354
#------------------------------------------------------------------------------
372355
if (BUILD_SHARED_LIBS)
373-
set( icu_i18n_FOR_BUILD_LIBRARY_DIRS ${icu_i18n_LIBRARY_DIRS} CACHE STRING "Placeholder" )
374356
set( secp256k1_FOR_BUILD_LIBRARY_DIRS ${secp256k1_LIBRARY_DIRS} CACHE STRING "Placeholder" )
375357
else()
376-
set( icu_i18n_FOR_BUILD_LIBRARY_DIRS ${icu_i18n_STATIC_LIBRARY_DIRS} CACHE STRING "Placeholder" )
377358
set( secp256k1_FOR_BUILD_LIBRARY_DIRS ${secp256k1_STATIC_LIBRARY_DIRS} CACHE STRING "Placeholder" )
378359
endif()
379360

380361
# Define project common library directories
381362
#------------------------------------------------------------------------------
382363
link_directories(
383364
${Boost_LIBRARY_DIRS}
384-
${icu_i18n_FOR_BUILD_LIBRARY_DIRS}
385365
${secp256k1_FOR_BUILD_LIBRARY_DIRS} )
386366

387367
# Define project common linker flags.
@@ -408,10 +388,8 @@ endif()
408388
# Define common library usage for build.
409389
#------------------------------------------------------------------------------
410390
if (BUILD_SHARED_LIBS)
411-
set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_LIBRARIES} CACHE STRING "Placeholder" )
412391
set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_LIBRARIES} CACHE STRING "Placeholder" )
413392
else()
414-
set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_STATIC_LIBRARIES} CACHE STRING "Placeholder" )
415393
set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_STATIC_LIBRARIES} CACHE STRING "Placeholder" )
416394
endif()
417395

@@ -423,12 +401,8 @@ link_libraries(
423401
${Boost_PROGRAM_OPTIONS_LIBRARY}
424402
${Boost_THREAD_LIBRARY}
425403
${Boost_URL_LIBRARY}
426-
${icu_i18n_FOR_BUILD_LIBRARIES}
427404
${secp256k1_FOR_BUILD_LIBRARIES} )
428405

429-
add_definitions(
430-
${icu} )
431-
432406
# Define ${CANONICAL_LIB_NAME} project.
433407
#------------------------------------------------------------------------------
434408
add_library( ${CANONICAL_LIB_NAME}
@@ -512,6 +486,7 @@ add_library( ${CANONICAL_LIB_NAME}
512486
"../../src/unicode/code_points.cpp"
513487
"../../src/unicode/conversion.cpp"
514488
"../../src/unicode/normalization.cpp"
489+
"../../src/unicode/unicode_tables.cpp"
515490
"../../src/unicode/utf8_everywhere/console_streambuf.cpp"
516491
"../../src/unicode/utf8_everywhere/environment.cpp"
517492
"../../src/unicode/utf8_everywhere/ifstream.cpp"
@@ -587,10 +562,8 @@ add_library( ${CANONICAL_LIB_NAME}
587562
# ${CANONICAL_LIB_NAME} project specific include directory normalization for build.
588563
#------------------------------------------------------------------------------
589564
if (BUILD_SHARED_LIBS)
590-
set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_INCLUDE_DIRS} CACHE STRING "Placeholder" )
591565
set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_INCLUDE_DIRS} CACHE STRING "Placeholder" )
592566
else()
593-
set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" )
594567
set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" )
595568
endif()
596569

@@ -599,7 +572,6 @@ endif()
599572
target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE
600573
"../../include"
601574
${Boost_INCLUDE_DIR}
602-
${icu_i18n_FOR_BUILD_INCLUDE_DIRS}
603575
${secp256k1_FOR_BUILD_INCLUDE_DIRS} )
604576

605577
target_include_directories( ${CANONICAL_LIB_NAME} PUBLIC
@@ -608,10 +580,8 @@ target_include_directories( ${CANONICAL_LIB_NAME} PUBLIC
608580
# ${CANONICAL_LIB_NAME} project specific libraries noramalization for build.
609581
#------------------------------------------------------------------------------
610582
if (BUILD_SHARED_LIBS)
611-
set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_LIBRARIES} CACHE STRING "Placeholder" )
612583
set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_LIBRARIES} CACHE STRING "Placeholder" )
613584
else()
614-
set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_STATIC_LIBRARIES} CACHE STRING "Placeholder" )
615585
set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_STATIC_LIBRARIES} CACHE STRING "Placeholder" )
616586
endif()
617587

@@ -623,7 +593,6 @@ target_link_libraries( ${CANONICAL_LIB_NAME}
623593
${Boost_PROGRAM_OPTIONS_LIBRARY}
624594
${Boost_THREAD_LIBRARY}
625595
${Boost_URL_LIBRARY}
626-
${icu_i18n_FOR_BUILD_LIBRARIES}
627596
${secp256k1_FOR_BUILD_LIBRARIES} )
628597

629598
# Define libbitcoin-system-examples project.
@@ -644,6 +613,28 @@ if (with-examples)
644613

645614
endif()
646615

616+
# Define libbitcoin-system-normalization-demo project.
617+
#------------------------------------------------------------------------------
618+
if (with-normalization-demo)
619+
add_executable( libbitcoin-system-normalization-demo
620+
"../../examples/normalization_demo.cpp" )
621+
622+
# libbitcoin-system-normalization-demo project specific include directories.
623+
#------------------------------------------------------------------------------
624+
target_include_directories( libbitcoin-system-normalization-demo PRIVATE
625+
"../../include" )
626+
627+
# libbitcoin-system-normalization-demo project specific libraries/linker flags.
628+
#------------------------------------------------------------------------------
629+
target_link_libraries( libbitcoin-system-normalization-demo
630+
${CANONICAL_LIB_NAME} )
631+
632+
if(BUILD_EXTERNAL_DEPS)
633+
add_dependencies( libbitcoin-system-normalization-demo boost_build secp256k1_build )
634+
endif()
635+
636+
endif()
637+
647638
# Define libbitcoin-system-test project.
648639
#------------------------------------------------------------------------------
649640
if (with-tests)
@@ -936,4 +927,3 @@ install( TARGETS ${CANONICAL_LIB_NAME}
936927
#------------------------------------------------------------------------------
937928
install( DIRECTORY "../../include/bitcoin"
938929
DESTINATION include )
939-

0 commit comments

Comments
 (0)