日本語入力環境を現在の fcitx, fcitx-mozc から fcitx5, fcitx5-mozc に移行してみるテスト
[先に結論] 大きなトラブルなく移行可能
[移行手順] 説明は手抜きです
j_w名でpostしてます。(わたしのコメントの中に自作SlackBuildのリンクを貼りました。
自作SlackBuildにより作成されるパッケージ・リスト (パッケージのバージョンは2022-03-25現在のもの)
[packages from SlackBuilds]
*** Essential packages ***
*** Essential packages ***
------------------------------------------
xcb-imdkit-1.0.3-x86_64-1jw.txz
fmt-7.1.3-x86_64-1jw.txz
fcitx5-5.0.15-x86_64-1jw.txz
fcitx5-gtk-5.0.13-x86_64-1jw.txz
fcitx5-qt-5.0.11-x86_64-1jw.txz
fcitx5-configtool-5.0.12-x86_64-1jw.txz
xcb-imdkit-1.0.3-x86_64-1jw.txz
fmt-7.1.3-x86_64-1jw.txz
fcitx5-5.0.15-x86_64-1jw.txz
fcitx5-gtk-5.0.13-x86_64-1jw.txz
fcitx5-qt-5.0.11-x86_64-1jw.txz
fcitx5-configtool-5.0.12-x86_64-1jw.txz
------------------------------------------
*** for Japanese IM ***
------------------------------------------
fcitx5-mozc-2.26.4680.102.1-x86_64-1jw.txz (Mozc Japanese IM) -- old version
fcitx5-mozc-2.28.4780.102.1-x86_64-1jw.txz (Mozc Japanese IM) -- updated on Jul.07.2022
fcitx5-anthy-5.0.10-x86_64-1jw.txz (light weight and basic Japanese IM; alternate choice)
bazel-5.1.0-x86_64-1jw.txz (Needs for compiling mozc)
jdk11-11.0.14-x86_64-1jw.txz (Needs for bazel)
bazel-5.1.0-x86_64-1jw.txz (Needs for compiling mozc)
jdk11-11.0.14-x86_64-1jw.txz (Needs for bazel)
------------------------------------------
[その他:参考リンク (other related LINKs)]
・自作パッケージのSlackBuild (SlackBuild of each package)
-- xcb-imdkit
-- fmt (See SlackBuilds_at_org)
-- fcitx5
-- gtk4 (Use slackware's official package)
-- fcitx5-gtk
-- fcitx5-qt
-- kitemviews (Use slackware's official package)
-- kwidgetsaddons (Use slackware's official package)
-- fcitx5-mozc
-- fcitx5-anthy
-- bazel
-- jdk11 ( or See SlackBuilds_at_org)
======
更新: 2022-03-29 19:30
fcitx5-mozc パッケージ作成が一番やっかいだったので、このスクリプトとslackware用パッチだけでも
ここに記載しておく。
更新 : 2022-05-13 20:50
fcitx5-mozc-2.28.4730.102 -- updated to version-2.28.4730.102
更新 : 2022-06-12 22:00
fcitx5-mozc-2.28.4750.102 -- updated to version-2.28.4750.102
更新 : 2022-07072 23:00
fcitx5-mozc-2.28.4780.102 -- updated to version-2.28.4780.102
fcitx5-mozc.SlackBuild
[code]
#!/bin/sh # Slackware build script for fcitx-mozc # Issued under The MIT License (MIT) # # Copyright 2016 Kuro_CODE25 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. PRGNAM=fcitx5-mozc VERSION=${VERSION:-2.28.4780.102.1} BUILD=${BUILD:-1} TAG=${TAG:-jw} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} BLDBASEDIR=$TMP/$PRGNAM-$VERSION if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e BLDTYPE=Release # source rev. and version. ZIPCODE_REL=202110 ABSEIL_CPP_REV=eb3db08cb3a4faf2aa09a2ba4a30b442457f36cf BREAKPAD_REV=c685fe1153193853cff23e83d6d2b2c577aaa5f6 GOOGLETEST_REV=703bd9caab50b139428cea1aaff9974ebee5742e JSONCPP_REV=42e892d96e47b1f6e29844cc705e148ec4856448 PROTOBUF_REV=b5a35bcc7e4cc4ff00eb105449b300fca3a8b0d2 GYP_REV=caa60026e223fc501e8b337fd5086ece4028b1c6 JAPANESE_USAGE_DICT_REV=e5b3425575734c323e1d947009dd74709437b684 # 2.28.4750 # MOZC_REV=56582ade9a5ffd30b9c588dad6e0fe280fee1979 MOZC_REV=47df743687b1768f209e877f4ff09a4956fc4342 # Download sources wget https://github.com/chromium/gyp/archive/${GYP_REV}/gyp-${GYP_REV}.zip wget https://github.com/fcitx/mozc/archive/${MOZC_REV}/mozc-${MOZC_REV}.zip wget https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/${JAPANESE_USAGE_DICT_REV}/japanese-usage-dictionary-${JAPANESE_USAGE_DICT_REV}.zip wget https://github.com/protocolbuffers/protobuf/archive/${PROTOBUF_REV}/protobuf-${PROTOBUF_REV}.zip wget https://github.com/abseil/abseil-cpp/archive/${ABSEIL_CPP_REV}/abseil-cpp-${ABSEIL_CPP_REV}.zip wget https://chromium.googlesource.com/breakpad/breakpad/+archive/${BREAKPAD_REV}.tar.gz wget https://github.com/google/googletest/archive/${GOOGLETEST_REV}/googletest-${GOOGLETEST_REV}.zip wget https://github.com/open-source-parsers/jsoncpp/archive/${JSONCPP_REV}/jsoncpp-${JSONCPP_REV}.zip wget https://osdn.net/projects/ponsfoot-aur/storage/mozc/jigyosyo-${ZIPCODE_REL}.zip wget https://osdn.net/projects/ponsfoot-aur/storage/mozc/x-ken-all-${ZIPCODE_REL}.zip wget https://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-icon.tar.gz rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION mkdir -p $PRGNAM-$VERSION cd $PRGNAM-$VERSION echo "prepare source file..." # unzip packages unzip $CWD/x-ken-all-$ZIPCODE_REL.zip unzip $CWD/jigyosyo-$ZIPCODE_REL.zip unzip $CWD/abseil-cpp-$ABSEIL_CPP_REV.zip unzip $CWD/googletest-$GOOGLETEST_REV.zip unzip $CWD/jsoncpp-$JSONCPP_REV.zip unzip $CWD/mozc-$MOZC_REV.zip unzip $CWD/japanese-usage-dictionary-$JAPANESE_USAGE_DICT_REV.zip unzip $CWD/gyp-$GYP_REV.zip unzip $CWD/protobuf-$PROTOBUF_REV.zip # untar breakpad to breakpad directory mkdir breakpad tar xvf ${CWD}/${BREAKPAD_REV}.tar.gz -C breakpad # extact tar file tar -xvf ${CWD}/fcitx-mozc-icon.tar.gz # rename directory mv mozc-$MOZC_REV mozc mv gyp-$GYP_REV gyp mv japanese-usage-dictionary-$JAPANESE_USAGE_DICT_REV japanese_usage_dictionary mv abseil-cpp-$ABSEIL_CPP_REV abseil-cpp mv protobuf-$PROTOBUF_REV protobuf #mv breakpad-$BREAKPAD_REV breakpad mv googletest-$GOOGLETEST_REV googletest mv jsoncpp-$JSONCPP_REV jsoncpp chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; cd $BLDBASEDIR/mozc/src # disable fcitx4 target #rm unix/fcitx/fcitx.gyp # disable android-ndk requirement, even if we don't need it bazel will complain sed "/android_ndk_repository/d" -i WORKSPACE.bazel # adjust QT_BASE_PATH sed 's|path = QT_BASE_PATH|path = "/usr/include/qt5"|' -i WORKSPACE.bazel cd $BLDBASEDIR/mozc # prepare zip code dictionary unzip -d src/data/dictionary_oss $CWD/x-ken-all-$ZIPCODE_REL.zip unzip -d src/data/dictionary_oss $CWD/jigyosyo-$ZIPCODE_REL.zip cd src/dictionary # Generate zip code seed sed -i "s/from dictionary import zip_code_util/import zip_code_util/g" gen_zip_code_seed.py cd ../data/dictionary_oss echo "Generating zip code seed ..." python3 ../../dictionary/gen_zip_code_seed.py --zip_code=x-ken-all.csv --jigyosyo=JIGYOSYO.CSV >> dictionary09.txt echo "Done." # Copy third party deps echo "Copy third party deps ..." cd $BLDBASEDIR/mozc # fix QT_BBASE_PATH QT_BIN_PATH #patch -p1 < $CWD/01_mozc_config.bzl_qt5.diff # # 2022-07-07 # For Linux, Qt paths are managed by pkg_config_repository in WORKSPACE.bazel. # So, we don't need 01_mozc_config.bzl_qt5.diff. # fix libdir path of fcitx5-mozc.so for Slackware patch -p1 < $CWD/02_install_fcitx5_libdir.diff cd .. for dep in abseil-cpp breakpad googletest jsoncpp gyp protobuf japanese_usage_dictionary do cp -a $dep mozc/src/third_party/ done # build package echo "build package..." CFLAGS="${CFLAGS} -fvisibility=hidden" CXXFLAGS="${CXXFLAGS} -fvisibility=hidden" cd $BLDBASEDIR/mozc/src QT_BASE_PATH=/usr/include/qt5 bash ../scripts/build_fcitx5_bazel # Build emacs_helper echo "build emacs_helper..." # export JAVA_HOME export JAVA_HOME=/usr/lib64/jdk11-11.0.14 # Build bazel build unix/emacs:mozc_emacs_helper --config oss_linux --compilation_mode opt # Extract license part of mozc head -n 29 server/mozc_server.cc > LICENSE export PREFIX="$PKG/usr" export _bldtype bash ../scripts/install_server_bazel install -d "$PKG/usr/share/licenses/${PRGNAM}/" install -m 644 LICENSE data/installer/*.html "$PKG/usr/share/licenses/${PRGNAM}/" install -d "${PREFIX}/share/fcitx5/addon" install -d "${PREFIX}/share/fcitx5/inputmethod" install -d "${PREFIX}/lib${LIBDIRSUFFIX}/fcitx5" bash ../scripts/install_fcitx5_bazel # Install emacs_helper install -Dm644 ../LICENSE $PKG/usr/share/licenses/emacs-mozc/LICENSE install -Dm644 data/installer/credits_en.html $PKG/usr/share/licenses/emacs-mozc/credits_en.html install -Dm755 bazel-bin/unix/emacs/mozc_emacs_helper $PKG/usr/bin/mozc_emacs_helper install -Dm644 unix/emacs/mozc.el $PKG/usr/share/emacs/site-lisp/mozc.el mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp $CWD/sources.url $CWD/init.el_mozc $CWD/README.emacs $PKG/usr/doc/$PRGNAM-$VERSION/ cp $CWD/*.diff $PKG/usr/doc/$PRGNAM-$VERSION/ cp $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install # install slack-desc cat $CWD/slack-desc > $PKG/install/slack-desc ### clean-up work directory echo "Clean up working directory ..." #for dep in abseil-cpp breakpad googletest jsoncpp gyp protobuf japanese_usage_dictionary #do # rm -rf $CWD/$dep #done rm -rf $CWD/*.zip $CWD/*.tar.gz cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} |
01_mozc_config.bzl_qt5.diff
[code]
--- a/src/config.bzl 2022-03-21 13:54:26.000000000 +0900 +++ b/src/config.bzl 2022-03-26 15:14:04.384298439 +0900 @@ -40,8 +40,8 @@ MACOS_MIN_OS_VER = "10.12" ## Qt paths -QT_BASE_PATH = "/usr/include/x86_64-linux-gnu/qt5" # For Debian -QT_BIN_PATH = "/usr/bin/" +QT_BASE_PATH = "/usr/include/qt5" # For Slackware +QT_BIN_PATH = "/usr/lib64/qt5/bin/" ## For macOS ## QT_BASE_PATH should be a directory compiled with -developer_build option. |
02_install_fcitx5_libdir.diff
[code]
--- a/scripts/install_fcitx5_bazel 2022-03-26 17:59:59.265593030 +0900 +++ b/scripts/install_fcitx5_bazel 2022-03-26 18:00:47.135593436 +0900 @@ -1,7 +1,7 @@ #!/bin/sh PREFIX="${PREFIX:-/usr}" -install -D -m 755 "bazel-bin/unix/fcitx5/fcitx5-mozc.so" "${PREFIX}/lib/fcitx5/fcitx5-mozc.so" +install -D -m 755 "bazel-bin/unix/fcitx5/fcitx5-mozc.so" "${PREFIX}/lib64/fcitx5/fcitx5-mozc.so" PREFIX="${PREFIX}" ../scripts/install_fcitx5_data PREFIX="${PREFIX}" ../scripts/install_fcitx5_icons |
init.el_mozc
[code]
(set-language-environment "Japanese") (require 'mozc) ; or (load-file "/usr/share/emacs/site-lisp/emacs-mozc/mozc.el") (setq default-input-method "japanese-mozc") (setq mozc-candidate-style 'overlay) |
README.emacs
[code]
# for emacs, create {HOME}/.emacs.d/init.el with followng lines (require 'mozc) ; or (load-file "/path/to/mozc.el") (setq default-input-method "japanese-mozc") (setq mozc-candidate-style 'overlay) |
slack-desc
[code]
# HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. # Line up the first '|' above the ':' following the base package name, and # the '|' on the right side marks the last column you can put a character in. # You must make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| fcitx5-mozc: fcitx5-mozc (Mozc engine for fcitx5) fcitx5-mozc: fcitx5-mozc: fcitx5-mozc is Mozc, Japanese input method editor, engine for fcitx5. fcitx5-mozc: fcitx5-mozc: Homepage: https://fcitx-im.org fcitx5-mozc: fcitx5-mozc: fcitx5-mozc: fcitx5-mozc: fcitx5-mozc: fcitx5-mozc: |
引き続き更新予定