I hope you don't mind me posting this here in case it is of use to anyone?
#!/bin/sh
STARTDIR=$(pwd)
CREATEDIR="gprbuild"
VER="22.0.0"
GPRURL="https://github.com/AdaCore/gprbuild/archive/refs/tags/v22.0.0.tar.gz"
XMLURL="https://github.com/AdaCore/xmlada/archive/refs/tags/v22.0.0.tar.gz"
GPRCONFURL="https://github.com/AdaCore/gprconfig_kb/archive/refs/tags/v21.0.0.tar.gz"
GPRSHA="076e2b6ac0c7170753a6499094a6d30a98698aca2551c6796b3a617dd9ffc704"
XMLSHA="853ed895defd395c0bc96c23a50812168b656b31befc1336f45c5541f2bec06d"
GPRCONFSHA="2aec26afad5bb1a4685d9c041c9c797ff5beda211a5e81f2a97452d2ceabc557"
GPRNAME="gprbuild-$VER"
XMLNAME="xmlada-$VER"
GPRCONFNAME="gprconfig_kb-21.0.0"
GPRBUILDPATH="$STARTDIR/$CREATEDIR/$GPRNAME"
XMLBUILDPATH="$STARTDIR/$CREATEDIR/$XMLNAME"
GPRCONFBUILDPATH="$STARTDIR/$CREATEDIR/$GPRCONFNAME"
GPRTAR="$GPRNAME.tar.gz"
XMLTAR="$XMLNAME.tar.gz"
GPRCONFTAR="$GPRCONFNAME.tar.gz"
# may as well immediately set the path where the bootstrap binaries are created and then
# used by this script.
PATH=$PATH:"$GPRBUILDPATH/bootstrap/bin":"$GPRBUILDPATH/bootstrap/libexec/gprbuild"
get() {
if [ ! -f "$1" ]; then
ftp -o "$1" "$3"
fi
DWNSHA=$(sha256 -q "$1")
if [ X"$DWNSHA" != X"$2" ]; then
echo "Download: $DWNSHA"
echo "Expected: $2"
echo "Checksum Failed"
exit 1
fi
}
if [ ! -d "$CREATEDIR" ]; then
mkdir "$CREATEDIR"
fi
cd "$CREATEDIR"
get "$GPRTAR" "$GPRSHA" "$GPRURL"
get "$XMLTAR" "$XMLSHA" "$XMLURL"
get "$GPRCONFTAR" "$GPRCONFSHA" "$GPRCONFURL"
tar -xzf "$GPRTAR"
tar -xzf "$XMLTAR"
tar -xzf "$GPRCONFTAR"
cd "$GPRBUILDPATH"
echo "_________________________________________________________________________"
echo ""
echo " Building Bootstrapped GprBuild"
echo "_________________________________________________________________________"
if ! /bin/sh ./bootstrap.sh --with-xmlada="$XMLBUILDPATH" --with-kb="$GPRCONFBUILDPATH" --prefix=./bootstrap; then
exit 1
fi
echo "_________________________________________________________________________"
echo ""
echo " Creating default.cgpr using bootstrapped gprconfig"
echo "_________________________________________________________________________"
cd "$GPRBUILDPATH"
echo $PATH
if ! gprconfig --batch --config Ada --config C; then
echo "Failed";
exit 1
fi
cp default.cgpr "$STARTDIR/$CREATEDIR/$XMLNAME"
echo "_________________________________________________________________________"
echo ""
echo " Build & Install XMLAda"
echo "_________________________________________________________________________"
cd "$XMLBUILDPATH"
if ! ./configure --prefix=/usr/local; then
exit 1
fi
# path to bootstrap bin already set at the begining of the script
gmake all
# doas clears the PATH env variable for general security, so re-instantiate it here
# specifically
if ! doas env PATH="$PATH" gmake install; then
exit 1
fi
echo "_________________________________________________________________________"
echo ""
echo " Building GprBuild"
echo "_________________________________________________________________________"
cd "$GPRBUILDPATH"
# path to bootstrap libexec already set at the begining of the script
if ! gmake prefix=/usr/local setup; then
exit 1
fi
# XXX
# temp fix for picking up pre-existing gprbind in /usr/local from previous builds
# might be cleaner to Run uninstalls? /usr/local is relatively easy to clean on OpenBSD though
if grep -q "/usr/local" default.cgpr; then
echo ",s/\/usr\/local\/libexec\/gprbuild\/gprbind/bootstrap\/libexec\/gprbuild\/gprbind/\nw" | /bin/ed -s default.cgpr
else
echo ",s/libexec\/gprbuild\/gprbind/bootstrap\/libexec\/gprbuild\/gprbind/\nw" | /bin/ed -s default.cgpr
fi
if ! gmake all; then
exit 1
fi
# doas clears the PATH env variable for general security, so re-instantiate it here
# specifically
if ! doas env PATH="$PATH" gmake install TARGET=$(gcc -dumpmachine); then
echo "Make install failed but the binaries to be installed are located at: $GPRBUILDPATH"
fi
echo "_________________________________________________________________________"
echo ""
echo " Finished"
echo "_________________________________________________________________________"
I hope you don't mind me posting this here in case it is of use to anyone?