Last active
April 1, 2019 08:02
-
-
Save hanya/8ea731c25f5b15bc86b2d5c6dfbf03fc to your computer and use it in GitHub Desktop.
Haikuports recipe for Mozc NEologd UT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/generate-dictionary.sh b/generate-dictionary.sh | |
index d60a741..20f3ee7 100755 | |
--- a/mozcdic-neologd-ut-20190204.1/generate-dictionary.sh | |
+++ b/mozcdic-neologd-ut-20190204.1/generate-dictionary.sh | |
@@ -3,23 +3,24 @@ | |
MOZCVER="2.23.2815.102" | |
DICVER="20190204" | |
REVISION="1" | |
- | |
+TOPDIR=../.. | |
+MOZCDIR=$TOPDIR/sources/mozc | |
# ============================================================================== | |
# remove tmp files | |
# ============================================================================== | |
-rm -rf ../mozc-$MOZCVER/ | |
-rm -rf ../mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION/ | |
-rm -f ../mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION.tar* | |
-rm -f chimei/*.zip | |
-rm -f chimei/*.CSV* | |
-rm -f chimei/*.py | |
-rm -f src/id.def | |
-rm -f src/mecab-user-dict-seed* | |
-rm -f src/mozcdic* | |
-rm -f src/neologd* | |
-rm -f src/zipcode.costs | |
+#rm -rf ../mozc-$MOZCVER/ | |
+#rm -rf ../mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION/ | |
+#rm -f ../mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION.tar* | |
+#rm -f chimei/*.zip | |
+#rm -f chimei/*.CSV* | |
+#rm -f chimei/*.py | |
+#rm -f src/id.def | |
+#rm -f src/mecab-user-dict-seed* | |
+#rm -f src/mozcdic* | |
+#rm -f src/neologd* | |
+#rm -f src/zipcode.costs | |
# ============================================================================== | |
@@ -27,13 +28,13 @@ rm -f src/zipcode.costs | |
# ============================================================================== | |
# extract official mozc | |
-echo "extract official mozc..." | |
-cd .. | |
-tar xf mozc-$MOZCVER.tar.bz2 | |
-cd - | |
- | |
+#echo "extract official mozc..." | |
+#cd .. | |
+#tar xf mozc-$MOZCVER.tar.bz2 | |
+#cd - | |
+export LANG=ja_JP.UTF-8 | |
# get hinsi ID | |
-cp ../mozc-$MOZCVER/src/data/dictionary_oss/id.def src/ | |
+cp $MOZCDIR/src/data/dictionary_oss/id.def src/ | |
# ============================================================================== | |
@@ -41,19 +42,21 @@ cp ../mozc-$MOZCVER/src/data/dictionary_oss/id.def src/ | |
# ============================================================================== | |
# get zip code data | |
-echo "get zip code data..." | |
+#echo "get zip code data..." | |
cd chimei/ | |
-wget http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip | |
-wget http://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip | |
-unzip ken_all.zip | |
-unzip jigyosyo.zip | |
+#wget http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip | |
+#wget http://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip | |
+#unzip ken_all.zip | |
+#unzip jigyosyo.zip | |
+cp ../$TOPDIR/sources-4/KEN_ALL.CSV . | |
+cp ../$TOPDIR/sources-5/JIGYOSYO.CSV . | |
# modify zip code data | |
echo "modify zip code data..." | |
ruby modify-zipcode.rb KEN_ALL.CSV | |
-cp ../../mozc-$MOZCVER/src/dictionary/gen_zip_code_seed.py . | |
-cp ../../mozc-$MOZCVER/src/dictionary/zip_code_util.py . | |
+cp ../$MOZCDIR/src/dictionary/gen_zip_code_seed.py . | |
+cp ../$MOZCDIR/src/dictionary/zip_code_util.py . | |
# temporary fix | |
sed -i "s/from dictionary import zip_code_util/import zip_code_util/g" gen_zip_code_seed.py | |
@@ -65,7 +68,7 @@ python2 gen_zip_code_seed.py --zip_code=KEN_ALL.CSV.modzip --jigyosyo=JIGYOSYO.C | |
# generate chimei costs | |
echo "generate chimei costs..." | |
-ruby get-chimei-costs.rb KEN_ALL.CSV.modzip | |
+ruby -E utf-8 get-chimei-costs.rb KEN_ALL.CSV.modzip | |
cd .. | |
@@ -74,7 +77,7 @@ cd .. | |
# ============================================================================== | |
# get official mozcdic | |
-cat ../mozc-$MOZCVER/src/data/dictionary_oss/dictionary*.txt > src/mozcdic.txt | |
+cat $MOZCDIR/src/data/dictionary_oss/dictionary*.txt > src/mozcdic.txt | |
cd mecab-ipadic-neologd/ | |
# extract mecab-user-dict-seed | |
@@ -85,48 +88,49 @@ cd ../src/ | |
# convert neologd entries to mozc format | |
echo "convert neologd entries to mozc format..." | |
-ruby convert-neologd-to-mozcformat.rb mecab-user-dict-seed.$DICVER.csv | |
+ruby -E utf-8 convert-neologd-to-mozcformat.rb mecab-user-dict-seed.$DICVER.csv | |
cat ../chimei/KEN_ALL.CSV.modzip.costs neologd.costs > neologd.costs.new | |
mv neologd.costs.new neologd.costs | |
# split new entries | |
echo "split new entries..." | |
-ruby split-new-entries.rb | |
+ruby -E utf-8 split-new-entries.rb | |
# fix jinmei costs and filter entries | |
echo "fix jinmei costs and filter entries..." | |
-ruby fix-jinmei-costs-and-filter-entries.rb mozcdic-neologd-ut.costs | |
+ruby -E utf-8 fix-jinmei-costs-and-filter-entries.rb mozcdic-neologd-ut.costs | |
# install mozcdic-neologd-ut | |
-cat mozcdic-neologd-ut.costs.jinmei zipcode.costs ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary00.txt > dictionary00.txt | |
-mv dictionary00.txt ../../mozc-$MOZCVER/src/data/dictionary_oss/ | |
+cat mozcdic-neologd-ut.costs.jinmei zipcode.costs ../$MOZCDIR/src/data/dictionary_oss/dictionary00.txt > dictionary00.txt | |
+mv dictionary00.txt ../$MOZCDIR/src/data/dictionary_oss/ | |
# change mozc branding | |
-cd ../../mozc-$MOZCVER/src/base/ | |
-sed -i "s/\"Mozc\"/\"Mozc-NEologd-UT\"/g" const.h | |
-cd - | |
cd .. | |
+#cd ../../mozc-$MOZCVER/src/base/ | |
+sed -i "s/\"Mozc\"/\"Mozc-NEologd-UT\"/g" ../$MOZCDIR/src/base/const.h | |
+#cd - | |
+#cd .. | |
# install docs | |
-mkdir -p ../mozc-$MOZCVER/docs-ut/mecab-ipadic-neologd | |
-cp mecab-ipadic-neologd/{COPYING,ChangeLog,README.ja.md,README.md} ../mozc-$MOZCVER/docs-ut/mecab-ipadic-neologd/ | |
-cp {AUTHORS,COPYING,ChangeLog,README.md} ../mozc-$MOZCVER/docs-ut/ | |
+mkdir -p ../$MOZCDIR/docs-ut/mecab-ipadic-neologd | |
+cp mecab-ipadic-neologd/{COPYING,ChangeLog,README.ja.md,README.md} ../$MOZCDIR/docs-ut/mecab-ipadic-neologd/ | |
+cp {AUTHORS,COPYING,ChangeLog,README.md} ../$MOZCDIR/docs-ut/ | |
# install fcitx-mozc | |
-cp -r fcitx-mozc/fcitx ../mozc-$MOZCVER/src/unix/ | |
+#cp -r fcitx-mozc/fcitx ../mozc-$MOZCVER/src/unix/ | |
# install PKGBUILD | |
-cp PKGBUILD ../mozc-$MOZCVER/ | |
+#cp PKGBUILD ../mozc-$MOZCVER/ | |
# install a patch | |
-cp fix-for-gcc81.patch ../mozc-$MOZCVER/ | |
+#cp fix-for-gcc81.patch ../mozc-$MOZCVER/ | |
# rename mozc dir to mozc-neologd-ut | |
-cd .. | |
-mv mozc-$MOZCVER mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION | |
+#cd .. | |
+#mv mozc-$MOZCVER mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION | |
# compress mozc-neologd-ut | |
-echo "compress mozc-neologd-ut..." | |
-tar cf mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION.tar mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION | |
-XZ_OPT="--threads=0" xz -f mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION.tar | |
+#echo "compress mozc-neologd-ut..." | |
+#tar cf mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION.tar mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION | |
+#XZ_OPT="--threads=0" xz -f mozc-neologd-ut-$MOZCVER.$DICVER.$REVISION.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUMMARY="Japanese input method editor" | |
DESCRIPTION="A Japanese Input Method Editor (IME) designed for multi-platform. \ | |
This is open source version." | |
HOMEPAGE="https://github.com/google/mozc" | |
COPYRIGHT="2010-2018 Google Inc. | |
2015-2019 Toshinori Sato | |
2010 Hatena | |
2019 Japan post | |
2019 Snafukin | |
2019 Taku Kudou" | |
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" | |
if [ "$effectiveTargetArchitecture" = x86 ]; then | |
PATCHES="mozc-$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="https://jaist.dl.osdn.jp/users/23/23742/mozcdic-neologd-ut-20190204.1.tar.bz2" | |
CHECKSUM_SHA256_3="0d9cc3a2a9471f90e40b6b9549488a0ce04d799fca3052c33aeb881fdc7041a1" | |
PATCHES_3="generate_dictionary.patch" | |
SOURCE_URI_4="http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip" | |
CHECKSUM_SHA256_4="6de08796e60d6eeaf87f156df33937972bfcae97b600500b1935c9a54dd77b0f" | |
SOURCE_URI_5="http://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip" | |
CHECKSUM_SHA256_5="50621cc16db8a3c70faeccf13a116b899ec299177d845d18ff84c850ac7b2131" | |
ARCHITECTURES="!x86_gcc2 x86 x86_64" | |
SECONDARY_ARCHITECTURES="x86" | |
PROVIDES=" | |
mozc_neologd_ut$secondaryArchSuffix | |
addon:mozc | |
" | |
REQUIRES=" | |
haiku$secondaryArchSuffix | |
lib:libprotobuf$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:ruby | |
cmd:which | |
cmd:xres | |
cmd:xz | |
" | |
if [ "$targetArchitecture" = x86_gcc2 ]; then | |
BUILD_PREREQUIRES+=" | |
cmd:g++ | |
" | |
fi | |
BUILD() | |
{ | |
cd ../../sources-3/mozcdic-neologd-ut-20190204.1 | |
sh generate-dictionary.sh | |
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-ut | |
cp -r docs-ut/* $MozcDataDir/docs-ut | |
} | |
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