comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Starting learning ADA
Date: Sun, 9 Jun 2019 21:29:23 +0200
Date: 2019-06-09T21:29:23+02:00	[thread overview]
Message-ID: <qdjmmh$1c21$1@gioia.aioe.org> (raw)
In-Reply-To: e9d07cf3-956e-472d-a3a7-ea5ba84e61b2@googlegroups.com

On 2019-06-09 20:12, Ricardo Brandão wrote:
> Thanks for information Simon
> 
>> If you can install GNAT CE 2019 in this environment, that would probably
>> work much better. And include GPS.
> 
> My question is: I'm in process of learning Ada. So, in some time in the near future (as soon as I got some good knowledge), I'll need to deploy in different devices: at least, Linux servers, embedded devices, and Windows. Will be possible compile the libraries in all these platforms?

Yes, it is easy. Especially with Ada libraries that do not use autoconf, 
make, cmake. Comparing to building any GNU library under, say, VxWorks 
Ada libraries work almost out of the box.

Regarding gprconfig. It frequently gets broken under Debian and Ubuntu. 
You can simply use a configuration file with gprbuild:

    gprbuild --config=config.cgpr -P<project>.gpr

config.cgpr is just a text file with 1-2 lines actually relevant to make 
it work. E.g. this is for Debian GNAT 8:
--------------------------------->
--  This gpr configuration file was generated by gprconfig
configuration project Default is
    for Target use "x86_64-linux-gnu";
    for Inherit_Source_Path ("C++") use ("C");
    for Toolchain_Version ("Ada") use "GNAT 8";
    for Runtime_Dir       ("Ada") use "/usr/lib/gcc/x86_64-linux-gnu/8/";
    for Library_Encapsulated_Supported use "true";
    for Object_Lister use ("nm", "-g");
    for Object_Lister_Matcher use " [TDRB] (.*)";
    for Archive_Builder  use ("ar", "cr");
    for Archive_Builder_Append_Option use ("q");
    for Archive_Indexer  use ("ranlib");
    for Archive_Suffix   use ".a";
    for Library_Builder  use "/usr/lib/gprbuild/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "true";
    for Library_Major_Minor_Id_Supported use "true";
    for Shared_Library_Minimum_Switches use ("-shared");
    for Library_Version_Switches use ("-Wl,-soname,");

    for Shared_Library_Suffix use ".so";
    for Library_Auto_Init_Supported use "true";
    for Run_Path_Option  use ("-Wl,-z,origin,-rpath,");
    for Run_Path_Origin use "$ORIGIN";
    for Library_Encapsulated_Options use ("-shared", "-static-libgcc");
    Target_Name := project'Target;
    case Target_Name is
       when "arm-android" | "arm-linux-androideabi" =>
          null;
       when others =>
          for Library_Partial_Linker use ("/usr/bin/gnatgcc", 
"-nostdlib", "-Wl,-r", "-o");
    end case;
    for Default_Language use "Ada";

    package Compiler is
       for Driver              ("C") use "/usr/bin/gnatgcc";
       for Leading_Required_Switches   ("C") use
          ("-c", "-x", "c") & Compiler'Leading_Required_Switches ("C");
       for Include_Switches        ("C") use ("-I");
       for Max_Command_Line_Length use "8192";
       for Response_File_Format    ("C") use "GCC_GNU";
       for Dependency_Switches ("C") use ("-MMD", "-MF", "");
       for PIC_Option ("C") use ("-fPIC");
       for Driver                   ("Ada") use "/usr/bin/gnatgcc";
       for Language_Kind            ("Ada") use "unit_based";
       for Dependency_Kind          ("Ada") use "ALI_File";
       for Leading_Required_Switches        ("Ada") use
	  ("-c", "-x", "ada", "-gnatA")
              & Compiler'Leading_Required_Switches ("Ada");
       for Mapping_File_Switches    ("Ada") use ("-gnatem=");
       for Mapping_Spec_Suffix      ("Ada") use "%s";
       for Mapping_Body_Suffix      ("Ada") use "%b";
       for Config_File_Switches     ("Ada") use ("-gnatec=");
       for Include_Path_File     ("Ada") use "ADA_PRJ_INCLUDE_FILE";
       for Multi_Unit_Switches ("Ada") use ("-gnateI");
       for Multi_Unit_Object_Separator ("Ada") use "~";
       for Config_Body_File_Name ("Ada") use
            "pragma Source_File_Name_Project (%u, Body_File_Name => 
""%f"");";
       for Config_Spec_File_Name ("Ada") use
            "pragma Source_File_Name_Project (%u, Spec_File_Name => 
""%f"");";
       for Config_Body_File_Name_Index ("Ada") use
            "pragma Source_File_Name_Project (%u, Body_File_Name => 
""%f"", Index => %i);";
       for Config_Spec_File_Name_Index ("Ada") use
            "pragma Source_File_Name_Project (%u, Spec_File_Name => 
""%f"", Index => %i);";
       for Config_Body_File_Name_Pattern ("Ada") use
            "pragma Source_File_Name_Project " &
            "  (Body_File_Name  => ""*%b""," &
            "   Casing          => %c," &
            "   Dot_Replacement => ""%d"");";
       for Config_Spec_File_Name_Pattern ("Ada") use
            "pragma Source_File_Name_Project " &
            "  (Spec_File_Name  => ""*%s""," &
            "   Casing          => %c," &
            "   Dot_Replacement => ""%d"");";
       for Config_File_Unique    ("Ada") use "False";
       for PIC_Option      ("Ada") use ("-fPIC");
    end Compiler;

    package Naming is
       for Spec_Suffix ("Ada") use ".ads";
       for Body_Suffix ("Ada") use ".adb";

       for Body_Suffix ("Asm") use ".s";
       for Body_Suffix ("Asm2") use ".asm";
       for Body_Suffix ("Asm_Cpp") use ".S";

       for Body_Suffix ("C") use ".c";
       for Spec_Suffix ("C") use ".h";

       for Spec_Suffix ("C++") use ".hh";
       for Body_Suffix ("C++") use ".cpp";

       for Body_Suffix ("Fortran") use ".f";

       for Casing use "lowercase";
       for Dot_Replacement use "-";
    end Naming;

    package Binder is
       for Required_Switches ("Ada") use
           Binder'Required_Switches ("Ada") &
           ("gnatbind_prefix=");
       for Objects_Path_File     ("Ada") use "ADA_PRJ_OBJECTS_FILE";
       for Driver         ("Ada") use
           "/usr/lib/gprbuild/gprbind";
    end Binder;

    package Linker is
       for Export_File_Format use "GNU";
       for Export_File_Switch use "-Wl,--version-script=";
       for Map_File_Option         use "-Wl,-Map,";
       for Driver use Compiler'Driver ("Ada");
       for Response_File_Format use "GCC_GNU";
       for Max_Command_Line_Length use "8192";
    end Linker;

    package Clean is
       for Source_Artifact_Extensions ("Ada") use (".dg", ".rep");
       for Object_Artifact_Extensions ("Ada") use (".s", ".ci", ".gcno", 
".su");

       for Source_Artifact_Extensions ("C")   use (".gli");
       for Object_Artifact_Extensions ("C")   use (".s", "ci", ".gcno", 
".su");

       for Source_Artifact_Extensions ("C++") use (".gli");
       for Object_Artifact_Extensions ("C++") use (".s", "ci", ".gcno", 
".su");
       --  Remove the files generated by gnatinspect (in the context of GPS)
       for Artifacts_In_Object_Dir use Clean'Artifacts_In_Object_Dir
          & ("gnatinspect.*");
    end Clean;
end Default;
<------------------------------------------
Check and modify paths in it. Make sure hello-world project compiles and 
then use it with all projects. You can even make gprbuild.sh that calls 
the original gprbuild with the --config switch.


-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2019-06-09 19:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-08 15:26 Starting learning ADA Ricardo Brandão
2019-06-08 15:53 ` Simon Wright
2019-06-08 17:07   ` Ricardo Brandão
2019-06-09  1:42     ` Dennis Lee Bieber
2019-06-09  7:25       ` Niklas Holsti
2019-06-08 15:55 ` joakimds
2019-06-08 17:10   ` Ricardo Brandão
2019-06-08 17:46     ` joakimds
2019-06-08 20:10       ` Simon Wright
2019-06-09 14:39         ` Ricardo Brandão
2019-06-09 17:44           ` Simon Wright
2019-06-09 18:12             ` Ricardo Brandão
2019-06-09 19:29               ` Dmitry A. Kazakov [this message]
2019-06-10 17:40               ` Dennis Lee Bieber
2019-06-09 18:23             ` Dennis Lee Bieber
2019-06-09 14:31       ` Ricardo Brandão
2019-06-09 19:35         ` Dmitry A. Kazakov
2019-06-10 12:28           ` Ricardo Brandão
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox