bootstrap 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. #! /bin/sh
  2. # Bootstrap 'tar' from CVS.
  3. # Copyright (C) 2003, 2004 Free Software Foundation, Inc.
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. # 02111-1307, USA.
  16. # Written by Paul Eggert.
  17. # URL of our text domain page in Translation Project
  18. TP_URL="http://www2.iro.umontreal.ca/~gnutra/po/maint/tar/"
  19. usage() {
  20. cat <<EOF
  21. usage: $0 [--gnulib-srcdir=DIR][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
  22. Options are:
  23. --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
  24. sources reside. Use this if you already
  25. have gnulib sources on your machine, and
  26. do not want to waste your bandwidth dowloading
  27. them again.
  28. --cvs-auth=METHOD Set the CVS access method used for downloading
  29. gnulib files. METHOD is one of the keywords
  30. accepted by cvs -d option (see info cvs
  31. repository).
  32. --cvs-user=USERNAME Set the CVS username to be used when accessing
  33. the gnulib repository.
  34. --no-po Do not download po files.
  35. --update-po[=LANG] Update po file(s) and exit.
  36. Running without arguments will suffice in most cases. It is equivalent
  37. to
  38. ./bootstrap --cvs-auth=ext --cvs-user=anoncvs
  39. EOF
  40. }
  41. update_po() {
  42. if [ $# = 1 ]; then
  43. case $1 in
  44. *.po) POFILE=$1;;
  45. *) POFILE=${1}.po;;
  46. esac
  47. echo "$0: getting translation for $1..."
  48. wget -C off $TP_URL/$POFILE
  49. else
  50. echo "$0: getting translations into po..."
  51. (cd po &&
  52. rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
  53. wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
  54. ls *.po | sed 's/\.po$//' >LINGUAS
  55. ) || exit
  56. fi
  57. }
  58. # Parse options.
  59. DOWNLOAD_PO=yes
  60. for option
  61. do
  62. case $option in
  63. --help)
  64. usage
  65. exit;;
  66. --gnulib-srcdir=*)
  67. GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
  68. --cvs-auth=*)
  69. CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
  70. --cvs-user=*)
  71. CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
  72. --no-po)
  73. DOWNLOAD_PO=no;;
  74. --update-po=*)
  75. DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
  76. --update-po)
  77. DOWNLOAD_PO=only;;
  78. *)
  79. echo >&2 "$0: $option: unknown option"
  80. exit 1;;
  81. esac
  82. done
  83. case $DOWNLOAD_PO in
  84. only) update_po
  85. exit 0
  86. ;;
  87. no|yes) ;;
  88. *) update_po $DOWNLOAD_PO
  89. exit 0
  90. esac
  91. echo "$0: Bootstrapping CVS tar..."
  92. build_cvs_prefix() {
  93. CVS_PREFIX=:${1}:
  94. if [ "${2}" != - ]; then
  95. CVS_PREFIX=${CVS_PREFIX}${2}@
  96. fi
  97. if [ "$1" = "ext" ]; then
  98. if [ -z "${CVS_RSH}" ]; then
  99. CVS_RSH=ssh
  100. export CVS_RSH
  101. fi
  102. fi
  103. }
  104. # Get gnulib files.
  105. case ${GNULIB_SRCDIR--} in
  106. -)
  107. if [ ! -d gnulib ]; then
  108. echo "$0: getting gnulib files..."
  109. trap exit 1 2 13 15
  110. trap 'rm -fr gnulib; exit 1' 0
  111. case "${CVS_AUTH--}" in
  112. -) build_cvs_prefix ext anoncvs;;
  113. pserver) build_cvs_prefix $CVS_AUTH ${CVS_USER:-anoncvs};;
  114. gserver|server)
  115. build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
  116. ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
  117. *) echo "$0: Unknown CVS access method" >&2
  118. exit 1;;
  119. esac
  120. if [ "${CVS_AUTH--}" = "pserver" ]; then
  121. cvs -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib login || exit
  122. fi
  123. cvs -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
  124. trap 0
  125. fi
  126. GNULIB_SRCDIR=gnulib
  127. esac
  128. <$GNULIB_SRCDIR/gnulib-tool || exit
  129. gnulib_modules='
  130. alloca
  131. argmatch
  132. argp
  133. backupfile
  134. dirname
  135. error
  136. exclude
  137. fileblocks
  138. fnmatch-gnu
  139. ftruncate
  140. full-write
  141. getdate
  142. getline
  143. getopt
  144. getpagesize
  145. gettext
  146. gettime
  147. hash
  148. human
  149. lchown
  150. memset
  151. modechange
  152. obstack
  153. quote
  154. quotearg
  155. rmdir
  156. safe-read
  157. save-cwd
  158. savedir
  159. stdbool
  160. stpcpy
  161. strtol
  162. strtoul
  163. timespec
  164. unlocked-io
  165. utime
  166. xalloc
  167. xalloc-die
  168. xgetcwd
  169. xstrtoumax
  170. '
  171. previous_gnulib_modules=
  172. while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
  173. previous_gnulib_modules=$gnulib_modules
  174. gnulib_modules=`
  175. (echo "$gnulib_modules"
  176. for gnulib_module in $gnulib_modules; do
  177. $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
  178. done) | sort -u
  179. `
  180. done
  181. gnulib_files=`
  182. (for gnulib_module in $gnulib_modules; do
  183. $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
  184. done) | sort -u
  185. `
  186. gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
  187. mkdir -p $gnulib_dirs || exit
  188. for gnulib_file in $gnulib_files; do
  189. dest=$gnulib_file
  190. case $gnulib_file in
  191. m4/codeset.m4) continue;;
  192. m4/intdiv0.m4) continue;;
  193. m4/inttypes-pri.m4) continue;;
  194. m4/isc-posix.m4) continue;;
  195. m4/lcmessage.m4) continue;;
  196. m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
  197. # These will be overwritten by autopoint, which still uses
  198. # old jm_.* macro names, so we have to keep both copies.
  199. m4/ulonglong.m4) dest=m4/ulonglong_gl.m4;;
  200. m4/inttypes_h.m4) dest=m4/inttypes_h_gl.m4;;
  201. m4/stdint_h.m4) dest=m4/stdint_h_gl.m4;;
  202. m4/uintmax_t.m4) dest=m4/uintmax_t_gl.m4;;
  203. esac
  204. rm -f $dest &&
  205. echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
  206. cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
  207. done
  208. echo "$0: Creating m4/gnulib.m4"
  209. (echo "# This file is generated automatically. Please, do not edit."
  210. echo "#"
  211. echo "AC_DEFUN([tar_GNULIB],["
  212. for gnulib_module in $gnulib_modules; do
  213. echo "# $gnulib_module"
  214. $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
  215. done | sed '/AM_GNU_GETTEXT/d'
  216. echo "])") > ./m4/gnulib.m4
  217. echo "$0: Creating lib/Makefile.am"
  218. (cat lib/Makefile.tmpl
  219. for gnulib_module in $gnulib_modules; do
  220. echo "# $gnulib_module"
  221. $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
  222. done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
  223. # Get translations.
  224. if test "$DOWNLOAD_PO" = "yes"; then
  225. update_po
  226. fi
  227. # Reconfigure, getting other files.
  228. echo "$0: autoreconf --verbose --install --force ..."
  229. autoreconf --verbose --install --force
  230. echo "$0: done. Now you can run './configure'."