How to install gprbuild on Linux - Centos7

1.2k Views Asked by At

I have recently dowloaded GNAT Community on my Linux machine (Centos7).

Within /home/parallels/opt/GNAT/2019 there is a folder gprbuild, my understanding is that to install this I need to execute the bootstrap.sh script that is located within gprbuild: /home/parallels/opt/GNAT/2019/gprbuild/bootstrap.sh

I try to execute the bootstrap.sh script like so...

[parallels@localhost gprbuild]$ ./bootstrap.sh

Then I recieve this error message...

./bootstrap.sh: line 87: gnatmake: command not found

Here is the bootstrap.sh script...

# bootstrap.sh - a simple bootstrap for building gprbuild with xmlada

progname=bootstrap

prefix=/usr/local
bindir=/bin
datarootdir=/share
libexecdir=/libexec

srcdir=$PWD
xmlada_src=../xmlada

CC=${CC:-cc}
GNATMAKE=${GNATMAKE:-gnatmake}
CFLAGS=${CFLAGS:-$CFLAGS}
GNATMAKEFLAGS=${GNATMAKEFLAGS:--j0}

usage() {
    cat >&2 <<EOF
usage: $progname [options]

Options [defaults in brackets]:
  --prefix=DIR       installation prefix [$prefix]
  --bindir=DIR       user executables [PREFIX/bin]
  --libexecdir=DIR   program executables [PREFIX/libexec]
  --datarootdir=DIR  read-only arch.-independent data root [PREFIX/share]

  --srcdir=DIR       source code path [$PWD]

  --with-xmlada=DIR  xmlada source path [$xmlada_src]

  --build            build only but do not install
  --install          install only, skip build steps

Environment variables:
  CC                 specify C compiler [$CC]
  CFLAGS             set C and Ada compilation flags [$CFLAGS]
  DESTDIR            optional for staged installs
  GNATMAKE           specify gnatmake Ada builder [$GNATMAKE]
  GNATMAKEFLAGS      additional Ada builder flags [$GNATMAKEFLAGS]
EOF
exit 0
}

error() {
    printf -- "%s: $1" "$progname" "${@:2}" >&2
    exit 1
}

while :; do
    case $1 in
        --prefix=?*)      prefix=${1#*=} ;;
        --bindir=?*)      bindir=${1#*=} ;;
        --libexecdir=?*)  libexecdir=${1#*=} ;;
        --datarootdir=?*) datarootdir=${1#*=} ;;

        --srcdir=?*)      srcdir=${1#*=} ;;
        --with-xmlada=?*) xmlada_src=${1#*=} ;;
    --build)          MODE="build";;
    --install)        MODE="install";;

        -h|-\?|--help)    usage ;;

        *=*)              error '%s: Requires a value, try --help\n' "$1" ;;
        -?*)              error '%s: Unknown option, try --help\n' "$1" ;;
        *)                break # End of arguments.
    esac
    shift
done

set -e

inc_flags="-I$srcdir/src -I$srcdir/gpr/src -I$xmlada_src/sax -I$xmlada_src/dom \
-I$xmlada_src/schema -I$xmlada_src/unicode -I$xmlada_src/input_sources"

# Programs to build and install
bin_progs="gprbuild gprconfig gprclean gprinstall gprname gprls"
lib_progs="gprlib gprbind"

# Build
if [ "x"${MODE} == "x" ] || [ ${MODE} == "build" ];
then
    command $CC -c $CFLAGS "$srcdir"/gpr/src/gpr_imports.c

    for bin in $bin_progs; do
        command $GNATMAKE $inc_flags "$bin"-main -o "$bin" $CFLAGS $GNATMAKEFLAGS -largs gpr_imports.o
    done

    for lib in $lib_progs; do
        command $GNATMAKE $inc_flags "$lib" $CFLAGS $GNATMAKEFLAGS -largs gpr_imports.o
    done
fi;

# Install

if [ "x"${MODE} == "x" ]  || [ ${MODE} == "install" ];
then
    mkdir -p "$DESTDIR$prefix$bindir"
    mkdir -p "$DESTDIR$prefix$libexecdir"/gprbuild
    mkdir -p "$DESTDIR$prefix$datarootdir"/gprconfig
    mkdir -p "$DESTDIR$prefix$datarootdir"/gpr

    install -m0755 $bin_progs -t "$DESTDIR$prefix$bindir"
    install -m0755 $lib_progs -t "$DESTDIR$prefix$libexecdir"/gprbuild
    install -m0644 "$srcdir"/share/gprconfig/*.xml -t "$DESTDIR$prefix$datarootdir"/gprconfig
    install -m0644 "$srcdir"/share/gprconfig/*.ent -t "$DESTDIR$prefix$datarootdir"/gprconfig
    install -m0644 "$srcdir"/share/_default.gpr "$DESTDIR$prefix$datarootdir"/gpr/_default.gpr
fi

I have been told that I need to install xmlada prior to installing gprbuild, then I have read elsewhere that I need to install gprbuild to be able to install xmlada!

I have a similair issue when attempting to install xmlada, the shell script within the xmlada folder is called install-sh, when I attempt to install this I am told there is no input file specified...

[parallels@localhost xmlada]$ ./install-sh
./install-sh: no input file specified.

I apreciate this is really two questions in one, but I felt I had to explain it this way, as I am unsure which library needs to be installed first, and also how do I actually install them.

Any help would be greatly apreciated! I hope you're all having a good weekend... :)

Thanks, Lloyd

1

There are 1 best solutions below

1
On

Just install gcc-ada, or search in your package manager for gcc-ada (may change its name), gnat* commands come in this package