Last active
April 1, 2019 08:02
-
-
Save hanya/783e741f81788e321e5a3737f01006a9 to your computer and use it in GitHub Desktop.
Haikuports recipe for Mozc UT2
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 2d1e45b..719c628 100755 | |
--- a/mozcdic-ut2-20171008/generate-dictionary.sh | |
+++ b/mozcdic-ut2-20171008/generate-dictionary.sh | |
@@ -2,6 +2,8 @@ | |
MOZCVER="2.20.2677.102" | |
DICVER="20171008" | |
+TOPDIR=../.. | |
+MOZCDIR=$TOPDIR/sources/mozc | |
# If you want to use an English-Japanese dictionary, | |
# uncomment the following line. | |
@@ -16,60 +18,60 @@ DICVER="20171008" | |
# remove tmp files | |
# ============================================================================== | |
-rm -rf ../mozc-$MOZCVER | |
-rm -rf ../mozc-ut2-$MOZCVER.$DICVER | |
-rm -rf ../mozc-ut2-$MOZCVER.$DICVER.tar* | |
-rm -f chimei/*.zip | |
-rm -f chimei/*.CSV* | |
-rm -f chimei/*.py | |
-rm -f src/id.def | |
-rm -f src/zipcode.costs | |
- | |
+#rm -rf ../mozc-$MOZCVER | |
+#rm -rf ../mozc-ut2-$MOZCVER.$DICVER | |
+#rm -rf ../mozc-ut2-$MOZCVER.$DICVER.tar* | |
+#rm -f chimei/*.zip | |
+#rm -f chimei/*.CSV* | |
+#rm -f chimei/*.py | |
+#rm -f src/id.def | |
+#rm -f src/zipcode.costs | |
+export LANG=ja_JP.UTF-8 | |
# ============================================================================== | |
# extract official mozc and filter entries | |
# ============================================================================== | |
# 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 - | |
echo "filter mozc entries..." | |
cd src/ | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary00.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary01.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary02.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary03.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary00.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary01.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary02.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary03.txt & | |
wait | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary04.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary05.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary06.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary04.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary05.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary06.txt & | |
wait | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary07.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary08.txt & | |
-ruby filter-mozc-entries.rb ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary09.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary07.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary08.txt & | |
+ruby -E utf-8 filter-mozc-entries.rb ../$MOZCDIR/src/data/dictionary_oss/dictionary09.txt & | |
wait | |
-cd - | |
+#cd - | |
-cd ../mozc-$MOZCVER/src/data/dictionary_oss/ | |
+cd ../$MOZCDIR/src/data/dictionary_oss/ | |
rm dictionary*.txt | |
for file in *.txt.filt; do | |
mv $file ${file%.txt.filt}.txt; | |
done | |
-cd - | |
+cd ../../../$TOPDIR/sources-3/mozcdic-ut2-20171008 | |
echo "remove mozc duplicates..." | |
-cat ../mozc-$MOZCVER/src/data/dictionary_oss/dictionary*.txt > src/mozcdict | |
+cat $MOZCDIR/src/data/dictionary_oss/dictionary*.txt > src/mozcdict | |
cd src/ | |
-ruby remove-mozc-duplicates.rb mozcdict | |
+ruby -E utf-8 remove-mozc-duplicates.rb mozcdict | |
mv mozcdict.remdup mozcdict | |
cd - | |
# get hinsi ID | |
-cp ../mozc-$MOZCVER/src/data/dictionary_oss/id.def src/ | |
+cp ../$MOZCDIR/src/data/dictionary_oss/id.def src/ | |
# ============================================================================== | |
@@ -77,19 +79,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 | |
@@ -101,7 +105,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 .. | |
@@ -119,14 +123,14 @@ if [ "$NICODIC" = "true" ]; then | |
fi | |
echo "change mozcdic order..." | |
-ruby change-mozcdic-order-to-utdic-order.rb mozcdict | |
+ruby -E utf-8 change-mozcdic-order-to-utdic-order.rb mozcdict | |
echo "convert jawikihits to costs..." | |
-ruby convert-jawikihits-to-costs.rb jawikihits_all | |
+ruby -E utf-8 convert-jawikihits-to-costs.rb jawikihits_all | |
# generate ekimei costs | |
cd ../ekimei/ | |
-ruby generate-ekimei-costs.rb ekimei.hits | |
-cd - | |
+ruby -E utf-8 generate-ekimei-costs.rb ekimei.hits | |
+cd ../src | |
cat mozcdict.utorder jawikihits_all.costs \ | |
../chimei/KEN_ALL.CSV.modzip.costs \ | |
@@ -139,38 +143,38 @@ if [ "$EJDIC" = "true" ]; then | |
fi | |
echo "split new words and add id..." | |
-ruby split-new-words-and-add-id.rb utdict.costs | |
+ruby -E utf-8 split-new-words-and-add-id.rb utdict.costs | |
mv utdict.costs.new utdict.costs | |
-cat utdict.costs zipcode.costs ../../mozc-$MOZCVER/src/data/dictionary_oss/dictionary00.txt > dictionary00.txt | |
-mv dictionary00.txt ../../mozc-$MOZCVER/src/data/dictionary_oss/ | |
+cat utdict.costs 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-UT2\"/g" const.h | |
-cd - | |
+#cd ../../mozc-$MOZCVER/src/base/ | |
+sed -i "s/\"Mozc\"/\"Mozc-UT2\"/g" ../$MOZCDIR/src/base/const.h | |
+#cd - | |
# copy docs and PKGBUILD | |
cd .. | |
-mkdir -p ../mozc-$MOZCVER/docs-ut/ | |
-cp {AUTHORS,ChangeLog,COPYING,README.md} ../mozc-$MOZCVER/docs-ut/ | |
-cp PKGBUILD ../mozc-$MOZCVER/ | |
+mkdir -p $MOZCDIR/docs-ut/ | |
+cp {AUTHORS,ChangeLog,COPYING,README.md} $MOZCDIR/docs-ut/ | |
+#cp PKGBUILD ../mozc-$MOZCVER/ | |
-cp -r docs/ ../mozc-$MOZCVER/docs-ut/ | |
+cp -r docs/ $MOZCDIR/docs-ut/ | |
if [ "$EJDIC" != "true" ]; then | |
- rm -rf ../mozc-$MOZCVER/docs-ut/wordnet-ejdic/ | |
+ rm -rf $MOZCDIR/docs-ut/wordnet-ejdic/ | |
fi | |
if [ "$NICODIC" != "true" ]; then | |
- rm -rf ../mozc-$MOZCVER/docs-ut/niconico/ | |
+ rm -rf $MOZCDIR/docs-ut/niconico/ | |
fi | |
# rename mozc dir to mozc-ut2 | |
-cd .. | |
-mv mozc-$MOZCVER mozc-ut2-$MOZCVER.$DICVER | |
+#cd .. | |
+#mv mozc-$MOZCVER mozc-ut2-$MOZCVER.$DICVER | |
# compress mozc-ut2 | |
-echo "compress mozc-ut2..." | |
-tar cf mozc-ut2-$MOZCVER.$DICVER.tar mozc-ut2-$MOZCVER.$DICVER | |
-XZ_OPT="--threads=0" xz -f mozc-ut2-$MOZCVER.$DICVER.tar | |
+#echo "compress mozc-ut2..." | |
+#tar cf mozc-ut2-$MOZCVER.$DICVER.tar mozc-ut2-$MOZCVER.$DICVER | |
+#XZ_OPT="--threads=0" xz -f mozc-ut2-$MOZCVER.$DICVER.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. | |
2017-2019 Hirosi Utumi | |
2010 Hatena | |
2019 Japan post | |
2009-2011 NICT | |
2012-2017 Francis Bond | |
2016-1017 Takayuki Kuribayashi" | |
LICENSE="BSD (3-clause) | |
GNU GPL 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="http://iij.dl.osdn.jp/users/16/16039/mozcdic-ut2-20171008.tar.bz2" | |
CHECKSUM_SHA256_3="fad6ae12f8ee918222d376d124a892fc233ab1159f7e551c4cffe1e3203af3fb" | |
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_ut2$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-ut2-20171008 | |
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