1# Bootstrap configuration.
2
3# Copyright (C) 2006-2020 Free Software Foundation, Inc.
4
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
18
19# We don't need these modules.
20avoided_gnulib_modules='
21  --avoid=canonicalize-lgpl
22  --avoid=dummy
23'
24
25# gnulib modules used by this package.
26gnulib_modules="
27  $avoided_gnulib_modules
28  acl
29  alignof
30  alloca
31  announce-gen
32  areadlink-with-size
33  argmatch
34  argv-iter
35  assert
36  autobuild
37  backupfile
38  backup-rename
39  base32
40  base64
41  btowc
42  buffer-lcm
43  c-strcase
44  cl-strtod
45  cl-strtold
46  calloc-gnu
47  canon-host
48  canonicalize
49  chmodat
50  chown
51  chownat
52  cloexec
53  closein
54  closeout
55  config-h
56  configmake
57  crypto/md5
58  crypto/sha1
59  crypto/sha256
60  crypto/sha512
61  cycle-check
62  d-ino
63  d-type
64  di-set
65  diacrit
66  dirfd
67  dirname
68  do-release-commit-and-tag
69  dtoastr
70  dup2
71  environ
72  error
73  euidaccess
74  exclude
75  exitfail
76  explicit_bzero
77  faccessat
78  fadvise
79  fchdir
80  fclose
81  fcntl
82  fcntl-safer
83  fd-reopen
84  fdatasync
85  fdl
86  fdopen
87  fdutimensat
88  file-has-acl
89  file-type
90  fileblocks
91  filemode
92  filenamecat
93  filevercmp
94  flexmember
95  fnmatch-gnu
96  fopen-safer
97  fprintftime
98  freopen
99  freopen-safer
100  fseeko
101  fstatat
102  fsusage
103  fsync
104  ftoastr
105  ftruncate
106  fts
107  full-read
108  full-write
109  getgroups
110  gethrxtime
111  getline
112  getloadavg
113  getlogin
114  getndelim2
115  getopt-gnu
116  getpagesize
117  getpass-gnu
118  gettext-h
119  gettime
120  gettimeofday
121  getugroups
122  getusershell
123  git-version-gen
124  gitlog-to-changelog
125  gnu-make
126  gnu-web-doc-update
127  gnumakefile
128  gnupload
129  group-member
130  hard-locale
131  hash
132  hash-pjw
133  heap
134  host-os
135  human
136  idcache
137  ignore-value
138  inttostr
139  inttypes
140  isapipe
141  isatty
142  isblank
143  largefile
144  lchmod
145  lchown
146  ldtoastr
147  lib-ignore
148  linebuffer
149  link
150  link-follow
151  linkat
152  long-options
153  lstat
154  maintainer-makefile
155  malloc-gnu
156  manywarnings
157  mbrlen
158  mbrtowc
159  mbsalign
160  mbschr
161  mbslen
162  mbswidth
163  memcasecmp
164  memchr
165  memcmp2
166  mempcpy
167  memrchr
168  minmax
169  mgetgroups
170  mkancesdirs
171  mkdir
172  mkdir-p
173  mkfifo
174  mknod
175  mkostemp
176  mkstemp
177  mktime
178  modechange
179  mountlist
180  mpsort
181  netinet_in
182  non-recursive-gnulib-prefix-hack
183  nproc
184  nstrftime
185  obstack
186  open
187  openat-safer
188  parse-datetime
189  pathmax
190  perl
191  physmem
192  pipe-posix
193  pipe2
194  posix-shell
195  posixtm
196  posixver
197  priv-set
198  progname
199  propername
200  pthread-cond
201  pthread-mutex
202  pthread-thread
203  pthread_sigmask
204  putenv
205  quote
206  quotearg
207  randint
208  randperm
209  read-file
210  readlink
211  readtokens
212  readtokens0
213  readutmp
214  realloc-gnu
215  regex
216  remove
217  rename
218  renameat
219  renameatu
220  rmdir
221  root-dev-ino
222  rpmatch
223  safe-read
224  same
225  save-cwd
226  savedir
227  savewd
228  select
229  selinux-at
230  setenv
231  settime
232  sig2str
233  sigaction
234  smack
235  ssize_t
236  stat-macros
237  stat-size
238  stat-time
239  statat
240  stdbool
241  stdlib-safer
242  stpcpy
243  stpncpy
244  strdup-posix
245  strncat
246  strnumcmp
247  strsignal
248  strtoimax
249  strtoumax
250  symlinkat
251  sys_ioctl
252  sys_resource
253  sys_stat
254  sys_wait
255  tempname
256  termios
257  time_rz
258  timer-time
259  timespec
260  tzset
261  uname
262  unicodeio
263  unistd-safer
264  unlink-busy
265  unlinkat
266  unlinkdir
267  unlocked-io
268  unsetenv
269  update-copyright
270  uptime
271  useless-if-before-free
272  userspec
273  utimecmp
274  utimens
275  vasprintf-posix
276  vc-list-files
277  verify
278  verror
279  version-etc-fsf
280  wchar-single
281  wcswidth
282  wcwidth
283  winsz-ioctl
284  winsz-termios
285  write-any-file
286  xalloc
287  xbinary-io
288  xdectoint
289  xfts
290  xgetcwd
291  xgetgroups
292  xgethostname
293  xmemcoll
294  xnanosleep
295  xprintf
296  xprintf-posix
297  xreadlink
298  xstrtod
299  xstrtoimax
300  xstrtol
301  xstrtol-error
302  xstrtold
303  xstrtoumax
304  year2038
305  yesno
306"
307
308# Other locale categories that need message catalogs.
309EXTRA_LOCALE_CATEGORIES=LC_TIME
310
311# Additional xgettext options to use.  Use "\\\newline" to break lines.
312XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
313 --flag=asnprintf:3:c-format\\\
314 --flag=asprintf:2:c-format\\\
315 --flag=error:3:c-format\\\
316 --flag=error_at_line:5:c-format\\\
317 --flag=vasnprintf:3:c-format\\\
318 --flag=vasprintf:2:c-format\\\
319 --flag=verror:3:c-format\\\
320 --flag=verror_at_line:5:c-format\\\
321 --flag=wrapf:1:c-format\\\
322 --flag=xasprintf:1:c-format\\\
323 --flag=xfprintf:2:c-format\\\
324 --flag=xprintf:1:c-format\\\
325 --from-code=UTF-8\\\
326'
327
328# Append these, since we use the propername module.
329see_manual='"This is a proper name. See the gettext manual, section Names."'
330see_manual=\'"$see_manual"\'
331XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
332 --keyword=proper_name:1,'"$see_manual"'\\\
333 --keyword=proper_name_utf8:1,'"$see_manual"'\\\
334'
335
336gnulib_tool_option_extras="--tests-base=gnulib-tests --with-tests --symlink\
337 --makefile-name=gnulib.mk
338"
339
340# Build prerequisites
341buildreq="\
342autoconf   2.64
343automake   1.11.2
344autopoint  0.19.2
345bison      -
346gettext    0.19.2
347git        1.4.4
348gperf      -
349gzip       -
350makeinfo   6.1
351patch      -
352perl       5.5
353rsync      -
354tar        -
355xz         -
356"
357
358bootstrap_post_import_hook ()
359{
360  # Automake requires that ChangeLog exist.
361  touch ChangeLog || return 1
362  # List of coreutils programs.  See heading comments in the invoked
363  # script for more info.  Keep this in sync with the rules in
364  (m4f=m4/cu-progs.m4 mkf=src/cu-progs.mk tmp=cu-progs.tmp \
365    && rm -f $m4f $mkf $tmp-1 $tmp-2 \
366    && build-aux/gen-lists-of-programs.sh --autoconf >$tmp-1 \
367    && build-aux/gen-lists-of-programs.sh --automake >$tmp-2 \
368    && chmod a-w $tmp-1 $tmp-2 \
369    && mv -f $tmp-1 $m4f && mv -f $tmp-2 $mkf)
370
371  # Massage lib/gnulib.mk before using it later in the bootstrapping process.
372  build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
373
374  # Regenerate src/single-binary.mk
375  (mkf=src/single-binary.mk tmp=single-binary.tmp \
376    && rm -f $mkf $tmp \
377    && build-aux/gen-single-binary.sh src/local.mk >$tmp \
378    && chmod a-w $tmp \
379    && mv -f $tmp $mkf)
380}
381
382
383bootstrap_epilogue()
384{
385  # Since this is a "GNU" package, replace this line
386  #   if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null \
387  #      | grep -v 'libtool:' >/dev/null; then
388  # with this:
389  #   if true; then
390  # Why?  That pipeline searches all files in $(top_srcdir), and if you
391  # happen to have large files (or apparently large sparse files), the
392  # first grep may well run out of memory.
393  perl -pi -e 's/if LC_ALL=C grep .GNU .PACKAGE.*; then/if true; then/' \
394    po/Makefile.in.in
395
396  # Add dummy 'install-html' target, required for packages using
397  # non-recursive makefiles with older gettext.
398  # See https://debbugs.gnu.org/25690
399  if ! grep -w 'install-html' po/Makefile.in.in ; then
400    printf 'install-%s:;\n' dvi ps pdf html >> po/Makefile.in.in
401  fi
402
403  # Install our git hooks, as long as "cp" accepts the --backup option,
404  # so that we can back up any existing files.
405  case $(cp --help) in *--backup*) backup=1;; *) backup=0;; esac
406  if test $backup = 1; then
407    hooks=$(cd scripts/git-hooks && git ls-files)
408    for f in $hooks; do
409      # If it is identical, skip it.
410      cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
411        && continue
412      cp --backup=numbered scripts/git-hooks/$f .git/hooks
413      chmod a-w .git/hooks/$f
414    done
415  fi
416}
417