#!/bin/sh
set -C -e -f -u
cd "$AUTOPKGTEST_TMP"

# Build static archives because these are the part adapted the most
# for Debian/Ada.

# By the way test a native build.  The gnat package and it symbolic
# links may not be installed, so this is quite similar to a cross
# build.

cat > m.adb <<EOF
with Ada.Text_IO;
procedure M is
begin
   Ada.Text_IO.Put_Line ("Hello from Ada.");
end M;
EOF
cat > p.gpr <<EOF
library project P is
   for Languages use ("Ada");
   for Library_Name use "p";
   for Library_Dir use "lib";
   for Library_Kind use "static";
   for Source_Files use ("m.adb");
   package Compiler is
      for Switches ("Ada") use External_As_List ("ADAFLAGS", " ");
   end Compiler;
end P;
EOF

gprbuild -vh p.gpr
find . -type f -a -not -name m.adb -a -not -name p.gpr -delete
gprbuild -vh p.gpr --target=alpha-linux-gnu
find . -type f -a -not -name m.adb -a -not -name p.gpr -delete
gprbuild -vh p.gpr --target=x86_64-w64-mingw32
