From ac4f80ae9da976a10e3da557b62d42523cf4bd68 Mon Sep 17 00:00:00 2001 From: Mengna Li <95600143+Adela0814@users.noreply.github.com> Date: Tue, 14 Mar 2023 03:04:42 +0800 Subject: [PATCH] [opencc] De-vendor marisa (#29997) * Add feature marisa * update * remove useless code * add pkgconf * update --- ports/opencc/fix-dependencies.patch | 36 ++++++++++++++++++++++++++++- ports/opencc/portfile.cmake | 2 ++ ports/opencc/vcpkg.json | 6 +++++ versions/baseline.json | 2 +- versions/o-/opencc.json | 5 ++++ 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/ports/opencc/fix-dependencies.patch b/ports/opencc/fix-dependencies.patch index f5899c4153f..093c0b6f19c 100644 --- a/ports/opencc/fix-dependencies.patch +++ b/ports/opencc/fix-dependencies.patch @@ -1,7 +1,41 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ee08591..c8c6b61 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -185,12 +185,14 @@ if(NOT USE_SYSTEM_MARISA) + message(STATUS "Use bundled marisa library.") + add_subdirectory(deps/marisa-0.2.6) + else() +- find_library(LIBMARISA NAMES marisa) +- if (LIBMARISA) +- message(STATUS "libmarisa found: ${LIBMARISA}") +- else() +- message(FATAL_ERROR "libmarisa not found.") +- endif() ++ find_package(PkgConfig REQUIRED) ++ pkg_check_modules(marisa REQUIRED IMPORTED_TARGET marisa) ++ # find_library(LIBMARISA NAMES marisa) ++ # if (LIBMARISA) ++ # message(STATUS "libmarisa found: ${LIBMARISA}") ++ # else() ++ # message(FATAL_ERROR "libmarisa not found.") ++ # endif() + endif() + + ######## Subdirectories diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index c0a0b10..19f7cbb 100644 +index c0a0b10..91b4037 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt +@@ -114,7 +114,7 @@ configure_file( + add_library(libopencc ${LIBOPENCC_SOURCES} ${LIBOPENCC_HEADERS}) + set_target_properties(libopencc PROPERTIES POSITION_INDEPENDENT_CODE ON) + source_group(libopencc FILES ${LIBOPENCC_SOURCES} ${LIBOPENCC_HEADERS}) +-target_link_libraries(libopencc marisa) ++target_link_libraries(libopencc PkgConfig::marisa) + + GENERATE_EXPORT_HEADER( + libopencc @@ -137,6 +137,21 @@ set_target_properties( ${OPENCC_VERSION_MAJOR}.${OPENCC_VERSION_MINOR} ) diff --git a/ports/opencc/portfile.cmake b/ports/opencc/portfile.cmake index 9b3de0040e8..01c60daf30e 100644 --- a/ports/opencc/portfile.cmake +++ b/ports/opencc/portfile.cmake @@ -20,6 +20,8 @@ vcpkg_cmake_configure( -DUSE_SYSTEM_RAPIDJSON=ON -DUSE_SYSTEM_TCLAP=ON -DUSE_SYSTEM_DARTS=ON + -DUSE_SYSTEM_MARISA=ON + -DPKG_CONFIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf ) vcpkg_cmake_install( diff --git a/ports/opencc/vcpkg.json b/ports/opencc/vcpkg.json index 7df415d1c76..c2c4f67389a 100644 --- a/ports/opencc/vcpkg.json +++ b/ports/opencc/vcpkg.json @@ -1,12 +1,18 @@ { "name": "opencc", "version": "1.1.6", + "port-version": 1, "description": "A project for conversions between Traditional Chinese, Simplified Chinese and Japanese Kanji (Shinjitai)", "homepage": "https://github.com/BYVoid/OpenCC", "license": "Apache-2.0", "supports": "!(arm | uwp)", "dependencies": [ "darts-clone", + "marisa-trie", + { + "name": "pkgconf", + "host": true + }, "rapidjson", "tclap", { diff --git a/versions/baseline.json b/versions/baseline.json index 40052924d4d..4f9c4cdb5db 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5686,7 +5686,7 @@ }, "opencc": { "baseline": "1.1.6", - "port-version": 0 + "port-version": 1 }, "opencensus-cpp": { "baseline": "2021-08-26", diff --git a/versions/o-/opencc.json b/versions/o-/opencc.json index 5432c20114a..68077106d27 100644 --- a/versions/o-/opencc.json +++ b/versions/o-/opencc.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "85a9b30209f5cd7460d2be2c8e1cc206fab66aaa", + "version": "1.1.6", + "port-version": 1 + }, { "git-tree": "246c0e831df06a5235e750d5af71b7cd9b2cc904", "version": "1.1.6",