main.aap 2.7 KB

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