Commit | Line | Data |
---|---|---|
9b4ee616 PE |
1 | #! /bin/sh |
2 | # Merge gnulib sources into Emacs sources. | |
3 | # Typical usage: | |
4 | # | |
5 | # admin/merge-gnulib | |
6 | ||
7 | # Copyright 2012 Free Software Foundation, Inc. | |
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=' | |
29 | alloca-opt | |
30 | careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 | |
31 | dtoastr dup2 | |
32 | filemode getloadavg getopt-gnu ignore-value intprops lstat | |
33 | manywarnings mktime pthread_sigmask readlink | |
34 | socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat | |
35 | warnings | |
36 | ' | |
37 | ||
38 | GNULIB_TOOL_FLAGS=' | |
39 | --avoid=msvc-inval --avoid=msvc-nothrow | |
40 | --avoid=raise --avoid=threadlib | |
41 | --conditional-dependencies --import --no-changelog --no-vc-files | |
42 | --makefile-name=gnulib.mk | |
43 | ' | |
44 | ||
45 | # The source directory, with a trailing '/'. | |
46 | # If empty, the source directory is the working directory. | |
47 | src=$2 | |
48 | case $src in | |
49 | */ | '') ;; | |
50 | *) src=$src/ ;; | |
51 | esac | |
52 | ||
53 | # Gnulib's source directory. | |
54 | gnulib_srcdir=${1-$src../gnulib} | |
55 | ||
56 | case $gnulib_srcdir in | |
57 | -*) src=- ;; | |
58 | esac | |
59 | case $src in | |
60 | -*) | |
61 | echo >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]] | |
62 | ||
63 | SRCDIR is the Emacs source directory (default: working directory). | |
64 | GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)." | |
65 | exit 1 ;; | |
66 | esac | |
67 | ||
68 | test -x "$src"autogen.sh || { | |
69 | echo >&2 "$0: '${src:-.}' is not an Emacs source directory." | |
70 | exit 1 | |
71 | } | |
72 | ||
73 | test -d "$gnulib_srcdir" || | |
74 | git clone -- "$GNULIB_URL" "$gnulib_srcdir" || | |
75 | exit | |
76 | ||
77 | test -x "$gnulib_srcdir"/gnulib-tool || { | |
78 | echo >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory." | |
79 | exit 1 | |
80 | } | |
81 | ||
9b4ee616 PE |
82 | "$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES && |
83 | rm -- "$src"m4/gnulib-cache.m4 "$src"m4/warn-on-use.m4 && | |
9b4ee616 PE |
84 | cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc && |
85 | cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux && | |
86 | autoreconf -i -I m4 -- ${src:+"$src"} |