2016-04-22 16:58:57 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-11-05 07:54:03 +00:00
|
|
|
### update_autogen - update some auto-generated files in the Emacs tree
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2017-01-01 03:14:01 +00:00
|
|
|
## Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
## Author: Glenn Morris <rgm@gnu.org>
|
|
|
|
|
|
|
|
## This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
## GNU Emacs 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.
|
|
|
|
|
|
|
|
## GNU Emacs 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
|
2017-09-13 22:52:52 +00:00
|
|
|
## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
### Commentary:
|
|
|
|
|
2013-11-05 07:54:03 +00:00
|
|
|
## This is a helper script to update some generated files in the Emacs
|
|
|
|
## repository. This is suitable for running from cron.
|
2011-03-20 23:58:23 +00:00
|
|
|
## Only Emacs maintainers need use this, so it uses bash features.
|
2011-04-06 02:13:16 +00:00
|
|
|
##
|
2013-11-05 07:54:03 +00:00
|
|
|
## By default, it updates the versioned loaddefs-like files in lisp,
|
|
|
|
## except ldefs-boot.el.
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
### Code:
|
|
|
|
|
2011-03-25 18:16:41 +00:00
|
|
|
die () # write error to stderr and exit
|
2011-03-20 23:58:23 +00:00
|
|
|
{
|
|
|
|
[ $# -gt 0 ] && echo "$PN: $@" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
PN=${0##*/} # basename of script
|
|
|
|
PD=${0%/*}
|
|
|
|
|
|
|
|
[ "$PD" = "$0" ] && PD=. # if PATH includes PWD
|
|
|
|
|
2013-11-05 07:54:03 +00:00
|
|
|
## This should be the admin directory.
|
2011-03-20 23:58:23 +00:00
|
|
|
cd $PD
|
|
|
|
cd ../
|
2013-11-05 07:54:03 +00:00
|
|
|
[ -d admin ] || die "Could not locate admin directory"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2017-05-31 01:03:16 +00:00
|
|
|
[ -d .git ] || die "No .git directory"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2011-03-25 18:16:41 +00:00
|
|
|
usage ()
|
2011-03-20 23:58:23 +00:00
|
|
|
{
|
|
|
|
cat 1>&2 <<EOF
|
2013-12-12 03:37:38 +00:00
|
|
|
Usage: ${PN} [-f] [-c] [-q] [-A dir] [-I] [-L] [-C] [-- make-flags]
|
2013-11-05 07:54:03 +00:00
|
|
|
Update some auto-generated files in the Emacs tree.
|
|
|
|
By default, only does the versioned loaddefs-like files in lisp/.
|
|
|
|
This requires a build. Passes any non-option args to make (eg -- -j2).
|
2011-03-20 23:58:23 +00:00
|
|
|
Options:
|
|
|
|
-f: force an update even if the source files are locally modified.
|
|
|
|
-c: if the update succeeds and the generated files are modified,
|
|
|
|
commit them (caution).
|
|
|
|
-q: be quiet; only give error messages, not status messages.
|
2013-11-05 07:54:03 +00:00
|
|
|
-A: only update autotools files, copying into specified dir.
|
2015-05-07 01:35:28 +00:00
|
|
|
-H: also update ChangeLog.${changelog_n}
|
2013-12-12 03:37:38 +00:00
|
|
|
-I: also update info/dir.
|
2011-04-06 04:15:53 +00:00
|
|
|
-L: also update ldefs-boot.el.
|
2011-04-06 02:13:16 +00:00
|
|
|
-C: start from a clean state. Slower, but more correct.
|
2011-03-20 23:58:23 +00:00
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
## Defaults.
|
|
|
|
|
|
|
|
force=
|
|
|
|
commit=
|
|
|
|
quiet=
|
2011-04-06 02:13:16 +00:00
|
|
|
clean=
|
2013-11-05 07:54:03 +00:00
|
|
|
autogendir= # was "autogen"
|
|
|
|
ldefs_flag=1
|
2011-04-06 04:15:53 +00:00
|
|
|
lboot_flag=
|
2013-12-12 03:37:38 +00:00
|
|
|
info_flag=
|
2015-05-07 01:35:28 +00:00
|
|
|
changelog_flag=
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
## Parameters.
|
2011-04-06 02:13:16 +00:00
|
|
|
ldefs_in=lisp/loaddefs.el
|
2017-03-07 13:25:45 +00:00
|
|
|
ldefs_out=lisp/ldefs-boot.el
|
2015-05-07 01:35:28 +00:00
|
|
|
changelog_n=$(sed -n 's/CHANGELOG_HISTORY_INDEX_MAX *= *//p' Makefile.in)
|
2015-06-07 23:51:44 +00:00
|
|
|
changelog_files="ChangeLog.$changelog_n"
|
2012-07-09 04:52:49 +00:00
|
|
|
sources="configure.ac lib/Makefile.am"
|
2013-11-05 07:54:03 +00:00
|
|
|
## Files to copy into autogendir.
|
|
|
|
## Everything:
|
2011-07-29 21:59:44 +00:00
|
|
|
genfiles="
|
Switch from Automake to GNU Make
Emacs assumes GNU Make, and GNU Make has much of the functionality of
Automake built-in. The Emacs build process uses Automake primarily
because Emacs uses some Gnulib code and Gnulib formerly required
Automake. Now that Gnulib no longer requires Automake, Emacs can
stop using Automake and this should simplify Emacs maintenance
in the future (Bug#26100). Although this patch may look long, most of
it is generated automatically: the changes to build-aux/config.guess,
build-aux/config.sub, build-aux/install-sh, and lib/gnulib.mk.in are
all done by admin/merge-gnulib.
* .gitignore: Remove build-aux/ar-lib, build-aux/compile,
build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
build-aux/install-sh, build-aux/missing, and lib/Makefile.in,
as they are no longer built by autogen.sh.
Add lib/gnulib.mk, as it is now built by 'configure'.
Remove nt/gnulib.mk, as it is no longer built by 'make'.
* INSTALL.REPO, README, admin/make-tarball.txt:
Remove mention of Automake.
* Makefile.in (AUTOCONF, AUTOMAKE, AUTOHEADER, ACLOCAL, lib)
(AUTOCONF_INPUTS, ACLOCAL_PATH, ACLOCAL_INPUTS)
($(srcdir)/aclocal.m4, AUTOMAKE_INPUTS)
($(srcdir)/lib/Makefile.in, $(srcdir)/nt/gnulib.mk, am--refresh):
Remove.
($(MAKEFILE_NAME)): Depend on lib/gnulib.mk.in.
($(srcdir)/configure, $(srcdir)/src/stamp-h.in)
($(srcdir)/src/config.in):
Use autogen.sh instead of doing it by hand.
* admin/merge-gnulib (AVOIDED_MODULES, avoided_flags)):
New vars, to simplify processing of avoided modules.
(GNULIB_TOOL_FLAGS): Move --avoid flags into AVOIDED_MODULES.
Add --gnu-make, and change makefile name to gnulib.mk.in.
Copy config.guess, config.sub, and install-sh too, since
Automake no longer does that for us.
* admin/notes/copyright:
* admin/update_autogen (genfiles):
Update list of files.
Remove hack for nt/gnulib.mk, a file that is no longer needed.
* autogen.sh (progs): Remove Automake.
(automake_min): Remove.
Build aclocal.m4 so that autoreconf need not use aclocal.
* build-aux/config.guess, build-aux/config.sub:
* build-aux/install-sh:
New files, copied from Gnulib. These are now updated by
admin/merge-gnulib instead by autogen.sh.
* configure.ac (AC_PROG_MAKE_SET, ACLOCAL_PATH, AM_CONDITIONAL):
Remove.
(AM_INIT_AUTOMAKE, AM_SILENT_RULES): Remove call.
(AC_PROG_CC_C_O): Call this instead of AM_PROG_CC_C_O.
(BUILDING_FOR_WINDOWSNT, HYBRID_MALLOC_LIB): Remove; no longer needed.
(--disable-silent-rules): New option, since Automake no longer
does this for us.
(AM_V, AM_DEFAULT_V): Set unconditionally, and do not bother
with AM_SUBST_NOTMAKE.
(AC_PROG_INSTALL): Add call.
(MAKEINFO): Do not bother with the 'missing' program.
(MAKEINFO, SYSTEM_TYPE): AC_SUBST.
(AC_CONFIG_FILES): Add Makefile, lib/gnulib.mk.
(SUBDIR_MAKEFILES): Remove duplication.
* lib/Makefile.am: Remove, replacing with:
* lib/Makefile.in: New file, with the old Makefile.am contents
and with the following changes:
(AUTOMAKE_OPTIONS, BUILT_SOURCES, CLEANFILES, EXTRA_DIST)
(MOSTLYCLEANDIRS, MOSTLYCLEANFILES, noinst_LIBRARIES, SUFFIXES)
(AM_CFLAGS, DEFAULT_INCLUDES, libegnu_a_SOURCES, libegnu_a_LIBADD)
(EXTRA_libegnu_a_SOURCES, libegnu_a_SHORTNAME, libegnu_a_CPPFLAGS):
Remove.
(VPATH, abs_top_builddir, top_builddir, top_srcdir, all, AM_V_AR)
(AM_V_CC, AM_V_GEN, AM_V_at, DEPDIR, DEPFLAGS, MKDEPDIR, SYSTEM_TYPE)
(libgnu.a, libegnu.a, ETAGS, $(ETAGS), tags, TAGS, clean)
(mostlyclean, distclean, bootstrap-clean, maintainer-clean):
New macros and rules, since Automake no longer does them.
Include ../nt/gnulib-cfg.mk if SYSTEM_TYPE is windows-nt,
instead of including ../nt/gnulib.mk if BUILDING_FOR_WINDOWS_NT.
Include dependency files if AUTO_DEPEND.
(ALL_CFLAGS, AUTOCONF_INPUTS, libgnu_a_OBJECTS, libegnu_a_OBJECTS):
New macros.
(bootstrap-clean): Depend on distclean, not maintainer-clean,
and remove gnulib.mk.
(AUTOCONF_INPUTS, $(top_srcdir)/configure, ../config.status, Makefile):
New macros and rules, copied from ../Makefile.in.
($(libegnu_a_OBJECTS), $(libgnu_a_OBJECTS)): Depend on BUILT_SOURCES.
(.c.o, e-%.o): New generic rules.
* lib/gnulib.mk: Remove.
* lib/gnulib.mk.in: New file, which is built by autogen.sh
and contains much of what used to be in lib/gnulib.mk.
* m4/gnulib-common.m4: Copy from gnulib.
* make-dist: Do not distribute build-aux/compile, build-aux/depcomp,
build-aux/missing, build-aux/ar-lib, lib/Makefile.am, nt/gnulib.mk,
nt/gnulib-modules-to-delete.cfg. Distribute lib/Makefile.in,
lib/gnulib.mk.in, and nt/gnulib-cfg.mk instead.
* nt/Makefile.in (AM_V_GEN, am__v_GEN_, am__v_GEN_0)
(am__v_GEN_1, ${srcdir}/gnulib.mk): Remove.
* nt/gnulib-cfg.mk: New file, which supersedes ...
* nt/gnulib-modules-to-delete.cfg: ... this file, which is removed.
* src/Makefile.in (ACLOCAL_INPUTS): Remove.
(AUTOCONF_INPUTS): Merge ACLOCAL_INPUTS into it.
($(top_srcdir)/configure, ../config.status, config.in Makefile):
Defer to parent Makefile.
2017-03-17 18:33:47 +00:00
|
|
|
configure aclocal.m4 src/config.in
|
|
|
|
build-aux/config.guess build-aux/config.sub
|
|
|
|
build-aux/install-sh
|
2011-07-29 21:59:44 +00:00
|
|
|
"
|
2013-11-05 07:54:03 +00:00
|
|
|
## msdos-only:
|
Switch from Automake to GNU Make
Emacs assumes GNU Make, and GNU Make has much of the functionality of
Automake built-in. The Emacs build process uses Automake primarily
because Emacs uses some Gnulib code and Gnulib formerly required
Automake. Now that Gnulib no longer requires Automake, Emacs can
stop using Automake and this should simplify Emacs maintenance
in the future (Bug#26100). Although this patch may look long, most of
it is generated automatically: the changes to build-aux/config.guess,
build-aux/config.sub, build-aux/install-sh, and lib/gnulib.mk.in are
all done by admin/merge-gnulib.
* .gitignore: Remove build-aux/ar-lib, build-aux/compile,
build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
build-aux/install-sh, build-aux/missing, and lib/Makefile.in,
as they are no longer built by autogen.sh.
Add lib/gnulib.mk, as it is now built by 'configure'.
Remove nt/gnulib.mk, as it is no longer built by 'make'.
* INSTALL.REPO, README, admin/make-tarball.txt:
Remove mention of Automake.
* Makefile.in (AUTOCONF, AUTOMAKE, AUTOHEADER, ACLOCAL, lib)
(AUTOCONF_INPUTS, ACLOCAL_PATH, ACLOCAL_INPUTS)
($(srcdir)/aclocal.m4, AUTOMAKE_INPUTS)
($(srcdir)/lib/Makefile.in, $(srcdir)/nt/gnulib.mk, am--refresh):
Remove.
($(MAKEFILE_NAME)): Depend on lib/gnulib.mk.in.
($(srcdir)/configure, $(srcdir)/src/stamp-h.in)
($(srcdir)/src/config.in):
Use autogen.sh instead of doing it by hand.
* admin/merge-gnulib (AVOIDED_MODULES, avoided_flags)):
New vars, to simplify processing of avoided modules.
(GNULIB_TOOL_FLAGS): Move --avoid flags into AVOIDED_MODULES.
Add --gnu-make, and change makefile name to gnulib.mk.in.
Copy config.guess, config.sub, and install-sh too, since
Automake no longer does that for us.
* admin/notes/copyright:
* admin/update_autogen (genfiles):
Update list of files.
Remove hack for nt/gnulib.mk, a file that is no longer needed.
* autogen.sh (progs): Remove Automake.
(automake_min): Remove.
Build aclocal.m4 so that autoreconf need not use aclocal.
* build-aux/config.guess, build-aux/config.sub:
* build-aux/install-sh:
New files, copied from Gnulib. These are now updated by
admin/merge-gnulib instead by autogen.sh.
* configure.ac (AC_PROG_MAKE_SET, ACLOCAL_PATH, AM_CONDITIONAL):
Remove.
(AM_INIT_AUTOMAKE, AM_SILENT_RULES): Remove call.
(AC_PROG_CC_C_O): Call this instead of AM_PROG_CC_C_O.
(BUILDING_FOR_WINDOWSNT, HYBRID_MALLOC_LIB): Remove; no longer needed.
(--disable-silent-rules): New option, since Automake no longer
does this for us.
(AM_V, AM_DEFAULT_V): Set unconditionally, and do not bother
with AM_SUBST_NOTMAKE.
(AC_PROG_INSTALL): Add call.
(MAKEINFO): Do not bother with the 'missing' program.
(MAKEINFO, SYSTEM_TYPE): AC_SUBST.
(AC_CONFIG_FILES): Add Makefile, lib/gnulib.mk.
(SUBDIR_MAKEFILES): Remove duplication.
* lib/Makefile.am: Remove, replacing with:
* lib/Makefile.in: New file, with the old Makefile.am contents
and with the following changes:
(AUTOMAKE_OPTIONS, BUILT_SOURCES, CLEANFILES, EXTRA_DIST)
(MOSTLYCLEANDIRS, MOSTLYCLEANFILES, noinst_LIBRARIES, SUFFIXES)
(AM_CFLAGS, DEFAULT_INCLUDES, libegnu_a_SOURCES, libegnu_a_LIBADD)
(EXTRA_libegnu_a_SOURCES, libegnu_a_SHORTNAME, libegnu_a_CPPFLAGS):
Remove.
(VPATH, abs_top_builddir, top_builddir, top_srcdir, all, AM_V_AR)
(AM_V_CC, AM_V_GEN, AM_V_at, DEPDIR, DEPFLAGS, MKDEPDIR, SYSTEM_TYPE)
(libgnu.a, libegnu.a, ETAGS, $(ETAGS), tags, TAGS, clean)
(mostlyclean, distclean, bootstrap-clean, maintainer-clean):
New macros and rules, since Automake no longer does them.
Include ../nt/gnulib-cfg.mk if SYSTEM_TYPE is windows-nt,
instead of including ../nt/gnulib.mk if BUILDING_FOR_WINDOWS_NT.
Include dependency files if AUTO_DEPEND.
(ALL_CFLAGS, AUTOCONF_INPUTS, libgnu_a_OBJECTS, libegnu_a_OBJECTS):
New macros.
(bootstrap-clean): Depend on distclean, not maintainer-clean,
and remove gnulib.mk.
(AUTOCONF_INPUTS, $(top_srcdir)/configure, ../config.status, Makefile):
New macros and rules, copied from ../Makefile.in.
($(libegnu_a_OBJECTS), $(libgnu_a_OBJECTS)): Depend on BUILT_SOURCES.
(.c.o, e-%.o): New generic rules.
* lib/gnulib.mk: Remove.
* lib/gnulib.mk.in: New file, which is built by autogen.sh
and contains much of what used to be in lib/gnulib.mk.
* m4/gnulib-common.m4: Copy from gnulib.
* make-dist: Do not distribute build-aux/compile, build-aux/depcomp,
build-aux/missing, build-aux/ar-lib, lib/Makefile.am, nt/gnulib.mk,
nt/gnulib-modules-to-delete.cfg. Distribute lib/Makefile.in,
lib/gnulib.mk.in, and nt/gnulib-cfg.mk instead.
* nt/Makefile.in (AM_V_GEN, am__v_GEN_, am__v_GEN_0)
(am__v_GEN_1, ${srcdir}/gnulib.mk): Remove.
* nt/gnulib-cfg.mk: New file, which supersedes ...
* nt/gnulib-modules-to-delete.cfg: ... this file, which is removed.
* src/Makefile.in (ACLOCAL_INPUTS): Remove.
(AUTOCONF_INPUTS): Merge ACLOCAL_INPUTS into it.
($(top_srcdir)/configure, ../config.status, config.in Makefile):
Defer to parent Makefile.
2017-03-17 18:33:47 +00:00
|
|
|
genfiles="src/config.in"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
for g in $genfiles; do
|
|
|
|
basegen="$basegen ${g##*/}"
|
|
|
|
done
|
|
|
|
|
|
|
|
[ "$basegen" ] || die "internal error"
|
|
|
|
|
|
|
|
tempfile=/tmp/$PN.$$
|
|
|
|
|
|
|
|
trap "rm -f $tempfile 2> /dev/null" EXIT
|
|
|
|
|
|
|
|
|
2015-05-07 01:35:28 +00:00
|
|
|
while getopts ":hcfqA:HCIL" option ; do
|
2011-03-20 23:58:23 +00:00
|
|
|
case $option in
|
|
|
|
(h) usage ;;
|
|
|
|
|
|
|
|
(c) commit=1 ;;
|
|
|
|
|
|
|
|
(f) force=1 ;;
|
|
|
|
|
|
|
|
(q) quiet=1 ;;
|
|
|
|
|
2013-11-05 07:54:03 +00:00
|
|
|
(A) autogendir=$OPTARG
|
|
|
|
[ -d "$autogendir" ] || die "No autogen directory: $autogendir"
|
|
|
|
;;
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
(C) clean=1 ;;
|
|
|
|
|
2015-05-07 01:35:28 +00:00
|
|
|
(H) changelog_flag=1 ;;
|
|
|
|
|
2013-12-12 03:37:38 +00:00
|
|
|
(I) info_flag=1 ;;
|
|
|
|
|
2011-04-06 04:15:53 +00:00
|
|
|
(L) lboot_flag=1 ;;
|
|
|
|
|
2011-03-20 23:58:23 +00:00
|
|
|
(\?) die "Bad option -$OPTARG" ;;
|
|
|
|
|
|
|
|
(:) die "Option -$OPTARG requires an argument" ;;
|
|
|
|
|
|
|
|
(*) die "getopts error" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(( --OPTIND ))
|
|
|
|
OPTIND=1
|
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
## Does not work 100% because a lot of Emacs batch output comes on stderr (?).
|
2011-03-23 07:58:05 +00:00
|
|
|
[ "$quiet" ] && exec 1> /dev/null
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
## Run status on inputs, list modified files on stdout.
|
|
|
|
status ()
|
|
|
|
{
|
2017-05-31 01:03:16 +00:00
|
|
|
git status -s "$@" >| $tempfile || die "git status error for $@"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
local stat file modified
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
while read stat file; do
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
[ "$stat" != "M" ] && \
|
|
|
|
die "Unexpected status ($stat) for generated $file"
|
|
|
|
modified="$modified $file"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
done < $tempfile
|
|
|
|
|
|
|
|
echo "$modified"
|
|
|
|
|
|
|
|
return 0
|
|
|
|
} # function status
|
|
|
|
|
|
|
|
|
|
|
|
echo "Checking input file status..."
|
|
|
|
|
|
|
|
## The lisp portion could be more permissive, eg only care about .el files.
|
|
|
|
modified=$(status ${autogendir:+$sources} ${ldefs_flag:+lisp} ${info_flag:+doc}) || die
|
|
|
|
|
|
|
|
[ "$modified" ] && {
|
|
|
|
echo "Locally modified: $modified"
|
|
|
|
[ "$force" ] || die "There are local modifications"
|
|
|
|
}
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
## Probably this is overkill, and there's no need to "bootstrap" just
|
|
|
|
## for making autoloads.
|
|
|
|
[ "$clean" ] && {
|
|
|
|
|
|
|
|
echo "Running 'make maintainer-clean'..."
|
|
|
|
|
|
|
|
make maintainer-clean #|| die "Cleaning error"
|
|
|
|
|
|
|
|
rm -f $ldefs_in
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-23 07:58:05 +00:00
|
|
|
echo "Running autoreconf..."
|
2011-03-20 23:58:23 +00:00
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
autoreconf ${clean:+-f} -i -I m4 2>| $tempfile
|
Remove some files that autoreconf can supply.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00863.html
* compile, config.guess, config.sub, depcomp, install-sh, missing:
Remove; autoreconf can supply them.
* Makefile.in (sync-from-gnulib): Don't sync config.sub,
config.guess, install-sh. Pass -i to autoreconf.
* autogen/update_autogen (genfiles): Add compile, config.guess,
config.sub, depcomp, install-sh, missing. Pass -i to autoreconf.
Discard non-error output from autoreconf in -q case.
* autogen/compile, autogen/config.guess, autogen/config.sub:
* autogen/depcomp, autogen/install-sh, autogen/missing: New files.
* autogen/copy_autogen: Add compile, config.guess, config.sub, depcomp,
install-sh, missing.
* autogen/README: Add compile, config.guess, config.sub, depcomp,
install-sh, missing.
* INSTALL.BZR, admin/make-tarball.txt: Add -i to autoreconf args.
* .bzrignore: Add compile, config.guess, config.sub, depcomp,
install-sh, missing.
2011-03-25 07:14:31 +00:00
|
|
|
|
|
|
|
retval=$?
|
|
|
|
|
|
|
|
## Annoyingly, autoreconf puts the "installing `./foo' messages on stderr.
|
|
|
|
if [ "$quiet" ]; then
|
|
|
|
grep -v 'installing `\.' $tempfile 1>&2
|
|
|
|
else
|
|
|
|
cat "$tempfile" 1>&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ $retval -ne 0 ] && die "autoreconf error"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
## Uses global $commit.
|
|
|
|
commit ()
|
|
|
|
{
|
|
|
|
local type=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
[ $# -gt 0 ] || {
|
|
|
|
echo "No files were modified"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "Modified file(s): $@"
|
|
|
|
|
|
|
|
[ "$commit" ] || return 0
|
|
|
|
|
|
|
|
echo "Committing..."
|
|
|
|
|
2017-05-31 01:03:16 +00:00
|
|
|
git commit -m "; Auto-commit of $type files." "$@" || return $?
|
2014-03-21 06:39:13 +00:00
|
|
|
|
2017-05-31 01:03:16 +00:00
|
|
|
## In case someone else pushed something while we were working.
|
|
|
|
git pull --rebase || return $?
|
|
|
|
git push || return $?
|
2011-04-06 02:13:16 +00:00
|
|
|
|
|
|
|
echo "Committed files: $@"
|
|
|
|
} # function commit
|
|
|
|
|
|
|
|
|
2013-12-12 08:54:21 +00:00
|
|
|
## No longer used since info/dir is now generated at install time if needed,
|
|
|
|
## and is not in the repository any more.
|
2013-12-12 03:37:38 +00:00
|
|
|
info_dir ()
|
|
|
|
{
|
2013-12-12 08:54:21 +00:00
|
|
|
local basefile=build-aux/dir_top outfile=info/dir
|
2013-12-12 03:37:38 +00:00
|
|
|
|
|
|
|
echo "Regenerating info/dir..."
|
|
|
|
|
|
|
|
## Header contains non-printing characters, so this is more
|
|
|
|
## reliable than using echo.
|
|
|
|
rm -f $outfile
|
|
|
|
cp $basefile $outfile
|
|
|
|
|
|
|
|
local topic file dircat dirent
|
|
|
|
|
|
|
|
## FIXME inefficient looping.
|
|
|
|
for topic in "Texinfo documentation system" "Emacs" "GNU Emacs Lisp" \
|
|
|
|
"Emacs editing modes" "Emacs network features" "Emacs misc features" \
|
|
|
|
"Emacs lisp libraries"; do
|
|
|
|
|
|
|
|
cat - <<EOF >> $outfile
|
|
|
|
|
|
|
|
$topic
|
|
|
|
EOF
|
|
|
|
## Bit faster than doc/*/*.texi.
|
|
|
|
for file in doc/emacs/emacs.texi doc/lispintro/*.texi \
|
|
|
|
doc/lispref/elisp.texi doc/misc/*.texi; do
|
|
|
|
|
|
|
|
## FIXME do not ignore w32 if OS is w32.
|
|
|
|
case $file in
|
|
|
|
*-xtra.texi|*efaq-w32.texi) continue ;;
|
|
|
|
esac
|
|
|
|
|
2014-03-21 06:39:13 +00:00
|
|
|
dircat=$(sed -n -e 's/@value{emacsname}/Emacs/' -e 's/^@dircategory //p' $file)
|
2013-12-12 03:37:38 +00:00
|
|
|
|
2013-12-12 08:54:21 +00:00
|
|
|
## TODO warn about unknown topics (check-info in top-level
|
|
|
|
## Makefile does this).
|
2013-12-12 03:37:38 +00:00
|
|
|
[ "$dircat" = "$topic" ] || continue
|
|
|
|
|
|
|
|
sed -n -e 's/@value{emacsname}/Emacs/' \
|
|
|
|
-e 's/@acronym{\([A-Z]*\)}/\1/' \
|
|
|
|
-e '/^@direntry/,/^@end direntry/ s/^\([^@]\)/\1/p' \
|
|
|
|
$file >> $outfile
|
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
local modified
|
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
modified=$(status $outfile) || die
|
2013-12-12 03:37:38 +00:00
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
commit "info/dir" $modified || die "commit error"
|
2013-12-12 03:37:38 +00:00
|
|
|
} # function info_dir
|
|
|
|
|
|
|
|
|
2013-11-05 07:54:03 +00:00
|
|
|
[ "$autogendir" ] && {
|
|
|
|
|
|
|
|
oldpwd=$PWD
|
|
|
|
|
|
|
|
cp $genfiles $autogendir/
|
|
|
|
|
|
|
|
cd $autogendir || die "cd error for $autogendir"
|
|
|
|
|
|
|
|
echo "Checking status of generated files..."
|
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
modified=$(status $basegen) || die
|
2013-11-05 07:54:03 +00:00
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
commit "generated" $modified || die "commit error"
|
2013-11-05 07:54:03 +00:00
|
|
|
|
|
|
|
exit 0
|
|
|
|
} # $autogendir
|
2011-04-06 02:13:16 +00:00
|
|
|
|
|
|
|
|
2013-12-12 03:37:38 +00:00
|
|
|
[ "$info_flag" ] && info_dir
|
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
[ "$ldefs_flag" ] || exit 0
|
|
|
|
|
|
|
|
|
|
|
|
echo "Finding loaddef targets..."
|
|
|
|
|
2014-06-30 00:01:51 +00:00
|
|
|
find lisp -name '*.el' -exec grep '^;.*generated-autoload-file:' {} + | \
|
|
|
|
sed -e '/loaddefs\|esh-groups/d' -e 's|/[^/]*: "|/|' -e 's/"//g' \
|
|
|
|
>| $tempfile || die "Error finding targets"
|
2011-04-06 02:13:16 +00:00
|
|
|
|
|
|
|
genfiles=
|
|
|
|
|
|
|
|
while read genfile; do
|
|
|
|
|
2014-06-30 00:01:51 +00:00
|
|
|
## Or we can just use sort -u when making tempfile...
|
|
|
|
case " $genfiles " in
|
|
|
|
*" $genfile "*) continue ;;
|
|
|
|
esac
|
|
|
|
|
2014-06-29 01:33:32 +00:00
|
|
|
[ -r $genfile ] || die "Unable to read $genfile"
|
2011-04-06 02:13:16 +00:00
|
|
|
|
|
|
|
genfiles="$genfiles $genfile"
|
|
|
|
done < $tempfile
|
|
|
|
|
|
|
|
|
|
|
|
[ "$genfiles" ] || die "Error setting genfiles"
|
|
|
|
|
|
|
|
|
|
|
|
[ -e Makefile ] || {
|
|
|
|
echo "Running ./configure..."
|
|
|
|
|
2011-04-06 02:23:28 +00:00
|
|
|
## Minimize required packages.
|
|
|
|
./configure --without-x || die "configure error"
|
2011-03-20 23:58:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
## Build the minimum needed to get the autoloads.
|
|
|
|
echo "Running lib/ make..."
|
|
|
|
|
|
|
|
make -C lib "$@" all || die "make lib error"
|
|
|
|
|
|
|
|
|
|
|
|
echo "Running src/ make..."
|
|
|
|
|
|
|
|
make -C src "$@" bootstrap-emacs || die "make src error"
|
|
|
|
|
|
|
|
|
|
|
|
echo "Running lisp/ make..."
|
|
|
|
|
|
|
|
make -C lisp "$@" autoloads EMACS=../src/bootstrap-emacs || die "make src error"
|
|
|
|
|
2017-03-07 13:25:45 +00:00
|
|
|
|
|
|
|
## Ignore comment differences.
|
|
|
|
[ ! "$lboot_flag" ] || \
|
|
|
|
diff -q -I '^;' $ldefs_in $ldefs_out || \
|
|
|
|
cp $ldefs_in $ldefs_out || die "cp ldefs_boot error"
|
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
echo "Checking status of loaddef files..."
|
|
|
|
|
|
|
|
## It probably would be fine to just check+commit lisp/, since
|
|
|
|
## making autoloads should not effect any other files. But better
|
|
|
|
## safe than sorry.
|
2017-03-07 13:25:45 +00:00
|
|
|
modified=$(status $genfiles $ldefs_out) || die
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
|
2014-01-13 21:17:18 +00:00
|
|
|
commit "loaddefs" $modified || die "commit error"
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
|
2015-05-07 01:35:28 +00:00
|
|
|
## Less important than the other stuff, so do it last.
|
|
|
|
[ ! "$changelog_flag" ] || {
|
|
|
|
make change-history-nocommit || die "make change-history error"
|
|
|
|
modified=$(status $changelog_files) || die
|
|
|
|
commit "ChangeLog" $modified || die "commit error"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-06 02:13:16 +00:00
|
|
|
exit 0
|
2011-03-20 23:58:23 +00:00
|
|
|
|
|
|
|
### update_autogen ends here
|