bootstrap 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. argp
  103. backupfile
  104. dirname
  105. error
  106. exclude
  107. fileblocks
  108. fnmatch-gnu
  109. ftruncate
  110. full-write
  111. getdate
  112. getline
  113. getopt
  114. gettext
  115. gettime
  116. hash
  117. human
  118. lchown
  119. memset
  120. modechange
  121. obstack
  122. quote
  123. quotearg
  124. rmdir
  125. safe-read
  126. save-cwd
  127. savedir
  128. stdbool
  129. stpcpy
  130. strtol
  131. strtoul
  132. timespec
  133. unlocked-io
  134. utime
  135. xalloc
  136. xgetcwd
  137. xstrtoumax
  138. '
  139. previous_gnulib_modules=
  140. while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
  141. previous_gnulib_modules=$gnulib_modules
  142. gnulib_modules=`
  143. (echo "$gnulib_modules"
  144. for gnulib_module in $gnulib_modules; do
  145. $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
  146. done) | sort -u
  147. `
  148. done
  149. gnulib_files=`
  150. (for gnulib_module in $gnulib_modules; do
  151. $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
  152. done) | sort -u
  153. `
  154. gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
  155. mkdir -p $gnulib_dirs || exit
  156. for gnulib_file in $gnulib_files; do
  157. dest=$gnulib_file
  158. case $gnulib_file in
  159. m4/codeset.m4) continue;;
  160. m4/intdiv0.m4) continue;;
  161. m4/inttypes-pri.m4) continue;;
  162. m4/isc-posix.m4) continue;;
  163. m4/lcmessage.m4) continue;;
  164. m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
  165. # These will be overwritten by autopoint, which still uses
  166. # old jm_.* macro names, so we have to keep both copies.
  167. m4/ulonglong.m4) dest=m4/ulonglong_gl.m4;;
  168. m4/inttypes_h.m4) dest=m4/inttypes_h_gl.m4;;
  169. m4/stdint_h.m4) dest=m4/stdint_h_gl.m4;;
  170. m4/uintmax_t.m4) dest=m4/uintmax_t_gl.m4;;
  171. esac
  172. rm -f $dest &&
  173. echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
  174. cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
  175. done
  176. if [ -d patches ]; then
  177. echo "$0: Patching gnulib"
  178. for file in patches/*.diff
  179. do
  180. patch -p0 < $file
  181. done
  182. fi
  183. echo "$0: Creating m4/gnulib.m4"
  184. (echo "# This file is generated automatically. Please, do not edit."
  185. echo "#"
  186. echo "AC_DEFUN([tar_GNULIB],["
  187. for gnulib_module in $gnulib_modules; do
  188. echo "# $gnulib_module"
  189. $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
  190. done | sed '/AM_GNU_GETTEXT/d'
  191. echo "])") > ./m4/gnulib.m4
  192. echo "$0: Creating lib/Makefile.am"
  193. (cat lib/Makefile.tmpl
  194. for gnulib_module in $gnulib_modules; do
  195. echo "# $gnulib_module"
  196. $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
  197. done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
  198. # Get translations.
  199. if test "$DOWNLOAD_PO" = "yes"; then
  200. echo "$0: getting translations into po..."
  201. (cd po &&
  202. rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
  203. wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
  204. ls *.po | sed 's/\.po$//' >LINGUAS
  205. ) || exit
  206. fi
  207. # Reconfigure, getting other files.
  208. echo "$0: autoreconf --verbose --install --force ..."
  209. autoreconf --verbose --install --force
  210. echo "$0: done. Now you can run './configure'."