瀏覽代碼

marisa: update to 0.3.0 (#7411)

* marisa: update to 0.3.0

* marisa: update to 0.3.0

* turn off cli tools

* cl

* retry

* export symbols windows

* try fixup ndk

* try fix debug install

* follow https://github.com/s-yata/marisa-trie/issues/118#issuecomment-2976079406

* Validate MinGW64 fix https://github.com/s-yata/marisa-trie/pull/119

* fixup

* cl

* Validate https://github.com/s-yata/marisa-trie/pull/119
Saikari 3 月之前
父節點
當前提交
9a9281f0f8
共有 2 個文件被更改,包括 49 次插入9 次删除
  1. 20 0
      packages/m/marisa/patches/v0.3.0/support-debug-install.diff
  2. 29 9
      packages/m/marisa/xmake.lua

+ 20 - 0
packages/m/marisa/patches/v0.3.0/support-debug-install.diff

@@ -0,0 +1,20 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a00be40..1fce4fb 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -256,7 +256,6 @@ endif()
+ install(
+   TARGETS marisa
+   EXPORT MarisaTargets
+-  CONFIGURATIONS Release
+   DESTINATION ${LIB_INSTALL_DIR}
+   COMPONENT Library
+ )
+@@ -270,7 +269,6 @@ install(
+ if(ENABLE_TOOLS)
+   install(
+     TARGETS ${MARISA_TOOLS}
+-    CONFIGURATIONS Release
+     COMPONENT Binaries
+   )
+ endif()

+ 29 - 9
packages/m/marisa/xmake.lua

@@ -1,22 +1,42 @@
 package("marisa")
-
     set_homepage("https://github.com/s-yata/marisa-trie")
     set_description("Matching Algorithm with Recursively Implemented StorAge.")
 
-    add_urls("https://github.com/s-yata/marisa-trie/archive/$(version).zip")
-    add_urls("https://github.com/s-yata/marisa-trie.git")
-    add_versions("v0.2.6", "8dc0b79ff9948be80fd09df6d2cc70134367339ec7d6496857bc47cf421df1af")
+    add_urls("https://github.com/s-yata/marisa-trie/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/s-yata/marisa-trie.git")
+
+    add_versions("v0.2.6", "1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de")
+    add_versions("v0.3.0", "a3057d0c2da0a9a57f43eb8e07b73715bc5ff053467ee8349844d01da91b5efb")
+
+    add_patches("v0.3.0", "patches/v0.3.0/support-debug-install.diff", "a3d02bf6881d233bf8cfadded33edfcde167bee719d47538b869e0e90d8bf7ce")
+    add_patches("v0.3.0", "https://github.com/s-yata/marisa-trie/pull/119.diff", "f02211699465b55cd2ab93ef20bafcd69aa573da1fd796cb9366697075074093")
 
     add_deps("cmake")
 
-    on_install("windows", "mingw", "linux", "macosx", "bsd", function (package)
-        os.cp(path.join(package:scriptdir(), "port", "CMakeLists.txt"), "CMakeLists.txt")
-        local configs = {"-DENABLE_TESTS=OFF"}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+    on_install(function (package)
+        if package:version() and package:version():lt("v0.3.0") then
+            os.cp(path.join(package:scriptdir(), "port", "CMakeLists.txt"), "CMakeLists.txt")
+        end
+        local configs = {
+            "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
+            "-DENABLE_TESTS=OFF",
+            "-DBUILD_TESTING=OFF",
+            "-DENABLE_TOOLS=OFF"
+        }
+        if package:config("shared") and package:is_plat("windows") then
+            table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
+        end
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
     end)
 
     on_test(function (package)
-        assert(package:has_cxxtypes("marisa::Trie", {configs = {languages = "c++11"}, includes = "marisa.h"}))
+        assert(package:check_cxxsnippets({test = [[
+            #include <marisa.h>
+            void test() {
+                int x = 1, y = 2;
+                marisa::swap(x, y);
+            }
+        ]]}, {configs = {languages = "c++17"}}), "package(marisa) require >= c++17")
     end)