bootstrap 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. #
  3. # bootstrap - update generated files by invoking autoreconf, autogen and perl
  4. # Copyright (C) 2015 Alex Vong
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software Foundation,
  18. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. # Process this file with autoconf to produce a configure script.
  20. # Use error
  21. set -e
  22. ERR_MISSING=127
  23. # Obtain DIRNAME by tranforming `foo/bar' to `foo/'
  24. # Otherwise, assume it is the current working directory
  25. case "$0" in
  26. */*)
  27. DIRNAME=`echo "$0" | sed -e 's/\/[^\/]*$/\//g'`
  28. ;;
  29. *)
  30. DIRNAME='./'
  31. ;;
  32. esac
  33. # Change to the script's directory
  34. cd "$DIRNAME"
  35. # Prepare the missing script
  36. chmod +x missing
  37. # Generate ChangeLog and NEWS
  38. chmod +x scripts/gen-ChangeLog-NEWS
  39. cat <<'EOF' > ChangeLog
  40. Hey, EMACS: -*- text -*-
  41. EOF
  42. scripts/gen-ChangeLog-NEWS >> ChangeLog
  43. scripts/gen-ChangeLog-NEWS > NEWS
  44. # Generate man page
  45. ./missing perl < /dev/null
  46. chmod +x scripts/manpage.pl
  47. mkdir doc > /dev/null 2>&1 || true
  48. scripts/manpage.pl > doc/mlucas.1
  49. # Invoke autogen
  50. cd am
  51. ../missing autogen main.def
  52. # Invoke autotools
  53. cd ..
  54. ./missing autoreconf -f -i
  55. # Make sure host has patch installed
  56. patch < /dev/null > /dev/zero 2>&1 || \
  57. {
  58. cat <<'EOF' >&2
  59. WARNING: 'patch' is missing on your system.
  60. You should need it to patch files generated by the autotools.
  61. The 'patch' program is part of the GNU patch package:
  62. <http://www.gnu.org/software/patch>
  63. EOF
  64. exit $ERR_MISSING
  65. }
  66. # Patch the generated missing script
  67. cp missing missing.orig
  68. patch -p1 -N \
  69. < patch/0001-missing-add-autoreconf-autogen-and-perl-as-supported.patch \
  70. || true
  71. if test -f missing.rej
  72. then
  73. rm -f missing missing.rej
  74. mv missing.orig missing
  75. else
  76. rm -f missing.orig
  77. fi