bootstrap 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 Update po files 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. echo "$0: getting translations into po..."
  43. (cd po &&
  44. rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
  45. wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
  46. ls *.po | sed 's/\.po$//' >LINGUAS
  47. ) || exit
  48. }
  49. # Parse options.
  50. DOWNLOAD_PO=yes
  51. for option
  52. do
  53. case $option in
  54. --help)
  55. usage
  56. exit;;
  57. --gnulib-srcdir=*)
  58. GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
  59. --cvs-auth=*)
  60. CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
  61. --cvs-user=*)
  62. CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
  63. --no-po)
  64. DOWNLOAD_PO=no;;
  65. --update-po)
  66. DOWNLOAD_PO=only;;
  67. *)
  68. echo >&2 "$0: $option: unknown option"
  69. exit 1;;
  70. esac
  71. done
  72. if [ "$DOWNLOAD_PO" = "only" ]; then
  73. update_po
  74. exit 0
  75. fi
  76. echo "$0: Bootstrapping CVS tar..."
  77. build_cvs_prefix() {
  78. CVS_PREFIX=:${1}:
  79. if [ "${2}" != - ]; then
  80. CVS_PREFIX=${CVS_PREFIX}${2}@
  81. fi
  82. if [ "$1" = "ext" ]; then
  83. if [ -z "${CVS_RSH}" ]; then
  84. CVS_RSH=ssh
  85. export CVS_RSH
  86. fi
  87. fi
  88. }
  89. # Get gnulib files.
  90. case ${GNULIB_SRCDIR--} in
  91. -)
  92. if [ ! -d gnulib ]; then
  93. echo "$0: getting gnulib files..."
  94. trap exit 1 2 13 15
  95. trap 'rm -fr gnulib; exit 1' 0
  96. case "${CVS_AUTH--}" in
  97. -) build_cvs_prefix ext anoncvs;;
  98. pserver) build_cvs_prefix $CVS_AUTH ${CVS_USER:-anoncvs};;
  99. gserver|server)
  100. build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
  101. ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
  102. *) echo "$0: Unknown CVS access method" >&2
  103. exit 1;;
  104. esac
  105. if [ "${CVS_AUTH--}" = "pserver" ]; then
  106. cvs -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib login || exit
  107. fi
  108. cvs -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
  109. trap 0
  110. fi
  111. GNULIB_SRCDIR=gnulib
  112. esac
  113. <$GNULIB_SRCDIR/gnulib-tool || exit
  114. gnulib_modules='
  115. alloca
  116. argmatch
  117. argp
  118. backupfile
  119. dirname
  120. error
  121. exclude
  122. fileblocks
  123. fnmatch-gnu
  124. ftruncate
  125. full-write
  126. getdate
  127. getline
  128. getopt
  129. gettext
  130. gettime
  131. hash
  132. human
  133. lchown
  134. memset
  135. modechange
  136. obstack
  137. quote
  138. quotearg
  139. rmdir
  140. safe-read
  141. save-cwd
  142. savedir
  143. stdbool
  144. stpcpy
  145. strtol
  146. strtoul
  147. timespec
  148. unlocked-io
  149. utime
  150. xalloc
  151. xgetcwd
  152. xstrtoumax
  153. '
  154. previous_gnulib_modules=
  155. while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
  156. previous_gnulib_modules=$gnulib_modules
  157. gnulib_modules=`
  158. (echo "$gnulib_modules"
  159. for gnulib_module in $gnulib_modules; do
  160. $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
  161. done) | sort -u
  162. `
  163. done
  164. gnulib_files=`
  165. (for gnulib_module in $gnulib_modules; do
  166. $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
  167. done) | sort -u
  168. `
  169. gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
  170. mkdir -p $gnulib_dirs || exit
  171. for gnulib_file in $gnulib_files; do
  172. dest=$gnulib_file
  173. case $gnulib_file in
  174. m4/codeset.m4) continue;;
  175. m4/intdiv0.m4) continue;;
  176. m4/inttypes-pri.m4) continue;;
  177. m4/isc-posix.m4) continue;;
  178. m4/lcmessage.m4) continue;;
  179. m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
  180. # These will be overwritten by autopoint, which still uses
  181. # old jm_.* macro names, so we have to keep both copies.
  182. m4/ulonglong.m4) dest=m4/ulonglong_gl.m4;;
  183. m4/inttypes_h.m4) dest=m4/inttypes_h_gl.m4;;
  184. m4/stdint_h.m4) dest=m4/stdint_h_gl.m4;;
  185. m4/uintmax_t.m4) dest=m4/uintmax_t_gl.m4;;
  186. esac
  187. rm -f $dest &&
  188. echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
  189. cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
  190. done
  191. if [ -d patches ]; then
  192. echo "$0: Patching gnulib"
  193. for file in patches/*.diff
  194. do
  195. patch -p0 < $file
  196. done
  197. fi
  198. echo "$0: Creating m4/gnulib.m4"
  199. (echo "# This file is generated automatically. Please, do not edit."
  200. echo "#"
  201. echo "AC_DEFUN([tar_GNULIB],["
  202. for gnulib_module in $gnulib_modules; do
  203. echo "# $gnulib_module"
  204. $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
  205. done | sed '/AM_GNU_GETTEXT/d'
  206. echo "])") > ./m4/gnulib.m4
  207. echo "$0: Creating lib/Makefile.am"
  208. (cat lib/Makefile.tmpl
  209. for gnulib_module in $gnulib_modules; do
  210. echo "# $gnulib_module"
  211. $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
  212. done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
  213. # Get translations.
  214. if test "$DOWNLOAD_PO" = "yes"; then
  215. update_po
  216. fi
  217. # Reconfigure, getting other files.
  218. echo "$0: autoreconf --verbose --install --force ..."
  219. autoreconf --verbose --install --force
  220. echo "$0: done. Now you can run './configure'."