bootstrap 6.0 KB

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