autopoint 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #! /bin/sh -
  2. #
  3. # autopoint: Copies standard gettext infrastructure (lightweight version).
  4. #
  5. # Alternative version for Dragora GNU/Linux-Libre.
  6. # Under the terms of the Apache License version 2.
  7. PROGRAM="${0##*/}"
  8. # A parser function to extract the value of 'AC_CONFIG_AUX_DIR'
  9. aparse()
  10. {
  11. inside='.*'
  12. search='AC_CONFIG_AUX_DIR'
  13. pre='([' stu='])'
  14. export inside search pre stu
  15. awk '#!/usr/bin/awk -f
  16. BEGIN {
  17. npre = length( pre = ENVIRON[ "search" ] ENVIRON[ "pre" ] )
  18. nstu = length( stu = ENVIRON[ "stu" ] )
  19. }
  20. function g( s ) { gsub(/./, "[&]", s); return s }
  21. match( $0, g( pre ) ENVIRON["inside"] g( stu ) ) {
  22. print substr( $0, RSTART + npre, RLENGTH -npre -nstu )
  23. }' "$@"
  24. unset inside search pre
  25. }
  26. # Default directory for gettext infrastructure
  27. DATADIR="${DATADIR:-/usr/share/gettext-tiny}"
  28. # Sanity checks
  29. if test ! -d "$DATADIR"
  30. then
  31. echo "${PROGRAM}: ${DATADIR}: Internal directory does not exist." 1>&2
  32. exit 1
  33. fi
  34. if test "$PWD" = / || test "$PWD" = "$DATADIR"
  35. then
  36. echo "${PROGRAM}: Current working directory is $PWD (forbidden)" 1>&2
  37. exit 1
  38. fi
  39. if test ! -e configure.ac
  40. then
  41. echo "${PROGRAM}: cannot access configure.ac: No such file or directory" 1>&2
  42. exit 1
  43. fi
  44. # Remove write permission for group and other
  45. umask 022
  46. mkdir -p -- m4 intl po
  47. for file in "${DATADIR}/m4"/*.m4
  48. do
  49. cp -f -- "$file" m4/
  50. done
  51. unset file
  52. dirprefix="$(aparse configure.ac)"
  53. mkdir -p -- "$dirprefix"
  54. touch "${dirprefix}/config.rpath" ABOUT-NLS
  55. unset dirprefix
  56. for file in intl/Makefile.in po/Makefile.in.in
  57. do
  58. cp -f "${DATADIR}/data/autopoint_Makefile.in" -- "$file"
  59. chmod 644 -- "$file"
  60. done
  61. unset file
  62. cp -f "${DATADIR}/data/Makevars.template" po/Makevars.template
  63. chmod 644 po/Makevars.template