3
0
Fork 0
forked from mirrors/nixpkgs

Now Dictd dictionary collection works to full extent.

svn path=/nixpkgs/trunk/; revision=11007
This commit is contained in:
Michael Raskin 2008-03-07 07:30:56 +00:00
parent b20aba1d92
commit 07cad2fc45
2 changed files with 53 additions and 20 deletions

View file

@ -15,14 +15,7 @@ let
(x: '' "${x.filename}" '')
dictlist;
databases = lib.concatStrings (map (x :
"
database ${x.name} {
data ${x.filename}.dict.dz
index ${x.filename}.index
index_word ${x.filename}.word
index_suffix ${x.filename}.suffix
}
") dictlist);
"${x.name} ${x.filename}\n") dictlist);
allow = lib.concatStrings (map (x: "allow ${x}\n") allowList);
deny = lib.concatStrings (map (x: "deny ${x}\n") denyList);
accessSection = "
@ -34,34 +27,45 @@ let
installPhase = ''
ensureDir $out/share/dictd
cd $out/share/dictd
echo "${databases}" >databases.names
echo "${accessSection}" > dictd.conf
for j in ${toString link_arguments}; do
name="$(egrep ' '"$j"\$ databases.names)"
name=''${name% $j}
if test -d "$j"; then
if test -d "$j"/share/dictd ; then
echo "Got store path $j"
j="$j"/share/dictd
fi
echo "Directory reference: $j"
i=$(ls "$j"/*.index)
i=$(ls "$j""/"*.index)
i="''${i%.index}";
else
i="$j";
fi
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
ln -s "$i".dict.dz
else
cp "$i".dict .
dictzip "$(basename "$i")".dict
dictzip "$base".dict
fi
ln -s "$i".index .
locale=$(cat "$(dirname "$i")"/locale)
LC_ALL=$locale dictfmt_index2word < "$(basename "$i")".index > "$(basename "$i")".word || true
LC_ALL=$locale dictfmt_index2suffix < "$(basename "$i")".index > "$(basename "$i")".suffix || true
dictfmt_index2word --locale $locale < "$base".index > "$base".word || true
dictfmt_index2suffix --locale $locale < "$base".index > "$base".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
echo "${accessSection}" > dictd.conf
cat <<EOF >> dictd.conf
${databases}
EOF
'';
in

View file

@ -36,7 +36,7 @@ fetchurl = (builderDefs {src="";} null).fetchurl;
in
{
rec {
nld2eng = makeDictdDBFreedict (fetchurl {
url = http://prdownloads.sourceforge.net/freedict/nld-eng.tar.gz;
sha256 = "1vhw81pphb64fzsjvpzsnnyr34ka2fxizfwilnxyjcmpn9360h07";
@ -57,9 +57,38 @@ in
url = http://downloads.sourceforge.net/freedict/eng-fra.tar.gz;
sha256 = "0fi6rrnbqnhc6lq8d0nmn30zdqkibrah0mxfg27hsn9z7alwbj3m";
}) "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;
sha256 = "04r5xxznvmcb8hkxqbjgfh2gxvbdd87jnhqn5gmgvxxw53zpwfmq";
}) "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";
};
}