-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[uchardet] Add new port #8477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[uchardet] Add new port #8477
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
720e27d
[uchardet] Add new port
myd7349 37cf157
[uchardet] Fix string no output variable error
myd7349 016690e
[uchardet] Fix tool build error on Windows
myd7349 10e0df7
[uchardet] Update
myd7349 b3214b2
Merge branch 'master' into uchardet-init
myd7349 1ba3654
[uchardet] Modernize
myd7349 c9321bc
[uchardet] Update to 2020-04-26
myd7349 01bbad6
Merge branch 'master' into uchardet-init
myd7349 17da7e6
[uchardet] Fix static build
myd7349 4075b4f
[uchardet] Fix UWP build
myd7349 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Source: uchardet | ||
| Version: 2019-10-07 | ||
| Description: An encoding detector library ported from Mozilla | ||
| Homepage: https://cgit.freedesktop.org/uchardet/uchardet/ | ||
|
|
||
| Feature: tool | ||
| Description: Build uchardet CLI tool | ||
| Build-Depends: getopt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index bf68ec0..4863a5c 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -39,7 +39,7 @@ if (BUILD_SHARED_LIBS) | ||
| endif (BUILD_SHARED_LIBS) | ||
|
|
||
| if (TARGET_ARCHITECTURE STREQUAL "") | ||
| - string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCHITECTURE) | ||
| + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" TARGET_ARCHITECTURE) | ||
| endif (TARGET_ARCHITECTURE STREQUAL "") | ||
|
|
||
| if (TARGET_ARCHITECTURE MATCHES ".*(x86)|(amd).*") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| diff --git a/src/tools/uchardet.cpp b/src/tools/uchardet.cpp | ||
| index f2aabfd..e49a9e2 100644 | ||
| --- a/src/tools/uchardet.cpp | ||
| +++ b/src/tools/uchardet.cpp | ||
| @@ -35,11 +35,8 @@ | ||
| * | ||
| * ***** END LICENSE BLOCK ***** */ | ||
| #include "../uchardet.h" | ||
| -#include <cstdio> | ||
| -#include <cstring> | ||
| -#include <cstdlib> | ||
| +#include <stdlib.h> | ||
| #include <getopt.h> | ||
| -#include <iostream> | ||
| #include <stdio.h> | ||
|
|
||
| #ifndef VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| include(vcpkg_common_functions) | ||
|
|
||
| vcpkg_from_git( | ||
| OUT_SOURCE_PATH SOURCE_PATH | ||
| URL https://gitlab.freedesktop.org/uchardet/uchardet | ||
| REF bdfd6116a965fd210ef563613763e724424728b7 | ||
| PATCHES | ||
| fix-string-no-output-variable.patch | ||
| fix-tool-build-error.patch | ||
| win32-getopt.patch | ||
| ) | ||
|
|
||
| if(VCPKG_TARGET_IS_WINDOWS) | ||
| # On Windows, we can get a uchardet.dll, but it exports no symbols. | ||
| vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | ||
| endif() | ||
|
|
||
| vcpkg_check_features( | ||
| OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
| tool BUILD_BINARY | ||
| ) | ||
|
|
||
| vcpkg_configure_cmake( | ||
| SOURCE_PATH ${SOURCE_PATH} | ||
| PREFER_NINJA | ||
| OPTIONS_DEBUG | ||
| -DBUILD_BINARY=OFF | ||
| OPTIONS_RELEASE | ||
| ${FEATURE_OPTIONS} | ||
| OPTIONS | ||
| -DBUILD_STATIC=ON | ||
| ) | ||
|
|
||
| vcpkg_install_cmake() | ||
|
|
||
| vcpkg_copy_pdbs() | ||
|
|
||
| if(tool IN_LIST FEATURES) | ||
| file(COPY | ||
| ${CURRENT_PACKAGES_DIR}/bin/uchardet${VCPKG_TARGET_EXECUTABLE_SUFFIX} | ||
| DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT} | ||
| ) | ||
|
|
||
| vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) | ||
| endif() | ||
|
|
||
| if(VCPKG_LIBRARY_LINKAGE STREQUAL static) | ||
| file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) | ||
| else() | ||
| file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/uchardet${VCPKG_TARGET_EXECUTABLE_SUFFIX}) | ||
| endif() | ||
|
|
||
| file(REMOVE_RECURSE | ||
| ${CURRENT_PACKAGES_DIR}/debug/include | ||
| ${CURRENT_PACKAGES_DIR}/debug/share | ||
| ${CURRENT_PACKAGES_DIR}/share/man | ||
| ) | ||
|
|
||
| configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) | ||
|
LilyWangL marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt | ||
| index fa15eb2..fbb4203 100644 | ||
| --- a/src/tools/CMakeLists.txt | ||
| +++ b/src/tools/CMakeLists.txt | ||
| @@ -3,6 +3,15 @@ set( | ||
| uchardet.cpp | ||
| ) | ||
|
|
||
| +if (WIN32) | ||
| + find_path(GETOPT_INCLUDE_DIR NAMES getopt.h) | ||
| + find_library(GETOPT_LIBRARY NAMES getopt) | ||
| + | ||
| + if (NOT GETOPT_INCLUDE_DIR OR NOT GETOPT_LIBRARY) | ||
| + message(FATAL_ERROR "getopt not found!") | ||
| + endif () | ||
| +endif () | ||
| + | ||
| set(UCHARDET_BINARY uchardet) | ||
|
|
||
| add_executable( | ||
| @@ -15,6 +24,11 @@ target_link_libraries( | ||
| ${UCHARDET_LIBRARY} | ||
| ) | ||
|
|
||
| +if (WIN32) | ||
| + target_include_directories(${UCHARDET_BINARY} PRIVATE ${GETOPT_INCLUDE_DIR}) | ||
| + target_link_libraries(${UCHARDET_BINARY} PRIVATE ${GETOPT_LIBRARY}) | ||
| +endif () | ||
| + | ||
| install( | ||
| TARGETS | ||
| ${UCHARDET_BINARY} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.