Commit | Line | Data |
---|---|---|
9b4ee616 PE |
1 | #! /bin/sh |
2 | # Merge gnulib sources into Emacs sources. | |
3 | # Typical usage: | |
4 | # | |
5 | # admin/merge-gnulib | |
6 | ||
ba318903 | 7 | # Copyright 2012-2014 Free Software Foundation, Inc. |
9b4ee616 PE |
8 | |
9 | # This file is part of GNU Emacs. | |
10 | ||
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. | |
15 | ||
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. | |
20 | ||
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/>. | |
23 | ||
24 | # written by Paul Eggert | |
25 | ||
26 | GNULIB_URL=git://git.savannah.gnu.org/gnulib.git | |
27 | ||
28 | GNULIB_MODULES=' | |
4eed3157 | 29 | alloca-opt byteswap c-ctype c-strcase |
595e113b PE |
30 | careadlinkat close-stream count-one-bits count-trailing-zeros |
31 | crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 | |
73dcdb9f | 32 | dtoastr dtotimespec dup2 environ execinfo faccessat |
067428c1 | 33 | fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync |
47d7532e | 34 | getloadavg getopt-gnu gettime gettimeofday |
4ebbdd67 | 35 | intprops largefile lstat |
e0fdb694 | 36 | manywarnings memrchr mkostemp mktime |
067428c1 | 37 | pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat |
8208d2bf | 38 | sig2str socklen stat-time stdalign stdio |
e32a5799 | 39 | strftime strtoimax strtoumax symlink sys_stat |
9ebada6a PE |
40 | sys_time time timer-time timespec-add timespec-sub |
41 | unsetenv update-copyright utimens | |
9b4ee616 PE |
42 | warnings |
43 | ' | |
44 | ||
45 | GNULIB_TOOL_FLAGS=' | |
7b154def | 46 | --avoid=close --avoid=dup |
067428c1 | 47 | --avoid=fchdir --avoid=fstat |
73dcdb9f | 48 | --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow |
8654f9d7 | 49 | --avoid=open --avoid=openat-die --avoid=opendir |
73dcdb9f | 50 | --avoid=raise |
0d181095 | 51 | --avoid=save-cwd --avoid=select --avoid=sigprocmask |
8208d2bf | 52 | --avoid=stdarg --avoid=stdbool |
d35af63c | 53 | --avoid=threadlib |
9b4ee616 PE |
54 | --conditional-dependencies --import --no-changelog --no-vc-files |
55 | --makefile-name=gnulib.mk | |
56 | ' | |
57 | ||
58 | # The source directory, with a trailing '/'. | |
59 | # If empty, the source directory is the working directory. | |
60 | src=$2 | |
61 | case $src in | |
62 | */ | '') ;; | |
63 | *) src=$src/ ;; | |
64 | esac | |
65 | ||
66 | # Gnulib's source directory. | |
67 | gnulib_srcdir=${1-$src../gnulib} | |
68 | ||
69 | case $gnulib_srcdir in | |
70 | -*) src=- ;; | |
71 | esac | |
72 | case $src in | |
73 | -*) | |
74 | echo >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]] | |
75 | ||
76 | SRCDIR is the Emacs source directory (default: working directory). | |
77 | GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)." | |
78 | exit 1 ;; | |
79 | esac | |
80 | ||
81 | test -x "$src"autogen.sh || { | |
82 | echo >&2 "$0: '${src:-.}' is not an Emacs source directory." | |
83 | exit 1 | |
84 | } | |
85 | ||
86 | test -d "$gnulib_srcdir" || | |
87 | git clone -- "$GNULIB_URL" "$gnulib_srcdir" || | |
88 | exit | |
89 | ||
90 | test -x "$gnulib_srcdir"/gnulib-tool || { | |
91 | echo >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory." | |
92 | exit 1 | |
93 | } | |
94 | ||
9b4ee616 | 95 | "$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES && |
a8f9bc05 PE |
96 | rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 "$src"m4/gl-openssl.m4 \ |
97 | "$src"m4/gnulib-cache.m4"$src" m4/warn-on-use.m4 && | |
9b4ee616 PE |
98 | cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc && |
99 | cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux && | |
0ec98478 PE |
100 | { test -z "$src" || cd "$src"; } && |
101 | ./autogen.sh |