diff options
Diffstat (limited to 'app-i18n/tagainijisho')
-rw-r--r-- | app-i18n/tagainijisho/Manifest | 10 | ||||
-rw-r--r-- | app-i18n/tagainijisho/files/tagainijisho-1.0.3-sqlite.patch | 15 | ||||
-rw-r--r-- | app-i18n/tagainijisho/metadata.xml | 27 | ||||
-rw-r--r-- | app-i18n/tagainijisho/tagainijisho-1.0.3-r1.ebuild | 59 | ||||
-rw-r--r-- | app-i18n/tagainijisho/tagainijisho-1.2.0_pre20180610092832.ebuild | 189 | ||||
-rw-r--r-- | app-i18n/tagainijisho/tagainijisho-9999.ebuild | 189 |
6 files changed, 489 insertions, 0 deletions
diff --git a/app-i18n/tagainijisho/Manifest b/app-i18n/tagainijisho/Manifest new file mode 100644 index 000000000000..1c1312af0ca7 --- /dev/null +++ b/app-i18n/tagainijisho/Manifest @@ -0,0 +1,10 @@ +AUX tagainijisho-1.0.3-sqlite.patch 425 BLAKE2B 0d14c8619933ca9218ccae185c21d57453b95ec96d7ce7fcd64b0596fd6746df8f9f5d98429c799a9e5a00795875ca7ea0d029b0a888969681f13a2ba0800498 SHA512 aca8593bc860f3bb640134e49898106414ff57b1cd6a39be5371151ed32e8bdb45a0747535f5f0d4710367919cf329fc2c308df38731b3c94be16f4992d7d174 +DIST JMdict-2018-06-12.gz 18306650 BLAKE2B 3ddb29bf631567717085912b1fa21c701e6183c94907f64121daedf358303df09a754bcdf51f24f0d7c95bf1bfe4ea13779f5e3532bd19a3f99a33751259a893 SHA512 cd8e0a737ccd1ccbe7c53ab0affb5d4ca068656966c75f0abbc184ffcdc69d8a1dbe0f096a16f0b59ecaed40371a29e566ee5076a7e80e3f51796e32798bed3e +DIST kanjidic2-2018-06-12.xml.gz 1482391 BLAKE2B c6f1d18f17b2107937fe07b77d6aa297d156d9c250cdc480000aeb7f8c9cd27a94e2cce1df80e4612d1bcadc94d92d5d013cfc8d923c5ceaba9ed5b0a692ae78 SHA512 700aba18e18ab271dbc583f1a1cc16dd7209e4aa48417201f0b51723d35f5aedcff299ed1503cb743151abce37c94c0facbab09dd0a46126131bb54f2004aa23 +DIST kanjivg-20160426.xml.gz 3587660 BLAKE2B c85291f3671f0980186e8deb296cfa743322df438d6f09fd69a4f5a30c3db6f097d6ff0a817b88c5c9a2c8d4a40c90b31c0a54cb71d681849b557ee364707c48 SHA512 1d35a8cc5d4947f6bedfc71a2f08e2d1fda832d7a02588c00953e1746812b0e51d4d1c39dff49999b4f65ec850788359f6e0d1465f0e688b1bf753c4c67b3c54 +DIST tagainijisho-1.0.3.tar.gz 24816175 BLAKE2B fbe9e671675b2a938aa13aaae87af7f076f4f20c6024d90fa70f2c86f5e1964998d83047b69473e4f9a43e46eacde6b61bc6620b5cfb13c1b4d12a3b1317a280 SHA512 3afd75cc27e8701d93df54a2244b83090770cc80ac20ab8fb843d2ab925ab575f73d731a2ce736179fb7361af68e94694ec91f813d186c87e730368c41535c53 +DIST tagainijisho-1.2.0_pre20180610092832.tar.gz 3634107 BLAKE2B f5cb75f45fced30c64f615147c3eb7e4d473e81dd734517710bcfdf390d1a34a1780196b6dbbb7a6d297df0bb8d73933d09a76eb6b8dd13d1c0759c562e81695 SHA512 3b17ff6972e3cfd35f4f9e8c575153a4c2021a66a238f631616452a16a151d604106586d438cdc574211bff54118d89e492f9460da4b25fef88a2354b0bd8555 +EBUILD tagainijisho-1.0.3-r1.ebuild 1751 BLAKE2B 98b42350d471ef3f42ee092b6a2952e6eda8347efb229447666a00bbc0f195e1d366de08857864d4e7df18558a7202abfcffcb16b7f59ba20bbba3124eb908bf SHA512 2d664fc8ab217d57fabde412368b368fd02b1e04918fe3aa7d6f348035bc29583956c07d295549b32b1d0abc60cdd572b16efa74e0184e9f6861cf40ea584161 +EBUILD tagainijisho-1.2.0_pre20180610092832.ebuild 6180 BLAKE2B ac53048f5508366e943275fdf19ce7dfc7e5ccc4d228608d57828098911a5219ac89b0f4f5450cfba87dadd06fcde209438834e4264286b257cf98dba6e26bad SHA512 8ed6439eae16cea8e714fe8a5de659286414bbaffccc6b3c9a0c79d33a36534039b6a56a5e8fa936556a9264c2e4b164841ced3c3805f21da82928621198baab +EBUILD tagainijisho-9999.ebuild 6109 BLAKE2B 0d10127700103382266b6606877e92de3205bac43a795a93bb30ed1c4d89c9f6bf2612a51e4e3bf3d92e611f3b1d1959c56cf2f5f34214220a80eb21fe72a5c6 SHA512 55c11b49c483b7654539a5627e44ee65111569be3fdc45c10f0db4600e09c0eef02c2f800337449f77a53b1c51ce01790d3c18b41945499d518b4f5a28883d32 +MISC metadata.xml 1133 BLAKE2B 863fcd0cbb85b715cf7666210c74a9e88423b0e982b3e05b4333036b607e4d2cf73b35dc6b8f5e549a35a6d8e2cc107f110f3500762d49065bd1ed2097dd6338 SHA512 cde2818f44f02091ac994ca049a25b90519b62b669b7923a52043df23a0de7f3e1f657d3080e574048556dbacd5521995addd35267ec9d1357360f473222cef7 diff --git a/app-i18n/tagainijisho/files/tagainijisho-1.0.3-sqlite.patch b/app-i18n/tagainijisho/files/tagainijisho-1.0.3-sqlite.patch new file mode 100644 index 000000000000..bf1d443395b6 --- /dev/null +++ b/app-i18n/tagainijisho/files/tagainijisho-1.0.3-sqlite.patch @@ -0,0 +1,15 @@ +https://github.com/Gnurou/tagainijisho/issues/163 + +--- src/sqlite/sqlite3ext.cc ++++ src/sqlite/sqlite3ext.cc +@@ -118,6 +118,10 @@ + sqlite3_stmt *pStmt; + const char *zSql = "SELECT fts3_tokenizer(?, ?)"; + ++#ifdef SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER ++ sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, NULL); ++#endif ++ + rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + if( rc!=SQLITE_OK ){ + return rc; diff --git a/app-i18n/tagainijisho/metadata.xml b/app-i18n/tagainijisho/metadata.xml new file mode 100644 index 000000000000..09f1cc4ec3ad --- /dev/null +++ b/app-i18n/tagainijisho/metadata.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>calchan@gentoo.org</email> + <name>Denis Dupeyron</name> + </maintainer> + <maintainer type="person"> + <email>arfrever.fta@gmail.com</email> + <name>Arfrever Frehtes Taifersar Arahesis</name> + </maintainer> + <longdescription> +Tagaini Jisho is a free, open-source Japanese dictionary and kanji lookup tool +that is available for Windows, MacOS X and Linux and aims at becoming your +Japanese study assistant. It allows you to quickly search for entries and mark +those that you wish to study, along with tags and personal notes. It also let +you train entries you are studying and follows your progression in remembering +them. Finally, it makes it easy to review entries you did not remember by +listing them on screen or printing them on a small booklet. + +Tagaini Jisho also features complete stroke order animations for more than 6000 +kanji. +</longdescription> + <upstream> + <remote-id type="github">Gnurou/tagainijisho</remote-id> + </upstream> +</pkgmetadata> diff --git a/app-i18n/tagainijisho/tagainijisho-1.0.3-r1.ebuild b/app-i18n/tagainijisho/tagainijisho-1.0.3-r1.ebuild new file mode 100644 index 000000000000..b89dc7ed279b --- /dev/null +++ b/app-i18n/tagainijisho/tagainijisho-1.0.3-r1.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit cmake-utils gnome2-utils + +DESCRIPTION="Open-source Japanese dictionary and kanji lookup tool" +HOMEPAGE="https://www.tagaini.net/" +SRC_URI="https://github.com/Gnurou/tagainijisho/releases/download/${PV}/${P}.tar.gz" +LICENSE="GPL-3+ public-domain" + +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" +DEPEND="dev-qt/qtcore:4 + dev-qt/qtgui:4 + >=dev-db/sqlite-3.11:3" +RDEPEND="${DEPEND}" + +pkg_langs=( ar cs de es fa fi fr hu id it nb nl pl pt ru sv th tr vi ) +IUSE+=" ${pkg_langs[@]/#/l10n_}" + +PATCHES=( "${FILESDIR}"/${P}-sqlite.patch ) + +src_configure() { + # GUI linguae + # en is not optional, and build fails if none other then en is set, so adding ja as non-optional too + # linguae undeclared in IUSE will trigger an error, which is a handy check + local lang use_lang + for lang in i18n/*.ts; do + lang=${lang#i18n/tagainijisho_} + lang=${lang%.ts} + case ${lang} in + fa_IR|fi_FI) use_lang=${lang%%_*} ;; # use generic tags instead + *) use_lang=${lang} ;; + esac + if [[ ${lang} != en && ${lang} != ja ]] && ! use l10n_${use_lang}; then + rm i18n/tagainijisho_${lang}.ts || die + fi + done + + # Dictionary linguae + # en is not optional here either, but nothing special needs to be done + # here too, linguae undeclared in IUSE will trigger an error + local cmake_langs + for lang in $(sed -e 's/;/ /g' -ne '/set(DICT_LANG ".*")/s/.*"\(.*\)".*/\1/p' CMakeLists.txt); do + if use l10n_${lang}; then + cmake_langs+=";${lang}" + fi + done + mycmakeargs=( -DDICT_LANG="${cmake_langs};" ) + + cmake-utils_src_configure +} + +pkg_preinst() { gnome2_icon_savelist; } +pkg_postinst() { gnome2_icon_cache_update; } +pkg_postrm() { gnome2_icon_cache_update; } diff --git a/app-i18n/tagainijisho/tagainijisho-1.2.0_pre20180610092832.ebuild b/app-i18n/tagainijisho/tagainijisho-1.2.0_pre20180610092832.ebuild new file mode 100644 index 000000000000..41902e9a643c --- /dev/null +++ b/app-i18n/tagainijisho/tagainijisho-1.2.0_pre20180610092832.ebuild @@ -0,0 +1,189 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +inherit cmake-utils gnome2-utils + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + + EGIT_REPO_URI="https://github.com/Gnurou/tagainijisho" +elif [[ "${PV}" == *_pre* ]]; then + inherit vcs-snapshot + + TAGAINIJISHO_GIT_REVISION="dde2ad85dc6dc47ac7862e728878a7c8d9d4faf6" +fi +if [[ "${PV}" == 9999 || "${PV}" == *_pre* ]]; then + JMDICT_DATE="2018-06-12" + KANJIDIC2_DATE="2018-06-12" + KANJIVG_VERSION="20160426" +fi + +DESCRIPTION="Open-source Japanese dictionary and kanji lookup tool" +HOMEPAGE="https://www.tagaini.net/ https://github.com/Gnurou/tagainijisho" +if [[ "${PV}" == 9999 ]]; then + SRC_URI="" +elif [[ "${PV}" == *_pre* ]]; then + SRC_URI="https://github.com/Gnurou/${PN}/archive/${TAGAINIJISHO_GIT_REVISION}.tar.gz -> ${P}.tar.gz" +else + SRC_URI="https://github.com/Gnurou/${PN}/releases/download/${PV}/${P}.tar.gz" +fi +if [[ "${PV}" == *_pre* ]]; then + # Upstream: http://ftp.monash.edu.au/pub/nihongo/JMdict.gz + SRC_URI+=" https://home.apache.org/~arfrever/distfiles/JMdict-${JMDICT_DATE}.gz" +fi +if [[ "${PV}" == *_pre* ]]; then + # Upstream: http://www.edrdg.org/kanjidic/kanjidic2.xml.gz + SRC_URI+=" https://home.apache.org/~arfrever/distfiles/kanjidic2-${KANJIDIC2_DATE}.xml.gz" +fi +if [[ "${PV}" == 9999 || "${PV}" == *_pre* ]]; then + SRC_URI+=" https://github.com/KanjiVG/kanjivg/releases/download/r${KANJIVG_VERSION}/kanjivg-${KANJIVG_VERSION}.xml.gz" +fi + +LICENSE="GPL-3+ public-domain" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND=">=dev-db/sqlite-3.12:3 + dev-qt/qtcore:5 + dev-qt/qtnetwork:5 + dev-qt/qtprintsupport:5 + dev-qt/qtwidgets:5" +DEPEND="${RDEPEND} + dev-qt/linguist-tools:5" + +pkg_langs=(ar cs de es fa fi fr hu id it nb nl pl pt ru sv th tr uk vi zh) +IUSE+=" ${pkg_langs[@]/#/l10n_}" +unset pkg_langs + +src_unpack() { + if [[ "${PV}" == 9999 ]]; then + git-r3_src_unpack + elif [[ "${PV}" == *_pre* ]]; then + unpack ${P}.tar.gz + mv tagainijisho-${TAGAINIJISHO_GIT_REVISION} ${P} || die + else + unpack ${P}.tar.gz + fi + + if [[ "${PV}" == 9999 ]]; then + # JMdict.gz and kanjidic2.xml.gz are updated once per day. + + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local today="$(TZ="UTC" date --date=today "+%Y-%m-%d")" + local yesterday="$(TZ="UTC" date --date=yesterday "+%Y-%m-%d")" + + if [[ -f ${distdir}/JMdict-${today}.gz && -s ${distdir}/JMdict-${today}.gz ]]; then + # Use previously downloaded file from today. + JMDICT_DATE="${today}" + elif [[ -f ${distdir}/JMdict-${yesterday}.gz && -s ${distdir}/JMdict-${yesterday}.gz ]]; then + # Use previously downloaded file from yesterday. File from today may still be nonexistent. + JMDICT_DATE="${yesterday}" + else + # Download file from today or yesterday. + wget http://ftp.monash.edu.au/pub/nihongo/JMdict.gz -O JMdict.gz || die + JMDICT_DATE="$(gzip -cd JMdict.gz | grep -E "^<!-- JMdict created: [[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} -->$" | sed -e "s/.*\([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\).*/\1/")" + if [[ ${JMDICT_DATE} != ${today} && ${JMDICT_DATE} != ${yesterday} ]]; then + die "Unexpected date in JMdict.gz: '${JMDICT_DATE}'" + fi + ( + addwrite "${distdir}" + mv JMdict.gz "${distdir}/JMdict-${JMDICT_DATE}.gz" || die + ) + fi + einfo "Date in JMdict.gz: '${JMDICT_DATE}'" + + if [[ -f ${distdir}/kanjidic2-${today}.xml.gz && -s ${distdir}/kanjidic2-${today}.xml.gz ]]; then + # Use previously downloaded file from today. + KANJIDIC2_DATE="${today}" + elif [[ -f ${distdir}/kanjidic2-${yesterday}.xml.gz && -s ${distdir}/kanjidic2-${yesterday}.xml.gz ]]; then + # Use previously downloaded file from yesterday. File from today may still be nonexistent. + KANJIDIC2_DATE="${yesterday}" + else + # Download file from today or yesterday. + wget http://www.edrdg.org/kanjidic/kanjidic2.xml.gz -O kanjidic2.xml.gz || die + KANJIDIC2_DATE="$(gzip -cd kanjidic2.xml.gz | grep -E "^<date_of_creation>[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}</date_of_creation>$" | sed -e "s/.*\([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\).*/\1/")" + if [[ ${KANJIDIC2_DATE} != ${today} && ${KANJIDIC2_DATE} != ${yesterday} ]]; then + die "Unexpected date in kanjidic2.xml.gz: '${KANJIDIC2_DATE}'" + fi + ( + addwrite "${distdir}" + mv kanjidic2.xml.gz "${distdir}/kanjidic2-${KANJIDIC2_DATE}.xml.gz" || die + ) + fi + einfo "Date in kanjidic2.xml.gz: '${KANJIDIC2_DATE}'" + + mkdir "${S}/3rdparty" || die + gzip -cd "${distdir}/JMdict-${JMDICT_DATE}.gz" > "${S}/3rdparty/JMdict" || die + gzip -cd "${distdir}/kanjidic2-${KANJIDIC2_DATE}.xml.gz" > "${S}/3rdparty/kanjidic2.xml" || die + elif [[ "${PV}" == *_pre* ]]; then + mkdir "${S}/3rdparty" || die + pushd "${S}/3rdparty" > /dev/null || die + + unpack JMdict-${JMDICT_DATE}.gz + mv JMdict-${JMDICT_DATE} JMdict || die + + unpack kanjidic2-${KANJIDIC2_DATE}.xml.gz + mv kanjidic2-${KANJIDIC2_DATE}.xml kanjidic2.xml || die + + popd > /dev/null || die + fi + + if [[ "${PV}" == 9999 || "${PV}" == *_pre* ]]; then + pushd "${S}/3rdparty" > /dev/null || die + + unpack kanjivg-${KANJIVG_VERSION}.xml.gz + mv kanjivg-${KANJIVG_VERSION}.xml kanjivg.xml || die + + popd > /dev/null || die + fi +} + +src_configure() { + # GUI linguae + # en is not optional, and build fails if none other than en is set, so adding ja as non-optional too. + local lang use_lang + for lang in i18n/*.ts; do + lang=${lang#i18n/tagainijisho_} + lang=${lang%.ts} + case ${lang} in + fa_IR|fi_FI|pt_BR) + # Use generic tags. + use_lang=${lang%%_*} + ;; + *) + use_lang=${lang} + ;; + esac + + if [[ ${lang} != en && ${lang} != ja ]] && ! use l10n_${use_lang}; then + rm i18n/tagainijisho_${lang}.ts || die + fi + done + + # Dictionary linguae + # en is not optional here either, but nothing special needs to be done. + local dict_langs + for lang in $(sed -e 's/;/ /g' -ne '/set(DICT_LANG ".*")/s/.*"\(.*\)".*/\1/p' CMakeLists.txt); do + if use l10n_${lang}; then + dict_langs+="${dict_langs:+;}${lang}" + fi + done + + local mycmakeargs=( + -DDICT_LANG="${dict_langs:-;}" + -DEMBED_SQLITE=OFF + ) + + cmake-utils_src_configure +} + +pkg_postinst() { + gnome2_icon_cache_update +} + +pkg_postrm() { + gnome2_icon_cache_update +} diff --git a/app-i18n/tagainijisho/tagainijisho-9999.ebuild b/app-i18n/tagainijisho/tagainijisho-9999.ebuild new file mode 100644 index 000000000000..11c02a413f1c --- /dev/null +++ b/app-i18n/tagainijisho/tagainijisho-9999.ebuild @@ -0,0 +1,189 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +inherit cmake-utils gnome2-utils + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + + EGIT_REPO_URI="https://github.com/Gnurou/tagainijisho" +elif [[ "${PV}" == *_pre* ]]; then + inherit vcs-snapshot + + TAGAINIJISHO_GIT_REVISION="" +fi +if [[ "${PV}" == 9999 || "${PV}" == *_pre* ]]; then + JMDICT_DATE="" + KANJIDIC2_DATE="" + KANJIVG_VERSION="20160426" +fi + +DESCRIPTION="Open-source Japanese dictionary and kanji lookup tool" +HOMEPAGE="https://www.tagaini.net/ https://github.com/Gnurou/tagainijisho" +if [[ "${PV}" == 9999 ]]; then + SRC_URI="" +elif [[ "${PV}" == *_pre* ]]; then + SRC_URI="https://github.com/Gnurou/${PN}/archive/${TAGAINIJISHO_GIT_REVISION}.tar.gz -> ${P}.tar.gz" +else + SRC_URI="https://github.com/Gnurou/${PN}/releases/download/${PV}/${P}.tar.gz" +fi +if [[ "${PV}" == *_pre* ]]; then + # Upstream: http://ftp.monash.edu.au/pub/nihongo/JMdict.gz + SRC_URI+=" https://home.apache.org/~arfrever/distfiles/JMdict-${JMDICT_DATE}.gz" +fi +if [[ "${PV}" == *_pre* ]]; then + # Upstream: http://www.edrdg.org/kanjidic/kanjidic2.xml.gz + SRC_URI+=" https://home.apache.org/~arfrever/distfiles/kanjidic2-${KANJIDIC2_DATE}.xml.gz" +fi +if [[ "${PV}" == 9999 || "${PV}" == *_pre* ]]; then + SRC_URI+=" https://github.com/KanjiVG/kanjivg/releases/download/r${KANJIVG_VERSION}/kanjivg-${KANJIVG_VERSION}.xml.gz" +fi + +LICENSE="GPL-3+ public-domain" +SLOT="0" +KEYWORDS="" +IUSE="" + +RDEPEND=">=dev-db/sqlite-3.12:3 + dev-qt/qtcore:5 + dev-qt/qtnetwork:5 + dev-qt/qtprintsupport:5 + dev-qt/qtwidgets:5" +DEPEND="${RDEPEND} + dev-qt/linguist-tools:5" + +pkg_langs=(ar cs de es fa fi fr hu id it nb nl pl pt ru sv th tr uk vi zh) +IUSE+=" ${pkg_langs[@]/#/l10n_}" +unset pkg_langs + +src_unpack() { + if [[ "${PV}" == 9999 ]]; then + git-r3_src_unpack + elif [[ "${PV}" == *_pre* ]]; then + unpack ${P}.tar.gz + mv tagainijisho-${TAGAINIJISHO_GIT_REVISION} ${P} || die + else + unpack ${P}.tar.gz + fi + + if [[ "${PV}" == 9999 ]]; then + # JMdict.gz and kanjidic2.xml.gz are updated once per day. + + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local today="$(TZ="UTC" date --date=today "+%Y-%m-%d")" + local yesterday="$(TZ="UTC" date --date=yesterday "+%Y-%m-%d")" + + if [[ -f ${distdir}/JMdict-${today}.gz && -s ${distdir}/JMdict-${today}.gz ]]; then + # Use previously downloaded file from today. + JMDICT_DATE="${today}" + elif [[ -f ${distdir}/JMdict-${yesterday}.gz && -s ${distdir}/JMdict-${yesterday}.gz ]]; then + # Use previously downloaded file from yesterday. File from today may still be nonexistent. + JMDICT_DATE="${yesterday}" + else + # Download file from today or yesterday. + wget http://ftp.monash.edu.au/pub/nihongo/JMdict.gz -O JMdict.gz || die + JMDICT_DATE="$(gzip -cd JMdict.gz | grep -E "^<!-- JMdict created: [[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} -->$" | sed -e "s/.*\([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\).*/\1/")" + if [[ ${JMDICT_DATE} != ${today} && ${JMDICT_DATE} != ${yesterday} ]]; then + die "Unexpected date in JMdict.gz: '${JMDICT_DATE}'" + fi + ( + addwrite "${distdir}" + mv JMdict.gz "${distdir}/JMdict-${JMDICT_DATE}.gz" || die + ) + fi + einfo "Date in JMdict.gz: '${JMDICT_DATE}'" + + if [[ -f ${distdir}/kanjidic2-${today}.xml.gz && -s ${distdir}/kanjidic2-${today}.xml.gz ]]; then + # Use previously downloaded file from today. + KANJIDIC2_DATE="${today}" + elif [[ -f ${distdir}/kanjidic2-${yesterday}.xml.gz && -s ${distdir}/kanjidic2-${yesterday}.xml.gz ]]; then + # Use previously downloaded file from yesterday. File from today may still be nonexistent. + KANJIDIC2_DATE="${yesterday}" + else + # Download file from today or yesterday. + wget http://www.edrdg.org/kanjidic/kanjidic2.xml.gz -O kanjidic2.xml.gz || die + KANJIDIC2_DATE="$(gzip -cd kanjidic2.xml.gz | grep -E "^<date_of_creation>[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}</date_of_creation>$" | sed -e "s/.*\([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\).*/\1/")" + if [[ ${KANJIDIC2_DATE} != ${today} && ${KANJIDIC2_DATE} != ${yesterday} ]]; then + die "Unexpected date in kanjidic2.xml.gz: '${KANJIDIC2_DATE}'" + fi + ( + addwrite "${distdir}" + mv kanjidic2.xml.gz "${distdir}/kanjidic2-${KANJIDIC2_DATE}.xml.gz" || die + ) + fi + einfo "Date in kanjidic2.xml.gz: '${KANJIDIC2_DATE}'" + + mkdir "${S}/3rdparty" || die + gzip -cd "${distdir}/JMdict-${JMDICT_DATE}.gz" > "${S}/3rdparty/JMdict" || die + gzip -cd "${distdir}/kanjidic2-${KANJIDIC2_DATE}.xml.gz" > "${S}/3rdparty/kanjidic2.xml" || die + elif [[ "${PV}" == *_pre* ]]; then + mkdir "${S}/3rdparty" || die + pushd "${S}/3rdparty" > /dev/null || die + + unpack JMdict-${JMDICT_DATE}.gz + mv JMdict-${JMDICT_DATE} JMdict || die + + unpack kanjidic2-${KANJIDIC2_DATE}.xml.gz + mv kanjidic2-${KANJIDIC2_DATE}.xml kanjidic2.xml || die + + popd > /dev/null || die + fi + + if [[ "${PV}" == 9999 || "${PV}" == *_pre* ]]; then + pushd "${S}/3rdparty" > /dev/null || die + + unpack kanjivg-${KANJIVG_VERSION}.xml.gz + mv kanjivg-${KANJIVG_VERSION}.xml kanjivg.xml || die + + popd > /dev/null || die + fi +} + +src_configure() { + # GUI linguae + # en is not optional, and build fails if none other than en is set, so adding ja as non-optional too. + local lang use_lang + for lang in i18n/*.ts; do + lang=${lang#i18n/tagainijisho_} + lang=${lang%.ts} + case ${lang} in + fa_IR|fi_FI|pt_BR) + # Use generic tags. + use_lang=${lang%%_*} + ;; + *) + use_lang=${lang} + ;; + esac + + if [[ ${lang} != en && ${lang} != ja ]] && ! use l10n_${use_lang}; then + rm i18n/tagainijisho_${lang}.ts || die + fi + done + + # Dictionary linguae + # en is not optional here either, but nothing special needs to be done. + local dict_langs + for lang in $(sed -e 's/;/ /g' -ne '/set(DICT_LANG ".*")/s/.*"\(.*\)".*/\1/p' CMakeLists.txt); do + if use l10n_${lang}; then + dict_langs+="${dict_langs:+;}${lang}" + fi + done + + local mycmakeargs=( + -DDICT_LANG="${dict_langs:-;}" + -DEMBED_SQLITE=OFF + ) + + cmake-utils_src_configure +} + +pkg_postinst() { + gnome2_icon_cache_update +} + +pkg_postrm() { + gnome2_icon_cache_update +} |