Browse Source

add mecab to the repo (#3338)

* add mecab to the repo

* update description

* add homepage

* remove unused config

* remove deps

* remove package end

* switch static/shared library

* add on_test

* add configs table

* include cassert

* add newline

* include memory

* adjust arg

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
Ren Tatsumoto 1 year ago
parent
commit
658669304c
1 changed files with 32 additions and 0 deletions
  1. 32 0
      packages/m/mecab/xmake.lua

+ 32 - 0
packages/m/mecab/xmake.lua

@@ -0,0 +1,32 @@
+package("mecab")
+    set_description("Yet another part-of-speech and morphological analyzer.")
+    set_homepage("https://taku910.github.io/mecab/")
+    set_license("GPL-2.0")
+
+    add_urls("https://github.com/taku910/mecab/archive/05481e751dd5aa536a2bace46715ce54568b972a.zip")
+    add_versions("0.996", "d5d3ec4954e969ea93f4f1d778d7dc3ae98848056ee1c8cb99fced8578fd73f3")
+
+    if is_plat("linux") then
+        add_extsources("pacman::mecab-git", "apt::mecab")
+    end
+
+    on_install("macosx|x86_64", "linux", function (package)
+        os.cd("mecab")
+        local configs = {}
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+        import("package.tools.autoconf").install(package, {"--with-charset=utf-8"})
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <cassert>
+            #include <memory>
+            #include <mecab.h>
+            static void test() {
+                std::unique_ptr<MeCab::Tagger> tagger{ MeCab::createTagger("") };
+                assert(tagger != nullptr);
+            }
+        ]]}, {configs = {languages = "c++17"}}))
+    end)
+