From 3924a585a238149f5bd4df0dee4b1bb3a6597899 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Mon, 30 Dec 2024 20:07:51 -0500 Subject: [PATCH 1/2] mozc [skip ci] --- .gitmodules | 3 ++ README.md | 3 +- plugin/mozc/build.gradle.kts | 52 +++++++++++++++++++ .../mozc/licenses/libraries/fcitx5-mozc.json | 11 ++++ plugin/mozc/src/main/AndroidManifest.xml | 6 +++ plugin/mozc/src/main/cpp/CMakeLists.txt | 30 +++++++++++ plugin/mozc/src/main/cpp/fcitx5-mozc | 1 + plugin/mozc/src/main/res/values/strings.xml | 6 +++ plugin/mozc/src/main/res/xml/plugin.xml | 6 +++ settings.gradle.kts | 1 + 10 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 plugin/mozc/build.gradle.kts create mode 100644 plugin/mozc/licenses/libraries/fcitx5-mozc.json create mode 100644 plugin/mozc/src/main/AndroidManifest.xml create mode 100644 plugin/mozc/src/main/cpp/CMakeLists.txt create mode 160000 plugin/mozc/src/main/cpp/fcitx5-mozc create mode 100644 plugin/mozc/src/main/res/values/strings.xml create mode 100644 plugin/mozc/src/main/res/xml/plugin.xml diff --git a/.gitmodules b/.gitmodules index b710f89d..dcf0e36f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -55,3 +55,6 @@ [submodule "plugin/thai/src/main/cpp/fcitx5-libthai"] path = plugin/thai/src/main/cpp/fcitx5-libthai url = https://github.com/fcitx/fcitx5-libthai +[submodule "plugin/mozc/src/main/cpp/fcitx5-mozc"] + path = plugin/mozc/src/main/cpp/fcitx5-mozc + url = https://github.com/fcitx-contrib/fcitx5-mozc diff --git a/README.md b/README.md index 7943e9d5..b6abc00d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ GitHub: [![release version](https://img.shields.io/github/v/release/fcitx5-andro - Zhuyin/Bopomofo (via [Chewing Plugin](./plugin/chewing)) - Jyutping (via [Jyutping Plugin](./plugin/jyutping/), powered by [libime-jyutping](https://github.com/fcitx/libime-jyutping)) - Vietnamese (via [UniKey Plugin](./plugin/unikey), supports Telex, VNI and VIQR) -- Japanese (via [Anthy Plugin](./plugin/anthy)) +- Japanese (via [Mozc Plugin](./plugin/mozc) and [Anthy Plugin](./plugin/anthy)) - Korean (via [Hangul Plugin](./plugin/hangul)) - Sinhala (via [Sayura Plugin](./plugin/sayura)) - Thai (via [Thai Plugin](./plugin/thai)) @@ -94,6 +94,7 @@ First, clone this repository and fetch all submodules: ```shell git clone git@github.com:fcitx5-android/fcitx5-android.git git submodule update --init --recursive +git clone git@github.com:google/mozc plugin/mozc/src/main/cpp/fcitx5-mozc/mozc --depth=1 --recurse-submodules ``` Install `extra-cmake-modules` and `gettext` with your system package manager: diff --git a/plugin/mozc/build.gradle.kts b/plugin/mozc/build.gradle.kts new file mode 100644 index 00000000..29f92983 --- /dev/null +++ b/plugin/mozc/build.gradle.kts @@ -0,0 +1,52 @@ +plugins { + id("org.fcitx.fcitx5.android.app-convention") + id("org.fcitx.fcitx5.android.plugin-app-convention") + id("org.fcitx.fcitx5.android.native-app-convention") + id("org.fcitx.fcitx5.android.build-metadata") + id("org.fcitx.fcitx5.android.data-descriptor") + id("org.fcitx.fcitx5.android.fcitx-component") +} + +android { + namespace = "org.fcitx.fcitx5.android.plugin.mozc" + + defaultConfig { + applicationId = "org.fcitx.fcitx5.android.plugin.mozc" + + @Suppress("UnstableApiUsage") + externalNativeBuild { + cmake { + targets( + "mozc" + ) + } + } + } + + buildTypes { + release { + resValue("string", "app_name", "@string/app_name_release") + } + debug { + resValue("string", "app_name", "@string/app_name_debug") + } + } + + packaging { + jniLibs { + excludes += setOf( + "**/libc++_shared.so", + "**/libFcitx5*" + ) + } + } +} + +fcitxComponent { + installPrebuiltAssets = true +} + +dependencies { + implementation(project(":lib:fcitx5")) + implementation(project(":lib:plugin-base")) +} diff --git a/plugin/mozc/licenses/libraries/fcitx5-mozc.json b/plugin/mozc/licenses/libraries/fcitx5-mozc.json new file mode 100644 index 00000000..57ffb510 --- /dev/null +++ b/plugin/mozc/licenses/libraries/fcitx5-mozc.json @@ -0,0 +1,11 @@ +{ + "uniqueId": "fcitx/mozc", + "artifactVersion": "2.30.5618.101", + "description": "Mozc for Fcitx", + "name": "fcitx/mozc", + "website": "https://github.com/fcitx/mozc", + "tag": "native", + "licenses": [ + "BSD-3-Clause" + ] +} diff --git a/plugin/mozc/src/main/AndroidManifest.xml b/plugin/mozc/src/main/AndroidManifest.xml new file mode 100644 index 00000000..9ba8bcb5 --- /dev/null +++ b/plugin/mozc/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/plugin/mozc/src/main/cpp/CMakeLists.txt b/plugin/mozc/src/main/cpp/CMakeLists.txt new file mode 100644 index 00000000..c8e89018 --- /dev/null +++ b/plugin/mozc/src/main/cpp/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.18) + +project(fcitx5-android-plugin-mozc VERSION ${VERSION_NAME}) + +# For reproducible build +add_link_options("LINKER:--hash-style=gnu,--build-id=none") + +# prefab dependency +find_package(fcitx5 REQUIRED CONFIG) +get_target_property(FCITX5_CMAKE_MODULES fcitx5::cmake INTERFACE_INCLUDE_DIRECTORIES) +set(CMAKE_MODULE_PATH ${FCITX5_CMAKE_MODULES} ${CMAKE_MODULE_PATH}) + +find_package(ECM MODULE) +find_package(Fcitx5Core MODULE) +find_package(Fcitx5Module MODULE) + +add_library(Mozc_static STATIC IMPORTED) +set_target_properties(Mozc_static PROPERTIES + IMPORTED_LOCATION "${PREBUILT_DIR}/libmozc/${ANDROID_ABI}/lib/libmozc-static.a" + INTERFACE_INCLUDE_DIRECTORIES "${PREBUILT_DIR}/libmozc/${ANDROID_ABI}/include/mozc" + INTERFACE_LINK_LIBRARIES "-llog -L${PREBUILT_DIR}/libmozc/${ANDROID_ABI}/lib -labsl -lprotobuf -lutf8_validity" + ) + +set(MOZC_TARGET Mozc_static) +add_subdirectory(fcitx5-mozc) + +target_include_directories(mozc PRIVATE + "${PROJECT_SOURCE_DIR}/../../../../../lib/fcitx5/build/headers/usr/include" + "${PROJECT_SOURCE_DIR}/../../../../../lib/fcitx5/build/headers/usr/include/Fcitx5/Module" + ) diff --git a/plugin/mozc/src/main/cpp/fcitx5-mozc b/plugin/mozc/src/main/cpp/fcitx5-mozc new file mode 160000 index 00000000..175c7230 --- /dev/null +++ b/plugin/mozc/src/main/cpp/fcitx5-mozc @@ -0,0 +1 @@ +Subproject commit 175c72309f74a67fe3f9474cbc4f578b341d7bea diff --git a/plugin/mozc/src/main/res/values/strings.xml b/plugin/mozc/src/main/res/values/strings.xml new file mode 100644 index 00000000..58ecc159 --- /dev/null +++ b/plugin/mozc/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + Fcitx5 (Mozc Plugin | Debug) + Fcitx5 (Mozc Plugin) + Mozc (Japanese input method) engine support for Fcitx5 + \ No newline at end of file diff --git a/plugin/mozc/src/main/res/xml/plugin.xml b/plugin/mozc/src/main/res/xml/plugin.xml new file mode 100644 index 00000000..22c6b2d7 --- /dev/null +++ b/plugin/mozc/src/main/res/xml/plugin.xml @@ -0,0 +1,6 @@ + + + 0.1 + fcitx5-mozc + @string/description + \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 88a0a2a2..bd3bd4f6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,3 +36,4 @@ include(":plugin:chewing") include(":plugin:sayura") include(":plugin:jyutping") include(":plugin:thai") +include(":plugin:mozc") From 9e250a727dd176bff63e3b9222675d13e2451bfa Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Mon, 30 Dec 2024 20:10:04 -0500 Subject: [PATCH 2/2] update submodule [skip ci] --- plugin/mozc/src/main/cpp/fcitx5-mozc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/mozc/src/main/cpp/fcitx5-mozc b/plugin/mozc/src/main/cpp/fcitx5-mozc index 175c7230..5580d540 160000 --- a/plugin/mozc/src/main/cpp/fcitx5-mozc +++ b/plugin/mozc/src/main/cpp/fcitx5-mozc @@ -1 +1 @@ -Subproject commit 175c72309f74a67fe3f9474cbc4f578b341d7bea +Subproject commit 5580d540d61e873033671e3d3af3e4fff51bd91d