summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-03-08 20:22:35 +0100
committerJim Meyering <meyering@redhat.com>2010-03-09 14:28:23 +0100
commit3c2dac22f427a7e10c096573d14c07ce926ae188 (patch)
treeaa10d9d95aa0cfd6b2ea893c4579871c2042ecc9
parent5acb1dc0dffbf8a8e9db87bc6caf9fa7c3dc170e (diff)
downloadgrep-3c2dac22f427a7e10c096573d14c07ce926ae188.tar.gz
doc+bootstrap: document build-from-git-clone process
* bootstrap: Update from coreutils/gnulib. * README-hacking: New file, nearly identical to the one in coreutils.
-rw-r--r--README-hacking77
-rwxr-xr-xbootstrap86
2 files changed, 140 insertions, 23 deletions
diff --git a/README-hacking b/README-hacking
new file mode 100644
index 00000000..f8d6668d
--- /dev/null
+++ b/README-hacking
@@ -0,0 +1,77 @@
+-*- outline -*-
+
+These notes intend to help people working on the checked-out sources.
+These requirements do not apply when building from a distribution tarball.
+
+* Requirements
+
+We've opted to keep only the highest-level sources in the GIT repository.
+This eases our maintenance burden, (fewer merges etc.), but imposes more
+requirements on anyone wishing to build from the just-checked-out sources.
+Note the requirements to build the released archive are much less and
+are just the requirements of the standard ./configure && make procedure.
+Specific development tools and versions will be checked for and listed by
+the bootstrap script. See README-prereq for specific notes on obtaining
+these prerequisite tools.
+
+Valgrind <http://valgrind.org/> is also highly recommended, if
+Valgrind supports your architecture. See also README-valgrind.
+
+While building from a just-cloned source tree may require installing a
+few prerequisites, later, a plain `git pull && make' should be sufficient.
+
+* First GIT checkout
+
+You can get a copy of the source repository like this:
+
+ $ git clone git://git.sv.gnu.org/grep
+ $ cd grep
+
+As an optional step, if you already have a copy of the gnulib git
+repository on your hard drive, then you can use it as a reference to
+reduce download time and disk space requirements:
+
+ $ export GNULIB_SRCDIR=/path/to/gnulib
+
+The next step is to get and check other files needed to build,
+which are extracted from other source packages:
+
+ $ ./bootstrap
+
+And there you are! Just
+
+ $ ./configure --quiet #[--enable-gcc-warnings] [*]
+ $ make
+ $ make check
+
+At this point, there should be no difference between your local copy,
+and the GIT master copy:
+
+ $ git diff
+
+should output no difference.
+
+Enjoy!
+
+[*] The --enable-gcc-warnings option is useful only with glibc
+and with a very recent version of gcc. You'll probably also have
+to use recent system headers. If you configure with this option,
+and spot a problem, please be sure to send the report to the bug
+reporting address of this package, and not to that of gnulib, even
+if the problem seems to originate in a gnulib-provided file.
+-----
+
+Copyright (C) 2002-2010 Free Software Foundation, Inc.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/bootstrap b/bootstrap
index 5b9f6ff5..365a3d92 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,4 +1,6 @@
#! /bin/sh
+# Print a version string.
+scriptversion=2010-02-24.17; # UTC
# Bootstrap this package from checked-out sources.
@@ -17,7 +19,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Written by Paul Eggert.
+# Originally written by Paul Eggert. The canonical version of this
+# script is maintained as build-aux/bootstrap in gnulib, however, to
+# be useful to your project, you should place a copy of it under
+# version control in the top-level directory of your project. The
+# intent is that all customization can be done with a bootstrap.conf
+# file also maintained in your version control; gnulib comes with a
+# template build-aux/bootstrap.conf to get you started.
+
+# Please report bugs or propose patches to bug-gnulib@gnu.org.
nl='
'
@@ -43,7 +53,7 @@ Options:
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth downloading
- them again.
+ them again. Defaults to \$GNULIB_SRCDIR.
--copy Copy files instead of creating symbolic links.
--force Attempt to bootstrap even if the sources seem
not to have been checked out.
@@ -133,7 +143,8 @@ XGETTEXT_OPTIONS='\\\
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
'
-# Package bug report address for gettext files
+# Package bug report address and copyright holder for gettext files
+COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
# Files we don't want to import.
@@ -160,7 +171,6 @@ vc_ignore=auto
# die otherwise.
find_tool ()
{
- # Find sha1sum, named gsha1sum on MacPorts.
find_tool_envvar=$1
shift
find_tool_names=$@
@@ -188,8 +198,8 @@ find_tool ()
eval "export $find_tool_envvar"
}
-# Find sha1sum, named gsha1sum on MacPorts.
-find_tool SHA1SUM sha1sum gsha1sum
+# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
+find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
@@ -314,10 +324,20 @@ get_version() {
$app --version >/dev/null 2>&1 || return 1
$app --version 2>&1 |
- sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
+ sed -n '# extract version within line
+ s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
+ t done
+
+ # extract version at start of line
+ s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
t done
+
d
+
:done
+ #the following essentially does s/5.005/5.5/
+ s/\.0*\([1-9]\)/.\1/g
+ p
q'
}
@@ -380,7 +400,7 @@ fi
cleanup_gnulib() {
status=$?
- rm -fr gnulib
+ rm -fr "$gnulib_path"
exit $status
}
@@ -388,6 +408,8 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@"
}
+gnulib_path=`git_modules_config submodule.gnulib.path`
+
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
@@ -397,30 +419,43 @@ case ${GNULIB_SRCDIR--} in
git submodule init || exit $?
git submodule update || exit $?
- elif [ ! -d gnulib ]; then
+ elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
- git clone $shallow git://git.sv.gnu.org/gnulib ||
+ git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
cleanup_gnulib
trap - 1 2 13 15
fi
- GNULIB_SRCDIR=gnulib
+ GNULIB_SRCDIR=$gnulib_path
;;
*)
- # Redirect the gnulib submodule to the directory on the command line
- # if possible.
+ # Use GNULIB_SRCDIR as a reference.
if test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
- git submodule init
- GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
- git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
echo "$0: getting gnulib files..."
- git submodule update || exit $?
- GNULIB_SRCDIR=gnulib
+ if git submodule --help|grep reference > /dev/null; then
+ # Prefer the one-liner available in git 1.6.4 or newer.
+ git submodule update --init --reference "$GNULIB_SRCDIR" \
+ "$gnulib_path" || exit $?
+ else
+ # This fallback allows at least git 1.5.5.
+ if test -f "$gnulib_path"/gnulib-tool; then
+ # Since file already exists, assume submodule init already complete.
+ git submodule update || exit $?
+ else
+ # Older git can't clone into an empty directory.
+ rmdir "$gnulib_path" 2>/dev/null
+ git clone --reference "$GNULIB_SRCDIR" \
+ "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
+ && git submodule init && git submodule update \
+ || exit $?
+ fi
+ fi
+ GNULIB_SRCDIR=$gnulib_path
fi
;;
esac
@@ -626,7 +661,7 @@ slurp() {
for excluded_file in $excluded_files; do
test "$dir/$file" = "$excluded_file" && continue 2
done
- if test $file = Makefile.am; then
+ if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
@@ -644,7 +679,7 @@ slurp() {
rm -f $dir/$file
sed '
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
- AC_DEFUN([AM_INTL_SUBDIR], [
+ AC_DEFUN([AM_INTL_SUBDIR], [])
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
$a\
@@ -777,7 +812,8 @@ if test $with_gettext = yes; then
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
- /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
+ /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
+ /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
@@ -808,6 +844,10 @@ bootstrap_epilogue
echo "$0: done. Now you can run './configure'."
-# Local Variables:
-# indent-tabs-mode: nil
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End: