main.aap 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Aap recipe for Swedish Vim spell files.
  2. #
  3. # Maintainer: Mattias Winther <vim@mattias.winthernet.se>
  4. # Use a freshly compiled Vim if it exists.
  5. @if os.path.exists('../../../src/vim'):
  6. VIM = ../../../src/vim
  7. @else:
  8. :progsearch VIM vim
  9. SPELLDIR = ..
  10. FILES = sv_SE.aff sv_SE.dic
  11. all: $SPELLDIR/sv.latin1.spl $SPELLDIR/sv.utf-8.spl ../README_sv.txt
  12. $SPELLDIR/sv.latin1.spl : $FILES
  13. :sys env LANG=sv_SE.ISO-8859-1
  14. $VIM -u NONE -e -c "mkspell! $SPELLDIR/sv sv_SE" -c q
  15. $SPELLDIR/sv.utf-8.spl : $FILES
  16. :sys env LANG=sv_SE.UTF-8
  17. $VIM -u NONE -e -c "mkspell! $SPELLDIR/sv sv_SE" -c q
  18. ../README_sv.txt : README_sv.txt
  19. :copy $source $target
  20. #
  21. # Fetching the files from OpenOffice.org.
  22. #
  23. OODIR = http://extensions.services.openoffice.org/e-files/1080/7
  24. :attr {fetch = $OODIR/%file%} ooo_swedish_dict_1.43.oxt
  25. # The files don't depend on the .zip file so that we can delete it.
  26. # Only download the zip file if the targets don't exist.
  27. sv_SE.aff sv_SE.dic: {buildcheck=}
  28. :assertpkg unzip patch
  29. :fetch ooo_swedish_dict_1.43.oxt
  30. :sys $UNZIP ooo_swedish_dict_1.43.oxt
  31. :delete ooo_swedish_dict_1.43.oxt
  32. :delete {r} META-INF
  33. :copy dictionaries/sv_SE.aff sv_SE.aff
  34. :copy dictionaries/sv_SE.dic sv_SE.dic
  35. :delete {r} dictionaries dictionaries.xcu description.xml
  36. :delete {f} README_sv.txt
  37. :sys $VIM README_sv.txt -u NONE -N -e -c "0read LICENSE_en_US.txt" -c "read LICENSE_sv_SE.txt" -c "set ff=unix" -c write -c q
  38. :delete LICENSE_en_US.txt LICENSE_sv_SE.txt
  39. @if not os.path.exists('sv_SE.orig.aff'):
  40. :copy sv_SE.aff sv_SE.orig.aff
  41. @if not os.path.exists('sv_SE.orig.dic'):
  42. :copy sv_SE.dic sv_SE.orig.dic
  43. @if os.path.exists('sv_SE.diff'):
  44. :sys patch <sv_SE.diff
  45. # Delete all the generated files, start from scratch
  46. clean:
  47. :delete {f} sv_SE.aff sv_SE.dic
  48. :delete {f} sv_SE.aff.orig sv_SE.dic.orig
  49. :delete {f} sv_SE.orig.aff sv_SE.orig.dic
  50. :delete {f} README_sv.txt
  51. # Generate diff files, so that others can get the OpenOffice files and apply
  52. # the diffs to get the Vim versions.
  53. diff:
  54. :assertpkg diff
  55. :sys {force} diff -a -C 1 sv_SE.orig.aff sv_SE.aff >sv_SE.diff
  56. :sys {force} diff -a -C 1 sv_SE.orig.dic sv_SE.dic >>sv_SE.diff
  57. # Check for updated OpenOffice spell files. When there are changes the
  58. # ".new.aff" and ".new.dic" files are left behind for manual inspection.
  59. check:
  60. :assertpkg unzip diff
  61. :fetch ooo_swedish_dict_1.43.oxt
  62. :mkdir tmp
  63. :cd tmp
  64. @try:
  65. @import stat
  66. :sys $UNZIP ../ooo_swedish_dict_1.43.oxt
  67. :sys {force} diff ../sv_SE.orig.aff sv_SE.aff >d
  68. @if os.stat('d')[stat.ST_SIZE] > 0:
  69. :copy sv_SE.aff ../sv_SE.new.aff
  70. :sys {force} diff ../sv_SE.orig.dic sv_SE.dic >d
  71. @if os.stat('d')[stat.ST_SIZE] > 0:
  72. :copy sv_SE.dic ../sv_SE.new.dic
  73. @finally:
  74. :cd ..
  75. :delete {r}{f}{q} tmp
  76. :delete ooo_swedish_dict_1.43.oxt
  77. # vim: set sts=4 sw=4 :