summaryrefslogtreecommitdiff
path: root/misc/stardict-tools
diff options
context:
space:
mode:
authorCezary M. Kruk <c.kruk@bigfoot.com>2014-11-29 01:18:16 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-11-29 01:18:16 +0700
commitd4c3076cb09b2c0366a29d9c9bbbc655424dcfca (patch)
tree9f386bc5476911cbc69fe60ebd58b2847b5b2f28 /misc/stardict-tools
parent4aa4962c4694b65952ef5717b483780bad0bf47a (diff)
downloadslackbuilds-d4c3076cb09b2c0366a29d9c9bbbc655424dcfca.tar.gz
misc/stardict-tools: Added (tool for stardict).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'misc/stardict-tools')
-rw-r--r--misc/stardict-tools/README8
-rw-r--r--misc/stardict-tools/README.StarDict380
-rw-r--r--misc/stardict-tools/README.sd111
-rw-r--r--misc/stardict-tools/sd57
-rw-r--r--misc/stardict-tools/slack-desc19
-rw-r--r--misc/stardict-tools/stardict-tools.SlackBuild115
-rw-r--r--misc/stardict-tools/stardict-tools.info10
-rw-r--r--misc/stardict-tools/stardict-tools.patch172
8 files changed, 872 insertions, 0 deletions
diff --git a/misc/stardict-tools/README b/misc/stardict-tools/README
new file mode 100644
index 0000000000..1e81f75b73
--- /dev/null
+++ b/misc/stardict-tools/README
@@ -0,0 +1,8 @@
+This package contains some tools for StarDict:
+
+Restart StarDict after using any converter.
+
+Slackware version of stardict-tools is patched
+against the compilation errors.
+
+Some valuable content is stored in /usr/doc/.
diff --git a/misc/stardict-tools/README.StarDict b/misc/stardict-tools/README.StarDict
new file mode 100644
index 0000000000..352bf18dd0
--- /dev/null
+++ b/misc/stardict-tools/README.StarDict
@@ -0,0 +1,380 @@
+
+Format for StarDict dictionary files
+------------------------------------
+
+StarDict homepage: http://stardict.sourceforge.net
+
+{0}. Number and Byte-order Conventions
+When you record the numbers that identify sizes, offsets, etc., you
+should use 32-bit numbers, such as you might represent with a glong.
+
+In order to make StarDict work on different platforms, these numbers
+must be in network byte order. You can ensure the correct byte order
+by using the g_htonl() function when creating dictionary files.
+Conversely, you should use g_ntohl() when reading dictionary files.
+
+Strings should be encoded in UTF-8.
+
+
+
+{1}. Files
+
+Every dictionary consists of three files:
+
+(1). somedict.ifo
+(2). somedict.idx or somedict.idx.gz
+(3). somedict.dict or somedict.dict.dz
+
+You can use gzip -9 to compress the .idx file. If the .idx file are not
+compressed, the loading can be fast and save memory when using, compress it
+will make the .idx file load into memory and make the quering fast when using.
+
+You can use dictzip to compress the .dict file.
+"dictzip" uses the same compression algorithm and file format as does gzip,
+but provides a table that can be used to randomly access compressed blocks
+in the file. The use of 50-64kB blocks for compression typically degrades
+compression by less than 10%, while maintaining acceptable random access
+capabilities for all data in the file. As an added benefit, files
+compressed with dictzip can be decompressed with gunzip.
+For more information about dictzip, refer to DICT project, please see:
+http://www.dict.org
+
+Stardict will search for the .ifo file, then open the .idx or
+.idx.gz file and the .dict.dz or .dict file which is in the same directory and
+has the same base name.
+
+
+
+{2}. The ".ifo" file's format.
+
+The .ifo file has the following format:
+
+StarDict's dict ifo file
+version=2.4.2
+[options]
+
+Note that the current "version" string must be "2.4.2". If it's not,
+then StarDict will refuse to read the file.
+
+[options]
+---------
+
+In the example above, [options] expands to any of the following lines
+specifying information about the dictionary. Each option is a keyword
+followed by an equal sign, then the value of that option, then a
+newline. The options may be appear in any order.
+
+Note that the dictionary must have at least a bookname, a wordcount and a
+idxfilesize, or the load will fail. All other information is optional. All
+strings should be encoded in UTF-8.
+
+Available options:
+
+bookname= // required
+wordcount= // required
+idxfilesize= // required
+author=
+email=
+website=
+description=
+date=
+sametypesequence= // very important.
+
+
+wordcount is the count of word entries in .idx file, it must be right.
+
+idxfilesize is the size(in bytes) of the .idx file, even the .idx is compressed
+to a .idx.gz file, this entry must record the original .idx file's size, and it
+must be right too. The .gz file don't contain its original size information,
+but knowing the original size can speed up the extraction to memory, as you
+don't need to call realloc() for many times.
+
+
+The "sametypesequence" option is described in further detail below.
+
+***
+
+sametypesequence
+
+You should first familiarize yourself with the .dict file format
+described in the next section so that you can understand what effect
+this option has on the .dict file.
+
+If the sametypesequence option is set, it tells StarDict that each
+word's data in the .dict file will have the same sequence of datatypes.
+In this case, we expect a .dict file that's been optimized in two
+ways: the type identifiers should be omitted, and the size marker for
+the last data entry of each word should be omitted.
+
+Let's consider some concrete examples of the sametypesequence option.
+
+Suppose that a dictionary records many .wav files, and so sets:
+sametypesequence=W
+In this case, each word's entry in the .dict file consists solely of a
+wav file. In the .dict file, you would leave out the 'W' character
+before each entry, and you would also omit the 32-bit integer at the
+front of each .wav entry that would normally give the entry's length.
+You can do this since the length is known from the information in the
+idx file.
+
+As another example, suppose a dictionary contains phonetic information
+and a meaning for each word. The sametypesequence option for this
+dictionary would be:
+sametypesequence=tm
+Once again, you can omit the 't' and 'm' characters before each data
+entry in the .dict file. In addition, you should omit the terminating
+'\0' for the 'm' entry for each word in the .dict file, as the length
+of the meaning string can be inferred from the length of the phonetic
+string (still indicated by a terminating '\0') and the length of the
+entire word entry (listed in the .idx file).
+
+So for cases where the last data entry for each word normally requires
+a terminating '\0' character, you should omit this character in the
+dict file. And for cases where the last data entry for each word
+normally requires an initial 32-bit number giving the length of the
+field (such as WAV and PNG entries), you must omit this number in the
+dictionary.
+
+Every dictionary should try to use the sametypesequence feature to
+save disk space.
+
+***
+
+
+
+{3}. The ".idx" file's format.
+
+The .idx file is just a word list.
+
+The word list is a sorted list of word entries.
+
+Each entry in the word list contains three fields, one after the other:
+
+word_str; // a utf-8 string terminated by '\0'.
+word_data_offset; // word data's offset in .dict file
+word_data_size; // word data's total size in .dict file
+
+word_str gives the string representing this word. It's the string
+that is "looked up" by the StarDict.
+
+word_data_offset and word_data_size should both be 32-bit numbers in
+network byte order.
+
+No two entries should have the same "word_str". In other words,
+(strcmp(s1, s2) != 0).
+
+The length of "word_str" should be less than 256. In other words,
+(strlen(word) < 256).
+
+The word list must be sorted by calling stardict_strcmp() on the "word_str"
+fields. If the word list order is wrong, StarDict will fail to function
+correctly!
+
+============
+gint stardict_strcmp(const gchar *s1, const gchar *s2)
+{
+gint a;
+a = g_ascii_strcasecmp(s1, s2);
+if (a == 0)
+return strcmp(s1, s2);
+else
+return a;
+}
+============
+
+g_ascii_strcasecmp() is a glib function:
+
+Unlike the BSD strcasecmp() function, this only recognizes standard
+ASCII letters and ignores the locale, treating all non-ASCII characters
+as if they are not letters.
+
+stardict_strcmp() works fine with English characters, but the other
+locale characters' sorting is not so good. There should be a _strcmp
+function which handles the utf-8 string sorting better. If you know
+one, email me :)
+
+g_utf8_collate()? This is a locale-dependent funcition. So if you look
+up Chinese characters while in the Chinese locale, it works fine. But
+if you are in some other locale then the lookup will fail, as the
+order is not the same as in the Chinese locale (which was used when
+creating the dictionary).
+
+g_utf8_to_ucs4() then do comparing? This sounds like a good solution, but..
+
+The complete solution can be found in "Unicode Technical Standard #10: Unicode
+Collation Algorithm", http://www.unicode.org/reports/tr10/
+
+I hope glib will provide a locale-independent g_utf8_collate() soon.
+http://bugzilla.gnome.org/show_bug.cgi?id=112798
+
+
+
+{4}. The ".dict" file's format.
+
+The .dict file is a pure data sequence, as the offset and size of each
+word is recorded in the corresponding .idx file.
+
+If the "sametypesequence" option is not used in the .ifo file, then
+the .dict file has fields in the following order:
+
+==============
+word_1_data_1_type; // a single char identifying the data type
+word_1_data_1_data; // the data
+word_1_data_2_type;
+word_1_data_2_data;
+...... // the number of data entries for each word is determined by
+// word_data_size in .idx file
+word_2_data_1_type;
+word_2_data_1_data;
+......
+==============
+
+It's important to note that each field in each word indicates its
+own length, as described below. The number of possible fields per
+word is also not fixed, and is determined by simply reading data until
+you've read word_data_size bytes for that word.
+
+
+Suppose the "sametypesequence" option is used in the .idx file, and
+the option is set like this:
+
+sametypesequence=tm
+
+Then the .dict file will look like this:
+
+==============
+word_1_data_1_data
+word_1_data_2_data
+word_2_data_1_data
+word_2_data_2_data
+......
+==============
+
+The first data entry for each word will have a terminating '\0', but
+the second entry will not have a terminating '\0'. The omissions of
+the type chars and of the last field's size information are the
+optimizations required by the "sametypesequence" option described
+above.
+
+
+Type identifiers
+----------------
+
+Here are the single-character type identifiers that may be used with
+the "sametypesequence" option in the .idx file, or may appear in the
+dict file itself if the "sametypesequence" option is not used.
+
+Lower-case characters signify that a field's size is determined by a
+terminating '\0', while upper-case characters indicate that the data
+begins with a 32-bit integer that gives the length of the data field.
+
+'m'
+Word's pure text meaning.
+The data should be a utf-8 string ending with '\0'.
+
+'l'
+Word's pure text meaning.
+The data is NOT a utf-8 string, but is instead a string in locale
+encoding, ending with '\0'. Sometimes using this type will save disk
+space, but its use is discouraged.
+
+'g'
+A utf-8 string which is marked up with the Pango text markup language.
+For more information about this markup language, See the "Pango
+Reference Manual."
+You might have it installed locally at:
+file:///usr/share/gtk-doc/html/pango/PangoMarkupFormat.html
+
+'t'
+English phonetic string.
+The data should be a utf-8 string ending with '\0'.
+
+Here are some utf-8 phonetic characters:
+θʃŋʧðʒæıʌʊɒɛəɑɜɔˌˈːˑ
+æɑɒʌәєŋvθðʃʒːɡˏˊˋ
+
+'y'
+Chinese YinBiao.
+The data should be a utf-8 string ending with '\0'.
+
+
+'W'
+wav file.
+The data begins with a network byte-ordered glong to identify the wav
+file's size, immediately followed by the file's content.
+
+'P'
+png file.
+The data begins with a network byte-ordered glong to identify the png
+file's size, immediately followed by the file's content.
+
+'X'
+this type identifier is reserved for experimental extensions.
+
+
+
+{5}. Tree Dictionary
+
+The tree dictionary support is used for information viewing, etc.
+
+A tree dictionary contains three file: sometreedict.ifo, sometreedict.tdx.gz
+and sometreedict.dict.dz.
+
+It is better to compress the .tdx file, as it is always load into memory.
+
+The .ifo file has the following format:
+
+StarDict's treedict ifo file
+version=2.4.2
+[options]
+
+Available options:
+
+bookname= // required
+tdxfilesize= // required
+wordcount=
+author=
+email=
+website=
+description=
+date=
+sametypesequence=
+
+wordcount is only used for info view in the dict manage dialog, so it is not
+important in tree dictionary.
+
+The .tdx file is just the word list.
+
+-----------
+
+The word list is a tree list of word entries.
+
+Each entry in the word list contains four fields, one after the other:
+word_str; // a utf-8 string terminated by '\0'.
+word_data_offset; // word data's offset in .dict file
+word_data_size; // word data's total size in .dict file. it can be 0.
+word_subentry_count; //have many sub word this entry has, 0 means none.
+
+Subentry is immidiately followed by its parent entry. This make the order is
+just as when a tree list with all its nodes extended, then sort from top to
+bottom.
+
+The .dict file's format is the same as the normal dictionary.
+
+
+
+{6}. More information.
+
+You can read "src/lib.cpp", "src/dictmanagedlg.cpp" and
+"src/tools/*.cpp" for more information.
+
+If you have any questions, email me. :)
+
+Thanks to Will Robinson <wsr23@stanford.edu> for cleaning up this file's
+English.
+
+Hu Zheng <huzheng_001@163.com>
+http://forlinux.yeah.net
+
+2003.11.11
+
diff --git a/misc/stardict-tools/README.sd b/misc/stardict-tools/README.sd
new file mode 100644
index 0000000000..46eac983fe
--- /dev/null
+++ b/misc/stardict-tools/README.sd
@@ -0,0 +1,111 @@
+
+sd: the dictionaries collections manager for StarDict
+
+
+The sd script allows you to use interchangeably any number of the collections of the dictionaries with StarDict. Theoretically the groups or the trees of the dictionaries should serve these purposes but I prefer simpler solutions so I did not try too hard to define these groups or trees. I wrote instead the sd script.
+
+I use StarDict with 63 different dictionaries, lexicons, and encyclopedias separated into five main groups: German (de), English (en), French (fr), Polish (pl), and Russian (ru). It is not possible to run them all at the same time because it is too much for this program.
+
+So I prepared five subdirectories in the /usr/share/stardict/ directory:
+
+ dic.de
+ dic.en
+ dic.fr
+ dic.pl
+ dic.ru
+
+Each of them contains the dictionaries for the respective languages.
+
+
+1. Changing the privileges:
+
+In order to be able to switch your collections as a regular user change the group and the mode of the /usr/share/stardict/ directory using the commands:
+
+ chgrp users /usr/share/stardict
+ chmod 775 /usr/share/stardict
+
+These commands are stored at the beginning of the sd script. So uncomment them, run the script as root, and comment these commands back. From now on you may use this script as a regular user.
+
+
+2. Preparing the template configuration file:
+
+Make sure that there is no stardict.cfg file in the ~/.stardict directory and there is no dic subdirectory in the /usr/share/stardict/ directory. Then run StarDict for the first time, set all options according to your preferences, and exit StarDict.
+
+Next prepare the template configuration file using the commands:
+
+ cd ~/.stardict
+ mv stardict.cfg stardict.cfg.template
+
+
+3. Preparing the collections:
+
+Go to the /usr/share/stardict/ directory and make the subdirectories for your collections using the following naming convention:
+
+ dic.NAME1
+ dic.NAME2
+ dic.NAME3
+
+for example:
+
+ dic.de
+ dic.en
+ dic.fr
+
+Then copy the appropriate dictionaries into the right subdirectories. Do not use the dic subdirectory at all.
+
+
+4. Preparing the configuration files:
+
+Use the commands such as:
+
+ sd NAME
+
+to copy the template configuration file to the current configuration file.
+
+Then run StarDict, sort the dictionaries, and exit StarDict.
+
+Finally move the current configuration file into the right file:
+
+ cd ~/.stardict
+ mv stardict.cfg stardict.cfg.NAME
+
+Repeat these steps for all your collections. As a result at the end you should have in the ~/.stardict directory the files such as:
+
+ stardict.cfg.de
+ stardict.cfg.en
+ stardict.cfg.fr
+
+
+5. Testing the configuration:
+
+$ sd
+dic -> dic.en
+dic.de
+dic.en
+dic.fr
+
+In the above case the dic symbolic link points the dic.en collection.
+
+
+6. Switching the collection:
+
+$ sd fr
+dic -> dic.fr
+Dictionnaire Littre, 1877 (Fr-Fr)
+Dictionnaire de l'Academie Francaise, 8eme edition, 1935 (Fr-Fr)
+
+In the above case the dic symbolic link was changed to point the dic.fr collection including two dictionaries.
+
+
+7. Checking the dictionaries:
+
+$ sd de ?
+English - German 2.4.2 (En-Ge)
+FreeDict English - German 2.4.2 (Ge-En)
+FreeDict German - English 2.4.2 (Ge-En)
+German - English 2.4.2 (Ge-En)
+Neolingus Niemiecko - Polski 2.4.2 (Ge-Pl)
+Neolingus Polsko - Niemiecki 2.4.2 (Pl-Ge)
+
+There are six German dictionaries in the dic.de collection.
+
diff --git a/misc/stardict-tools/sd b/misc/stardict-tools/sd
new file mode 100644
index 0000000000..c5592b2b71
--- /dev/null
+++ b/misc/stardict-tools/sd
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# sd: the dictionaries collections manager for StarDict
+
+#
+# RUN THE BELOW COMMAND ONCE AS ROOT
+#
+
+# chgrp users /usr/share/stardict ; chmod 775 /usr/share/stardict ; exit
+
+#
+# RUN THE ABOVE COMMAND ONCE AS ROOT
+#
+
+if [ "$1" == "" ]
+then
+ cd /usr/share/stardict/
+ ls -l | grep '\->' | sed 's/.* dic \->/dic ->/'
+ ls | grep '^dic\.'
+elif [ "$1" == "?" ]
+then
+ cd /usr/share/stardict/
+ for d in dic.*
+ do
+ echo
+ ls -l | grep $d | sed 's/.* dic/dic/'
+ ls -1 /usr/share/stardict/$d
+ done
+elif [ "$2" == "?" ]
+then
+ if [ -e /usr/share/stardict/dic.$1 ]
+ then
+ ls -1 /usr/share/stardict/dic.$1
+ else
+ echo "There is no /usr/share/stardict/dic.$1."
+ fi
+elif [ -e /usr/share/stardict/dic.$1 ]
+then
+ if [ "$(ps ax | grep 'stardict' | grep -v 'grep')" != "" ]
+ then
+ killall stardict
+ fi
+ cd /usr/share/stardict/
+ rm dic
+ ln -s dic.$1 dic
+ cd
+ if [ ! -e ~/.stardict/stardict.cfg.$1 ]
+ then
+ cp ~/.stardict/stardict.cfg.template ~/.stardict/stardict.cfg.$1
+ fi
+ cp ~/.stardict/stardict.cfg.$1 ~/.stardict/stardict.cfg
+ ls -l /usr/share/stardict/ | grep '\->' | sed 's/.* dic \->/dic ->/'
+ ls -1 /usr/share/stardict/dic.$1
+else
+ echo "There is no /usr/share/stardict/dic.$1."
+fi
+
diff --git a/misc/stardict-tools/slack-desc b/misc/stardict-tools/slack-desc
new file mode 100644
index 0000000000..5c96f703e4
--- /dev/null
+++ b/misc/stardict-tools/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+stardict-tools: stardict-tools (tool for stardict)
+stardict-tools:
+stardict-tools: This package contains some tools for StarDict:
+stardict-tools:
+stardict-tools: https://code.google.com/p/stardictproject/
+stardict-tools:
+stardict-tools: Restart StarDict after using any converter.
+stardict-tools:
+stardict-tools: Slackware version of stardict-tools is patched
+stardict-tools: against the compilation errors.
+stardict-tools:
diff --git a/misc/stardict-tools/stardict-tools.SlackBuild b/misc/stardict-tools/stardict-tools.SlackBuild
new file mode 100644
index 0000000000..ae3c373c68
--- /dev/null
+++ b/misc/stardict-tools/stardict-tools.SlackBuild
@@ -0,0 +1,115 @@
+#!/bin/sh
+
+# Slackware build script for stardict-tools
+# Written by Cezary M. Kruk (c.kruk@bigfoot.com)
+
+PRGNAM=stardict-tools
+VERSION=${VERSION:-3.0.1}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar -xvf $CWD/$PRGNAM-$VERSION.tar.bz2
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+patch -p0 < $CWD/stardict-tools.patch
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --enable-static=no \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+mkdir -p $PKG/usr/bin
+cd src
+cp -a \
+ 21shiji dictbuilder exc2i2e kingsoft soothill wikipedia \
+ 21tech dictd2dic fest2dict mova stardict-editor wikipediaImage \
+ KangXi directory2dic frgb2utf myspell2dic stardict2txt wordnet \
+ Unihan directory2treedic gmx2utf olddic2newdic stardict_dict_update wquick2dic \
+ babylon downloadwiki i2e2dict ooo2dict stardict_verify wubi \
+ bgl2txt dsl2dict jdictionary oxford2dic tabfile xiaoxuetang-ja \
+ buddhist duden jpgb2utf powerword tabfile2sql xmlinout \
+ cedict ec50 kanjidic2 pydict2dic testutf8 ydp2dict \
+ degb2utf edict kdic rucn treedict2dir \
+ $PKG/usr/bin
+cd -
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a AUTHORS COPYING ChangeLog INSTALL README $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples
+cd src
+cp -a Po2Tab.zip example.ifo example_treedict.tar.bz2 \
+ $PKG/usr/doc/$PRGNAM-$VERSION/examples
+cd -
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/scripts
+cd src
+cp -a \
+ KangXiZiDian-djvu2tiff.py hanzim2dict.py makevietdict.py ooo.sh \
+ dictd2dic.sh i2e.sh mkguangyunst.py parse-oxford.perl \
+ exc.sh jm2stardict.py myspell.sh stmerge.py \
+ extractKangXi.py lingea-trd-decoder.py ncce2stardict.pl uyghur2dict.py \
+ $PKG/usr/doc/$PRGNAM-$VERSION/scripts
+cd -
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/contrib
+cp -a $CWD/sd $CWD/README.sd $PKG/usr/doc/$PRGNAM-$VERSION/contrib
+
+cp -a $CWD/README.StarDict $PKG/usr/doc/$PRGNAM-$VERSION
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/misc/stardict-tools/stardict-tools.info b/misc/stardict-tools/stardict-tools.info
new file mode 100644
index 0000000000..a93770fe88
--- /dev/null
+++ b/misc/stardict-tools/stardict-tools.info
@@ -0,0 +1,10 @@
+PRGNAM="stardict-tools"
+VERSION="3.0.1"
+HOMEPAGE="https://code.google.com/p/stardictproject/"
+DOWNLOAD="https://stardictproject.googlecode.com/files/stardict-tools-3.0.1.tar.bz2"
+MD5SUM="1d78c5da68080368b854278cdf56b8da"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Cezary M. Kruk"
+EMAIL="c.kruk@bigfoot.com"
diff --git a/misc/stardict-tools/stardict-tools.patch b/misc/stardict-tools/stardict-tools.patch
new file mode 100644
index 0000000000..e7b5aa7243
--- /dev/null
+++ b/misc/stardict-tools/stardict-tools.patch
@@ -0,0 +1,172 @@
+Author: Cezary M. Kruk <c.kruk@bigfoot.com>
+Date: 2014-11-06
+Package: stardict-tools
+Version: 3.0.1
+Origin: https://code.google.com/p/stardict-3/downloads/list/stardict-3.0.1.tar.bz2
+Description: fixes things up for gcc-4.8.2
+
+diff -us src/KangXi.cpp src/KangXi.cpp
+--- src/KangXi.cpp 2007-07-10 09:16:06.000000000 +0200
++++ src/KangXi.cpp 2014-11-06 04:08:47.000000000 +0100
+@@ -6,6 +6,9 @@
+ #include <list>
+ #include <string>
+
++#include <cstring>
++using std::strrchr;
++
+ static int hexalpha_to_int(int c)
+ {
+ char hexalpha[] = "aAbBcCdDeEfF";
+@@ -57,7 +60,7 @@
+ gchar utf8[7];
+ gint n = g_unichar_to_utf8(uc, utf8);
+ utf8[n] = '\0';
+- char *p;
++ const char *p;
+ p = strchr(line, '\t');
+ if (!p) {
+ g_print("Error: %s\n", line);
+diff -us src/Unihan.cpp src/Unihan.cpp
+--- src/Unihan.cpp 2007-07-10 09:16:06.000000000 +0200
++++ src/Unihan.cpp 2014-11-06 04:15:20.000000000 +0100
+@@ -57,13 +57,13 @@
+ }
+ const char *han = line+2;
+
+- char *p;
++ const char *p;
+ p = strchr(han, '\t');
+ if (!p) {
+ g_print("Error: %s\n", line);
+ return;
+ }
+- *p = '\0';
++ p = '\0';
+ p++;
+ const char *key = p;
+
+@@ -72,7 +72,7 @@
+ g_print("Error: %s\n", line);
+ return;
+ }
+- *p = '\0';
++ p = '\0';
+ p++;
+ const char *def = p;
+
+diff -us src/bgl2txt.cpp src/bgl2txt.cpp
+--- src/bgl2txt.cpp 2007-08-01 05:00:02.000000000 +0200
++++ src/bgl2txt.cpp 2014-11-06 04:20:23.000000000 +0100
+@@ -1,5 +1,8 @@
+ #include "libbgl2txt.h"
+
++#include <string.h>
++#include <stdio.h>
++
+ int main(int argc, char * argv[])
+ {
+ if (argc<2) {
+diff -us src/bgl_babylon.cpp src/bgl_babylon.cpp
+--- src/bgl_babylon.cpp 2007-08-16 07:14:35.000000000 +0200
++++ src/bgl_babylon.cpp 2014-11-06 05:02:40.090014886 +0100
+@@ -25,6 +25,8 @@
+ #include <glib/gstdio.h>
+ #include <iconv.h>
+
++#include <string.h>
++
+ #ifdef _WIN32
+ #include <io.h>
+ #define DUP _dup
+diff -us src/bgl_stardictbuilder.cpp src/bgl_stardictbuilder.cpp
+--- src/bgl_stardictbuilder.cpp 2007-09-05 05:48:06.000000000 +0200
++++ src/bgl_stardictbuilder.cpp 2014-11-06 05:03:42.639927341 +0100
+@@ -23,6 +23,9 @@
+ #include <iostream>
+ #include <glib.h>
+
++#include <cstring>
++using std::strrchr;
++
+ StarDictBuilder::StarDictBuilder( std::string filename )
+ {
+ const char *p = strrchr(filename.c_str(), G_DIR_SEPARATOR);
+diff -us src/dictbuilder.cpp src/dictbuilder.cpp
+--- src/dictbuilder.cpp 2007-07-10 09:16:06.000000000 +0200
++++ src/dictbuilder.cpp 2014-11-06 03:36:56.000000000 +0100
+@@ -14,6 +14,9 @@
+
+ #include "dictbuilder-tree.h"
+
++#include <string.h>
++#include <stdio.h>
++
+ struct sectionEntry
+ {
+ char sign;
+diff -us src/libbgl2txt.cpp src/libbgl2txt.cpp
+--- src/libbgl2txt.cpp 2007-08-01 05:01:10.000000000 +0200
++++ src/libbgl2txt.cpp 2014-11-06 05:04:31.950070070 +0100
+@@ -2,6 +2,9 @@
+ #include "bgl_babylonreader.h"
+ #include "bgl_stardictbuilder.h"
+
++#include <cstring>
++using std::strrchr;
++
+ void convert_bglfile(std::string infile, std::string source_charset, std::string target_charset)
+ {
+ std::string outfile;
+diff -us src/tabfile2sql.cpp src/tabfile2sql.cpp
+--- src/tabfile2sql.cpp 2007-08-15 07:56:06.000000000 +0200
++++ src/tabfile2sql.cpp 2014-11-06 03:38:08.000000000 +0100
+@@ -9,6 +9,9 @@
+
+ #include <string>
+
++#include <cstring>
++using std::strrchr;
++
+ void print_info(const char *info)
+ {
+ g_print("%s", info);
+diff -us src/wordnet.cpp src/wordnet.cpp
+--- src/wordnet.cpp 2007-09-10 09:49:15.000000000 +0200
++++ src/wordnet.cpp 2014-11-06 05:08:15.152193594 +0100
+@@ -3,6 +3,7 @@
+ #include <glib.h>
+ #include <string>
+
++#include <string.h>
+
+ static int hexalpha_to_int(int c)
+ {
+@@ -42,12 +43,12 @@
+ return answer;
+ }
+
+-void convert(std::string &filename, std::string &content)
++int convert(std::string &filename, std::string &content)
+ {
+ gchar *contents;
+ if (!g_file_get_contents(filename.c_str(), &contents, NULL, NULL)) {
+ g_print("Open file %s failed!\n", filename.c_str());
+- return;
++// return;
+ }
+ char *p, *p1, *p2, *p3, *p4;
+ p = contents;
+diff -us src/wubi.cpp src/wubi.cpp
+--- src/wubi.cpp 2007-07-10 09:16:06.000000000 +0200
++++ src/wubi.cpp 2014-11-06 04:18:16.000000000 +0100
+@@ -6,6 +6,9 @@
+ #include <glib.h>
+ #include <string>
+
++#include <cstring>
++#include <cstdlib>
++
+ void convert(const char *filename)
+ {
+ struct stat stats;