glib-gettextize 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #! /bin/sh
  2. #
  3. # Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, see <http://www.gnu.org/licenses/>.
  17. #
  18. # - Modified in October 2001 by jacob berkman <jacob@ximian.com> to
  19. # work with glib's Makefile.in.in and po2tbl.sed.in, to not copy in
  20. # intl/, and to not add ChangeLog entries to po/ChangeLog
  21. # This file is meant for authors or maintainers which want to
  22. # internationalize their package with the help of GNU gettext. For
  23. # further information how to use it consult the GNU gettext manual.
  24. echo=echo
  25. progname=$0
  26. force=0
  27. configstatus=0
  28. origdir=`pwd`
  29. usage="\
  30. Usage: glib-gettextize [OPTION]... [package-dir]
  31. --help print this help and exit
  32. --version print version information and exit
  33. -c, --copy copy files instead of making symlinks
  34. -f, --force force writing of new files even if old exist
  35. Report bugs to http://bugzilla.gnome.org/."
  36. package=glib
  37. version=2.48.2
  38. try_ln_s=:
  39. # Directory where the sources are stored.
  40. prefix=/usr
  41. case `uname` in
  42. MINGW32*)
  43. prefix="`dirname $0`/.."
  44. ;;
  45. esac
  46. datarootdir=${prefix}/share
  47. datadir=/usr/share
  48. gettext_dir=$prefix/share/glib-2.0/gettext
  49. while test $# -gt 0; do
  50. case "$1" in
  51. -c | --copy | --c* )
  52. shift
  53. try_ln_s=false ;;
  54. -f | --force | --f* )
  55. shift
  56. force=1 ;;
  57. -r | --run | --r* )
  58. shift
  59. configstatus=1 ;;
  60. --help | --h* )
  61. $echo "$usage"; exit 0 ;;
  62. --version | --v* )
  63. echo "$progname (GNU $package) $version"
  64. $echo "Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
  65. This is free software; see the source for copying conditions. There is NO
  66. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  67. $echo "Written by" "Ulrich Drepper"
  68. exit 0 ;;
  69. -- ) # Stop option prcessing
  70. shift; break ;;
  71. -* )
  72. $echo "glib-gettextize: unknown option $1"
  73. $echo "Try \`glib-gettextize --help' for more information."; exit 1 ;;
  74. * )
  75. break ;;
  76. esac
  77. done
  78. if test $# -gt 1; then
  79. $echo "$usage"
  80. exit 1
  81. fi
  82. # Fill in the command line options value.
  83. if test $# -eq 1; then
  84. srcdir=$1
  85. if cd "$srcdir"; then
  86. srcdir=`pwd`
  87. else
  88. $echo "Cannot change directory to \`$srcdir'"
  89. exit 1
  90. fi
  91. else
  92. srcdir=$origdir
  93. fi
  94. test -f configure.in || test -f configure.ac || {
  95. $echo "Missing configure.in or configure.ac, please cd to your package first."
  96. exit 1
  97. }
  98. configure_in=NONE
  99. if test -f configure.in; then
  100. configure_in=configure.in
  101. else
  102. if test -f configure.ac; then
  103. configure_in=configure.ac
  104. fi
  105. fi
  106. # Check in which directory config.rpath, mkinstalldirs etc. belong.
  107. auxdir=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
  108. if test -n "$auxdir"; then
  109. auxdir="$auxdir/"
  110. fi
  111. if test -f po/Makefile.in.in && test $force -eq 0; then
  112. $echo "\
  113. po/Makefile.in.in exists: use option -f if you really want to delete it."
  114. exit 1
  115. fi
  116. test -d po || {
  117. $echo "Creating po/ subdirectory"
  118. mkdir po || {
  119. $echo "failed to create po/ subdirectory"
  120. exit 1
  121. }
  122. }
  123. # For simplicity we changed to the gettext source directory.
  124. cd $gettext_dir || {
  125. $echo "gettext source directory '${gettext_dir}' doesn't exist"
  126. exit 1
  127. }
  128. # Now copy all files. Take care for the destination directories.
  129. for file in *; do
  130. case $file in
  131. intl | po)
  132. ;;
  133. mkinstalldirs)
  134. rm -f "$srcdir/$auxdir$file"
  135. ($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$auxdir$file" && $echo "Symlinking file $file") 2>/dev/null ||
  136. { $echo "Copying file $file"; cp $file "$srcdir/$auxdir$file"; }
  137. ;;
  138. *)
  139. rm -f "$srcdir/$file"
  140. ($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$file" && $echo "Symlinking file $file") 2>/dev/null ||
  141. { $echo "Copying file $file"; cp $file "$srcdir/$file"; }
  142. ;;
  143. esac
  144. done
  145. # Copy files to po/ subdirectory.
  146. cd po
  147. for file in *; do
  148. rm -f "$srcdir/po/$file"
  149. ($try_ln_s && ln -s $gettext_dir/po/$file "$srcdir/po/$file" && $echo "Symlinking file po/$file") 2>/dev/null ||
  150. { $echo "Copying file po/$file"; cp $file "$srcdir/po/$file"; }
  151. done
  152. if test -f "$srcdir/po/cat-id-tbl.c"; then
  153. $echo "Removing po/cat-id-tbl.c"
  154. rm -f "$srcdir/po/cat-id-tbl.c"
  155. fi
  156. if test -f "$srcdir/po/stamp-cat-id"; then
  157. $echo "Removing po/stamp-cat-id"
  158. rm -f "$srcdir/po/stamp-cat-id"
  159. fi
  160. echo
  161. echo "Please add the files"
  162. echo " codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4"
  163. echo " progtest.m4"
  164. echo "from the $datadir/aclocal directory to your autoconf macro directory"
  165. echo "or directly to your aclocal.m4 file."
  166. echo "You will also need config.guess and config.sub, which you can get from"
  167. echo "ftp://ftp.gnu.org/pub/gnu/config/."
  168. echo
  169. exit 0