X

News, tips, partners, and perspectives for the Oracle Solaris operating system

How To build an Input Method Engine for Oracle Solaris 11.4

Contributed by: Pavel Heimlich and Ales Cernosek

Oracle Solaris 11.4 delivers a modern and extensible enterprise desktop environment. The desktop environment supports and delivers an IBus (Intelligent Input Bus) runtime environment and libraries that enable customers to easily customize and build Open Source IBus Input Method Engines to suit their preference.

This article explores the step-by-step process of building one of the available IBus input methods - KKC, a Japanese input method engine. We'll start with the Oracle Solaris Userland build infrastructure and use it to build the KKC dependencies and KKC itself, and publish the Input Method IPS packages to a local publisher.

A similar approach can be used for building and delivering other input method engines for other languages. Please note the components built may no longer be current; newer versions may have been released since these steps were made available. You should check for and use the latest version available.

We'll start with installing all the build system dependencies :

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

To make this task as easy as possible, we'll reuse the Userland build infrastructure. This also has the advantage of using the same compiler, build flags and other defaults as the rest of the GNOME desktop. First clone the Userland workspace:

# git clone https://github.com/oracle/solaris-userland gate

Use your Oracle Solaris 11.4 IPS publisher; set this variable to empty:

# export CANONICAL_REPO=http://pkg.oracle.com/...

Do not use the internal Userland archive mirror:

# export INTERNAL_ARCHIVE_MIRROR=''

Set a few other variables and prepare the build environment:

# export COMPILER=gcc
# export PUBLISHER=example
# export OS_VERSION=11.4
# cd gate
# git checkout 8b36ec131eb42a65b0f42fc0d0d71b49cfb3adf3
# gmake setup

We are going to need the intermediary packages installed on the build system, so let's add the build publisher:

# pkg set-publisher -g `uname -p`/repo example

KKC has a couple of dependencies. The first of them is marisa-trie. Create a folder for it :

# mkdir components/marisa
# cd components/marisa

And create a Makefile as follows:

#
# 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

Most of the build process is defined in shared macros from the Userland workspace, so building marisa is now as easy as running the following command :

# gmake install

Copy the marisa copyright file so that the package follows Oracle standards:

# cat marisa-0.2.4/COPYING > marisa.copyright

Create the marisa.p5m package manifest as follows:

#
# 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"

Generate the IPS package:

# gmake publish

It's necessary to install the package as it's a prerequisite to build other packages :

# sudo pkg install marisa
# cd ..

The next step is to build the KKC library:

# mkdir libkkc
# cd libkkc

Create the Makefile as follows:

#
# 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)

And build the component:

# gmake install

Prepare the copyright file :

# cat libkkc-0.3.5/COPYING > libkkc.copyright

Create the libkkc.p5m package manifest as follows:

#
# 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

Use the following command to create the IPS package:

# gmake publish
# cd ..

Then install the package so that it's available for dependency resolution:

# sudo pkg install libkkc

Next build libkkc-data:

# mkdir libkkc-data
# cd libkkc-data

Create the Makefile as follows:

#
# 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"

Build libkkc-data :

# gmake install

Prepare the copyright file :

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

Create the libkkc-data.p5m package manifest as follows:

#
# 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

Use the following command to create the IPS package:

# gmake publish
# cd ..

Then install the package so that it's available for dependency resolution:

# sudo pkg install libkkc-data

Finally, create the KKC package:

# mkdir ibus-kkc
# cd ibus-kkc

Create the Makefile as follows:

#
# 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)

And build the component:

# gmake install

Prepare the copyright file :

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

Create the ibus-kkc.p5m package manifest as follows:

#
# 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

Perform the final build:

# gmake publish 

Use the following command to install the package from the build's IPS repository:

# sudo pkg install ibus/kkc

Other input method engines can be built in a similar way: for example, ibus-hangul for Korean, ibus-chewing or ibus-table for Chinese, and others.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services