From 86cd6e0532d9378109d8fc9582db058bd3b6fb79 Mon Sep 17 00:00:00 2001 From: day253 <9634619+day253@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:26:59 +0800 Subject: [PATCH] [marisa-trie] Add new port (#27922) * [marisa] Add new port * [marisa] Add new port * add COPY_SOURCE to fix build * fix ci * test arm * fix version * !(windows & static) * !arm * !arm * add vcpkg_fixup_pkgconfig to msbuild * rename port * fix license and change version to 2020-09-26 * static build on win * use "version-semver" * up supports * up version * add configure_file when msbuild * fix empty bindir libdir includedir * fix msvc build Co-authored-by: Monica --- ports/marisa-trie/portfile.cmake | 53 ++++++++++++++++++++++++++++++++ ports/marisa-trie/usage | 5 +++ ports/marisa-trie/vcpkg.json | 8 +++++ versions/baseline.json | 4 +++ versions/m-/marisa-trie.json | 9 ++++++ 5 files changed, 79 insertions(+) create mode 100644 ports/marisa-trie/portfile.cmake create mode 100644 ports/marisa-trie/usage create mode 100644 ports/marisa-trie/vcpkg.json create mode 100644 versions/m-/marisa-trie.json diff --git a/ports/marisa-trie/portfile.cmake b/ports/marisa-trie/portfile.cmake new file mode 100644 index 00000000000..5b30b5b9bab --- /dev/null +++ b/ports/marisa-trie/portfile.cmake @@ -0,0 +1,53 @@ +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO s-yata/marisa-trie + REF 006020c1df76d0d7dc6118dacc22da64da2e35c4 + SHA512 05dd7cc81a6347d4528654c19617af16de8d7352ad9e38d5f1cd296d88527377ecbfed9dbe722362d64369cd792d1ae0410319854b546ce0b6081ac560a40c0f + HEAD_REF master +) + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_install_msbuild( + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_SUBPATH vs2019/vs2019.sln + INCLUDES_SUBPATH include + LICENSE_SUBPATH COPYING.md + PLATFORM ${TRIPLET_SYSTEM_ARCH} + ALLOW_ROOT_INCLUDES + ) + vcpkg_clean_msbuild() + set(prefix "${CURRENT_INSTALLED_DIR}") + set(exec_prefix "\${prefix}") + set(bindir "\${prefix}/bin") + set(libdir "\${prefix}/lib") + set(includedir "\${prefix}/include") + configure_file("${SOURCE_PATH}/marisa.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/marisa.pc" @ONLY) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/marisa.pc" "-lmarisa" "-llibmarisa") + if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + set(prefix "${CURRENT_INSTALLED_DIR}/debug") + set(exec_prefix "\${prefix}") + set(bindir "\${prefix}/bin") + set(libdir "\${prefix}/lib") + set(includedir "\${prefix}/include") + configure_file("${SOURCE_PATH}/marisa.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/marisa.pc" @ONLY) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/marisa.pc" "-lmarisa" "-llibmarisa") + endif() +else() + vcpkg_configure_make( + SOURCE_PATH "${SOURCE_PATH}" + AUTOCONFIG + COPY_SOURCE + ) + vcpkg_install_make() + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + file(INSTALL "${SOURCE_PATH}/COPYING.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +endif() + +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/marisa-trie/usage b/ports/marisa-trie/usage new file mode 100644 index 00000000000..2dadcffa13c --- /dev/null +++ b/ports/marisa-trie/usage @@ -0,0 +1,5 @@ +The package marisa-trie can be imported via CMake FindPkgConfig module: + + find_package(PkgConfig REQUIRED) + pkg_check_modules(marisa REQUIRED IMPORTED_TARGET marisa) + target_link_libraries(main PkgConfig::marisa) diff --git a/ports/marisa-trie/vcpkg.json b/ports/marisa-trie/vcpkg.json new file mode 100644 index 00000000000..fe1b00cdbd7 --- /dev/null +++ b/ports/marisa-trie/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "marisa-trie", + "version": "0.2.6+20200926", + "description": "Matching Algorithm with Recursively Implemented StorAge (MARISA) is a space-efficient trie data structure. This is a C++ library for an implementation of MARISA.", + "homepage": "https://github.com/s-yata/marisa-trie", + "license": "BSD-2-Clause OR LGPL-2.1-or-later", + "supports": "!windows | mingw | ((x86 | x64) & !staticcrt)" +} diff --git a/versions/baseline.json b/versions/baseline.json index 1ba19c02932..c9bb4fd0d22 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4752,6 +4752,10 @@ "baseline": "22.04.0", "port-version": 1 }, + "marisa-trie": { + "baseline": "0.2.6+20200926", + "port-version": 0 + }, "marl": { "baseline": "2022-03-02", "port-version": 0 diff --git a/versions/m-/marisa-trie.json b/versions/m-/marisa-trie.json new file mode 100644 index 00000000000..8071cdd3593 --- /dev/null +++ b/versions/m-/marisa-trie.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "aec2055269a2ed80494b6cc8876c48787b65d265", + "version": "0.2.6+20200926", + "port-version": 0 + } + ] +}