mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.1 KiB

  1. #!/usr/bin/perl
  2. #
  3. # re-run this scrip if hosted_freedict.txt has changed
  4. # generates hosted_freedict.{desc,sel,cfg}
  5. #
  6. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  7. #
  8. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  9. # Please add additional copyright information _after_ the line containing
  10. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  11. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  12. #
  13. # ROCK Linux: rock-src/package/import/freedict/hosted_freedict.pl
  14. # ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
  15. #
  16. # This program is free software; you can redistribute it and/or modify
  17. # it under the terms of the GNU General Public License as published by
  18. # the Free Software Foundation; either version 2 of the License, or
  19. # (at your option) any later version. A copy of the GNU General Public
  20. # License can be found at Documentation/COPYING.
  21. #
  22. # Many people helped and are helping developing ROCK Linux. Please
  23. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  24. # file for details.
  25. #
  26. # --- ROCK-COPYRIGHT-NOTE-END ---
  27. my $baseurl="http://dl.sourceforge.net/sourceforge/freedict/";
  28. my %hosted;
  29. my %lang=(
  30. afr => 'Afrikaans',
  31. cro => 'Croatian',
  32. cze => 'Czech',
  33. dan => 'Danish',
  34. nld => 'Dutch',
  35. eng => 'English',
  36. deu => 'German',
  37. fra => 'French',
  38. ara => 'Arabic',
  39. hin => 'Hindi',
  40. hun => 'Hungarian',
  41. iri => 'Irish',
  42. ita => 'Italian',
  43. lat => 'Latin',
  44. por => 'Portuguese',
  45. rom => 'Romanian',
  46. rus => 'Russian',
  47. sco => 'Scottish',
  48. slo => 'Slovak',
  49. spa => 'Spanish',
  50. swa => 'Swahili',
  51. swe => 'Swedish',
  52. wel => 'Welsh',
  53. jpn => 'Japanese',
  54. kha => 'Khasi',
  55. scr => 'Serbo-Croat',
  56. tur => 'Turkish' );
  57. open(F, "hosted_freedict.txt") || die $!;
  58. while (<F>) {
  59. chomp;
  60. next if /^#/ or /^\s*$/;
  61. my ($d,$v)=split /\s+/ , $_, 2;
  62. $hosted{$d}=$v;
  63. }
  64. close F;
  65. open(D, ">hosted_freedict.desc") || die $!;
  66. open(S, ">hosted_freedict.sel") || die $!;
  67. open(C, ">hosted_freedict.cfg") || die $!;
  68. print D "# Auto-generated by hosted_freedict.pl from hosted_freedict.txt\n";
  69. print S "# Auto-generated by hosted_freedict.pl from hosted_freedict.txt\n";
  70. print C "# Auto-generated by hosted_freedict.pl from hosted_freedict.txt\n";
  71. print S "\ncase \"\$xpkg\" in\n";
  72. print D "\n";
  73. print C "\n";
  74. foreach my $dict ( sort keys %hosted ){
  75. my $f="$dict.tar.gz";
  76. $f="freedict-$dict-$hosted{$dict}.tar.gz" if $dict eq "eng-ara";
  77. my $ydict=uc $dict;
  78. $ydict=~ s/\-/_/g;
  79. my ($sl,$tl)=split /\-/, $dict;
  80. $sl=$lang{$sl};
  81. $tl=$lang{$tl};
  82. print D "#if xpkg == freedict-$dict\n";
  83. print D "[V] $hosted{$dict}\n";
  84. print D "[D] 0 $f $baseurl\n";
  85. print D "#endif\n\n";
  86. $f =~ s/\.gz$/.bz2/;
  87. print S "\tfreedict-$dict)\n";
  88. print S "\t\tfreedict=\"$dict\"\n";
  89. print S "\t\tfreedictver=\"$hosted{$dict}\"\n";
  90. print S "\t\tsrctar=\"$f\"\n";
  91. print S "\t\t;;\n";
  92. print C "bool 'Building package freedict-$dict ($sl-$tl)' ROCKCFG_PKG_FREEDICT_$ydict 1\n";
  93. print C "if [ \$ROCKCFG_PKG_FREEDICT_$ydict = 1 ]; then pkgfork freedict freedict-$dict priority 700.000; fi\n\n"
  94. }
  95. print S "esac\n\n";
  96. close D; close S;
  97. close C;