(同じ利用者による、間の39版が非表示)
8行目: 8行目:
  sudo zypper addrepo 'https://download.opensuse.org/repositories/M17N/$releasever/' M17N
  sudo zypper addrepo 'https://download.opensuse.org/repositories/M17N/$releasever/' M17N
  または
  または
  sudo zypper addrepo 'https://download.opensuse.org/repositories/home:/ftake:/branches:/M17N/buildtools_$releasever/' ftake
  sudo zypper addrepo 'https://download.opensuse.org/repositories/home:/ftake:/mozc/$releasever/' ftake
<br>
<br>
追加したリポジトリを更新する。<br>
リポジトリを更新する。<br>
  sudo zypper refresh
  sudo zypper refresh
<br>
<br>
Fcitx5をインストールする。<br>
Fcitx5をインストールする。<br>
Fcitx5の設定ツールは自動的にインストールされる。<br>
この時、Fcitx5の設定ツールは自動的にインストールされる。<br>
  # KKCを使用する場合
  # KKCを使用する場合
  sudo zypper install fcitx5-kkc fcitx5-table-other
  sudo zypper install fcitx5-kkc fcitx5-table-other
29行目: 29行目:


== Fcitx5のインストール (ソースコードからインストール) ==
== Fcitx5のインストール (ソースコードからインストール) ==
==== ソースコードからインストールする前に ====
まず最初に、~/.profileファイル等に各ライブラリの環境変数を設定する。<br>
vi ~/.profile
<br>
<syntaxhighlight lang="sh">
export PATH="/<Fcitx5のインストールディレクトリ>/bin:$PATH"
export LD_LIBRARY_PATH="/<Fcitx5のインストールディレクトリ>/lib64:/<Fcitx5のインストールディレクトリ>/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="$(pkg-config --variable pc_path pkg-config)"
export PKG_CONFIG_PATH="/<Fcitx5のインストールディレクトリ>/lib64/pkgconfig:/<Fcitx5のインストールディレクトリ>/lib/pkgconfig:/<Fcitx5のインストールディレクトリ>/share/pkgconfig:$PKG_CONFIG_PATH"
export PYTHONPATH="/<Fcitx5のインストールディレクトリ>/lib64/python2.7/site-packages:$PYTHONPATH"
</syntaxhighlight>
<br>
==== XCB-IMDKitのインストール ====
==== XCB-IMDKitのインストール ====
まず、XCB-IMDKitを[https://github.com/fcitx/xcb-imdkit Github]からダウンロードする。<br>
まず、XCB-IMDKitを[https://github.com/fcitx/xcb-imdkit Github]からダウンロードする。<br>
40行目: 54行目:
  mkdir build && cd build
  mkdir build && cd build
   
   
  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=<Fcitxのインストールディレクトリ> ..
  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ> ..
  make -j $(nproc)
  make -j $(nproc)
  make install
  make install
57行目: 71行目:
  mkdir build && cd build
  mkdir build && cd build
   
   
  ../configure --prefix=<Fcitxのインストールディレクトリ> --enable-dtd
  ../configure --prefix=<Fcitx5のインストールディレクトリ> --enable-dtd
  make -j $(nproc)
  make -j $(nproc)
  make install
  make install
66行目: 80行目:
  mkdir build && cd build
  mkdir build && cd build
   
   
  ../configure --prefix=<Fcitxのインストールディレクトリ>
  ../configure --prefix=<Fcitx5のインストールディレクトリ>
  make -j $(nproc)
  make -j $(nproc)
  make install
  make install
<br>
<br>
XCB IMDkitおよびEmojiモジュールを読み込むため、~/.profileファイル等に環境変数を追記する。<br>
XCB IMDkitおよびEmojiモジュールを読み込むため、~/.profileファイル等に環境変数を追記する。<br>
  export LD_LIBRARY_PATH="/<Fcitxのインストールディレクトリ>/lib64"
  export LD_LIBRARY_PATH="/<Fcitx5のインストールディレクトリ>/lib64"
  export PKG_CONFIG_PATH="$(pkg-config --variable pc_path pkg-config)"
  export PKG_CONFIG_PATH="$(pkg-config --variable pc_path pkg-config)"
  export PKG_CONFIG_PATH="/<Fcitxのインストールディレクトリ>/lib64/pkgconfig:/<Fcitxのインストールディレクトリ>/share/pkgconfig:$PKG_CONFIG_PATH"
  export PKG_CONFIG_PATH="/<Fcitx5のインストールディレクトリ>/lib64/pkgconfig:/<Fcitx5のインストールディレクトリ>/share/pkgconfig:$PKG_CONFIG_PATH"
<br>
<br>
==== Fcitx5のインストール ====
==== Fcitx5のインストール ====
102行目: 116行目:
Fcitxをビルドおよびインストールする。<br>
Fcitxをビルドおよびインストールする。<br>
  cmake .. -DCMAKE_CXX_COMPILER=<G++8.5以降のG++のフルパス> \
  cmake .. -DCMAKE_CXX_COMPILER=<G++8.5以降のG++のフルパス> \
           -DCMAKE_INSTALL_PREFIX=<Fcitxのインストールディレクトリ> \
           -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ> \
           -DCMAKE_BUILD_TYPE=Release \
           -DCMAKE_BUILD_TYPE=Release \
           -DENABLE_GTK3_IM_MODULE=ON \
           -DENABLE_GTK3_IM_MODULE=ON \
111行目: 125行目:
  make install
  make install
<br>
<br>
もし、FcitxおよびFcitxライブラリをホームディレクトリ等にインストールする場合、~/.profileファイルに環境変数の設定を追記する。<br>
もし、Fcitx5をホームディレクトリ等の任意のディレクトリにインストールする場合、~/.profileファイル等に環境変数を設定する。<br>
  export PATH="/<Fcitxのインストールディレクトリ>/bin:$PATH"
vi ~/.profile
  export LD_LIBRARY_PATH="/<Fcitxのインストールディレクトリ>/lib:$LD_LIBRARY_PATH"
<br>
<syntaxhighlight lang="sh">
# ~/.profileファイル等
  export PATH="/<Fcitx5のインストールディレクトリ>/bin:$PATH"
  export LD_LIBRARY_PATH="/<Fcitx5のインストールディレクトリ>/lib:$LD_LIBRARY_PATH"
  export PKG_CONFIG_PATH="$(pkg-config --variable pc_path pkg-config)"
  export PKG_CONFIG_PATH="$(pkg-config --variable pc_path pkg-config)"
  export PKG_CONFIG_PATH="/<Fcitxのインストールディレクトリ>/lib/pkgconfig:$PKG_CONFIG_PATH"
  export PKG_CONFIG_PATH="/<Fcitx5のインストールディレクトリ>/lib/pkgconfig:$PKG_CONFIG_PATH"
</syntaxhighlight>
<br>
<br>
Fcitx5のD-Busサービスファイル (セッションバス) を作成する。<br>
sudo vi /usr/share/dbus-1/services/org.fcitx.Fcitx5.service
<br>
<syntaxhighlight lang="ini">
# /usr/share/dbus-1/services/org.fcitx.Fcitx5.serviceファイル
[D-BUS Service]
Name=org.fcitx.Fcitx5
Exec=/<Fcitx5のインストールディレクトリ>/bin/fcitx5
</syntaxhighlight>
<br>
<br>
==== Fcitx5-qtのインストール ====
==== Fcitx5-qtのインストール ====
[https://github.com/fcitx/fcitx5-qt/tags Fcitx5-qtのGithub]にアクセスして、ソースコードをダウンロードする。<br>
[https://github.com/fcitx/fcitx5-qt/tags Fcitx5-qtのGithub]にアクセスして、ソースコードをダウンロードする。<br>
127行目: 160行目:
<br>
<br>
Fcitx5-qtのビルドに必要なライブラリをインストールする。<br>
Fcitx5-qtのビルドに必要なライブラリをインストールする。<br>
  sudo zypper install libQt5Core-devel libQt5Gui-devel libQt5Widgets-devel libQt5DBus-devel libQt5Concurrent-devel \
  sudo zypper install  
                    # Qt 5を有効化する場合
                    libQt5Core-devel libQt5Gui-devel libQt5Widgets-devel libQt5DBus-devel libQt5Concurrent-devel \
                     libqt5-qtbase-devel libqt5-qtbase-private-headers-devel
                     libqt5-qtbase-devel libqt5-qtbase-private-headers-devel
                    # Qt 6を有効化する場合
                    qt6-core-devel qt6-gui-devel qt6-widgets-devel qt6-dbus-devel qt6-concurrent-devel \
                    qt6-base-devel qt6-base-private-devel
<br>
<br>
Fcitx5-qtをビルドおよびインストールする。<br>
Fcitx5-qtをビルドおよびインストールする。<br>
  cmake -DCMAKE_C_COMPILER=<GCC 8.5以降のGCCのパス> -DCMAKE_CXX_COMPILER=<G++ 8.5以降のG++のパス> \
mkdir build && cd build
       -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ> -DCMAKE_BUILD_TYPE=Release \
       -DENABLE_QT4=off -DENABLE_QT6=off ..
  cmake -DCMAKE_C_COMPILER=<GCC 8以降のGCCのパス> -DCMAKE_CXX_COMPILER=<G++ 8以降のG++のパス>                 \
       -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ>                                                 \
      -DCMAKE_INSTALL_QT5PLUGINDIR=/<Fcitx5のインストールディレクトリ>/lib64/qt5/plugins/platforminputcontexts  \  # 未指定でも可
      -DCMAKE_BUILD_TYPE=Release \
       -DENABLE_QT4=OFF          \  # デフォルトで無効になっている
      -DENABLE_QT6=OFF          \  # デフォルトでは無効になっているため、有効にする場合は<codE>ON</code>を指定する
      ..
  make -j $(nproc)
  make -j $(nproc)
  make install または sudo make install
  make install または sudo make install
140行目: 185行目:
  sudo cp libfcitx5platforminputcontextplugin.so /usr/lib64/qt5/plugins/platforminputcontexts/
  sudo cp libfcitx5platforminputcontextplugin.so /usr/lib64/qt5/plugins/platforminputcontexts/
<br>
<br>
==== Fcitx5-gtkのインストール ====
==== Fcitx5-gtkのインストール ====
[https://github.com/fcitx/fcitx5-gtk/tags Fcitx5-gtkのGithub]にアクセスして、ソースコードをダウンロードする。<br>
[https://github.com/fcitx/fcitx5-gtk/tags Fcitx5-gtkのGithub]にアクセスして、ソースコードをダウンロードする。<br>
150行目: 196行目:
<br>
<br>
Fcitx5-gtkのビルドに必要なライブラリをインストールする。<br>
Fcitx5-gtkのビルドに必要なライブラリをインストールする。<br>
  sudo zypper install gobject-introspection-devel
  sudo zypper install gtk3-devel gobject-introspection-devel
                    gtk4-devel  # GTK 4を有効にする場合
<br>
<br>
Fcitx5-gtkをビルドおよびインストールする。<br>
Fcitx5-gtkをビルドおよびインストールする。<br>
  cmake -DCMAKE_C_COMPILER=<GCC 8.5以降のGCCのパス> -DCMAKE_CXX_COMPILER=<G++ 8.5以降のG++のパス> \
  cmake -DCMAKE_C_COMPILER=<GCC 8以降のGCCのパス> -DCMAKE_CXX_COMPILER=<G++ 8以降のG++のパス>       \
       -DCMAKE_INSTALL_PREFIX=<Fcitxのインストールディレクトリ> -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ>                                     \  # 未指定でも可
       -DENABLE_GTK2_IM_MODULE=off -DENABLE_GTK4_IM_MODULE=off ..
      -DGOBJECT_INTROSPECTION_GIRDIR=/<Fcitx5のインストールディレクトリ>/share/gir-1.0              \  # 未指定でも可
      -DGOBJECT_INTROSPECTION_TYPELIBDIR=/<Fcitx5のインストールディレクトリ>/lib64/girepository-1.0 \  # 未指定でも可
      -DCMAKE_BUILD_TYPE=Release \
       -DENABLE_GTK2_IM_MODULE=OFF \  # GTK 2を無効にする場合
      -DENABLE_GTK4_IM_MODULE=OFF \  # GTK 4を無効にする場合
      ..
  make -j $(nproc)
  make -j $(nproc)
  make install または sudo make install
  make install または sudo make install
187行目: 239行目:
  python setup.py install --prefix=<Fcitx5のインストールディレクトリ>
  python setup.py install --prefix=<Fcitx5のインストールディレクトリ>
<br>
<br>
==== Fcitx5-Anthyのインストール ====
==== Anthy-Unicodeのインストール (任意 : Fcitx5-Anthyを使用する場合) ====
Anthyとは、LGPLでライセンスされた日本語入力メソッドエンジンである。<br>
Anthyとは、LGPLでライセンスされた日本語入力メソッドエンジンである。<br>
2009年以降、開発が停滞気味であったが、2021年に元開発者の田畑氏の合意の下で「Anthy Unicode」なる計画がTakao Fujiwara氏ら有志の手により開始している。<br>
2009年以降、開発が停止していたが、2021年に元開発者の田畑氏の合意の下で「Anthy Unicode」なる計画がTakao Fujiwara氏ら有志の手により開始している。<br>
2023年2月4日より、Anthy Unicodeが利用可能になった。利用可能になったのは以下に示すパッケージである。<br>
* anthy-unicode (本体)
* kasumi-unicode (辞書ツール)
* fcitx-anthy-unicode (Fcitx4用ラッパー)
* fcitx5-anthy-unicode (Fcitx5用ラッパー)
* ibus-anthy-unicode (IBus用ラッパー)
<br>
詳細は、[https://ja.osdn.net/projects/univalentgnulinux/news/31010 OSDNのWebサイト]から閲覧することができる。<br>
Anthy UnicodeのGithub : https://github.com/fujiwarat/anthy-unicode<br>
<br>
[https://github.com/fujiwarat/anthy-unicode Anthy-UnicodeのGithub]にアクセスして、ソースコードをダウンロードする。<br>
ダウンロードしたファイルを解凍する。<br>
tar xf anthy-unicode-<バージョン>.tar.gz
cd anthy-unicode-<バージョン>
<br>
または、<code>git clone</code>コマンドを実行して、Anthy-Unicodeのソースコードをダウンロードする。<br>
git clone https://github.com/fujiwarat/anthy-unicode.git
cd anthy-unicode
<br>
Anthy-Unicodeをビルドおよびインストールする。<br>
autoreconf -i
mkdir build && cd build
../configure --prefix=<Fcitx5のインストールディレクトリ>
make -j $(nproc)
make install
<br>
==== Kasumi-Unicodeのインストール (任意 : Fcitx5-Anthyを使用する場合) ====
霞 (Kasumi-Unicode) は、シンプルなAnthy個人辞書管理ツールである。<br>
<br>
Kasumi-Unicodeのビルドに必要なライブラリをインストールする。<br>
# SUSE
sudo zypper install make gcc gcc-c++ gtk3-devel
                    anthy-devel  # パッケージ管理システムからAnthy-Unicodeをインストールしている場合
<br>
[https://github.com/fujiwarat/kasumi-unicode Kasumi-UnicodeのGithub]にアクセスして、ソースコードをダウンロードする。<br>
ダウンロードしたファイルを解凍する。<br>
tar xf kasumi-unicode-<バージョン>.tar.gz
cd kasumi-unicode-<バージョン>
<br>
または、<code>git clone</code>コマンドを実行して、Kasumi-Unicodeのソースコードをダウンロードする。<br>
git clone https://github.com/fujiwarat/kasumi-unicode.git
cd kasumi-unicode
<br>
Kasumi-Unicodeをビルドおよびインストールする。<br>
autoreconf -i
mkdir build && cd build
../configure --prefix=<Fcitx5のインストールディレクトリ>
make -j $(nproc)
make install
<br>
<br>
==== Fcitx5-Anthyのインストール (任意 : Fcitx5-Anthyを使用する場合) ====
Fcitx5-Anthyのビルドに必要なライブラリをダウンロードする。<br>
Fcitx5-Anthyのビルドに必要なライブラリをダウンロードする。<br>
  sudo zypper install pkg-config gettext-runtime gettext-tools make cmake extra-cmake-modules \
  sudo zypper install pkg-config gettext-runtime gettext-tools make cmake extra-cmake-modules \
                     fcitx5-devel anthy-devel  # パッケージ管理システムからFcitx5をインストールしている場合
                     anthy-devel   # パッケージ管理システムからAnthyをインストールしている場合
                    fcitx5-devel  # パッケージ管理システムからFcitx5をインストールしている場合
<br>
<br>
[https://github.com/fcitx/fcitx5-anthy Fcitx5-AnthyのGithub]にアクセスして、ソースコードをダウンロードする。<br>
[https://github.com/fcitx/fcitx5-anthy Fcitx5-AnthyのGithub]にアクセスして、ソースコードをダウンロードする。<br>
201行目: 309行目:
<br>
<br>
Fcitx5-Anthyをビルドおよびインストールする。<br>
Fcitx5-Anthyをビルドおよびインストールする。<br>
  cmake -DCMAKE_INSTALL_PREFIX=<Fcitxのインストールディレクトリ> -DCMAKE_BUILD_TYPE=Release ..
  cmake -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ> -DCMAKE_BUILD_TYPE=Release ..
  make -j $(nproc)
  make -j $(nproc)
  make install
  make install
<br>
<br>
==== libKKCおよびlibKKC Dataのインストール ====
 
==== libKKCおよびlibKKC Dataのインストール (任意 : Fcitx5-KKCを使用する場合) ====
[https://github.com/ueno/libkkc.git libKKCのGithub]にアクセスして、ソースコードをダウンロードする。<br>
[https://github.com/ueno/libkkc.git libKKCのGithub]にアクセスして、ソースコードをダウンロードする。<br>
  tar xf libkkc-<バージョン>.tar.gz
  tar xf libkkc-<バージョン>.tar.gz
241行目: 350行目:
  sudo zypper install libgee-0_8-2 typelib-1_0-Gee-0_8 libxcb-ewmh2
  sudo zypper install libgee-0_8-2 typelib-1_0-Gee-0_8 libxcb-ewmh2
<br>
<br>
==== Fcitx5-KKCのインストール ====
 
==== Fcitx5-KKCのインストール (任意 : Fcitx5-KKCを使用する場合) ====
[https://github.com/fcitx/fcitx5-kkc/tags/ Fcitx5-KKCのGithub]にアクセスして、ソースコードをダウンロードする。<br>
[https://github.com/fcitx/fcitx5-kkc/tags/ Fcitx5-KKCのGithub]にアクセスして、ソースコードをダウンロードする。<br>
ダウンロードしたファイルを解凍する。<br>
ダウンロードしたファイルを解凍する。<br>
255行目: 365行目:
<br>
<br>
Fcitx5-KKCをビルドおよびインストールする。<br>
Fcitx5-KKCをビルドおよびインストールする。<br>
  cmake -DCMAKE_INSTALL_PREFIX=<Fcitxのインストールディレクトリ> -DCMAKE_BUILD_TYPE=Release ..
  cmake -DCMAKE_INSTALL_PREFIX=<Fcitx5のインストールディレクトリ> -DCMAKE_BUILD_TYPE=Release ..
  make -j $(nproc)
  make -j $(nproc)
  make install
  make install
<br>
<br>
==== Fcitx5-ConfigToolのインストール ====
==== Fcitx5-ConfigToolのインストール ====
[https://github.com/fcitx/fcitx5-configtool/tags Fcitx5-ConfigToolのGithub]にアクセスして、ソースコードをダウンロードする。<br>
[https://github.com/fcitx/fcitx5-configtool/tags Fcitx5-ConfigToolのGithub]にアクセスして、ソースコードをダウンロードする。<br>
278行目: 389行目:
  make -j $(nproc)
  make -j $(nproc)
  make install
  make install
<br>
==== Fcitx5のデスクトップエントリファイルの作成 ====
Fcitx5の自動起動を設定するファイルを作成する。<br>
vi ~/.share/local/applications/org.fcitx.Fcitx5.desktop
# または
sudo vi /usr/share/applications/org.fcitx.Fcitx5.desktop
<br>
<syntaxhighlight lang="ini">
[Desktop Entry]
Type=Application
Name=Fcitx 5
Name[ja]=Fcitx 5
GenericName=Input Method
GenericName[ja]=入力メソッド
Comment=Start Input Method
Comment[ja]=入力メソッドを開始
Exec=/<Fcitx5のインストールディレクトリ>/bin/fcitx5
Icon=fcitx
Terminal=false
Categories=System;Utility;X-SuSE-DesktopUtility;
StartupNotify=false
X-GNOME-AutoRestart=false
X-GNOME-Autostart-Notify=false
X-KDE-autostart-after=panel
X-KDE-StartupNotify=false
X-KDE-Wayland-VirtualKeyboard=true
</syntaxhighlight>
<br>
==== Fcitx5の自動起動設定 ====
Fcitx5の自動起動を設定するファイルを作成する。<br>
vi ~/.config/autostart/org.fcitx.Fcitx5.desktop
# または
sudo vi /etc/xdg/autostart/org.fcitx.Fcitx5.desktop
<br>
<syntaxhighlight lang="ini">
# ~/.config/autostart/org.fcitx.Fcitx5.desktopファイル
# または
# /etc/xdg/autostart/org.fcitx.Fcitx5.desktopファイル
[Desktop Entry]
Type=Application
Name[ja]=Fcitx 5
Name=Fcitx 5
GenericName[ja]=入力メソッド
GenericName=Input Method
Comment[ja]=入力メソッドを開始
Comment=Start Input Method
Exec=/<Fcitx5のインストールディレクトリ>/bin/fcitx5
Icon=fcitx
Categories=System;Utility;X-SuSE-DesktopUtility;
Terminal=false
StartupNotify=false
X-GNOME-AutoRestart=false
X-GNOME-Autostart-Notify=false
X-KDE-autostart-after=panel
X-KDE-StartupNotify=false
X-KDE-Wayland-VirtualKeyboard=true
</syntaxhighlight>
<br>
==== D-Bus設定ファイルの作成 ====
Fcitx5のD-Bus設定ファイルを作成する。<br>
sudo vi /usr/share/dbus-1/services/org.fcitx.Fcitx5.service
<br>
<syntaxhighlight lang="ini>
# /usr/share/dbus-1/services/org.fcitx.Fcitx5.serviceファイル
[D-BUS Service]
Name=org.fcitx.Fcitx5
Exec=/<Fcitx5のインストールディレクトリ>/bin/fcitx5
</syntaxhighlight>
<br><br>
<br><br>


296行目: 477行目:
Mozcのビルドに必要な依存関係のライブラリをインストールする。<br>
Mozcのビルドに必要な依存関係のライブラリをインストールする。<br>
  sudo zypper install git curl unzip bzip2 update-desktop-files pkg-config make ninja gcc10-c++ zlib-devel protobuf-devel \
  sudo zypper install git curl unzip bzip2 update-desktop-files pkg-config make ninja gcc10-c++ zlib-devel protobuf-devel \
                     bazel6 bazel-rules-cc-source bazel-apple-support-source bazel-rules-android-ndk-source              \
                     bazel6 bazel-rules-cc-source bazel-apple-support-source bazel-workspaces \
                     bazel-rules-java-source bazel-rules-pkg-source bazel-rules-proto-source                             \
                     bazel-rules-java-source bazel-rules-proto-source                         \
                     bazel-rules-python-source bazel-rules-swift-source bazel-skylib-source bazel-workspaces            \
                     bazel-rules-python-source bazel-rules-swift-source bazel-skylib-source   \
                     qt6-core-devel qt6-gui-devel qt6-widgets-devel                                                     \
                     qt6-core-devel qt6-gui-devel qt6-widgets-devel                           \
                     ibus-devel
                     ibus-devel
                     fcitx5-devel  # Fcitx5をパッケージ管理システムからインストールしている場合
                     fcitx5-devel  # Fcitx5をパッケージ管理システムからインストールしている場合
318行目: 499行目:
   
   
  LINUX_MOZC_BROWSER_COMMAND = "/usr/bin/xdg-open"
  LINUX_MOZC_BROWSER_COMMAND = "/usr/bin/xdg-open"
  LINUX_MOZC_ICONS_DIR = "/<Mozcのインストールディクトリ>/share/icons/mozc"
  LINUX_MOZC_ICONS_DIR       = "/<Mozcのインストールディクトリ>/share/icons/mozc"
  LINUX_MOZC_SERVER_DIR = "/<Mozcのインストールディクトリ>/lib/mozc"
  LINUX_MOZC_SERVER_DIR     = "/<Mozcのインストールディクトリ>/lib/mozc"
  LINUX_MOZC_DOCUMENT_DIR = LINUX_MOZC_SERVER_DIR + "/documents"
  LINUX_MOZC_DOCUMENT_DIR   = LINUX_MOZC_SERVER_DIR + "/documents"
  IBUS_COMPONENT_DIR = "/<Mozcのインストールディクトリ>/share/ibus/component"
  IBUS_COMPONENT_DIR         = "/<Mozcのインストールディクトリ>/share/ibus/component"
  IBUS_MOZC_INSTALL_DIR = "/<Mozcのインストールディクトリ>/share/ibus-mozc"
  IBUS_MOZC_INSTALL_DIR     = "/<Mozcのインストールディクトリ>/share/ibus-mozc"
  IBUS_MOZC_ICON_PATH = IBUS_MOZC_INSTALL_DIR + "/product_icon.png"
  IBUS_MOZC_ICON_PATH       = IBUS_MOZC_INSTALL_DIR + "/product_icon.png"
  IBUS_MOZC_PATH = "/<Mozcのインストールディクトリ>/lib/ibus-mozc/ibus-engine-mozc"
  IBUS_MOZC_PATH             = "/<Mozcのインストールディクトリ>/lib/ibus-mozc/ibus-engine-mozc"
  EMACS_MOZC_CLIENT_DIR = "/<Mozcのインストールディクトリ>/share/emacs/site-lisp/emacs-mozc"
  EMACS_MOZC_CLIENT_DIR     = "/<Mozcのインストールディクトリ>/share/emacs/site-lisp/emacs-mozc"
  EMACS_MOZC_HELPER_DIR = "/<Mozcのインストールディクトリ>/bin"
  EMACS_MOZC_HELPER_DIR     = "/<Mozcのインストールディクトリ>/bin"
<br>
 
==== Bazelの設定ファイルの作成と変更 ====
===== WORKSPACEの編集 =====
src/WORKSPACE.bazelファイルを編集して、以下に示す設定を追記する。<br>
vi src/WORKSPACE.bazel
<br>
* パッケージ管理システムからFcitx5をインストールしている場合
# src/WORKSPACE.bazelファイル
## 138行目あたり
# Fcitx
# pkg_config_repository does not work because pkgconfig --cflags-only-I fcitx returns nothing
new_local_repository(
  name = "fcitx",
  # This path should be updated per the environment.
  path = "/usr",  # For Debian
  build_file = "BUILD.fcitx.bazel",
)
# Fcitx 5
pkg_config_repository(
  name = "fcitx5",
  packages = ["Fcitx5Module", "Fcitx5Core"],
)
<br>
* ソースコードからFcitx5をインストールしている場合
# src/WORKSPACE.bazelファイル
## 138行目あたり
# Fcitx
# pkg_config_repository does not work because pkgconfig --cflags-only-I fcitx returns nothing
new_local_repository(
  name = "fcitx",
  # This path should be updated per the environment.
  path = "/usr",  # For Debian
  build_file = "BUILD.fcitx.bazel",
)
# Fcitx 5
new_local_repository(
  name = "fcitx5",
  path = "/<Fcitx5のインストールディレクトリ>",
  build_file = "BUILD.fcitx5.bazel",
)
<br>
src/BUILD.fcitx.bazelファイルを作成する。<br>
vi src/BUILD.fcitx.bazel
<br>
# src/BUILD.fcitx.bazelファイル
package(
    default_visibility = ["//visibility:public"],
)
cc_library(
    name = "fcitx",
    hdrs = glob([
        "include/fcitx/**",
        "include/fcitx-config/**",
        "include/fcitx-utils/**",
    ]),
    copts = ["-pthread"],
    includes = [
        "include",
    ],
    linkopts = [
        "-lfcitx-core",
        "-lfcitx-config",
        "-lfcitx-utils",
    ],
)
<br>
<u>また、ソースコードからFcitx5をインストールしている場合は、src/BUILD.fcitx5.bazelファイルを作成する。</u><br>
vi src/BUILD.fcitx5.bazel
<br>
# src/BUILD.fcitx5.bazelファイル
package(
    default_visibility = ["//visibility:public"],
)
cc_library(
    name = "fcitx5",
    srcs = glob(["lib64/libFcitx5Core.so*",
                "lib64/libFcitx5Utils.so*",
                "lib64/libFcitx5Config.so*",
                ]),
    hdrs = glob([
        "include/Fcitx5/**",
        "include/Fcitx5/Module/**",
        "include/Fcitx5/Core/**",
        "include/Fcitx5/Config/**",
        "include/Fcitx5/Utils/**",
    ]),
    copts = ["-pthread"],
    includes = [
        "include/Fcitx5/Module",
        "include/Fcitx5/Core",
        "include/Fcitx5/Config",
        "include/Fcitx5/Utils",
    ],
    linkopts = [
        "-lFcitx5Core",
        "-lFcitx5Config",
        "-lFcitx5Utils",
    ],
)
<br>
===== Mozcの設定ファイルの変更 =====
vi src/unix/fcitx5/mozc.conf
<br>
<syntaxhighlight lang="ini">
# src/unix/fcitx5/mozc.confファイル
[InputMethod]
Name=Mozc
#Icon=fcitx-mozc
Icon=mozc
Label=あ
LangCode=ja
Addon=mozc
Configurable=True
</syntaxhighlight>
<br>
vi src/unix/fcitx5/mozc-addon.conf
<br>
<syntaxhighlight lang="ini">
# src/unix/fcitx5/mozc-addon.confファイル
[Addon]
Name=Mozc
Category=InputMethod
#Library=fcitx5-mozc
Library=mozc
Type=SharedLibrary
OnDemand=True
Configurable=True
[Addon/OptionalDependencies]
0=clipboard
</syntaxhighlight>
<br>
===== Python 3.6を使用している場合 =====
vi src/base/gen_config_file_stream_data.py
<br>
<syntaxhighlight lang="python">
# src/base/gen_config_file_stream_data.pyファイル
# 68行目あたり
## 編集前
output.write('constexpr FileData kFileData[] = {\n')
for path in path_list:
    output.write('  {"%s", "' % os.path.basename(path))
    with open(path, 'rb') as stream:
      while (byte := stream.read(1)):
          output.write(r'\x' + byte.hex())
    output.write('"},\n')
output.write('};\n')
## 編集後
output.write('constexpr FileData kFileData[] = {\n')
for path in path_list:
    output.write('  {"%s", "' % os.path.basename(path))
    with open(path, 'rb') as stream:
      byte = stream.read(1)
      while (byte):
          output.write(r'\x' + byte.hex())
          byte = stream.read(1)
    output.write('"},\n')
output.write('};\n')
</syntaxhighlight>
<br>
===== Mozcのウインドウレンダリングの変更 =====
vi src/renderer/qt/qt_window_manager.cc
<br>
<syntaxhighlight lang="c++">
// src/renderer/qt/qt_window_manager.ccファイル
// 35行目あたり
// 編集前
#include "base/logging.h"
#include "protocol/candidates.pb.h"
#include "absl/strings/str_cat.h"
#include "renderer/renderer_style_handler.h"
#include "renderer/window_util.h"
// 編集後
#include "absl/strings/str_cat.h"
#include "base/logging.h"
#include "protocol/candidates.pb.h"
#include "renderer/renderer_style_handler.h"
#include "renderer/window_util.h"
</syntaxhighlight>
<br>
<syntaxhighlight lang="c++">
// src/renderer/qt/qt_window_manager.ccファイル
// 344行目あたり
// 追加
struct VirtualRect {
    const QScreen* screen;
    const Rect rect;
    VirtualRect(const QScreen* screen, const Rect rect): screen(screen), rect(rect) {}
};
Rect TranslateToVirtualRectWithScreen(const QScreen *screen, const Rect& native_rect) {
    const double device_pixel_ratio = screen->devicePixelRatio();
    // screen_left, screen_top have the save value in both virtual and native coordinate
    const int screen_left = screen->geometry().x();
    const int screen_top = screen->geometry().y();
    const int vx = (native_rect.Left() - screen_left) / device_pixel_ratio + screen_left;
    const int vy = (native_rect.Top() - screen_top) / device_pixel_ratio + screen_top;
    return Rect(vx, vy, native_rect.Width() / device_pixel_ratio, native_rect.Height() / device_pixel_ratio);
}
VirtualRect TranslateToVirtualRect(const Rect& native_rect) {
    for (const QScreen *screen: QGuiApplication::screens()) {
      Rect rect = TranslateToVirtualRectWithScreen(screen, native_rect);
      const QRect screen_rect = screen->geometry();
      // Use (top left) to locate a screen
      if (screen_rect.contains(rect.Left(), rect.Top())) {
          return VirtualRect(screen, rect);
      }
    }
    // fall back to primary screen
    const QScreen *screen = QGuiApplication::primaryScreen();
    Rect point = TranslateToVirtualRectWithScreen(screen, native_rect);
    return VirtualRect(screen, point);
}
</syntaxhighlight>
<br>
<syntaxhighlight lang="c++">
// src/renderer/qt/qt_window_manager.ccファイル
// 379行目あたり
// 編集前
Point QtWindowManager::GetWindowPosition(
    const commands::RendererCommand &command, const Size &win_size) {
    const Rect preedit_rect = GetRect(command.preedit_rectangle());
    const Point win_pos = Point(preedit_rect.Left(), preedit_rect.Bottom());
    const Rect monitor_rect = GetMonitorRect(win_pos.x, win_pos.y);
    const Point offset_to_column1(kColumn0Width, 0);
    const Rect adjusted_win_geometry =
      WindowUtil::GetWindowRectForMainWindowFromTargetPointAndPreedit(
          win_pos, preedit_rect, win_size, offset_to_column1, monitor_rect,
          /* vertical */ false);  // Only support horizontal window yet.
    return adjusted_win_geometry.origin;
}
// 編集後
Point QtWindowManager::GetWindowPosition(
    const commands::RendererCommand &command, const Size &win_size) {
    const Rect native_preedit_rect = GetRect(command.preedit_rectangle());
    const VirtualRect preedit_rect = TranslateToVirtualRect(native_preedit_rect);
    const Point win_pos = Point(preedit_rect.rect.Left(), preedit_rect.rect.Bottom());
    const Rect monitor_rect = GetRect(preedit_rect.screen->geometry());
    const Point offset_to_column1(kColumn0Width, 0);
    const Rect adjusted_win_geometry =
      WindowUtil::GetWindowRectForMainWindowFromTargetPointAndPreedit(
          win_pos, preedit_rect.rect, win_size, offset_to_column1, monitor_rect,
          /* vertical */ false);  // Only support horizontal window yet.
    return adjusted_win_geometry.origin;
}
</syntaxhighlight>
<br>
 
===== IBus-Mozcの設定 =====
vi src/unix/ibus/gen_mozc_xml.py
<br>
<syntaxhighlight lang="python">
# src/unix/ibus/gen_mozc_xml.pyファイル
# 261行目あたり
# 編集前
}, {
    'name': 'mozc-off',
    'longname': product_name + ':A_',
    'layout': 'default',
    'layout_variant': '',
    'layout_option': '',
    'rank': 99,
    'symbol': 'A',
    'composition_mode': 'DIRECT',
}]
# 編集後
}, {
    'name': 'mozc-off',
    'longname': product_name + ':A_',
    'layout': 'default',
    'layout_variant': '',
    'layout_option': '',
    'rank': 99,
    'symbol': 'A',
    'composition_mode': 'DIRECT',
}, {
    'name': 'mozc-jp-jp',
    'longname': product_name + " - JP layout",
    'layout': 'jp',
    'layout_variant': '',
    'layout_option': '',
    'rank': 0,
}, {
    'name': 'mozc-us',
    'longname': product_name + " - US layout",
    'layout': 'us',
    'layout_variant': '',
    'layout_option': '',
    'rank': 0,
}, {
    'name': 'mozc-dv',
    'longname': product_name + " - US Dvorak layout",
    'layout': 'us',
    'layout_variant': 'dvorak',
    'layout_option': '',
    'rank': 0,
}]
</syntaxhighlight>
<br>
<br>


335行目: 843行目:
  # Fcitx 5をソースコードからインストールしている場合
  # Fcitx 5をソースコードからインストールしている場合
   
   
  FCITX5_DIR="<Fcitx5のインストールディレクトリ>"; \
  export FCITX5_DIR="<Fcitx5のインストールディレクトリ>"; \
  export PATH="$FCITX5_DIR/bin:$PATH";     \
  export PATH="$FCITX5_DIR/bin:$PATH";                   \
  export LD_LIBRARY_PATH="$FCITX5_DIR/lib64:$FCITX5_DIR/lib:$LD_LIBRARY_PATH";                    \
  export LD_LIBRARY_PATH="$FCITX5_DIR/lib64:$FCITX5_DIR/lib:$LD_LIBRARY_PATH";                    \
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(pkg-config --variable pc_path pkg-config)";          \
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(pkg-config --variable pc_path pkg-config)";          \
  export PKG_CONFIG_PATH="$FCITX5_DIR/lib64/pkgconfig:$FCITX5_DIR/lib/pkgconfig:$PKG_CONFIG_PATH"; \
  export PKG_CONFIG_PATH="$FCITX5_DIR/lib64/pkgconfig:$FCITX5_DIR/lib/pkgconfig:$PKG_CONFIG_PATH"
export CPATH="$FCITX5_DIR/include/Fcitx5/Core:$FCITX5_DIR/include/Fcitx5/Config:$FCITX5_DIR/include/Fcitx5/Module:$FCITX5_DIR/include/Fcitx5/Utils"
  </syntaxhighlight>
  </syntaxhighlight>
<br>
<br>
361行目: 868行目:
Mozcファイル群を、以下に示すディレクトリに配置する。<br>
Mozcファイル群を、以下に示すディレクトリに配置する。<br>
<u>ただし、Mozcのインストールディレクトリを変更している場合は、変更した設定に合わせてMozcファイル群を配置する必要がある。</u><br>
<u>ただし、Mozcのインストールディレクトリを変更している場合は、変更した設定に合わせてMozcファイル群を配置する必要がある。</u><br>
  cp bazel-bin/unix/fcitx5/fcitx5-mozc.so /<Fcitx5のインストールディレクトリ>/lib64/fcitx5/mozc.so  # ファイル名を変更する必要があることに注意する
  # デフォルトのインストールディレクトリ (SUSE)
sudp cp bazel-bin/unix/fcitx5/fcitx5-mozc.so /usr/lib64/fcitx5/mozc.so  # <u>ファイル名をmozc.so変更する必要がある</u>
  sudo cp bazel-bin/server/mozc_server /usr/lib64/mozc/
  sudo cp bazel-bin/server/mozc_server /usr/lib64/mozc/
  sudo cp bazel-bin/gui/tool/mozc_tool /usr/lib64/mozc/
  sudo cp bazel-bin/gui/tool/mozc_tool /usr/lib64/mozc/
# インストールディレクトリを変更している場合
cp bazel-bin/unix/fcitx5/fcitx5-mozc.so /<Mozcのインストールディレクトリ>/lib64/fcitx5/mozc.so  # <u>ファイル名をmozc.so変更する必要がある</u>
cp bazel-bin/server/mozc_server /<Mozcのインストールディレクトリ>/lib/mozc/
cp bazel-bin/gui/tool/mozc_tool /<Mozcのインストールディレクトリ>/lib/mozc/
<br>
<br>
<u>※注意</u><br>
<u>※注意</u><br>
<u>必要であれば、src/scripts/install_fcitx5_bazelファイルおよびsrc/scripts/install_server_bazelファイルの内容を参照する。</u><br>
<u>必要であれば、src/scripts/install_fcitx5_bazelファイルおよびsrc/scripts/install_server_bazelファイルの内容を参照する。</u><br>
<br>
<br>
===== Mozcの設定ファイルの作成 =====
==== Mozcの設定ファイルの作成 ====
Mozcのアドオン設定ファイル、および、インプットメソッド設定ファイルを作成する。<br>
Mozcのアドオン設定ファイル、および、インプットメソッド設定ファイルを作成する。<br>
  vi /<Mozcのインストールディレクトリ>/share/fcitx5/addon/mozc.conf
  vi /<Mozcのインストールディレクトリ>/share/fcitx5/addon/mozc.conf
446行目: 959行目:
最後に、PCを再起動する。<br>
最後に、PCを再起動する。<br>
<br><br>
<br><br>
{{#seo:
|title={{PAGENAME}} : Exploring Electronics and SUSE Linux | MochiuWiki
|keywords=MochiuWiki,Mochiu,Wiki,Mochiu Wiki,Electric Circuit,Electric,pcb,Mathematics,AVR,TI,STMicro,AVR,ATmega,MSP430,STM,Arduino,Xilinx,FPGA,Verilog,HDL,PinePhone,Pine Phone,Raspberry,Raspberry Pi,C,C++,C#,Qt,Qml,MFC,Shell,Bash,Zsh,Fish,SUSE,SLE,Suse Enterprise,Suse Linux,openSUSE,open SUSE,Leap,Linux,uCLnux,Podman,電気回路,電子回路,基板,プリント基板
|description={{PAGENAME}} - 電子回路とSUSE Linuxに関する情報 | This page is {{PAGENAME}} in our wiki about electronic circuits and SUSE Linux
|image=/resources/assets/MochiuLogo_Single_Blue.png
}}


__FORCETOC__
__FORCETOC__
[[カテゴリ:RHEL]][[カテゴリ:SUSE]]
[[カテゴリ:RHEL]][[カテゴリ:SUSE]]