#!/usr/bin/perl # # re-run this scrip if hosted_freedict.txt has changed # generates hosted_freedict.{desc,sel,cfg} # # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/import/freedict/hosted_freedict.pl # ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at http://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- my $baseurl="http://dl.sourceforge.net/sourceforge/freedict/"; my %hosted; my %lang=( afr => 'Afrikaans', cro => 'Croatian', cze => 'Czech', dan => 'Danish', nld => 'Dutch', eng => 'English', deu => 'German', fra => 'French', ara => 'Arabic', hin => 'Hindi', hun => 'Hungarian', iri => 'Irish', ita => 'Italian', lat => 'Latin', por => 'Portuguese', rom => 'Romanian', rus => 'Russian', sco => 'Scottish', slo => 'Slovak', spa => 'Spanish', swa => 'Swahili', swe => 'Swedish', wel => 'Welsh', jpn => 'Japanese', kha => 'Khasi', scr => 'Serbo-Croat', tur => 'Turkish' ); open(F, "hosted_freedict.txt") || die $!; while () { chomp; next if /^#/ or /^\s*$/; my ($d,$v)=split /\s+/ , $_, 2; $hosted{$d}=$v; } close F; open(D, ">hosted_freedict.desc") || die $!; open(S, ">hosted_freedict.sel") || die $!; open(C, ">hosted_freedict.cfg") || die $!; print D "# Auto-generated by hosted_freedict.pl from hosted_freedict.txt\n"; print S "# Auto-generated by hosted_freedict.pl from hosted_freedict.txt\n"; print C "# Auto-generated by hosted_freedict.pl from hosted_freedict.txt\n"; print S "\ncase \"\$xpkg\" in\n"; print D "\n"; print C "\n"; foreach my $dict ( sort keys %hosted ){ my $f="$dict.tar.gz"; $f="freedict-$dict-$hosted{$dict}.tar.gz" if $dict eq "eng-ara"; my $ydict=uc $dict; $ydict=~ s/\-/_/g; my ($sl,$tl)=split /\-/, $dict; $sl=$lang{$sl}; $tl=$lang{$tl}; print D "#if xpkg == freedict-$dict\n"; print D "[V] $hosted{$dict}\n"; print D "[D] 0 $f $baseurl\n"; print D "#endif\n\n"; $f =~ s/\.gz$/.bz2/; print S "\tfreedict-$dict)\n"; print S "\t\tfreedict=\"$dict\"\n"; print S "\t\tfreedictver=\"$hosted{$dict}\"\n"; print S "\t\tsrctar=\"$f\"\n"; print S "\t\t;;\n"; print C "bool 'Building package freedict-$dict ($sl-$tl)' ROCKCFG_PKG_FREEDICT_$ydict 1\n"; print C "if [ \$ROCKCFG_PKG_FREEDICT_$ydict = 1 ]; then pkgfork freedict freedict-$dict priority 700.000; fi\n\n" } print S "esac\n\n"; close D; close S; close C;