Commit 25076bd9 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Make sure kazoo is found in the path

parent 71f2c2a1
...@@ -41,7 +41,8 @@ endif ...@@ -41,7 +41,8 @@ endif
install: install:
$(MAKE) $(MAKE)
cp kazoo `ocarina-config --prefix`/bin/ mkdir -p `ocarina-config --prefix`/share/kazoo
cp -a templates kazoo `ocarina-config --prefix`/share/kazoo
edit: edit:
OCARINA_PATH=`ocarina-config --prefix` gps OCARINA_PATH=`ocarina-config --prefix` gps
......
...@@ -175,6 +175,7 @@ package body TASTE.Concurrency_View is ...@@ -175,6 +175,7 @@ package body TASTE.Concurrency_View is
All_Thread_Names : Tag; -- Complete list of threads All_Thread_Names : Tag; -- Complete list of threads
All_Target_Names : Tag; -- List of all targets used (AADL packages) All_Target_Names : Tag; -- List of all targets used (AADL packages)
begin begin
Put_Debug ("Concurrency View templates expected in " & Prefix);
Start_Search (Search => ST, Start_Search (Search => ST,
Pattern => "", Pattern => "",
Directory => Prefix, Directory => Prefix,
...@@ -636,10 +637,6 @@ package body TASTE.Concurrency_View is ...@@ -636,10 +637,6 @@ package body TASTE.Concurrency_View is
procedure Generate_CV (CV : Taste_Concurrency_View) is procedure Generate_CV (CV : Taste_Concurrency_View) is
begin begin
-- In this first iteration Nodes are generated in standalone files,
-- and they include their processes. It would be useful to be able
-- to decide if processes could also have their own files, since
-- in the future they may be more than one process per node (for TSP).
CV.Generate_Code; CV.Generate_Code;
exception exception
when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error => when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error =>
......
...@@ -51,6 +51,7 @@ package body TASTE.Dump is ...@@ -51,6 +51,7 @@ package body TASTE.Dump is
-- Tags that are built over the whole system -- Tags that are built over the whole system
-- and cleant up between each template folder: -- and cleant up between each template folder:
begin begin
Put_Debug ("Folder with Dump templates: " & Prefix);
Start_Search (Search => ST, Start_Search (Search => ST,
Pattern => "", Pattern => "",
Directory => Prefix, Directory => Prefix,
......
...@@ -6,6 +6,9 @@ with Ada.Characters.Latin_1, ...@@ -6,6 +6,9 @@ with Ada.Characters.Latin_1,
Ada.Strings.Maps, Ada.Strings.Maps,
Ada.Strings.Fixed, Ada.Strings.Fixed,
Ada.Strings, Ada.Strings,
Ada.Directories,
Ada.Command_Line,
Ada.Environment_Variables,
GNAT.OS_Lib, GNAT.OS_Lib,
GNAT.Strings, GNAT.Strings,
GNAT.Command_Line, GNAT.Command_Line,
...@@ -66,11 +69,47 @@ package body TASTE.Parser_Utils is ...@@ -66,11 +69,47 @@ package body TASTE.Parser_Utils is
procedure Parse_Command_Line (Result : out Taste_Configuration) is procedure Parse_Command_Line (Result : out Taste_Configuration) is
Config : Command_Line_Configuration; Config : Command_Line_Configuration;
Version : aliased Boolean := False; Version : aliased Boolean := False;
Command : constant String := Ada.Command_Line.Command_Name;
use String_Holders; use String_Holders;
IV, DeplV, DataV, OutDir : aliased GNAT.Strings.String_Access := null; IV, DeplV, DataV, OutDir : aliased GNAT.Strings.String_Access := null;
begin begin
Result.Binary_Path := To_Holder (Get_Program_Directory); -- Retrieve the path of the kazoo binary, to have a base prefix
-- to find the templates folder
if Command /= "kazoo" then
-- Command used a explicit path to call kazoo - use it
Result.Binary_Path := To_Holder (Get_Program_Directory);
else
-- We must find kazoo in the PATH
-- This will work only on Linux because the PATH separator is ":"
-- while on Windows it is ";"
declare
Path : constant String := Ada.Environment_Variables.Value ("PATH");
Nb : constant Natural := Ada.Strings.Fixed.Count (Path, ":");
From : Natural := Path'First;
To : Natural;
begin
if Nb = 0 then
To := Path'Last;
end if;
for I in 0 .. Nb loop
To := Ada.Strings.Fixed.Index (Path, ":", From => From);
if To = 0 then
To := Path'Last + 1;
end if;
if Ada.Directories.Exists
(Path (From .. To - 1) & "/" & "kazoo")
then
-- Found the folder containing the kazoo binary
Result.Binary_Path := To_Holder
(Path (From .. To - 1) & "/");
exit;
end if;
From := To + 1;
end loop;
end;
end if;
Define_Switch (Config, Output => IV'Access, Define_Switch (Config, Output => IV'Access,
Switch => "-i:", Switch => "-i:",
Long_Switch => "--interfaceview=", Long_Switch => "--interfaceview=",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment