mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 03:49:06 +08:00
[hunspell] switch to make to enable build of hunspell tools (#17148)
* [hunspell] switch to make to enable build of hunspell tools * version stuff
This commit is contained in:
parent
4a03e74569
commit
5c19a00f26
@ -1,159 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(hunspell)
|
||||
|
||||
#get hunspell version
|
||||
file(STRINGS "configure.ac" CONFIGURE_AC_INIT REGEX "AC_INIT\\(\\[hunspell\\],\\[.*\\].*" )
|
||||
string(REGEX REPLACE "AC_INIT\\(\\[.*\\],\\[([0-9]+\\.[0-9]+\\.[0-9]+)\\].*" "\\1" VERSION ${CONFIGURE_AC_INIT})
|
||||
message(STATUS "Hunspell version: ${VERSION}")
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
||||
option(ENABLE_NLS "Define if translation of program messages to the user's native language is requested" OFF)
|
||||
option(HUNSPELL_WARNING_ON "Define if you need warning messages" OFF)
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
add_definitions(-DHUNSPELL_STATIC)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
include_directories("src/hunspell")
|
||||
include_directories("src/parsers")
|
||||
|
||||
#libhunspell
|
||||
set(LIBHUNSPELL_SRCS
|
||||
src/hunspell/affentry.cxx
|
||||
src/hunspell/affixmgr.cxx
|
||||
src/hunspell/csutil.cxx
|
||||
src/hunspell/hashmgr.cxx
|
||||
src/hunspell/hunspell.cxx
|
||||
src/hunspell/suggestmgr.cxx
|
||||
src/hunspell/phonet.cxx
|
||||
src/hunspell/filemgr.cxx
|
||||
src/hunspell/hunzip.cxx
|
||||
src/hunspell/replist.cxx
|
||||
src/hunspell/affentry.hxx
|
||||
src/hunspell/htypes.hxx
|
||||
src/hunspell/affixmgr.hxx
|
||||
src/hunspell/csutil.hxx
|
||||
src/hunspell/atypes.hxx
|
||||
src/hunspell/suggestmgr.hxx
|
||||
src/hunspell/baseaffix.hxx
|
||||
src/hunspell/hashmgr.hxx
|
||||
src/hunspell/langnum.hxx
|
||||
src/hunspell/phonet.hxx
|
||||
src/hunspell/filemgr.hxx
|
||||
src/hunspell/hunzip.hxx
|
||||
src/hunspell/replist.hxx
|
||||
)
|
||||
|
||||
set(LIBHUNSPELL_HDRS
|
||||
src/hunspell/hunspell.hxx
|
||||
src/hunspell/hunspell.h
|
||||
src/hunspell/hunvisapi.h
|
||||
src/hunspell/w_char.hxx
|
||||
src/hunspell/atypes.hxx
|
||||
src/hunspell/csutil.hxx
|
||||
src/hunspell/htypes.hxx
|
||||
)
|
||||
|
||||
#hunspell/libhunspell
|
||||
add_library(libhunspell ${LIBHUNSPELL_HDRS} ${LIBHUNSPELL_SRCS})
|
||||
|
||||
#Avoid automatically added lib prefix 'lib' for hunspell
|
||||
set_target_properties(libhunspell PROPERTIES PREFIX "")
|
||||
|
||||
target_compile_definitions(libhunspell PRIVATE -DBUILDING_LIBHUNSPELL)
|
||||
install(TARGETS libhunspell
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
#parsers/libparsers
|
||||
set(LIBPARSERS_SRCS
|
||||
src/parsers/firstparser.cxx
|
||||
src/parsers/xmlparser.cxx
|
||||
src/parsers/latexparser.cxx
|
||||
src/parsers/manparser.cxx
|
||||
src/parsers/textparser.cxx
|
||||
src/parsers/htmlparser.cxx
|
||||
src/parsers/odfparser.cxx
|
||||
)
|
||||
add_library(libparsers OBJECT ${LIBPARSERS_SRCS})
|
||||
|
||||
#parsers/testparser
|
||||
set(TESTPARSER_SRCS
|
||||
src/parsers/firstparser.cxx
|
||||
src/parsers/firstparser.hxx
|
||||
src/parsers/xmlparser.cxx
|
||||
src/parsers/xmlparser.hxx
|
||||
src/parsers/latexparser.cxx
|
||||
src/parsers/latexparser.hxx
|
||||
src/parsers/manparser.cxx
|
||||
src/parsers/manparser.hxx
|
||||
src/parsers/testparser.cxx
|
||||
src/parsers/textparser.cxx
|
||||
src/parsers/textparser.hxx
|
||||
src/parsers/htmlparser.cxx
|
||||
src/parsers/htmlparser.hxx
|
||||
src/parsers/odfparser.hxx
|
||||
src/parsers/odfparser.cxx
|
||||
)
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_BUILD_TYPE STREQUAL "Release" AND BUILD_TOOLS)
|
||||
add_executable(testparser ${TESTPARSER_SRCS})
|
||||
target_link_libraries(testparser libhunspell)
|
||||
|
||||
#tools/analyze
|
||||
add_executable(analyze "src/tools/analyze.cxx")
|
||||
target_link_libraries(analyze libhunspell)
|
||||
|
||||
#tools/chmorph
|
||||
add_executable(chmorph "src/tools/chmorph.cxx" $<TARGET_OBJECTS:libparsers>)
|
||||
target_link_libraries(chmorph libhunspell)
|
||||
|
||||
#tools/hunspell
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("curses.h" HAVE_CURSES_H)
|
||||
check_include_file("langinfo.h" HAVE_LANGINFO_CODESET)
|
||||
check_include_file("libintl.h" HAVE_LIBINTL_H)
|
||||
check_include_file("locale.h" HAVE_LOCALE_H)
|
||||
check_include_file("ncursesw/curses.h" HAVE_NCURSESW_H)
|
||||
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||
configure_file("config.h.in" "config.h")
|
||||
|
||||
add_executable(hunspell "src/tools/hunspell.cxx" $<TARGET_OBJECTS:libparsers>)
|
||||
target_include_directories(hunspell PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
target_link_libraries(hunspell libhunspell)
|
||||
|
||||
#tools/munch
|
||||
add_executable(munch "src/tools/munch.cxx")
|
||||
|
||||
#tools/unmunch
|
||||
add_executable(unmunch "src/tools/unmunch.cxx")
|
||||
|
||||
#tools/hzip
|
||||
#add_executable(hzip "src/tools/hzip.cxx")
|
||||
#target_link_libraries(hzip libhunspell)
|
||||
|
||||
#tools/hunzip
|
||||
add_executable(hunzip "src/tools/hunzip.cxx")
|
||||
target_link_libraries(hunzip libhunspell)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
hunspell
|
||||
testparser
|
||||
analyze
|
||||
chmorph
|
||||
munch
|
||||
unmunch
|
||||
# hzip
|
||||
hunzip
|
||||
DESTINATION tools/hunspell
|
||||
)
|
||||
endif()
|
||||
|
||||
install(FILES ${LIBHUNSPELL_HDRS} DESTINATION "include/hunspell/")
|
@ -1,8 +0,0 @@
|
||||
Source: hunspell
|
||||
Version: 1.7.0
|
||||
Port-Version: 2
|
||||
Homepage: https://github.com/hunspell/hunspell
|
||||
Description: The most popular spellchecking library.
|
||||
|
||||
Feature: tools
|
||||
Description: Build hunspell tools
|
@ -1,35 +0,0 @@
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native language is requested. */
|
||||
#cmakedefine ENABLE_NLS 1
|
||||
|
||||
/* "Define if you have the <curses.h> header" */
|
||||
#cmakedefine HAVE_CURSES_H 1
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
#cmakedefine HAVE_ICONV 1
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#cmakedefine HAVE_LANGINFO_CODESET 1
|
||||
|
||||
/* Define to 1 if you have the <libintl.h> header file. */
|
||||
#cmakedefine HAVE_LIBINTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#cmakedefine HAVE_LOCALE_H 1
|
||||
|
||||
/* "Define if you have the <ncursesw/curses.h> header" */
|
||||
#cmakedefine HAVE_NCURSESW_H 1
|
||||
|
||||
/* "Define if you have fancy command input editing with Readline" */
|
||||
#cmakedefine HAVE_READLINE 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you need warning messages */
|
||||
#cmakedefine HUNSPELL_WARNING_ON 1
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#cmakedefine ICONV_CONST const
|
||||
|
||||
#cmakedefine VERSION "@VERSION@"
|
@ -7,29 +7,36 @@ vcpkg_from_github(
|
||||
PATCHES 0001_fix_unistd.patch
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h.in DESTINATION ${SOURCE_PATH})
|
||||
|
||||
if ("tools" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
message(FATAL_ERROR "Feature tools is only supported on Windows platforms.")
|
||||
endif()
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
tools BUILD_TOOLS
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
set(ENV{CFLAGS} "$ENV{CFLAGS} -DHUNSPELL_STATIC")
|
||||
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -DHUNSPELL_STATIC")
|
||||
endif()
|
||||
if(NOT "tools" IN_LIST FEATURES) # Building the tools is not possible on windows!
|
||||
file(READ "${SOURCE_PATH}/src/Makefile.am" _contents)
|
||||
string(REPLACE " parsers tools" "" _contents "${_contents}")
|
||||
file(WRITE "${SOURCE_PATH}/src/Makefile.am" "${_contents}")
|
||||
endif()
|
||||
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/gettext/bin")
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS ${FEATURE_OPTIONS}
|
||||
OPTIONS
|
||||
AUTOCONFIG
|
||||
ADDITIONAL_MSYS_PACKAGES gzip
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
#install-pkgconfDATA:
|
||||
vcpkg_build_make(BUILD_TARGET dist LOGFILE_ROOT build-dist)
|
||||
vcpkg_install_make()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
|
||||
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING.LESSER DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright-lgpl)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright-mpl)
|
||||
|
22
ports/hunspell/vcpkg.json
Normal file
22
ports/hunspell/vcpkg.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "hunspell",
|
||||
"version-string": "1.7.0",
|
||||
"port-version": 3,
|
||||
"description": "The most popular spellchecking library.",
|
||||
"homepage": "https://github.com/hunspell/hunspell",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "gettext",
|
||||
"host": true,
|
||||
"features": [
|
||||
"tools"
|
||||
]
|
||||
},
|
||||
"libiconv"
|
||||
],
|
||||
"features": {
|
||||
"tools": {
|
||||
"description": "Build hunspell tools"
|
||||
}
|
||||
}
|
||||
}
|
@ -2466,7 +2466,7 @@
|
||||
},
|
||||
"hunspell": {
|
||||
"baseline": "1.7.0",
|
||||
"port-version": 2
|
||||
"port-version": 3
|
||||
},
|
||||
"hwloc": {
|
||||
"baseline": "2.2.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "b943abf7281879a8f3ab2c2c14ea5da7cf735dae",
|
||||
"version-string": "1.7.0",
|
||||
"port-version": 3
|
||||
},
|
||||
{
|
||||
"git-tree": "2d430ba4b4104cdf4f38babf9918c292d7d90b7e",
|
||||
"version-string": "1.7.0",
|
||||
|
Loading…
Reference in New Issue
Block a user