[2022-02-05]  2.26.4360.102.1 へのアップデートスクリプトをアップしましたこちら

Arch linux の情報を参考にして slackware64-current の fcitx-mozc をバージョン 2.26-4220.102.1
アップデートしてみた。

コンパイルが通った環境は
・slackware64-current 2020-12-07以降の環境
・gcc-10.2.0
・python3-3.9.1
・qt4 無し
・qt-5.15.2
・zinnia (別途インストール済)

0. Arch linux - fcitx-mozc-2.26.4220.102 の情報

1. fcitx-mozc.info (ソース入手先)
PRGNAM="fcitx-mozc"
VERSION="2.26.4220.102.1"
HOMEPAGE="https://fcitx-im.org"
DOWNLOAD="http://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-icon.tar.gz \
          https://osdn.net/projects/ponsfoot-aur/storage/mozc/jigyosyo-202011.zip \
          https://osdn.net/projects/ponsfoot-aur/storage/mozc/x-ken-all-202011.zip \
          https://github.com/fcitx/mozc/archive/1882e33b61673b66d63277f82b4c80ae4e506c10/mozc-1882e33b61673b66d63277f82b4c80ae4e506c10.zip \
          https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/e5b3425575734c323e1d947009dd74709437b684/japanese-usage-dictionary-e5b3425575734c323e1d947009dd74709437b684.zip \
          https://github.com/protocolbuffers/protobuf/archive/fde7cf7358ec7cd69e8db9be4f1fa6a5c431386a/protobuf-fde7cf7358ec7cd69e8db9be4f1fa6a5c431386a.zip \
          https://github.com/chromium/gyp/archive/caa60026e223fc501e8b337fd5086ece4028b1c6/gyp-caa60026e223fc501e8b337fd5086ece4028b1c6.zip \
          https://github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862/abseil-cpp-0f3bb466b868b523cf1dc9b2aaaed65c77b28862.zip \
          https://chromium.googlesource.com/breakpad/breakpad/archive/216cea7bca53fa441a3ee0d0f5fd339a3a894224/breakpad-216cea7bca53fa441a3ee0d0f5fd339a3a894224.zip \
          https://github.com/open-source-parsers/jsoncpp/archive/9059f5cad030ba11d37818847443a53918c327b1/jsoncpp-9059f5cad030ba11d37818847443a53918c327b1.zip \
         https://github.com/google/googletest/archive/703bd9caab50b139428cea1aaff9974ebee5742e/googletest-703bd9caab50b139428cea1aaff9974ebee5742e.zip"
MD5SUM="8ec243464ddb9ecf48924708c0448284 \
        c5f9c8f0149f5350cfd9dfcfa876aed4 \
        669ae868ea978ca06909a2d4562eaf0a \
        5ad08b20c092f8c5d7e65f4e8bd7b94c \
        a6eb1da9ad7ceffcb9683003332abf7e \
        cb4b1baed208474284161b7abd5cc17c \
        699c5af5c6d7e19835afb5292d151f91 \
        4f23c5fcb19a7ef0fb6ce0f636d480e3 \
        721ec19eb2b0bffa91e1eb94292bc7e4 \
        b697e8c85b2e41304d690ebc6bf2e1ca \

        768da4173ee9df3248b8f828747982ad"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="fcitx-configtool ninja zinnia"
MAINTAINER="Kuro_CODE25"
EMAIL="kuro-dot-code25-at-gmail-dot.com"

2. fcitx-mozc.SlackBuild
#!/bin/shjsoncpp
# 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=fcitx-mozc
VERSION=${VERSION:-2.26.4220.102.1}
BUILD=${BUILD:-2}
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=202011
ABSEIL_CPP_REV=0f3bb466b868b523cf1dc9b2aaaed65c77b28862
BREAKPAD_REV=216cea7bca53fa441a3ee0d0f5fd339a3a894224
GOOGLETEST_REV=703bd9caab50b139428cea1aaff9974ebee5742e
JSONCPP_REV=9059f5cad030ba11d37818847443a53918c327b1
PROTOBUF_REV=fde7cf7358ec7cd69e8db9be4f1fa6a5c431386a
GYP_REV=caa60026e223fc501e8b337fd5086ece4028b1c6
JAPANESE_USAGE_DICT_REV=e5b3425575734c323e1d947009dd74709437b684
MOZC_REV=1882e33b61673b66d63277f82b4c80ae4e506c10

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/breakpad-$BREAKPAD_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

# 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 {} \;

# Apply Arch-linux patch
cd $BLDBASEDIR/mozc
patch -Np1 -i $CWD/patches/0001-fix-install_fcitx-translation-files.patch

cd $BLDBASEDIR/mozc/src

# We won't need fcitx5
rm -rf unix/fcitx5

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
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
_targets="server/server.gyp:mozc_server gui/gui.gyp:mozc_tool unix/fcitx/fcitx.gyp:fcitx-mozc unix/emacs/emacs.gyp:mozc_emacs_helper"

QTDIR=/usr GYP_DEFINES="ibus_mozc_path=/usrshare/ibus-mozc/product_icon.png ibus_mozc_icon_path=/usrshare/ibus-mozc/product_icon.png document_dir=/usr/share/licenses/$pkgname use_libzinnia=1 use_fcitx5=0" python3 build_mozc.py gyp
python3 build_mozc.py gyp --server_dir=/usr/lib/mozc
python3 build_mozc.py build  -c Release $_targets

# Extract license part of mozc
head -n 29 server/mozc_server.cc > LICENSE

BLDTYPE=Release

# install mozc to /usr/lib even if 64 bit
install -D -m 755 out_linux/${BLDTYPE}/mozc_server "${PKG}/usr/lib/mozc/mozc_server"
install    -m 755 out_linux/${BLDTYPE}/mozc_tool   "${PKG}/usr/lib/mozc/mozc_tool"

install -d "${PKG}/usr/share/licenses/$pkgname/"
install -m 644 LICENSE data/installer/*.html "${PKG}/usr/share/licenses/${pkgname}/"

for mofile in out_linux/${BLDTYPE}/gen/unix/fcitx/po/*.mo
do
  filename=`basename $mofile`
  lang=${filename/.mo/}
  install -D -m 644 "$mofile" "${PKG}/usr/share/locale/$lang/LC_MESSAGES/fcitx-mozc.mo"
done

install -D -m 755 out_linux/${BLDTYPE}/fcitx-mozc.so "${PKG}/usr/lib${LIBDIRSUFFIX}/fcitx/fcitx-mozc.so"
install -D -m 644 unix/fcitx/fcitx-mozc.conf "${PKG}/usr/share/fcitx/addon/fcitx-mozc.conf"
install -D -m 644 unix/fcitx/mozc.conf "${PKG}/usr/share/fcitx/inputmethod/mozc.conf"

install -d "${PKG}/usr/share/fcitx/mozc/icon"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-alpha_full.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-alpha_full.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-alpha_half.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-alpha_half.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-direct.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-direct.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-hiragana.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-hiragana.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-katakana_full.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-katakana_full.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-katakana_half.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-katakana_half.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-dictionary.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-dictionary.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-properties.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-properties.png"
install -m 644 "$BLDBASEDIR/fcitx-mozc-icons/mozc-tool.png" "${PKG}/usr/share/fcitx/mozc/icon/mozc-tool.png"
# emacs helper
install -D -m 755 out_linux/Release/mozc_emacs_helper "${PKG}/usr/bin/mozc_emacs_helper"
install -D -m 644 unix/emacs/mozc.el "${PKG}/usr/share/emacs/site-lisp/emacs-mozc/mozc.el"
install -D -m 644 "${CWD}/mozc-isearch.el" "${PKG}/usr/share/emacs/site-lisp/emacs-mozc/mozc-isearch.el"


mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
# copy patches just in case
cp $CWD/patches/* $PKG/usr/doc/$PRGNAM-$VERSION/
cp $CWD/sources.url $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

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}

3. 0001-fix-install_fcitx-translation-files.patch
From daed110fb6f5d4309aaac4982f8e8712b809f81f Mon Sep 17 00:00:00 2001
From: Jiachen YANG <farseerfc@gmail.com>
Date: Tue, 15 Dec 2020 11:42:26 +0900
Subject: [PATCH] fix install_fcitx translation files

---
scripts/install_fcitx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/install_fcitx b/scripts/install_fcitx
index d4aa204e..493f1e1c 100755
--- a/scripts/install_fcitx
+++ b/scripts/install_fcitx
@@ -3,7 +3,7 @@
_bldtype="${_bldtype:-Debug}"
PREFIX="${PREFIX:-/usr}"

-for mofile in "out_linux/${_bldtype}/gen/unix/fcitx/po/*.mo"
+for mofile in out_linux/${_bldtype}/gen/unix/fcitx/po/*.mo
do
     filename=`basename $mofile`
     lang=${filename/.mo/}
--
2.29.2

4. emacs で fcitx-mozc  を使う
[HOME]/.emacs.d/init.el
(require 'mozc)  ; or (load-file "/path/to/mozc.el")
(setq default-input-method "japanese-mozc")
(setq mozc-candidate-style 'overlay)