# bootstrap.conf - Bootstrap configuration.
# Copyright (C) 2007-2012, 2018-2020 Free Software Foundation, Inc.
#
# This file is part of GNU Wget.
#
# GNU Wget is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# GNU Wget is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see `https://www.gnu.org/licenses/'.

# gnulib library name
source_base=lib
tests_base=lib/tests
gnulib_name=libgnu
gnulib_tool_option_extras="--makefile-name=gnulib.mk"
use_libtool=0
checkout_only_file=

# gnulib modules used by this package.
gnulib_modules="
accept
announce-gen
base32
bind
c-ctype
c-strcase
c-strcasestr
clock-time
close
connect
dirname
fcntl
flock
fnmatch-gnu
fopen
futimens
ftello
getaddrinfo
getline
getopt-gnu
getpass-gnu
getpeername
getsockname
gettext-h
gitlog-to-changelog
git-version-gen
gnupload
group-member
hostent
ioctl
iconv
iconv-h
inet_ntop
intprops
inttypes
langinfo
limits-h
link
listen
maintainer-makefile
mbiter
mbtowc
memrchr
mkdir
mkstemp
mkostemp
nanosleep
crypto/md2
crypto/md4
crypto/md5
crypto/sha1
crypto/sha256
crypto/sha512
open
pipe-posix
posix_spawn
quote
quotearg
recv
regex
select
send
setsockopt
signal-h
sigprocmask
sigpipe
snprintf
socket
spawn-pipe
stat
stdbool
stdint
strcase
strerror_r-posix
strpbrk
strptime
strtok_r
strtol
strtoll
symlink
sys_types
timegm
tmpdir
unlink
unlocked-io
update-copyright
libunistring-optional
unistr/u8-strlen
unicase/u8-tolower
utime
utime-h
utimens
vasprintf
vsnprintf
warnings
wcwidth
write
xmemdup0
xstrndup
"

gnulib_extra_files="
	$build_aux/install-sh
	$build_aux/mdate-sh
	$build_aux/texinfo.tex
	$build_aux/depcomp
	$build_aux/config.guess
	$build_aux/config.sub
	$build_aux/config.rpath
	doc/INSTALL
"

# Build prerequisites
buildreq="\
autoconf   2.62
automake   1.11.1
autopoint  -
gettext    0.17
git        1.4.4
makeinfo   -
perl       5.5
tar        -
gzip       -
flex       -
gperf      -
"

bootstrap_post_import_hook ()
{
  # We need to patch unicase/special-casing-table.h for gperf < 3.1
  GPERF_VER=$(gperf --version | {
    IFS=' .' read x y major minor bugfix _
    printf "%d%02d%02d" $major $minor $bugfix
  })

  if [ $GPERF_VER -lt 30100 ]; then
    echo "Creating lib/unicase/special-casing-table.h for gperf < 3.1"
     gperf -m 10 lib/unicase/special-casing-table.gperf | \
       sed -e "s/gl_unicase_special_lookup.*/gl_unicase_special_lookup\ \(const char \*str, size_t len\)/g" \
         > lib/unicase/special-casing-table.h
  fi

  # ./bootstrap calls 'autopoint --force' which will overwrite
  #   po/Makevars.template. So here we add what we need for a VPATH
  #   build. ./bootstrap will create po/Makevars from po/Makevars.template
  #   after our change.
  echo 'PACKAGE_GNU = yes' >> po/Makevars.template
}