Now Dictd dictionary collection works to full extent.
svn path=/nixpkgs/trunk/; revision=11007
This commit is contained in:
parent
b20aba1d92
commit
07cad2fc45
@ -15,14 +15,7 @@ let
|
|||||||
(x: '' "${x.filename}" '')
|
(x: '' "${x.filename}" '')
|
||||||
dictlist;
|
dictlist;
|
||||||
databases = lib.concatStrings (map (x :
|
databases = lib.concatStrings (map (x :
|
||||||
"
|
"${x.name} ${x.filename}\n") dictlist);
|
||||||
database ${x.name} {
|
|
||||||
data ${x.filename}.dict.dz
|
|
||||||
index ${x.filename}.index
|
|
||||||
index_word ${x.filename}.word
|
|
||||||
index_suffix ${x.filename}.suffix
|
|
||||||
}
|
|
||||||
") dictlist);
|
|
||||||
allow = lib.concatStrings (map (x: "allow ${x}\n") allowList);
|
allow = lib.concatStrings (map (x: "allow ${x}\n") allowList);
|
||||||
deny = lib.concatStrings (map (x: "deny ${x}\n") denyList);
|
deny = lib.concatStrings (map (x: "deny ${x}\n") denyList);
|
||||||
accessSection = "
|
accessSection = "
|
||||||
@ -34,34 +27,45 @@ let
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
ensureDir $out/share/dictd
|
ensureDir $out/share/dictd
|
||||||
cd $out/share/dictd
|
cd $out/share/dictd
|
||||||
|
echo "${databases}" >databases.names
|
||||||
|
echo "${accessSection}" > dictd.conf
|
||||||
for j in ${toString link_arguments}; do
|
for j in ${toString link_arguments}; do
|
||||||
|
name="$(egrep ' '"$j"\$ databases.names)"
|
||||||
|
name=''${name% $j}
|
||||||
if test -d "$j"; then
|
if test -d "$j"; then
|
||||||
if test -d "$j"/share/dictd ; then
|
if test -d "$j"/share/dictd ; then
|
||||||
echo "Got store path $j"
|
echo "Got store path $j"
|
||||||
j="$j"/share/dictd
|
j="$j"/share/dictd
|
||||||
fi
|
fi
|
||||||
echo "Directory reference: $j"
|
echo "Directory reference: $j"
|
||||||
i=$(ls "$j"/*.index)
|
i=$(ls "$j""/"*.index)
|
||||||
i="''${i%.index}";
|
i="''${i%.index}";
|
||||||
else
|
else
|
||||||
i="$j";
|
i="$j";
|
||||||
fi
|
fi
|
||||||
echo "Basename is $i"
|
echo "Basename is $i"
|
||||||
|
locale=$(cat "$(dirname "$i")"/locale)
|
||||||
|
base="$(basename "$i")"
|
||||||
|
echo "Locale is $locale"
|
||||||
|
export LC_ALL=$locale
|
||||||
|
export LANG=$locale
|
||||||
if test -e "$i".dict.dz; then
|
if test -e "$i".dict.dz; then
|
||||||
ln -s "$i".dict.dz
|
ln -s "$i".dict.dz
|
||||||
else
|
else
|
||||||
cp "$i".dict .
|
cp "$i".dict .
|
||||||
dictzip "$(basename "$i")".dict
|
dictzip "$base".dict
|
||||||
fi
|
fi
|
||||||
ln -s "$i".index .
|
ln -s "$i".index .
|
||||||
locale=$(cat "$(dirname "$i")"/locale)
|
dictfmt_index2word --locale $locale < "$base".index > "$base".word || true
|
||||||
LC_ALL=$locale dictfmt_index2word < "$(basename "$i")".index > "$(basename "$i")".word || true
|
dictfmt_index2suffix --locale $locale < "$base".index > "$base".suffix || true
|
||||||
LC_ALL=$locale dictfmt_index2suffix < "$(basename "$i")".index > "$(basename "$i")".suffix || true
|
|
||||||
|
echo "database $name {" >> dictd.conf
|
||||||
|
echo " data $out/share/dictd/$base.dict.dz" >> dictd.conf
|
||||||
|
echo " index $out/share/dictd/$base.index" >> dictd.conf
|
||||||
|
echo " index_word $out/share/dictd/$base.word" >> dictd.conf
|
||||||
|
echo " index_suffix $out/share/dictd/$base.suffix" >> dictd.conf
|
||||||
|
echo "}" >> dictd.conf
|
||||||
done
|
done
|
||||||
echo "${accessSection}" > dictd.conf
|
|
||||||
cat <<EOF >> dictd.conf
|
|
||||||
${databases}
|
|
||||||
EOF
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -36,7 +36,7 @@ fetchurl = (builderDefs {src="";} null).fetchurl;
|
|||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
rec {
|
||||||
nld2eng = makeDictdDBFreedict (fetchurl {
|
nld2eng = makeDictdDBFreedict (fetchurl {
|
||||||
url = http://prdownloads.sourceforge.net/freedict/nld-eng.tar.gz;
|
url = http://prdownloads.sourceforge.net/freedict/nld-eng.tar.gz;
|
||||||
sha256 = "1vhw81pphb64fzsjvpzsnnyr34ka2fxizfwilnxyjcmpn9360h07";
|
sha256 = "1vhw81pphb64fzsjvpzsnnyr34ka2fxizfwilnxyjcmpn9360h07";
|
||||||
@ -57,9 +57,38 @@ in
|
|||||||
url = http://downloads.sourceforge.net/freedict/eng-fra.tar.gz;
|
url = http://downloads.sourceforge.net/freedict/eng-fra.tar.gz;
|
||||||
sha256 = "0fi6rrnbqnhc6lq8d0nmn30zdqkibrah0mxfg27hsn9z7alwbj3m";
|
sha256 = "0fi6rrnbqnhc6lq8d0nmn30zdqkibrah0mxfg27hsn9z7alwbj3m";
|
||||||
}) "eng-fra" "en_UK";
|
}) "eng-fra" "en_UK";
|
||||||
mueller_eng2rus = makeDictdDB (fetchurl {
|
mueller_eng2rus_pkg = makeDictdDB (fetchurl {
|
||||||
url = http://downloads.sourceforge.net/mueller-dict/mueller-dict-3.1.tar.gz;
|
url = http://downloads.sourceforge.net/mueller-dict/mueller-dict-3.1.tar.gz;
|
||||||
sha256 = "04r5xxznvmcb8hkxqbjgfh2gxvbdd87jnhqn5gmgvxxw53zpwfmq";
|
sha256 = "04r5xxznvmcb8hkxqbjgfh2gxvbdd87jnhqn5gmgvxxw53zpwfmq";
|
||||||
}) "mueller-eng-rus" "mueller-dict-*/dict" "en_UK";
|
}) "mueller-eng-rus" "mueller-dict-*/dict" "en_UK";
|
||||||
|
mueller_enru_abbr = {
|
||||||
|
outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-abbrev";
|
||||||
|
name = "mueller-abbr";
|
||||||
|
dbName = "mueller-abbr";
|
||||||
|
locale = "en_UK";
|
||||||
|
};
|
||||||
|
mueller_enru_base = {
|
||||||
|
outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-base";
|
||||||
|
name = "mueller-base";
|
||||||
|
dbName = "mueller-base";
|
||||||
|
locale = "en_UK";
|
||||||
|
};
|
||||||
|
mueller_enru_dict = {
|
||||||
|
outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-dict";
|
||||||
|
name = "mueller-dict";
|
||||||
|
dbName = "mueller-dict";
|
||||||
|
locale = "en_UK";
|
||||||
|
};
|
||||||
|
mueller_enru_geo = {
|
||||||
|
outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-geo";
|
||||||
|
name = "mueller-geo";
|
||||||
|
dbName = "mueller-geo";
|
||||||
|
locale = "en_UK";
|
||||||
|
};
|
||||||
|
mueller_enru_names = {
|
||||||
|
outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-names";
|
||||||
|
name = "mueller-names";
|
||||||
|
dbName = "mueller-names";
|
||||||
|
locale = "en_UK";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user