[hunspell] Fix build error on Windows (#18037)

* [hunspell] Fix build error on Windows

* Update ports/hunspell/portfile.cmake

* re-factory win build

* Drop support with UWP since the upstream doesn't add app bitset in vcxproj

* update baseline

* Update port-version

* Update version files

* Update version-string field as version

* Re update versions/h-/hunspell.json

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
This commit is contained in:
NancyLi1013 2021-06-10 06:28:21 +08:00 committed by GitHub
parent c21792bd04
commit 0c1b57592b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 194 additions and 29 deletions

View File

@ -0,0 +1,36 @@
diff --git a/msvc/Hunspell.sln b/msvc/Hunspell.sln
index 5607c8d..dabd755 100644
--- a/msvc/Hunspell.sln
+++ b/msvc/Hunspell.sln
@@ -5,8 +5,6 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhunspell", "libhunspell.vcxproj", "{53609BB3-D874-465C-AF7B-DF626DB0D89B}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testparser", "testparser.vcxproj", "{611BF6C7-332A-49BB-B2A3-80AFD5B785D9}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hunspell", "hunspell.vcxproj", "{6A0453F4-B12A-4810-B9A2-8AB059316ED7}"
EndProject
Global
@@ -37,22 +35,6 @@ Global
{53609BB3-D874-465C-AF7B-DF626DB0D89B}.Release|Win32.Build.0 = Release|Win32
{53609BB3-D874-465C-AF7B-DF626DB0D89B}.Release|x64.ActiveCfg = Release|x64
{53609BB3-D874-465C-AF7B-DF626DB0D89B}.Release|x64.Build.0 = Release|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug_dll|Win32.ActiveCfg = Debug|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug_dll|Win32.Build.0 = Debug|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug_dll|x64.ActiveCfg = Debug|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug_dll|x64.Build.0 = Debug|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug|Win32.ActiveCfg = Debug|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug|Win32.Build.0 = Debug|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug|x64.ActiveCfg = Debug|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Debug|x64.Build.0 = Debug|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release_dll|Win32.ActiveCfg = Release|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release_dll|Win32.Build.0 = Release|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release_dll|x64.ActiveCfg = Release|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release_dll|x64.Build.0 = Release|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release|Win32.ActiveCfg = Release|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release|Win32.Build.0 = Release|Win32
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release|x64.ActiveCfg = Release|x64
- {611BF6C7-332A-49BB-B2A3-80AFD5B785D9}.Release|x64.Build.0 = Release|x64
{6A0453F4-B12A-4810-B9A2-8AB059316ED7}.Debug_dll|Win32.ActiveCfg = Debug|Win32
{6A0453F4-B12A-4810-B9A2-8AB059316ED7}.Debug_dll|Win32.Build.0 = Debug|Win32
{6A0453F4-B12A-4810-B9A2-8AB059316ED7}.Debug_dll|x64.ActiveCfg = Debug|x64

View File

@ -0,0 +1,80 @@
diff --git a/msvc/hunspell.vcxproj b/msvc/hunspell.vcxproj
index ca39388..d4817a5 100644
--- a/msvc/hunspell.vcxproj
+++ b/msvc/hunspell.vcxproj
@@ -91,7 +91,7 @@
<PreprocessorDefinitions>W32;WIN32;_DEBUG;_CONSOLE;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
@@ -112,7 +112,7 @@
<AdditionalIncludeDirectories>..\src\hunspell;..\src\parsers;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>W32;WIN32;_DEBUG;_CONSOLE;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
@@ -134,7 +134,7 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\src\hunspell;..\src\parsers;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>W32;WIN32;NDEBUG;_CONSOLE;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
@@ -157,7 +157,7 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\src\hunspell;..\src\parsers;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>W32;WIN32;NDEBUG;_CONSOLE;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
diff --git a/msvc/libhunspell.vcxproj b/msvc/libhunspell.vcxproj
index a0772da..9a875ca 100644
--- a/msvc/libhunspell.vcxproj
+++ b/msvc/libhunspell.vcxproj
@@ -166,7 +166,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
@@ -187,7 +187,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
@@ -206,7 +206,7 @@
<AdditionalIncludeDirectories>..\src\hunspell;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
@@ -232,7 +232,7 @@
<AdditionalIncludeDirectories>..\src\hunspell;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>

View File

@ -1,43 +1,85 @@
vcpkg_fail_port_install(ON_TARGET "UWP")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO hunspell/hunspell
REF v1.7.0
SHA512 8149b2e8b703a0610c9ca5160c2dfad3cf3b85b16b3f0f5cfcb7ebb802473b2d499e8e2d0a637a97a37a24d62424e82d3880809210d3f043fa17a4970d47c903
HEAD_REF master
PATCHES 0001_fix_unistd.patch
PATCHES
0001_fix_unistd.patch
0002-disable-test.patch
0003-fix-win-build.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
tools BUILD_TOOLS
FEATURES
tools BUILD_TOOLS
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(ENV{CFLAGS} "$ENV{CFLAGS} -DHUNSPELL_STATIC")
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -DHUNSPELL_STATIC")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
file(REMOVE "${SOURCE_PATH}/README") #README is a symlink
#architecture detection
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(HUNSPELL_ARCH Win32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(HUNSPELL_ARCH x64)
else()
message(FATAL_ERROR "unsupported architecture")
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(HUNSPELL_CONFIGURATION _dll)
else()
set(HUNSPELL_CONFIGURATION )
endif()
if("tools" IN_LIST FEATURES)
set(HSP_TARGET hunspell)
else()
set(HSP_TARGET libhunspell)
endif()
vcpkg_install_msbuild(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH "msvc/Hunspell.sln"
INCLUDES_SUBPATH src/hunspell
PLATFORM ${HUNSPELL_ARCH}
RELEASE_CONFIGURATION Release${HUNSPELL_CONFIGURATION}
DEBUG_CONFIGURATION Debug${HUNSPELL_CONFIGURATION}
ALLOW_ROOT_INCLUDES
)
else()
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}
OPTIONS
AUTOCONFIG
ADDITIONAL_MSYS_PACKAGES gzip
)
#install-pkgconfDATA:
vcpkg_build_make(BUILD_TARGET dist LOGFILE_ROOT build-dist)
vcpkg_install_make()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
vcpkg_fixup_pkgconfig()
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}
OPTIONS
AUTOCONFIG
ADDITIONAL_MSYS_PACKAGES gzip
)
#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")
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)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
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)

View File

@ -1,9 +1,10 @@
{
"name": "hunspell",
"version-string": "1.7.0",
"port-version": 3,
"version": "1.7.0",
"port-version": 4,
"description": "The most popular spellchecking library.",
"homepage": "https://github.com/hunspell/hunspell",
"supports": "!((arm | uwp) & windows)",
"dependencies": [
{
"name": "gettext",

View File

@ -449,6 +449,7 @@ hiredis:arm-uwp=fail
hiredis:x64-uwp=fail
hpx:x64-windows-static=fail
hpx:x64-linux=fail
hunspell:x64-windows-static-md=fail
libhsplasma:x64-windows-static=fail
ideviceinstaller:x64-windows-static-md=fail
idevicerestore:x64-linux=fail

View File

@ -2514,7 +2514,7 @@
},
"hunspell": {
"baseline": "1.7.0",
"port-version": 3
"port-version": 4
},
"hwloc": {
"baseline": "2.2.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1441675cd83b048c9fe45d9230ab99c06421b121",
"version": "1.7.0",
"port-version": 4
},
{
"git-tree": "b943abf7281879a8f3ab2c2c14ea5da7cf735dae",
"version-string": "1.7.0",