diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libunibreak | |
Diffstat (limited to 'vcpkg/ports/libunibreak')
| -rw-r--r-- | vcpkg/ports/libunibreak/CMakeLists.txt | 49 | ||||
| -rw-r--r-- | vcpkg/ports/libunibreak/fix_export.patch | 23 | ||||
| -rw-r--r-- | vcpkg/ports/libunibreak/libunibreak-config.cmake.in | 32 | ||||
| -rw-r--r-- | vcpkg/ports/libunibreak/portfile.cmake | 27 | ||||
| -rw-r--r-- | vcpkg/ports/libunibreak/vcpkg.json | 14 |
5 files changed, 145 insertions, 0 deletions
diff --git a/vcpkg/ports/libunibreak/CMakeLists.txt b/vcpkg/ports/libunibreak/CMakeLists.txt new file mode 100644 index 0000000..495ff2d --- /dev/null +++ b/vcpkg/ports/libunibreak/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.8.0) + +project(libunibreak) + +set(libunibreak_srcs + src/linebreak.c + src/linebreakdata.c + src/linebreakdef.c + src/wordbreak.c + src/wordbreakdata.c + src/graphemebreak.c + src/graphemebreakdata.c + src/emojidef.c + src/eastasianwidthdef.c + src/eastasianwidthdata.c + src/unibreakbase.c + src/unibreakdef.c +) + +include_directories(src) + +add_library(unibreak ${libunibreak_srcs}) + +install( + TARGETS unibreak + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install( + FILES + src/emojidef.h + src/eastasianwidthdef.h + src/unibreakbase.h + src/unibreakdef.h + src/graphemebreak.h + src/graphemebreakdef.h + src/linebreak.h + src/linebreakdef.h + src/test_skips.h + src/unibreakbase.h + src/unibreakdef.h + src/wordbreak.h + src/wordbreakdef.h + DESTINATION include + ) +endif() diff --git a/vcpkg/ports/libunibreak/fix_export.patch b/vcpkg/ports/libunibreak/fix_export.patch new file mode 100644 index 0000000..aafa6b4 --- /dev/null +++ b/vcpkg/ports/libunibreak/fix_export.patch @@ -0,0 +1,23 @@ +diff --git a/src/eastasianwidthdef.h b/src/eastasianwidthdef.h
+index 67a41aa..c081a02 100644
+--- a/src/eastasianwidthdef.h
++++ b/src/eastasianwidthdef.h
+@@ -26,6 +26,9 @@
+
+ #include "unibreakdef.h"
+
++#ifdef __cplusplus
++extern "C" {
++#endif
+ /**
+ * East Asian Width (ea) class. This is defined in Unicode Standard
+ * Annex 11.
+@@ -52,5 +55,8 @@ struct EastAsianWidthProperties
+ };
+
+ enum EastAsianWidthClass ub_get_char_eaw_class(utf32_t ch);
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* EASTASIANWIDTHDEF_H */
diff --git a/vcpkg/ports/libunibreak/libunibreak-config.cmake.in b/vcpkg/ports/libunibreak/libunibreak-config.cmake.in new file mode 100644 index 0000000..0a47463 --- /dev/null +++ b/vcpkg/ports/libunibreak/libunibreak-config.cmake.in @@ -0,0 +1,32 @@ +# For old projects where the minimum CMake version is lower than 3.3.
+cmake_policy(SET CMP0057 NEW)
+include(CMakeFindDependencyMacro)
+
+if(TARGET libunibreak)
+ return()
+endif()
+
+# Compute the installation prefix relative to this file.
+get_filename_component(_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_INSTALL_DIR "${_INSTALL_DIR}" PATH)
+get_filename_component(_INSTALL_DIR "${_INSTALL_DIR}" PATH)
+if(_INSTALL_DIR STREQUAL "/")
+ set(_INSTALL_DIR "")
+endif()
+
+add_library(unibreak INTERFACE IMPORTED GLOBAL)
+add_library(libunibreak::libunibreak ALIAS unibreak)
+
+find_library(LIBUNIBREAK_LIBRARY_DEBUG NAMES unibreak PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
+if(LIBUNIBREAK_LIBRARY_DEBUG)
+ target_link_libraries(unibreak INTERFACE $<$<CONFIG:DEBUG>:${LIBUNIBREAK_LIBRARY_DEBUG}>)
+endif()
+
+find_library(LIBUNIBREAK_LIBRARY_RELEASE NAMES unibreak PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" PATH_SUFFIXES lib NO_DEFAULT_PATH)
+target_link_libraries(unibreak INTERFACE $<$<NOT:$<CONFIG:DEBUG>>:${LIBUNIBREAK_LIBRARY_RELEASE}>)
+
+set(LIBUNIBREAK_LIBRARY libunibreak::libunibreak PARENT_SCOPE)
+set(LIBUNIBREAK_LIBRARIES libunibreak::libunibreak PARENT_SCOPE)
+set(LIBUNIBREAK_INCLUDE_DIR "${_INSTALL_DIR}/include" PARENT_SCOPE)
+
+target_include_directories(unibreak INTERFACE ${_INSTALL_DIR}/include)
\ No newline at end of file diff --git a/vcpkg/ports/libunibreak/portfile.cmake b/vcpkg/ports/libunibreak/portfile.cmake new file mode 100644 index 0000000..339ace0 --- /dev/null +++ b/vcpkg/ports/libunibreak/portfile.cmake @@ -0,0 +1,27 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +string(REGEX REPLACE "^([0-9]*)[.].*" "\\1" MAJOR "${VERSION}") +string(REGEX REPLACE "^.*[.]([0-9]*)" "\\1" MINOR "${VERSION}") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO adah1972/libunibreak + REF "libunibreak_${MAJOR}_${MINOR}" + SHA512 a85333d59c78b67b1c05d33ab99c069ba493780d6a98ad5ab00e33235c454b8b33515cac4e815de35533f235be7cf5473550b3a6389f7581ba2f6216d42d38e1 + HEAD_REF master + PATCHES + fix_export.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_cmake_install() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/libunibreak-config.cmake.in" + "${CURRENT_PACKAGES_DIR}/share/${PORT}/libunibreak-config.cmake" @ONLY) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENCE") diff --git a/vcpkg/ports/libunibreak/vcpkg.json b/vcpkg/ports/libunibreak/vcpkg.json new file mode 100644 index 0000000..e1aea08 --- /dev/null +++ b/vcpkg/ports/libunibreak/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "libunibreak", + "version": "6.1", + "port-version": 1, + "description": "an implementation of the line breaking and word breaking algorithms as described in [Unicode Standard Annex 14] 1 and [Unicode Standard Annex 29] 2. Check the project's [home page] 3 for up-to-date information.", + "homepage": "https://github.com/adah1972/libunibreak", + "license": "zlib-acknowledgement", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |