Merge from origin/emacs-25
[emacs.git] / admin / merge-gnulib
blob69db30cc41e19abd8d223a4ad7f1855a1461e061
1 #! /bin/sh
2 # Merge gnulib sources into Emacs sources.
3 # Typical usage:
5 # admin/merge-gnulib
7 # Copyright 2012-2017 Free Software Foundation, Inc.
9 # This file is part of GNU Emacs.
11 # GNU Emacs is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # GNU Emacs is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 # written by Paul Eggert
26 GNULIB_URL=git://git.savannah.gnu.org/gnulib.git
28 GNULIB_MODULES='
29 alloca-opt binary-io byteswap c-ctype c-strcase
30 careadlinkat close-stream count-one-bits count-trailing-zeros
31 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
32 dtoastr dtotimespec dup2 environ execinfo faccessat
33 fcntl fcntl-h fdatasync fdopendir
34 filemode filevercmp flexmember fstatat fsync
35 getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog
36 ignore-value intprops largefile lstat
37 manywarnings memrchr mkostemp mktime
38 pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat
39 sig2str socklen stat-time std-gnu11 stdalign stddef stdio
40 stpcpy strftime strtoimax strtoumax symlink sys_stat
41 sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub
42 unsetenv update-copyright utimens
43 vla warnings
46 GNULIB_TOOL_FLAGS='
47 --avoid=close --avoid=dup
48 --avoid=fchdir --avoid=fstat
49 --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow
50 --avoid=open --avoid=openat-die --avoid=opendir
51 --avoid=raise
52 --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask
53 --avoid=stdarg --avoid=stdbool
54 --avoid=threadlib --avoid=unsetenv
55 --conditional-dependencies --import --no-changelog --no-vc-files
56 --makefile-name=gnulib.mk
59 # The source directory, with a trailing '/'.
60 # If empty, the source directory is the working directory.
61 src=$2
62 case $src in
63 */ | '') ;;
64 *) src=$src/ ;;
65 esac
67 # Gnulib's source directory.
68 gnulib_srcdir=${1-$src../gnulib}
70 case $gnulib_srcdir in
71 -*) src=- ;;
72 esac
73 case $src in
74 -*)
75 printf '%s\n' >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]]
77 SRCDIR is the Emacs source directory (default: working directory).
78 GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)."
79 exit 1 ;;
80 esac
82 test -x "$src"autogen.sh || {
83 printf '%s\n' >&2 "$0: '${src:-.}' is not an Emacs source directory."
84 exit 1
87 test -d "$gnulib_srcdir" ||
88 git clone -- "$GNULIB_URL" "$gnulib_srcdir" ||
89 exit
91 test -x "$gnulib_srcdir"/gnulib-tool || {
92 printf '%s\n' >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory."
93 exit 1
96 "$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES &&
97 rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 \
98 "$src"m4/gl-openssl.m4 \
99 "$src"m4/gnulib-cache.m4"$src" m4/warn-on-use.m4 &&
100 cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc &&
101 cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux &&
102 { test -z "$src" || cd "$src"; } &&
103 ./autogen.sh