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