mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 17:41:09 +08:00
[libdatrie] add version 0.2.10
This commit is contained in:
parent
6cb6a61aaf
commit
cd6fb55cd9
94
ports/libdatrie/CMakeLists.txt
Normal file
94
ports/libdatrie/CMakeLists.txt
Normal file
@ -0,0 +1,94 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(libdatrie LANGUAGES C)
|
||||
|
||||
option(SKIP_HEADERS "Skip headers" OFF)
|
||||
option(SKIP_TOOL "Skip tool" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
||||
|
||||
set(LIB_SRCS
|
||||
datrie/alpha-map.c
|
||||
datrie/darray.c
|
||||
datrie/dstring.c
|
||||
datrie/fileutils.c
|
||||
datrie/tail.c
|
||||
datrie/trie.c
|
||||
datrie/trie-string.c
|
||||
)
|
||||
|
||||
set(LIB_HDRS
|
||||
datrie/alpha-map.h
|
||||
datrie/trie.h
|
||||
datrie/triedefs.h
|
||||
datrie/typedefs.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND LIB_SRCS datrie/libdatrie.def)
|
||||
endif()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckFunctionExists)
|
||||
|
||||
set(STDC_HEADERS 1)
|
||||
check_include_file(dlfcn.h HAVE_DLFCN_H)
|
||||
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file(limits.h HAVE_LIMITS_H)
|
||||
check_include_file(memory.h HAVE_MEMORY_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stdio.h HAVE_STDIO_H)
|
||||
check_include_file(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_file(strings.h HAVE_STRINGS_H)
|
||||
check_include_file(string.h HAVE_STRING_H)
|
||||
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||
|
||||
check_function_exists(nl_langinfo HAVE_LANGINFO_CODESET)
|
||||
check_function_exists(locale_charset HAVE_LOCALE_CHARSET)
|
||||
check_function_exists(malloc HAVE_MALLOC)
|
||||
|
||||
configure_file(config.h.cmake config.h)
|
||||
|
||||
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")
|
||||
|
||||
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})
|
||||
|
||||
install(
|
||||
TARGETS trietool
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS libdatrie
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if (NOT SKIP_HEADERS)
|
||||
install(
|
||||
FILES ${LIB_HDRS}
|
||||
DESTINATION "include/datrie"
|
||||
)
|
||||
endif()
|
4
ports/libdatrie/CONTROL
Normal file
4
ports/libdatrie/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: libdatrie
|
||||
Version: 0.2.10-1
|
||||
Description: implementation of double-array structure for representing trie
|
||||
Build-Depends: libiconv
|
87
ports/libdatrie/config.h.cmake
Normal file
87
ports/libdatrie/config.h.cmake
Normal file
@ -0,0 +1,87 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#cmakedefine HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
/* Have nl_langinfo (CODESET) */
|
||||
#cmakedefine HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#cmakedefine HAVE_LIMITS_H
|
||||
|
||||
/* Have locale_charset() */
|
||||
#cmakedefine HAVE_LOCALE_CHARSET
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#cmakedefine HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#cmakedefine HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#cmakedefine HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#cmakedefine LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libdatrie"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#cmakedefine PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libdatrie"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#cmakedefine PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#cmakedefine PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL "https://linux.thai.net/~thep/datrie/datrie.html"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#cmakedefine PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#cmakedefine VERSION "@VERSION@"
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#cmakedefine const
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#cmakedefine malloc
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#cmakedefine size_t
|
8
ports/libdatrie/fix-exports.patch
Normal file
8
ports/libdatrie/fix-exports.patch
Normal file
@ -0,0 +1,8 @@
|
||||
diff -Naur ./a/libdatrie.def ./b/libdatrie.def
|
||||
--- a/libdatrie.def 2013-10-17 06:27:57.000000000 +0300
|
||||
+++ b/libdatrie.def 2017-12-21 02:42:39.873879000 +0300
|
||||
@@ -1,3 +1,4 @@
|
||||
+EXPORTS
|
||||
alpha_map_new
|
||||
alpha_map_clone
|
||||
alpha_map_free
|
53
ports/libdatrie/portfile.cmake
Normal file
53
ports/libdatrie/portfile.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
set(LIBDATRIE_VERSION 0.2.10)
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libdatrie-${LIBDATRIE_VERSION})
|
||||
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(${ARCHIVE})
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}/datrie
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/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})
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(SKIP_TOOL ON)
|
||||
else()
|
||||
set(SKIP_TOOL OFF)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DVERSION=${LIBDATRIE_VERSION}
|
||||
OPTIONS_RELEASE
|
||||
-DSKIP_TOOL=${SKIP_TOOL}
|
||||
-DSKIP_HEADERS=OFF
|
||||
OPTIONS_DEBUG
|
||||
-DSKIP_TOOL=ON
|
||||
-DSKIP_HEADERS=ON
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
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})
|
||||
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)
|
Loading…
x
Reference in New Issue
Block a user