bootstrap 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. getpagesize
  130. gettext
  131. gettime
  132. hash
  133. human
  134. lchown
  135. memset
  136. modechange
  137. obstack
  138. quote
  139. quotearg
  140. rmdir
  141. safe-read
  142. save-cwd
  143. savedir
  144. stdbool
  145. stpcpy
  146. strtol
  147. strtoul
  148. timespec
  149. unlocked-io
  150. utime
  151. xalloc
  152. xgetcwd
  153. xstrtoumax
  154. '
  155. previous_gnulib_modules=
  156. while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
  157. previous_gnulib_modules=$gnulib_modules
  158. gnulib_modules=`
  159. (echo "$gnulib_modules"
  160. for gnulib_module in $gnulib_modules; do
  161. $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
  162. done) | sort -u
  163. `
  164. done
  165. gnulib_files=`
  166. (for gnulib_module in $gnulib_modules; do
  167. $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
  168. done) | sort -u
  169. `
  170. gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
  171. mkdir -p $gnulib_dirs || exit
  172. for gnulib_file in $gnulib_files; do
  173. dest=$gnulib_file
  174. case $gnulib_file in
  175. m4/codeset.m4) continue;;
  176. m4/intdiv0.m4) continue;;
  177. m4/inttypes-pri.m4) continue;;
  178. m4/isc-posix.m4) continue;;
  179. m4/lcmessage.m4) continue;;
  180. m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
  181. # These will be overwritten by autopoint, which still uses
  182. # old jm_.* macro names, so we have to keep both copies.
  183. m4/ulonglong.m4) dest=m4/ulonglong_gl.m4;;
  184. m4/inttypes_h.m4) dest=m4/inttypes_h_gl.m4;;
  185. m4/stdint_h.m4) dest=m4/stdint_h_gl.m4;;
  186. m4/uintmax_t.m4) dest=m4/uintmax_t_gl.m4;;
  187. esac
  188. rm -f $dest &&
  189. echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
  190. cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
  191. done
  192. if [ -d patches ]; then
  193. echo "$0: Patching gnulib"
  194. for file in patches/*.diff
  195. do
  196. patch -p0 < $file
  197. done
  198. fi
  199. echo "$0: Creating m4/gnulib.m4"
  200. (echo "# This file is generated automatically. Please, do not edit."
  201. echo "#"
  202. echo "AC_DEFUN([tar_GNULIB],["
  203. for gnulib_module in $gnulib_modules; do
  204. echo "# $gnulib_module"
  205. $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
  206. done | sed '/AM_GNU_GETTEXT/d'
  207. echo "])") > ./m4/gnulib.m4
  208. echo "$0: Creating lib/Makefile.am"
  209. (cat lib/Makefile.tmpl
  210. for gnulib_module in $gnulib_modules; do
  211. echo "# $gnulib_module"
  212. $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
  213. done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
  214. # Get translations.
  215. if test "$DOWNLOAD_PO" = "yes"; then
  216. update_po
  217. fi
  218. # Reconfigure, getting other files.
  219. echo "$0: autoreconf --verbose --install --force ..."
  220. autoreconf --verbose --install --force
  221. echo "$0: done. Now you can run './configure'."