main.aap 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Aap recipe for Bulgarian 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 = bg_BG.aff bg_BG.dic
  9. all: $SPELLDIR/bg.cp1251.spl $SPELLDIR/bg.utf-8.spl ../README_bg.txt
  10. $SPELLDIR/bg.cp1251.spl : $FILES
  11. :sys env LANG=bg_BG.CP1251 $VIM -u NONE -e -c "mkspell! $SPELLDIR/bg bg_BG" -c q
  12. $SPELLDIR/bg.utf-8.spl : $FILES
  13. :sys env LANG=bg_BG.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/bg bg_BG" -c q
  14. ../README_bg.txt: README_bg_BG.txt
  15. :copy $source $target
  16. #
  17. # Fetching the files from OpenOffice.org.
  18. #
  19. OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
  20. :attr {fetch = $OODIR/%file%} bg_BG.zip
  21. # The files don't depend on the .zip file so that we can delete it.
  22. # Only download the zip file if the targets don't exist.
  23. # This is a bit tricky, since the file name includes the date.
  24. bg_BG.aff bg_BG.dic: {buildcheck=}
  25. :assertpkg unzip patch
  26. :fetch bg_BG.zip
  27. :sys $UNZIP bg_BG.zip
  28. :delete bg_BG.zip
  29. :sys $VIM bg_BG.aff -u NONE -e -c "set ff=unix" -c update -c q
  30. :sys $VIM bg_BG.dic -u NONE -e -c "set ff=unix" -c update -c q
  31. :sys $VIM README_bg_BG.txt -u NONE -e -c "set ff=unix" -c update -c q
  32. @if not os.path.exists('bg_BG.orig.aff'):
  33. :copy bg_BG.aff bg_BG.orig.aff
  34. @if not os.path.exists('bg_BG.orig.dic'):
  35. :copy bg_BG.dic bg_BG.orig.dic
  36. @if os.path.exists('bg_BG.diff'):
  37. :sys patch <bg_BG.diff
  38. # Generate diff files, so that others can get the OpenOffice files and apply
  39. # the diffs to get the Vim versions.
  40. diff:
  41. :assertpkg diff
  42. :sys {force} diff -a -C 1 bg_BG.orig.aff bg_BG.aff >bg_BG.diff
  43. :sys {force} diff -a -C 1 bg_BG.orig.dic bg_BG.dic >>bg_BG.diff
  44. # Check for updated OpenOffice spell files. When there are changes the
  45. # ".new.aff" and ".new.dic" files are left behind for manual inspection.
  46. check:
  47. :assertpkg unzip diff
  48. :fetch bg_BG.zip
  49. :mkdir tmp
  50. :cd tmp
  51. @try:
  52. @import stat
  53. :sys $UNZIP ../bg_BG.zip
  54. :sys {force} diff ../bg_BG.orig.aff bg_BG.aff >d
  55. @if os.stat('d')[stat.ST_SIZE] > 0:
  56. :copy bg_BG.aff ../bg_BG.new.aff
  57. :sys {force} diff ../bg_BG.orig.dic bg_BG.dic >d
  58. @if os.stat('d')[stat.ST_SIZE] > 0:
  59. :copy bg_BG.dic ../bg_BG.new.dic
  60. @finally:
  61. :cd ..
  62. :delete {r}{f}{q} tmp
  63. :delete bg_BG.zip
  64. # vim: set sts=4 sw=4 :