1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
#! /bin/echo this-file-should-be-sourced,-not-executed.
## -*- Mode: shell-script -*-
## bootstrap -- bootstrapping script
##
## This file is part of Complexity.
## Complexity Copyright (c) 2011-2020 by Bruce Korb - all rights reserved
##
## Complexity 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.
##
## Complexity 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 <http://www.gnu.org/licenses/>.
gnulib_stuff() {
# If there's a git directory, then clean the repo
#
if test -d .git
then
git clean -f -x -d .
# else if we have a pointer to the source tree, cd to there
#
elif test -f .sdir
then
cd $(<.sdir)
# else assume we're next door to the source tree.
#
else
cd $(dirname "$0")/../complexity || \
die "Cannot locate source directory"
fi
# We are now in the source tree for complexity. Assume gnulib is next door
#
export GNULIB_SRCDIR=$(realpath ../gnulib)
v=$(bash ${GNULIB_SRCDIR}/build-aux/git-version-gen \
$progdir/.tarball-version)
printf %s $v > $progdir/.tarball-version
sed "s/m4.*cat .tarball-version.*/$v,/" \
$progdir/configure.ac > $progdir/configure.ver
mv -f $progdir/configure.ver $progdir/configure.ac
export gnulib_tool=${GNULIB_SRCDIR}/gnulib-tool
export gnulib_path=${GNULIB_SRCDIR}
cd $progdir
ln -s $gnulib_path gnulib
}
gen_this_source()
{
cmd_path=$(command -v $1)
local sum=$(sum $2 | sed $'s/[ \t][ \t]*/./g')
sum_pattern="sum: $2 = $sum"
shift 2
test -x "$cmd_path" || \
cmd_path="die -- the '$1' tool cannot be found"
for f
do test -f $f || return $true_res
done
grep -q -E "$sum_pattern" $1 && return $false_res
return $true_res
}
gen_source()
{
cd $progdir/src
if gen_this_source autogen opts.def opts.c opts.h
then
echo "Rebuilding opts.c opts.h"
$cmd_path opts.def || die FAILED: $cmd_path
chmod u+w opts.c
echo "/* $sum_pattern */" >> opts.c
chmod a-w opts.c
tail opts.c
fi
if gen_this_source char-mapper char-types.map char-types.h
then
echo "Rebuilding char-types.h"
$cmd_path char-types.map || die FAILED: $cmd_path
chmod u+w char-types.h
echo "/* $sum_pattern */" >> char-types.h
chmod a-w char-types.h
tail char-types.h
fi
}
initialize()
{
true_res=0
false_res=1
set -e
if shopt -qo xtrace
then
PS4='>BS-${FUNCNAME:-=}-$LINENO> '
TRAPPED=false
tcode='TRAPPED=true sfile=${BASH_SOURCE[0]} sline=${BASH_LINENO[0]}'
trap "$tcode"' ; die "failed: ${_:-${FUNCNAME[0]}}"' 0
fi
cd $progdir
builddir=$PWD
rm -rf m4 build-aux 2>/dev/null
mkdir m4 build-aux
chmod a+x tests/*.test
# List of programs (and minimum versions) required to bootstrap, maintain
# and release Libtool.
buildreq="
make 3.81 http://www.gnu.org/s/make
makeinfo 4.8 http://www.gnu.org/s/texinfo
xz 4.999.8beta http://tukaani.org/xz
"
gnulib_stuff
gen_source
cd ${progdir}
cp $(autoopts-config pkgdatadir)/liboptschk.m4 m4/.
sed $'1i\\\n'"New in $v - $(date +'%B %Y')"$'\\\n\n' NEWS > XX
mv -f XX NEWS
gnulib_modules="\
close
fdl
gendocs
gpl-3.0
malloc-posix
snprintf
stdbool"
set +e
}
untrap_die() {
case "$(trap -p 0)" in
*TRAPPED=true*' die '* )
trap '' 0
;;
esac
ln build-aux/* .
}
. ./"$0.std"
initialize
func_add_hook func_fini untrap_die
# Local Variables:
# mode:shell-script
# sh-indentation:4
# sh-basic-offset:4
# indent-tabs-mode: nil
# End:
# bootstrap.conf ends here
|