Skip to content

Instantly share code, notes, and snippets.

@hanya
Last active August 4, 2021 00:01
Show Gist options
  • Save hanya/75741ff70c1590800ddec3a61dcfae36 to your computer and use it in GitHub Desktop.
Save hanya/75741ff70c1590800ddec3a61dcfae36 to your computer and use it in GitHub Desktop.
Mozc with UT dictionary for Haiku
SUMMARY="Japanese input method editor"
DESCRIPTION="A Japanese Input Method Editor (IME) designed for multi-platform. \
This is open source version.
With Mozc UT dictionary which adds over 1,000,000 entries to original dictionary."
HOMEPAGE="https://github.com/google/mozc"
COPYRIGHT="2010-2018 Google Inc.
2017-2019 Hirosi Utumi
2019 Japan post
2009-2011 NICT
2021 Wikipedia"
LICENSE="BSD (3-clause)
Apache v2"
REVISION="1"
SOURCE_URI="https://github.com/hanya/mozc/releases/download/v$portVersion/mozc-v$portVersion.tar.bz2"
CHECKSUM_SHA256="15785beb91e8ab78728bc85c1e5d8a8a6e17aa64a3c5399339d200679bbcad6a"
SOURCE_DIR="mozc"
PATCHES="mozc_ut-$portVersion.patchset"
if [ "$effectiveTargetArchitecture" = x86 ]; then
PATCHES+="
mozc_ut-$portVersion-x86.patch"
fi
zinniaTomoeVersion="0.6.0-20080911"
SOURCE_URI_2="https://downloads.sourceforge.net/zinnia/zinnia-tomoe-$zinniaTomoeVersion.tar.bz2"
CHECKSUM_SHA256_2="fd1a264b8aeea0ebec59e8c8765864a9543a75fb2dba349745bb3a3587790927"
SOURCE_URI_3="http://iij.dl.osdn.jp/users/32/32748/mozcdic-ut-20210725.tar.bz2"
CHECKSUM_SHA256_3="ff431c6da2344d400f3e1eb875cf5f870429f8febb24db63814a4a92dcc618c6"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
mozc_ut$secondaryArchSuffix
addon:mozc
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libprotobuf$secondaryArchSuffix
"
CONFLICTS="
mozc$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libprotobuf$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:g++$secondaryArchSuffix
cmd:gcc$secondaryArchSuffix
cmd:ninja
cmd:pkg_config$secondaryArchSuffix
cmd:protoc$secondaryArchSuffix
cmd:python2
cmd:which
cmd:xres
cmd:xz
"
if [ "$targetArchitecture" = x86_gcc2 ]; then
BUILD_PREREQUIRES+="
cmd:g++
"
fi
BUILD()
{
cd ../../sources-3/mozcdic-ut-20210725
cat mozcdic-ut-20210725.txt >> $sourceDir/src/data/dictionary_oss/dictionary00.txt
cd $sourceDir/src
GYP_DEFINES="document_dir=$dataDir/mozc \
zinnia_model_file=$dataDir/mozc/zinnia/handwriting-ja.model \
zinnia_tomoe_dir=$sourceDir2/zinnia-tomoe-$zinniaTomoeVersion \
enable_gtk_renderer=0 \
target_x86_gcc2=$targetArchitecture" \
$portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py gyp \
--target_platform=Linux --variant=Haiku --noqt \
--server_dir=$dataDir/mozc
$portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py build \
-c Release \
server/server.gyp:mozc_server \
emacs/emacs.gyp:mozc_emacs_helper \
input_method/input_method.gyp:mozc \
haiku_gui/haiku_gui.gyp:mozc_tool_haiku \
zinnia_model/zinnia_model.gyp:zinnia_model
}
INSTALL()
{
MozcOutDir=src/out_linux/Release
MozcDataDir=$dataDir/mozc
if [ "$targetArchitecture" = x86_gcc2 ]; then
InputMethodDir=$addOnsDir/../input_server/methods
else
InputMethodDir=$addOnsDir/input_server/methods
fi
mkdir -p $MozcDataDir
mkdir -p $MozcDataDir/zinnia
mkdir -p $MozcDataDir/images
mkdir -p $dataDir/locale/catalogs/x-vnd.Mozc-InputMethod
mkdir -p $dataDir/locale/catalogs/x-vnd.Mozc-MozcTool
mkdir -p $InputMethodDir
cp $MozcOutDir/mozc $InputMethodDir/mozc
if [ "$targetArchitecture" = x86_gcc2 ]; then
cp $MozcOutDir/mozc_task $MozcDataDir/mozc_task
fi
cp $MozcOutDir/mozc_server $MozcDataDir/mozc_server
cp $MozcOutDir/mozc_tool_haiku $MozcDataDir/mozc_tool
cp $MozcOutDir/handwriting-ja.model \
$MozcDataDir/zinnia/handwriting-ja.model
cp $MozcOutDir/mozc_emacs_helper $MozcDataDir/mozc_emacs_helper
cp src/data/installer/credits_en.html $MozcDataDir/credits_en.html
cp src/data/images/product_icon_32bpp-128.png \
$MozcDataDir/images/product_icon_32bpp-128.png
cp $MozcOutDir/x-vnd.Mozc-InputMethod/* \
$dataDir/locale/catalogs/x-vnd.Mozc-InputMethod
cp $MozcOutDir/x-vnd.Mozc-MozcTool/* \
$dataDir/locale/catalogs/x-vnd.Mozc-MozcTool
mkdir -p $MozcDataDir/docs
cp -r docs/* $MozcDataDir/docs
}
TEST()
{
cd src
# Some tests fails with job > 1
python2 build_mozc.py runtests -c Release --test_jobs 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment