From f650be847cce20aebf40031a45c57043d43f5562 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Tue, 25 Jul 2017 03:12:30 +0300 Subject: [PATCH] [hunspell] add version 1.6.1 --- ports/hunspell/0001_fix_unistd.patch | 78 ++++++++++++++ ports/hunspell/CMakeLists.txt | 151 +++++++++++++++++++++++++++ ports/hunspell/CONTROL | 3 + ports/hunspell/config.h.in | 35 +++++++ ports/hunspell/portfile.cmake | 52 +++++++++ 5 files changed, 319 insertions(+) create mode 100644 ports/hunspell/0001_fix_unistd.patch create mode 100644 ports/hunspell/CMakeLists.txt create mode 100644 ports/hunspell/CONTROL create mode 100644 ports/hunspell/config.h.in create mode 100644 ports/hunspell/portfile.cmake diff --git a/ports/hunspell/0001_fix_unistd.patch b/ports/hunspell/0001_fix_unistd.patch new file mode 100644 index 0000000000..79a48d824f --- /dev/null +++ b/ports/hunspell/0001_fix_unistd.patch @@ -0,0 +1,78 @@ +From 9f33c841afe51be517eaea318d46985c596c94ff Mon Sep 17 00:00:00 2001 +From: Mikhail Paulyshka +Date: Tue, 25 Jul 2017 01:58:39 +0300 +Subject: [PATCH] tools/hzip: fix build with MSVC + +--- + src/tools/hzip.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/tools/hzip.cxx b/src/tools/hzip.cxx +index ef1864f..d284c64 100644 +--- a/src/tools/hzip.cxx ++++ b/src/tools/hzip.cxx +@@ -41,7 +41,9 @@ + #include + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif /* HAVE_UNISTD_H */ + #include + #include + +-- +2.12.2.windows.2 + +From 840f920bcd370668b9e788b3c8272eca1f20ce3a Mon Sep 17 00:00:00 2001 +From: Mikhail Paulyshka +Date: Tue, 25 Jul 2017 01:55:13 +0300 +Subject: [PATCH] tools/unmunch: fix build with MSVC + +--- + src/tools/unmunch.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/tools/unmunch.cxx b/src/tools/unmunch.cxx +index 44b4cb1..2144370 100644 +--- a/src/tools/unmunch.cxx ++++ b/src/tools/unmunch.cxx +@@ -42,7 +42,9 @@ + #include + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif /* HAVE_UNISTD_H */ + #include + #include + #include +-- +2.12.2.windows.2 + +From 1c231aa84624082a0fa52d59be8c449bfe1fadd1 Mon Sep 17 00:00:00 2001 +From: Mikhail Paulyshka +Date: Tue, 25 Jul 2017 01:50:21 +0300 +Subject: [PATCH] tools/munch: fix build with MSVC + +Include only if exists +--- + src/tools/munch.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/tools/munch.cxx b/src/tools/munch.cxx +index 17fc6fd..8503abe 100644 +--- a/src/tools/munch.cxx ++++ b/src/tools/munch.cxx +@@ -40,7 +40,9 @@ + #include + #include + #include ++#ifdef HAVE_UNISTD_H + #include ++#endif /* HAVE_UNISTD_H */ + #include + #include + #include +-- +2.12.2.windows.2 diff --git a/ports/hunspell/CMakeLists.txt b/ports/hunspell/CMakeLists.txt new file mode 100644 index 0000000000..c04e0e37cf --- /dev/null +++ b/ports/hunspell/CMakeLists.txt @@ -0,0 +1,151 @@ +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}) +target_compile_definitions(libhunspell PRIVATE -DBUILDING_LIBHUNSPELL) + +#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 +) + +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_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_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 + libhunspell + hunspell + testparser + analyze + chmorph + munch + unmunch +# hzip + hunzip +ARCHIVE DESTINATION lib +LIBRARY DESTINATION lib +RUNTIME DESTINATION bin +) + +install(FILES ${LIBHUNSPELL_HDRS} DESTINATION "include/hunspell/") diff --git a/ports/hunspell/CONTROL b/ports/hunspell/CONTROL new file mode 100644 index 0000000000..ec7979e357 --- /dev/null +++ b/ports/hunspell/CONTROL @@ -0,0 +1,3 @@ +Source: hunspell +Version: 1.6.1-1 +Description: The most popular spellchecking library. diff --git a/ports/hunspell/config.h.in b/ports/hunspell/config.h.in new file mode 100644 index 0000000000..c659d1c525 --- /dev/null +++ b/ports/hunspell/config.h.in @@ -0,0 +1,35 @@ + +/* 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 header" */ +#cmakedefine HAVE_CURSES_H 1 + +/* Define if you have the iconv() function. */ +#cmakedefine HAVE_ICONV 1 + +/* Define if you have and nl_langinfo(CODESET). */ +#cmakedefine HAVE_LANGINFO_CODESET 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBINTL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LOCALE_H 1 + +/* "Define if you have the 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 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@" \ No newline at end of file diff --git a/ports/hunspell/portfile.cmake b/ports/hunspell/portfile.cmake new file mode 100644 index 0000000000..7d632563cd --- /dev/null +++ b/ports/hunspell/portfile.cmake @@ -0,0 +1,52 @@ +include(vcpkg_common_functions) +set(HUNSPELL_VERSION 1.6.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/hunspell-${HUNSPELL_VERSION}) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/hunspell/hunspell/archive/v${HUNSPELL_VERSION}.zip" + FILENAME "hunspell-${HUNSPELL_VERSION}.zip" + SHA512 164eb1ae9ff9f4d8efe8998fa3ad847bf5a0c1a87113acc52dcdb3aaddb4e9179274585623bd7152f9a82b803bd42ce24fe856ac8d49121214bef59ac1c7753c +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/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}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_build_cmake() +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(GLOB_RECURSE TOOLS_RELEASE ${CURRENT_PACKAGES_DIR}/bin/*.exe) +file(GLOB_RECURSE TOOLS_DEBUG ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) + +file(COPY ${TOOLS_RELEASE} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + +file(REMOVE ${TOOLS_RELEASE} ${TOOLS_DEBUG}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/hunspell) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/hunspell/COPYING ${CURRENT_PACKAGES_DIR}/share/hunspell/copyright) + +file(COPY ${SOURCE_PATH}/COPYING.LESSER DESTINATION ${CURRENT_PACKAGES_DIR}/share/hunspell) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/hunspell/COPYING.LESSER ${CURRENT_PACKAGES_DIR}/share/hunspell/copyright-lgpl) + +file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/hunspell) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/hunspell/COPYING.MPL ${CURRENT_PACKAGES_DIR}/share/hunspell/copyright-mpl) +