Solaris114

Solarisのページに戻る

目次

Table of Contents

Solaris 11.4 上で、KKC 日本語入力エンジンを build する方法 :

参考記事 How To build an Input Method Engine for Oracle Solaris 11.4

準備

build 中はインターネットへの接続が必要になります。 まず、build に必要なパッケージを追加でインストールします :

 $ sudo pkg exact-install developer/opensolaris/userland system/input-method/ibus group/system/solaris-desktop

追加パッケージのインストールには、けっこう時間がかかります。

 $ sudo reboot

リブート後は開発環境の BEで起動されています。 Build 用に gate というディレクトリー名の workspaceのクローンを作成します :

 $ git clone https://github.com/oracle/solaris-userland gate
 Cloning into 'gate'...
 remote: Enumerating objects: 533, done.
 remote: Counting objects: 100% (533/533), done.
 remote: Compressing objects: 100% (313/313), done.
 remote: Total 88110 (delta 267), reused 367 (delta 203), pack-reused 87577
 Receiving objects: 100% (88110/88110), 131.52 MiB | 8.69 MiB/s, done.
 Resolving deltas: 100% (32628/32628), done.

現在の IPS publisher の設定を CANONICAL_REPO 環境変数として設定しておきます :

 # pkg publisher
 PUBLISHER                   TYPE     STATUS P LOCATION
 solaris                     origin   online F http://pkg.oracle.com/solaris/release/
 $ export CANONICAL_REPO=http://pkg.oracle.com/solaris/release/

internal Userland archive mirror は使用しない設定にします :

 $ export INTERNAL_ARCHIVE_MIRROR=''

Build の準備のために他のいくつかの環境変数も以下のとおり設定します :

 $ export COMPILER=gcc
 $ export PUBLISHER=example
 $ export OS_VERSION=11

build するコードをcheckout します :

 $ cd gate
 $ git checkout 8b36ec131eb42a65b0f42fc0d0d71b49cfb3adf3
 Note: checking out '8b36ec131eb42a65b0f42fc0d0d71b49cfb3adf3'.
 
 You are in 'detached HEAD' state. You can look around, make experimental
 changes and commit them, and you can discard any commits you make in this
 state without impacting any branches by performing another checkout.
 
 If you want to create a new branch to retain commits you create, you may
 do so (now or later) by using -b with the checkout command again. Example:
 
   git checkout -b <new-branch-name>
 
 HEAD is now at 8b36ec131... 28068078 Userland repo doesn't work well outside Oracle

※ git checkout で上記のワーニングが出力されますが、これは無視してかまいません

セットアップを実行します : この作業 30分〜45分ほどかかります。

 $ gmake setup
 setup components
 gmake[1]: Entering directory '/export/home/admin/gate/components'
 /bin/mkdir -p /export/home/admin/gate/i386
 Generating component list...
 Generating component dependencies...
 Generating component list...
 Generating component dependencies...
 /bin/mkdir -p /export/home/admin/gate/i386/logs
 /bin/mkdir -p /export/home/admin/gate/i386/home
 /usr/bin/pkgrepo create file:/export/home/admin/gate/i386/repo
 /usr/bin/pkgrepo add-publisher -s file:/export/home/admin/gate/i386/repo example
 /usr/bin/pkgrepo add-publisher -s file:/export/home/admin/gate/i386/repo userland-localizable
 /usr/bin/pkgrepo create file:/export/home/admin/gate/i386/repo.experimental
 /usr/bin/pkgrepo add-publisher -s file:/export/home/admin/gate/i386/repo.experimental example
 /usr/bin/pkgrepo add-publisher -s file:/export/home/admin/gate/i386/repo.experimental userland-localizable
 building tools...
 /usr/gnu/bin/make -C ../tools clean
 make[2]: Entering directory '/export/home/admin/gate/tools'
 make[2]: Leaving directory '/export/home/admin/gate/tools'
 /usr/gnu/bin/make -C ../tools setup
 make[2]: Entering directory '/export/home/admin/gate/tools'
 make[2]: Leaving directory '/export/home/admin/gate/tools'
 Generating pkglint(1) cache from CANONICAL_REPO http://pkg.oracle.com/solaris/release/...
 gmake[1]: Leaving directory '/export/home/admin/gate/components'

Build の途中で、build した package を build システムにインストールする必要があります : build package 用の example という名前の publisher を追加しておきます :

 $ sudo pkg set-publisher -g `uname -p`/repo example
 $ pkg publisher
 PUBLISHER                   TYPE     STATUS P LOCATION
 solaris                     origin   online F http://pkg.oracle.com/solaris/release/
 example                     origin   online F file:///export/home/admin/gate/i386/repo/

marisa コンポーネントの build

KKC には依存するいくつかのコンポーネントがあります まず最初が "marisa" で、これ用の folder を作成します :

 $ mkdir components/marisa
 $ cd components/marisa

Makefile.marisa を以下の内容で作成します :

 $ vi Makefile.marisa
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#
BUILD_BITS= 64_and_32
COMPILER= gcc
include ../../make-rules/shared-macros.mk

COMPONENT_NAME=         marisa
COMPONENT_VERSION=      0.2.4
COMPONENT_PROJECT_URL=  https://github.com/s-yata/marisa-trie
COMPONENT_ARCHIVE_HASH= \
    sha256:67a7a4f70d3cc7b0a85eb08f10bc3eaf6763419f0c031f278c1f919121729fb3
COMPONENT_ARCHIVE_URL=  https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/marisa-trie/marisa-0.2.4.tar.gz

TPNO=                   26209

REQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime
REQUIRED_PACKAGES += system/library/gcc/gcc-c++-runtime
REQUIRED_PACKAGES += system/library/math

TEST_TARGET= $(NO_TESTS)

COMPONENT_POST_INSTALL_ACTION += \
        cd $(SOURCE_DIR)/bindings/python; \
 
      CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS) -I$(SOURCE_DIR)/lib" LDFLAGS=-L$(PROTO_DIR)$(USRLIB) $(PYTHON) setup.py install --install-lib $(PROTO_DIR)/$(PYTHON_LIB);
# to avoid libtool breaking build of libkkc
COMPONENT_POST_INSTALL_ACTION += rm -f $(PROTO_DIR)$(USRLIB)/libmarisa.la;

include $(WS_MAKE_RULES)/common.mk

作成もしくはダウンロードした Makefile.marisa を Makefile に copy します :

 $ cp Makefile.marisa Makefile

ほとんどの build プロセスは、Userland workspace で共有されているマクロで定義されています、 marisa の build もこの一環で、gmake install で build できます :

 $ gmake install

marisa の copyright ファイルを Oracle package 様式のファイル名でコピーします :

 $ cat marisa-0.2.4/COPYING > marisa.copyright

marisa.p5m というファイル名で、以下の内容の package マニフェストを作成します :

 $ vi marisa.p5m
#
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
#

<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
set name=pkg.fmri \
    value=pkg:/example/system/input-method/library/marisa@$(BUILD_VERSION)
set name=pkg.summary value="Marisa library"
set name=pkg.description \
    value="Marisa - Matching Algorithm with Recursively Implemented StorAge library"
set name=com.oracle.info.description \
    value="Marisa - Matching Algorithm with Recursively Implemented StorAge library"
set name=info.classification \
    value=org.opensolaris.category.2008:System/Internationalization
set name=info.source-url \
    value=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/marisa-trie/marisa-0.2.4.tar.gz
set name=info.upstream-url value=https://github.com/s-yata/marisa-trie
set name=org.opensolaris.arc-caseid value=PSARC/2009/499
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
file path=usr/bin/marisa-benchmark
file path=usr/bin/marisa-build
file path=usr/bin/marisa-common-prefix-search
file path=usr/bin/marisa-dump
file path=usr/bin/marisa-lookup
file path=usr/bin/marisa-predictive-search
file path=usr/bin/marisa-reverse-lookup
file path=usr/include/marisa.h
file path=usr/include/marisa/agent.h
file path=usr/include/marisa/base.h
file path=usr/include/marisa/exception.h
file path=usr/include/marisa/iostream.h
file path=usr/include/marisa/key.h
file path=usr/include/marisa/keyset.h
file path=usr/include/marisa/query.h
file path=usr/include/marisa/scoped-array.h
file path=usr/include/marisa/scoped-ptr.h
file path=usr/include/marisa/stdio.h
file path=usr/include/marisa/trie.h
link path=usr/lib/$(MACH64)/libmarisa.so target=libmarisa.so.0.0.0
link path=usr/lib/$(MACH64)/libmarisa.so.0 target=libmarisa.so.0.0.0
file path=usr/lib/$(MACH64)/libmarisa.so.0.0.0
file path=usr/lib/$(MACH64)/pkgconfig/marisa.pc
link path=usr/lib/libmarisa.so target=libmarisa.so.0.0.0
link path=usr/lib/libmarisa.so.0 target=libmarisa.so.0.0.0
file path=usr/lib/libmarisa.so.0.0.0
file path=usr/lib/pkgconfig/marisa.pc
file path=usr/lib/python2.7/vendor-packages/64/_marisa.so
file path=usr/lib/python2.7/vendor-packages/_marisa.so
file path=usr/lib/python2.7/vendor-packages/marisa-0.0.0-py2.7.egg-info
file path=usr/lib/python2.7/vendor-packages/marisa.py
license marisa.copyright license="marisa, LGPLv2.1"

marisa IPS package を build します :

 $ gmake publish

作成された marisa パッケージは、他のパッケージを build するために build システムに install する 必要があります :

 $ sudo pkg install marisa
 Password: 
            Packages to install:  1
        Create boot environment: No
 Create backup boot environment: No
 
 DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
 Completed                                1/1         29/29      0.3/0.3      --
 
 PHASE                                          ITEMS
 Installing new actions                         51/51
 Updating package state database                 Done 
 Updating package cache                           0/0 
 Updating image state                            Done 
 Creating fast lookup database                   Done 
 Updating package cache                           2/2 
 $ pkg list -af marisa
 NAME (PUBLISHER)                                  VERSION                    IFO
 example/system/input-method/library/marisa (example) 5.11-11.5.0.0.0.22.0       i--
 system/input-method/library/marisa                11.4-11.4.0.0.0.12.6       --o

component ディレクトリーに戻ります :

 $ cd ..

libkkc の build

次のステップは KKC ライブラリ(libkkc)を build します :

 $ mkdir libkkc
 $ cd libkkc  

Makefile.libkkc を以下の内容で作成します :

 $ vi Makefile.libkkc
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#
BUILD_BITS= 64_and_32
COMPILER= gcc
include ../../make-rules/shared-macros.mk

COMPONENT_NAME= libkkc
COMPONENT_VERSION= 0.3.5
COMPONENT_PROJECT_URL= https://github.com/ueno/libkkc
COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH= \
    sha256:89b07b042dae5726d306aaa1296d1695cb75c4516f4b4879bc3781fe52f62aef
COMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)/releases/download/v$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
TPNO=                   26171

TEST_TARGET= $(NO_TESTS)

REQUIRED_PACKAGES += example/system/input-method/library/marisa
REQUIRED_PACKAGES += library/glib2
REQUIRED_PACKAGES += library/json-glib
REQUIRED_PACKAGES += library/desktop/libgee
REQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime

export LD_LIBRARY_PATH=$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)$(USRLIB)
export PYTHONPATH=$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)$(PYTHON_LIB)
CPPFLAGS += -I$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)/usr/include
LDFLAGS += -L$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)$(USRLIB)

# for gsed - metadata
PATH=$(GNUBIN):$(USRBINDIR)

include $(WS_MAKE_RULES)/common.mk

# some of this is likely unnecessary
CONFIGURE_OPTIONS += --enable-introspection=no
PKG_CONFIG_PATHS += $(COMPONENT_DIR)/../marisa/build/$(MACH$(BITS))
# to avoid libtool breaking build of ibus-kkc
COMPONENT_POST_INSTALL_ACTION = rm -f $(PROTO_DIR)$(USRLIB)/libkkc.la

# to rebuild configure for libtool fix and fix building json files
COMPONENT_PREP_ACTION = \
        (cd $(@D) ; $(AUTORECONF) -m --force -v; gsed -i 's@test -f ./$$<@test -f $$<@' data/rules/rule.mk)

Makefile にコピーします。

 $ cp Makefile.libkkc Makefile

KKC ライブラリー(libkkc)を build します :

 $ gmake install

copyright ファイルを用意します :

 $ cat libkkc-0.3.5/COPYING > libkkc.copyright

libkkc.p5m というファイル名で、以下の内容の package マニフェストを作成します :

 $vi libkkc.p5m
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#

<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
set name=pkg.fmri \
    value=pkg:/example/system/input-method/library/libkkc@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.summary value="libkkc - Kana Kanji input library"
set name=pkg.description \
    value="libkkc - Japanese Kana Kanji conversion input method library"
set name=com.oracle.info.description value="libkkc - Kana Kanji input library"
set name=info.classification \
    value=org.opensolaris.category.2008:System/Internationalization
set name=info.source-url \
    value=https://github.com/ueno/libkkc/releases/download/v0.3.5/libkkc-0.3.5.tar.gz
set name=info.upstream-url value=https://github.com/ueno/libkkc
set name=org.opensolaris.arc-caseid value=PSARC/2009/499
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
file path=usr/bin/kkc
file path=usr/bin/kkc-package-data
dir  path=usr/include/libkkc
file path=usr/include/libkkc/libkkc.h
dir  path=usr/lib/$(MACH64)/libkkc
link path=usr/lib/$(MACH64)/libkkc.so target=libkkc.so.2.0.0
link path=usr/lib/$(MACH64)/libkkc.so.2 target=libkkc.so.2.0.0
file path=usr/lib/$(MACH64)/libkkc.so.2.0.0
file path=usr/lib/$(MACH64)/pkgconfig/kkc-1.0.pc
dir  path=usr/lib/libkkc
link path=usr/lib/libkkc.so target=libkkc.so.2.0.0
link path=usr/lib/libkkc.so.2 target=libkkc.so.2.0.0
file path=usr/lib/libkkc.so.2.0.0
file path=usr/lib/pkgconfig/kkc-1.0.pc
dir  path=usr/share/libkkc
dir  path=usr/share/libkkc/rules
dir  path=usr/share/libkkc/rules/act
dir  path=usr/share/libkkc/rules/act/keymap
file path=usr/share/libkkc/rules/act/keymap/default.json
file path=usr/share/libkkc/rules/act/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/act/keymap/hiragana.json
file path=usr/share/libkkc/rules/act/keymap/katakana.json
file path=usr/share/libkkc/rules/act/keymap/latin.json
file path=usr/share/libkkc/rules/act/keymap/wide-latin.json
file path=usr/share/libkkc/rules/act/metadata.json
dir  path=usr/share/libkkc/rules/act/rom-kana
file path=usr/share/libkkc/rules/act/rom-kana/default.json
dir  path=usr/share/libkkc/rules/azik
dir  path=usr/share/libkkc/rules/azik-jp106
dir  path=usr/share/libkkc/rules/azik-jp106/keymap
file path=usr/share/libkkc/rules/azik-jp106/keymap/default.json
file path=usr/share/libkkc/rules/azik-jp106/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/azik-jp106/keymap/hiragana.json
file path=usr/share/libkkc/rules/azik-jp106/keymap/katakana.json
file path=usr/share/libkkc/rules/azik-jp106/keymap/latin.json
file path=usr/share/libkkc/rules/azik-jp106/keymap/wide-latin.json
file path=usr/share/libkkc/rules/azik-jp106/metadata.json
dir  path=usr/share/libkkc/rules/azik-jp106/rom-kana
file path=usr/share/libkkc/rules/azik-jp106/rom-kana/default.json
dir  path=usr/share/libkkc/rules/azik/keymap
file path=usr/share/libkkc/rules/azik/keymap/default.json
file path=usr/share/libkkc/rules/azik/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/azik/keymap/hiragana.json
file path=usr/share/libkkc/rules/azik/keymap/katakana.json
file path=usr/share/libkkc/rules/azik/keymap/latin.json
file path=usr/share/libkkc/rules/azik/keymap/wide-latin.json
file path=usr/share/libkkc/rules/azik/metadata.json
dir  path=usr/share/libkkc/rules/azik/rom-kana
file path=usr/share/libkkc/rules/azik/rom-kana/default.json
dir  path=usr/share/libkkc/rules/default
dir  path=usr/share/libkkc/rules/default/keymap
file path=usr/share/libkkc/rules/default/keymap/default.json
file path=usr/share/libkkc/rules/default/keymap/direct.json
file path=usr/share/libkkc/rules/default/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/default/keymap/hiragana.json
file path=usr/share/libkkc/rules/default/keymap/katakana.json
file path=usr/share/libkkc/rules/default/keymap/latin.json
file path=usr/share/libkkc/rules/default/keymap/wide-latin.json
file path=usr/share/libkkc/rules/default/metadata.json
dir  path=usr/share/libkkc/rules/default/rom-kana
file path=usr/share/libkkc/rules/default/rom-kana/default.json
dir  path=usr/share/libkkc/rules/kana
dir  path=usr/share/libkkc/rules/kana/keymap
file path=usr/share/libkkc/rules/kana/keymap/default.json
file path=usr/share/libkkc/rules/kana/keymap/direct.json
file path=usr/share/libkkc/rules/kana/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/kana/keymap/hiragana.json
file path=usr/share/libkkc/rules/kana/keymap/katakana.json
file path=usr/share/libkkc/rules/kana/keymap/latin.json
file path=usr/share/libkkc/rules/kana/keymap/wide-latin.json
file path=usr/share/libkkc/rules/kana/metadata.json
dir  path=usr/share/libkkc/rules/kana/rom-kana
file path=usr/share/libkkc/rules/kana/rom-kana/default.json
dir  path=usr/share/libkkc/rules/kzik
dir  path=usr/share/libkkc/rules/kzik/keymap
file path=usr/share/libkkc/rules/kzik/keymap/default.json
file path=usr/share/libkkc/rules/kzik/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/kzik/keymap/hiragana.json
file path=usr/share/libkkc/rules/kzik/keymap/katakana.json
file path=usr/share/libkkc/rules/kzik/keymap/latin.json
file path=usr/share/libkkc/rules/kzik/keymap/wide-latin.json
file path=usr/share/libkkc/rules/kzik/metadata.json
dir  path=usr/share/libkkc/rules/kzik/rom-kana
file path=usr/share/libkkc/rules/kzik/rom-kana/default.json
dir  path=usr/share/libkkc/rules/nicola
dir  path=usr/share/libkkc/rules/nicola/keymap
file path=usr/share/libkkc/rules/nicola/keymap/default.json
file path=usr/share/libkkc/rules/nicola/keymap/direct.json
file path=usr/share/libkkc/rules/nicola/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/nicola/keymap/hiragana.json
file path=usr/share/libkkc/rules/nicola/keymap/katakana.json
file path=usr/share/libkkc/rules/nicola/keymap/latin.json
file path=usr/share/libkkc/rules/nicola/keymap/wide-latin.json
file path=usr/share/libkkc/rules/nicola/metadata.json
dir  path=usr/share/libkkc/rules/nicola/rom-kana
file path=usr/share/libkkc/rules/nicola/rom-kana/default.json
dir  path=usr/share/libkkc/rules/tcode
dir  path=usr/share/libkkc/rules/tcode/keymap
file path=usr/share/libkkc/rules/tcode/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/tcode/keymap/hiragana.json
file path=usr/share/libkkc/rules/tcode/keymap/katakana.json
file path=usr/share/libkkc/rules/tcode/keymap/latin.json
file path=usr/share/libkkc/rules/tcode/keymap/wide-latin.json
file path=usr/share/libkkc/rules/tcode/metadata.json
dir  path=usr/share/libkkc/rules/tcode/rom-kana
file path=usr/share/libkkc/rules/tcode/rom-kana/default.json
dir  path=usr/share/libkkc/rules/trycode
dir  path=usr/share/libkkc/rules/trycode/keymap
file path=usr/share/libkkc/rules/trycode/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/trycode/keymap/hiragana.json
file path=usr/share/libkkc/rules/trycode/keymap/katakana.json
file path=usr/share/libkkc/rules/trycode/keymap/latin.json
file path=usr/share/libkkc/rules/trycode/keymap/wide-latin.json
file path=usr/share/libkkc/rules/trycode/metadata.json
dir  path=usr/share/libkkc/rules/trycode/rom-kana
file path=usr/share/libkkc/rules/trycode/rom-kana/default.json
dir  path=usr/share/libkkc/rules/tutcode
dir  path=usr/share/libkkc/rules/tutcode-touch16x
dir  path=usr/share/libkkc/rules/tutcode-touch16x/keymap
file path=usr/share/libkkc/rules/tutcode-touch16x/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/tutcode-touch16x/keymap/hiragana.json
file path=usr/share/libkkc/rules/tutcode-touch16x/keymap/katakana.json
file path=usr/share/libkkc/rules/tutcode-touch16x/keymap/latin.json
file path=usr/share/libkkc/rules/tutcode-touch16x/keymap/wide-latin.json
file path=usr/share/libkkc/rules/tutcode-touch16x/metadata.json
dir  path=usr/share/libkkc/rules/tutcode-touch16x/rom-kana
file path=usr/share/libkkc/rules/tutcode-touch16x/rom-kana/default.json
dir  path=usr/share/libkkc/rules/tutcode/keymap
file path=usr/share/libkkc/rules/tutcode/keymap/hankaku-katakana.json
file path=usr/share/libkkc/rules/tutcode/keymap/hiragana.json
file path=usr/share/libkkc/rules/tutcode/keymap/katakana.json
file path=usr/share/libkkc/rules/tutcode/keymap/latin.json
file path=usr/share/libkkc/rules/tutcode/keymap/wide-latin.json
file path=usr/share/libkkc/rules/tutcode/metadata.json
dir  path=usr/share/libkkc/rules/tutcode/rom-kana
file path=usr/share/libkkc/rules/tutcode/rom-kana/default.json
dir  path=usr/share/libkkc/templates
dir  path=usr/share/libkkc/templates/libkkc-data
file path=usr/share/libkkc/templates/libkkc-data/Makefile.am
file path=usr/share/libkkc/templates/libkkc-data/configure.ac.in
dir  path=usr/share/libkkc/templates/libkkc-data/data
file path=usr/share/libkkc/templates/libkkc-data/data/Makefile.am
dir  path=usr/share/libkkc/templates/libkkc-data/data/models
file path=usr/share/libkkc/templates/libkkc-data/data/models/Makefile.sorted2
file path=usr/share/libkkc/templates/libkkc-data/data/models/Makefile.sorted3
dir  path=usr/share/libkkc/templates/libkkc-data/data/models/sorted2
file path=usr/share/libkkc/templates/libkkc-data/data/models/sorted2/metadata.json
dir  path=usr/share/libkkc/templates/libkkc-data/data/models/sorted3
file path=usr/share/libkkc/templates/libkkc-data/data/models/sorted3/metadata.json
dir  path=usr/share/libkkc/templates/libkkc-data/data/models/text2
file path=usr/share/libkkc/templates/libkkc-data/data/models/text2/metadata.json
dir  path=usr/share/libkkc/templates/libkkc-data/data/models/text3
file path=usr/share/libkkc/templates/libkkc-data/data/models/text3/metadata.json
dir  path=usr/share/libkkc/templates/libkkc-data/tools
file path=usr/share/libkkc/templates/libkkc-data/tools/Makefile.am
file path=usr/share/libkkc/templates/libkkc-data/tools/genfilter.py
file path=usr/share/libkkc/templates/libkkc-data/tools/sortlm.py
file path=usr/share/locale/ja/LC_MESSAGES/libkkc.mo
file path=usr/share/vala/vapi/kkc-1.0.deps
file path=usr/share/vala/vapi/kkc-1.0.vapi
license libkkc.copyright license="libkkc, GPLmix" \
    com.oracle.info.description="libkkc - Kana Kanji input library" \
    com.oracle.info.name=pci.ids com.oracle.info.tpno=26171 \
    com.oracle.info.version=0.3.5

libkkc IPS パッケージを build します :

 $ gmake publish

依存性の解決のため libkkc パッケージも build システムにインストールします :

 $ sudo pkg install libkkc
 Password: 
            Packages to install:  1
        Create boot environment: No
 Create backup boot environment: No
 
 DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
 Completed                                1/1       110/110      0.5/0.5      --
 
 PHASE                                          ITEMS
 Installing new actions                       182/182
 Updating package state database                 Done 
 Updating package cache                           0/0 
 Updating image state                            Done 
 Creating fast lookup database                   Done 
 Updating package cache                           2/2 
 $ pkg list -af libkkc
 NAME (PUBLISHER)                                  VERSION                    IFO
 example/system/input-method/library/libkkc (example) 0.3.5-11.5.0.0.0.22.0      i--
 system/input-method/library/libkkc                11.4-11.4.0.0.0.12.6       --o

component ディレクトリーに戻ります :

 $ cd ..

libkkc-data の build

次は libkkc-data を build します :

 $ mkdir libkkc-data
 $ cd libkkc-data

Makefile.libkkc-data を以下の内容で作成します :

 $ vi Makefile.libkkc-data
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#
BUILD_BITS= 64_and_32
COMPILER= gcc
include ../../make-rules/shared-macros.mk

COMPONENT_NAME=         libkkc-data
COMPONENT_VERSION= 0.2.7
COMPONENT_PROJECT_URL= https://github.com/ueno/libkkc
COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz
COMPONENT_ARCHIVE_HASH= \
    sha256:9e678755a030043da68e37a4049aa296c296869ff1fb9e6c70026b2541595b99
COMPONENT_ARCHIVE_URL= https://github.com/ueno/libkkc/releases/download/v0.3.5/$(COMPONENT_ARCHIVE)
TPNO=           26171

TEST_TARGET= $(NO_TESTS)

export LD_LIBRARY_PATH=$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)/$(USRLIB)
export PYTHONPATH=$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)$(PYTHON_LIB)

include $(WS_MAKE_RULES)/common.mk


CONFIGURE_ENV += MARISA_CFLAGS="-I$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)/usr/include"
CONFIGURE_ENV += MARISA_LIBS="-L$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)$(USRLIB) -lmarisa"

Makefile にコピーします :

 $ cp Makefile.libkkc-data Makefile

libkkc-data の build (この build は少し時間がかかります) :

 $ gmake install

copyright ファイルを用意します :

 $ cat libkkc-data-0.2.7/COPYING > libkkc-data.copyright

libkkc-data.p5m というファイル名で、以下の内容の package マニフェストを作成します :

 $ vi libkkc-data.p5m
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#

<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
set name=pkg.fmri \
    value=pkg:/example/system/input-method/library/libkkc-data@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.summary value="libkkc-data - Kana Kanji input library data"
set name=pkg.description \
    value="libkkc-data - data for Japanese Kana Kanji conversion input method library"
set name=com.oracle.info.description \
    value="libkkc-data - Kana Kanji input library data"
set name=info.classification \
    value=org.opensolaris.category.2008:System/Internationalization
set name=info.source-url \
    value=https://bitbucket.org/libkkc/libkkc-data/downloads/libkkc-data-0.2.7.tar.xz
set name=info.upstream-url value=https://bitbucket.org/libkkc/libkkc-data
set name=org.opensolaris.arc-caseid value=PSARC/2009/499
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
dir  path=usr/lib/$(MACH64)/libkkc/models
dir  path=usr/lib/$(MACH64)/libkkc/models/sorted3
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.1gram
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.1gram.index
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.2gram
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.2gram.filter
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.3gram
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.3gram.filter
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/data.input
file path=usr/lib/$(MACH64)/libkkc/models/sorted3/metadata.json
dir  path=usr/lib/libkkc/models
dir  path=usr/lib/libkkc/models/sorted3
file path=usr/lib/libkkc/models/sorted3/data.1gram
file path=usr/lib/libkkc/models/sorted3/data.1gram.index
file path=usr/lib/libkkc/models/sorted3/data.2gram
file path=usr/lib/libkkc/models/sorted3/data.2gram.filter
file path=usr/lib/libkkc/models/sorted3/data.3gram
file path=usr/lib/libkkc/models/sorted3/data.3gram.filter
file path=usr/lib/libkkc/models/sorted3/data.input
file path=usr/lib/libkkc/models/sorted3/metadata.json
license libkkc-data.copyright license="libkkc-data, GPLv3" \
    com.oracle.info.description="libkkc - Kana Kanji input library language data" \
    com.oracle.info.name=usb.ids com.oracle.info.tpno=26171 \
    com.oracle.info.version=0.2.7

libkkc-data IPS パッケージの build :

 $ gmake publish

依存性の解決のため libkkc-data パッケージも build システムにインストールします :

 $ sudo pkg install libkkc-data
 Password: 
            Packages to install:  1
        Create boot environment: No
 Create backup boot environment: No
 
 DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
 Completed                                1/1         17/17    33.2/33.2      --
 
 PHASE                                          ITEMS
 Installing new actions                         35/35
 Updating package state database                 Done 
 Updating package cache                           0/0 
 Updating image state                            Done 
 Creating fast lookup database                   Done 
 Updating package cache                           2/2 
 $ pkg list -af libkkc-data
 NAME (PUBLISHER)                                  VERSION                    IFO
 example/system/input-method/library/libkkc-data (example) 0.2.7-11.5.0.0.0.22.0      i--

comonent ディレクトリーに戻ります:

 $ cd ..

ibus/kkc の build

最後に KKC パッケージ(ibus-kkc)を build します :

 $ mkdir ibus-kkc
 $ cd ibus-kkc

Makefile.ibus-kkc を下記の内容で作成します :

 $ vi Makefile.ibus-kkc
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#
BUILD_BITS= 64_and_32
COMPILER= gcc
include ../../make-rules/shared-macros.mk

COMPONENT_NAME= ibus-kkc
COMPONENT_VERSION= 1.5.22
COMPONENT_PROJECT_URL= https://github.com/ueno/ibus-kkc
IBUS-KKC_PROJECT_URL= https://github.com/ueno/ibus-kkc
COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH= \
    sha256:22fe2552f08a34a751cef7d1ea3c088e8dc0f0af26fd7bba9cdd27ff132347ce
COMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)/releases/download/v$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
TPNO=                   31503

TEST_TARGET= $(NO_TESTS)

REQUIRED_PACKAGES += system/input-method/ibus
REQUIRED_PACKAGES += example/system/input-method/library/libkkc
REQUIRED_PACKAGES += example/system/input-method/library/libkkc-data
REQUIRED_PACKAGES += library/desktop/gtk3
REQUIRED_PACKAGES += library/desktop/libgee
REQUIRED_PACKAGES += library/json-glib
REQUIRED_PACKAGES += library/glib2

# for marisa
REQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime
REQUIRED_PACKAGES += system/library/gcc/gcc-c++-runtime
REQUIRED_PACKAGES += system/library/math

CPPFLAGS += -I$(COMPONENT_DIR)/../libkkc/build/prototype/$(MACH)/usr/include
LDFLAGS += "-L$(COMPONENT_DIR)/../libkkc/build/prototype/$(MACH)$(USRLIB)"
LDFLAGS += "-L$(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)$(USRLIB)"

include $(WS_MAKE_RULES)/common.mk

CONFIGURE_ENV += PATH=$(GNUBIN):$(USRBINDIR)
CONFIGURE_OPTIONS +=    --libexecdir=$(USRLIBDIR)/ibus
#CONFIGURE_OPTIONS +=    --enable-static=no
PKG_CONFIG_PATHS += $(COMPONENT_DIR)/../libkkc/build/$(MACH$(BITS))/libkkc
PKG_CONFIG_PATHS += $(COMPONENT_DIR)/../marisa/build/$(MACH$(BITS))

# to rebuild configure for libtool fix
COMPONENT_PREP_ACTION = \
        (cd $(@D) ; $(AUTORECONF) -m --force -v)

PKG_PROTO_DIRS += $(COMPONENT_DIR)/../marisa/build/prototype/$(MACH)
PKG_PROTO_DIRS += $(COMPONENT_DIR)/../libkkc/build/prototype/$(MACH)
PKG_PROTO_DIRS += $(COMPONENT_DIR)/../libkkc-data/build/prototype/$(MACH)

Makefile に copy します :

 $ cp Makefile.ibus-kkc Makefile

ibus/kkc を build します :

 $ gmake install

copyright file を用意します :

 $ cat ibus-kkc-1.5.22/COPYING > ibus-kkc.copyright

ibus-kkc.p5m というファイル名で、以下の内容の package マニフェストを作成します :

 $vi ibus-kkc.p5m
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#

<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
set name=pkg.fmri \
    value=pkg:/example/system/input-method/ibus/kkc@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.summary value="IBus Japanese IME - kkc"
set name=pkg.description value="Japanese Kana Kanji input engine for IBus"
set name=com.oracle.info.description value="ibus kkc - Kana kanji input engine"
set name=info.classification \
    value=org.opensolaris.category.2008:System/Internationalization
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=org.opensolaris.arc-caseid value=PSARC/2009/499
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
file path=usr/lib/ibus/ibus-engine-kkc mode=0555
file path=usr/lib/ibus/ibus-setup-kkc mode=0555
file path=usr/share/applications/ibus-setup-kkc.desktop
dir  path=usr/share/ibus-kkc
dir  path=usr/share/ibus-kkc/icons
file path=usr/share/ibus-kkc/icons/ibus-kkc.svg
file path=usr/share/ibus/component/kkc.xml
file path=usr/share/locale/ja/LC_MESSAGES/ibus-kkc.mo
license ibus-kkc.copyright license="ibus-kkc, GPLmix"
depend type=require fmri=example/system/input-method/library/libkkc-data

ibus-kkc IPS パッケージを build します。

 $ gmake publish

ibus/kkc パッケージもインストールして全ての build は終了です :

 $ sudo pkg install ibus/kkc
 Password: 
            Packages to install:  
             Services to change:  1
        Create boot environment: No
 Create backup boot environment: No
 
 DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
 Completed                                1/1           7/7      0.1/0.1      --
 
 PHASE                                          ITEMS
 Installing new actions                         31/31
 Updating package state database                 Done 
 Updating package cache                           0/0 
 Updating image state                            Done 
 Creating fast lookup database                   Done 
 Updating package cache                           2/2 
 $ pkg list -af ibus/kkc
 NAME (PUBLISHER)                                  VERSION                    IFO
 example/system/input-method/ibus/kkc (example)    1.5.22-11.5.0.0.0.22.0     i--
 system/input-method/ibus/kkc                      1.5.13-11.4.0.0.0.12.6     --o

KKC 日本語入力エンジンの使用方法 :

Solaris 11.4 では ibus/kkc はSolaris のレポジトリには存在しないので、今回 build した ibus/kkc パッケージを利用します :

 $ sudo pkg install ibus/kkc

で、KKC が使用可能になります。

KKC が使えるようになるまでの設定は以下の通りです

  1. 日本語言語環境のインストールと ja_JP.UTF-8 ロケールで gnome を起動
  2. 設定=> 地域と言語 => 入力ソースで "日本語(Kana Kanji)" を追加する
    1. ※KKC をインストール後、再起動後ログアウト・ログイン後に "日本語(Kana Kanji)" が追加できるようになります
  3. KKC の Preference で各種設定(もし英語キーボードや Mac 日本語キーボードを使っている場合)
    1. シュートカットキーの設定で "Zenkaku Hankaku" を "Ctrl-Space" とかに変更する。"ひらがな入力"と"直接入力"の両方の設定を変えないとトグル操作での切り替えはできないので注意が必要です。
    2. 辞書に単語登録するには、例えば "章司" という漢字を表示させて選択し、Alt+R を押して、そのあと "しょうじ" と入力してリターンを押すと登録されます。