mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 22:59:02 +08:00
[libdatrie] Update and fixes (#23681)
* Libdatrie fixes * Libdatrie fixes and update to v0.2.13 * Add usage * Create feature 'tool' * Update versions * Install pkg-config module * Update versions Co-authored-by: Thomas Heinrichs <46387399+Thomas1664@users.noreply.github.com>
This commit is contained in:
parent
ed9ba1e0a9
commit
cec1fbea37
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(libdatrie LANGUAGES C)
|
||||
|
||||
option(SKIP_HEADERS "Skip headers" OFF)
|
||||
@ -49,30 +49,23 @@ check_function_exists(malloc HAVE_MALLOC)
|
||||
|
||||
configure_file(config.h.cmake config.h)
|
||||
|
||||
include_directories(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
|
||||
add_library(libdatrie ${LIB_SRCS})
|
||||
target_include_directories(libdatrie PRIVATE ".")
|
||||
target_include_directories(libdatrie PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(libdatrie PROPERTIES PREFIX "")
|
||||
set_target_properties(libdatrie PROPERTIES DEBUG_POSTFIX "d")
|
||||
set_target_properties(libdatrie PROPERTIES OUTPUT_NAME "datrie")
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT SKIP_TOOL)
|
||||
add_executable(trietool "tools/trietool.c" )
|
||||
target_include_directories(trietool PRIVATE ".")
|
||||
target_include_directories(trietool PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(trietool libdatrie)
|
||||
|
||||
find_path(ICONV_INCLUDE_DIR iconv.h)
|
||||
find_library(ICONV_LIBRARY NAMES iconv libiconv)
|
||||
find_library(CHARSET_LIBRARY NAMES charset libcharset)
|
||||
target_include_directories(trietool PRIVATE ${ICONV_INCLUDE_DIR})
|
||||
target_link_libraries(trietool ${ICONV_LIBRARY} ${CHARSET_LIBRARY})
|
||||
|
||||
find_package(Iconv REQUIRED)
|
||||
target_link_libraries(trietool PRIVATE libdatrie Iconv::Iconv)
|
||||
install(
|
||||
TARGETS trietool
|
||||
RUNTIME DESTINATION bin
|
||||
@ -92,3 +85,13 @@ if (NOT SKIP_HEADERS)
|
||||
DESTINATION "include/datrie"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${prefix}/lib")
|
||||
set(includedir "\${prefix}/include")
|
||||
configure_file(datrie-0.2.pc.in datrie-0.2.pc)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/datrie-0.2.pc"
|
||||
DESTINATION "lib/pkgconfig"
|
||||
)
|
@ -1,31 +0,0 @@
|
||||
From 086a76ad7c17060d504371ea724cf5d651d43eb3 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Paulyshka <me@mixaill.tk>
|
||||
Date: Thu, 28 Dec 2017 16:07:51 +0300
|
||||
Subject: [PATCH] fix trietool for MSVC runtime
|
||||
|
||||
---
|
||||
tools/trietool.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/trietool.c b/tools/trietool.c
|
||||
index 4cfde2a..7c90905 100644
|
||||
--- a/tools/trietool.c
|
||||
+++ b/tools/trietool.c
|
||||
@@ -589,12 +589,12 @@ string_trim (char *s)
|
||||
char *p;
|
||||
|
||||
/* skip leading white spaces */
|
||||
- while (*s && isspace (*s))
|
||||
+ while (*s && isspace ((unsigned char)*s))
|
||||
++s;
|
||||
|
||||
/* trim trailing white spaces */
|
||||
p = s + strlen (s) - 1;
|
||||
- while (isspace (*p))
|
||||
+ while (isspace ((unsigned char)*p))
|
||||
--p;
|
||||
*++p = '\0';
|
||||
|
||||
--
|
||||
2.14.1.windows.1
|
||||
|
@ -1,52 +1,40 @@
|
||||
set(LIBDATRIE_VERSION 0.2.10)
|
||||
set(LIBDATRIE_VERSION 0.2.13)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-${LIBDATRIE_VERSION}.tar.xz"
|
||||
FILENAME "libdatrie-${LIBDATRIE_VERSION}.tar.xz"
|
||||
SHA512 ee68ded9d6e06c562da462d42e7e56098a82478d7b8547506200c3018b72536c4037a4e518924f779dc77d3ab139d93216bdb29ab4116b9dc9efd1a5d1eb9e31
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
ARCHIVE ${ARCHIVE}
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO tlwg/libdatrie
|
||||
REF v${LIBDATRIE_VERSION}
|
||||
SHA512 38f5a3ee1f3ca0f0601a5fcfeec3892cb34857d4b4720b8e018ca1beb6520c4c10af3bd2f0e4d64367cb256e8e2bca4d0a59b1c81fb36782613d2c258b64df59
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fix-exports.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fix-trietool.patch"
|
||||
fix-exports.patch
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h.cmake DESTINATION ${SOURCE_PATH})
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h.cmake" DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(SKIP_TOOL ON)
|
||||
else()
|
||||
set(SKIP_TOOL OFF)
|
||||
endif()
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
INVERTED_FEATURES
|
||||
tool SKIP_TOOL
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DVERSION=${LIBDATRIE_VERSION}
|
||||
OPTIONS_RELEASE
|
||||
-DSKIP_TOOL=${SKIP_TOOL}
|
||||
-DSKIP_HEADERS=OFF
|
||||
${FEATURE_OPTIONS}
|
||||
OPTIONS_DEBUG
|
||||
-DSKIP_TOOL=ON
|
||||
-DSKIP_HEADERS=ON
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT})
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/trietool.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/trietool.exe)
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
|
||||
if(NOT SKIP_TOOL)
|
||||
vcpkg_copy_tools(TOOL_NAMES trietool AUTO_CLEAN)
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
endif()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libdatrie RENAME copyright)
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
13
ports/libdatrie/usage
Normal file
13
ports/libdatrie/usage
Normal file
@ -0,0 +1,13 @@
|
||||
The package libdatrie can be used via CMake:
|
||||
|
||||
find_path(LIBDATRIE_INCLUDE_DIR datrie/trie.h)
|
||||
find_library(LIBDATRIE_LIBRARY NAMES datrie)
|
||||
target_include_directories(main PRIVATE "${LIBDATRIE_INCLUDE_DIR}")
|
||||
target_link_libraries(main PRIVATE "${LIBDATRIE_LIBRARY}")
|
||||
|
||||
The package libdatrie can be imported via CMake FindPkgConfig module:
|
||||
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(LIBDATRIE REQUIRED IMPORTED_TARGET datrie-0.2)
|
||||
|
||||
target_link_libraries(main PRIVATE PkgConfig::LIBDATRIE)
|
@ -1,10 +1,22 @@
|
||||
{
|
||||
"name": "libdatrie",
|
||||
"version-string": "0.2.10",
|
||||
"port-version": 4,
|
||||
"description": "implementation of double-array structure for representing trie",
|
||||
"version": "0.2.13",
|
||||
"description": "Implementation of double-array structure for representing trie",
|
||||
"homepage": "https://linux.thai.net/pub/ThaiLinux/software/libthai",
|
||||
"license": "LGPL-2.1-or-later",
|
||||
"dependencies": [
|
||||
"libiconv"
|
||||
]
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"tool": {
|
||||
"description": "Build the trietool application",
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
"libiconv"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -495,8 +495,6 @@ libcopp:arm-uwp=fail
|
||||
# Missing system libraries on linux to run/prepare autoconf
|
||||
libgpod:x64-linux=fail
|
||||
libgpod:x64-osx=fail
|
||||
libdatrie:x64-linux=fail
|
||||
libdatrie:x64-osx=fail
|
||||
libepoxy:arm-uwp=fail
|
||||
libepoxy:x64-uwp=fail
|
||||
libepoxy:x64-windows-static=fail
|
||||
|
@ -3453,8 +3453,8 @@
|
||||
"port-version": 0
|
||||
},
|
||||
"libdatrie": {
|
||||
"baseline": "0.2.10",
|
||||
"port-version": 4
|
||||
"baseline": "0.2.13",
|
||||
"port-version": 0
|
||||
},
|
||||
"libdc1394": {
|
||||
"baseline": "2.2.6",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f8e0374439550fd870ff280c0a3321c202b42929",
|
||||
"version": "0.2.13",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "55aab3566cc2c82313f67f484a411b28f53da90b",
|
||||
"version-string": "0.2.10",
|
||||
|
Loading…
Reference in New Issue
Block a user