main.aap 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Aap recipe for French Vim spell files.
  2. # Use a freshly compiled Vim if it exists.
  3. @if os.path.exists('../../../src/vim'):
  4. VIM = ../../../src/vim
  5. @else:
  6. :progsearch VIM vim
  7. SPELLDIR = ..
  8. FILES = fr_FR.aff fr_FR.dic
  9. all: $SPELLDIR/fr.latin1.spl $SPELLDIR/fr.utf-8.spl ../README_fr.txt
  10. # The spell file is iso-8859-15, but Vim normally uses "latin1" for this.
  11. # This is OK for the utf-8 files, but for latin1 we need to avoid the "oe"
  12. # character. When unpacking we create four files:
  13. # fr_FR_latin1.aff modified file
  14. # fr_FR_latin1.dic modified file
  15. # fr_FR_iso15.aff original file (after applying diff)
  16. # fr_FR_iso15.dic original file (after applying diff)
  17. # Just before using the dictionary files, the right ones are copied to
  18. # fr_FR.aff
  19. # fr_FR.dic
  20. $SPELLDIR/fr.latin1.spl : $FILES
  21. :copy {force} fr_FR_latin1.aff fr_FR.aff
  22. :copy {force} fr_FR_latin1.dic fr_FR.dic
  23. :sys env LANG=fr_FR.ISO-8859-15@euro
  24. $VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q
  25. $SPELLDIR/fr.utf-8.spl : $FILES
  26. :copy {force} fr_FR_iso15.aff fr_FR.aff
  27. :copy {force} fr_FR_iso15.dic fr_FR.dic
  28. :sys env LANG=fr_FR.UTF-8
  29. $VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q
  30. ../README_fr.txt : README_fr_FR.txt
  31. :cat $source >!$target
  32. #
  33. # Used to fetch the files from OpenOffice.org. Those are old.
  34. # Later versions are elsewhere.
  35. #
  36. #OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
  37. ZIPFILE = http://dico.savant.free.fr/_download/fr_FR_1-1-6.zip
  38. :attr {fetch = $ZIPFILE} fr_FR.zip
  39. # The files don't depend on the .zip file so that we can delete it.
  40. # Only download the zip file if the targets don't exist.
  41. fr_FR.aff fr_FR.dic: {buildcheck=}
  42. :assertpkg unzip patch
  43. :fetch fr_FR.zip
  44. :sys $UNZIP fr_FR.zip
  45. :delete fr_FR.zip
  46. @if not os.path.exists('fr_FR.orig.aff'):
  47. :copy fr_FR.aff fr_FR.orig.aff
  48. @if not os.path.exists('fr_FR.orig.dic'):
  49. :copy fr_FR.dic fr_FR.orig.dic
  50. @if os.path.exists('fr_FR.diff'):
  51. :sys patch <fr_FR.diff
  52. # Keep the unmodified files (after diff) for ISO-8859-15.
  53. :copy fr_FR.aff fr_FR_iso15.aff
  54. :copy fr_FR.dic fr_FR_iso15.dic
  55. # For the latin1 .dic file change all the "oe" characters to the two
  56. # characters "oe".
  57. :sys $VIM -u NONE -e -c "set enc=latin1"
  58. -c "e fr_FR.dic"
  59. -c "%s/½/oe/g"
  60. -c "w! fr_FR_latin1.dic"
  61. -c q
  62. # For the latin1 .aff file delete all the "oe" and "OE" characters and
  63. # delete the REP lines with those characters.
  64. :sys $VIM -u NONE -e -c "set enc=latin1"
  65. -c "e fr_FR.aff"
  66. -c "%s/½//g"
  67. -c "%s/¼//g"
  68. -c "%g/REP.*oe/d"
  69. -c "w! fr_FR_latin1.aff"
  70. -c q
  71. # Generate diff files, so that others can get the OpenOffice files and apply
  72. # the diffs to get the Vim versions.
  73. # This uses the iso-8859-15 files.
  74. diff:
  75. :assertpkg diff
  76. :copy {force} fr_FR_iso15.aff fr_FR.aff
  77. :copy {force} fr_FR_iso15.dic fr_FR.dic
  78. :sys {force} diff -a -C 1 fr_FR.orig.aff fr_FR.aff >fr_FR.diff
  79. :sys {force} diff -a -C 1 fr_FR.orig.dic fr_FR.dic >>fr_FR.diff
  80. # Delete all the unpacked and generated files, including the "orig" files.
  81. clean:
  82. :delete {force} fr_FR.zip fr_FR.aff fr_FR.dic
  83. fr_FR.aff.orig fr_FR.dic.orig
  84. fr_FR.orig.aff fr_FR.orig.dic
  85. fr_FR_latin1.aff fr_FR_latin1.dic
  86. fr_FR_iso15.aff fr_FR_iso15.dic
  87. README_fr_FR.txt
  88. # Check for updated OpenOffice spell files. When there are changes the
  89. # ".new.aff" and ".new.dic" files are left behind for manual inspection.
  90. check:
  91. :assertpkg unzip diff
  92. :fetch fr_FR.zip
  93. :mkdir tmp
  94. :cd tmp
  95. @try:
  96. @import stat
  97. :sys $UNZIP ../fr_FR.zip
  98. :sys {force} diff ../fr_FR.orig.aff fr_FR.aff >d
  99. @if os.stat('d')[stat.ST_SIZE] > 0:
  100. :copy fr_FR.aff ../fr_FR.new.aff
  101. :sys {force} diff ../fr_FR.orig.dic fr_FR.dic >d
  102. @if os.stat('d')[stat.ST_SIZE] > 0:
  103. :copy fr_FR.dic ../fr_FR.new.dic
  104. @finally:
  105. :cd ..
  106. :delete {r}{f}{q} tmp
  107. :delete fr_FR.zip
  108. # vim: set sts=4 sw=4 :