From 5b59526f5a2eb6b630b62d397e0375b826e9908e Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Fri, 11 May 2018 15:31:23 +0200 Subject: [PATCH] Support to bring in the native compiler --- index/alire-index-gnatcoll.ads | 2 +- index/native/alire-index-gnat.ads | 31 ++++++++----------------- index/native/alire-index-gtkada.ads | 4 ++-- index/native/alire-index-ncursesada.ads | 10 ++++---- src/alire-index.ads | 18 +++++--------- src/alire-properties-labeled.ads | 14 ++++++++--- 6 files changed, 36 insertions(+), 43 deletions(-) diff --git a/index/alire-index-gnatcoll.ads b/index/alire-index-gnatcoll.ads index 31e65826..5b967a67 100644 --- a/index/alire-index-gnatcoll.ads +++ b/index/alire-index-gnatcoll.ads @@ -52,7 +52,7 @@ package Alire.Index.GNATCOLL is package Strings is function Project is new Catalogued_Project - ("GNAT Components Collection - Strings-only"); + ("GNAT Components Collection - Strings only"); package V_20180425 is new Project_Release (Base diff --git a/index/native/alire-index-gnat.ads b/index/native/alire-index-gnat.ads index 83ba99f4..b01918d8 100644 --- a/index/native/alire-index-gnat.ads +++ b/index/native/alire-index-gnat.ads @@ -1,27 +1,16 @@ package Alire.Index.GNAT is --- This is apparently a good idea but it is not, in practice --- Since the compiler is a requisite of alr itself, there's no point in requiring it again here --- Furthermore, the compiler might be installed but not be the one in use --- (e.g., GPL version is in an earlier path) --- Conclusion: use the requisite Compiler_Is_Native instead + function Project is new Catalogued_Project + ("GNAT is a compiler for the Ada programming language"); --- Still, this might come back for cross-compilations or sumzing + Base : constant Release := Project.Unreleased + (Properties => Path ("/usr/bin")); --- function Project is new Catalogued_Project (Projects.GNAT); --- --- -- If minor versions proved important they could be segregated with platform-specific knowledge --- --- V_8 : constant Release := --- Project.Register --- (V ("8"), --- Native ((Debian | Ubuntu => Packaged_As ("gnat-8"), --- others => Unavailable))); --- --- V_7 : constant Release := --- Project.Register --- (V ("7"), --- Native ((Debian | Ubuntu => Packaged_As ("gnat-7"), --- others => Unavailable))); + -- If minor versions proved important they could be segregated with platform-specific knowledge + + package V_7 is new Project_Release + (Base.Replacing + (Origin => Native ((Debian | Ubuntu => Packaged_As ("gnat-7"), + others => Unavailable)))); end Alire.Index.GNAT; diff --git a/index/native/alire-index-gtkada.ads b/index/native/alire-index-gtkada.ads index 40802838..cd3af123 100644 --- a/index/native/alire-index-gtkada.ads +++ b/index/native/alire-index-gtkada.ads @@ -10,8 +10,8 @@ package Alire.Index.GtkAda is Native ((Debian | Ubuntu => Packaged_As ("libgtkada16.1.0-dev"), others => Unavailable)), - Available_When => - Compiler_Is_Native + Dependencies => + GNAT.Project.Current ); end Alire.Index.GtkAda; diff --git a/index/native/alire-index-ncursesada.ads b/index/native/alire-index-ncursesada.ads index db9b68f2..0d3a8119 100644 --- a/index/native/alire-index-ncursesada.ads +++ b/index/native/alire-index-ncursesada.ads @@ -1,3 +1,5 @@ +with Alire.Index.GNAT; + package Alire.Index.NcursesAda is function Project is @@ -9,8 +11,8 @@ package Alire.Index.NcursesAda is Native ((Debian | Ubuntu => Packaged_As ("libncursesada5-dev"), others => Unavailable)), - Available_When => - Compiler_Is_Native + Dependencies => + GNAT.Project.Current ); V_5 : constant Release := @@ -19,8 +21,8 @@ package Alire.Index.NcursesAda is Native ((Debian | Ubuntu => Packaged_As ("libncursesada3-dev"), others => Unavailable)), - Available_When => - Compiler_Is_Native + Dependencies => + GNAT.Project.Current ); end Alire.Index.NcursesAda; diff --git a/src/alire-index.ads b/src/alire-index.ads index 0439c1a8..559130e2 100644 --- a/src/alire-index.ads +++ b/src/alire-index.ads @@ -280,12 +280,13 @@ package Alire.Index is function Maintainer is new PL.Cond_New_Label (Properties.Labeled.Maintainer); function Website is new PL.Cond_New_Label (Properties.Labeled.Website); --- function U (Prop : Properties.Vector) return Conditional.Properties renames Conditional.For_Properties.New_Value; + function Path is new PL.Cond_New_Path_Label (Properties.Labeled.Path); + function Project_File is new PL.Cond_New_Path_Label (Properties.Labeled.Project_File); + + -- Non-label attributes or processed data require a custom builder function + function U (Prop : Properties.Property'Class) return Conditional.Properties renames Conditional.For_Properties.New_Value; --- (U (+Prop)); - - -- Non-label attributes or processed data require a custom builder function function GPR_Free_Scenario (Name : String) return Conditional.Properties is (U (Properties.Scenarios.New_Property (GPR.Free_Variable (Name)))); @@ -295,8 +296,6 @@ package Alire.Index is function License (L : Licensing.Licenses) return Conditional.Properties is (U (Properties.Licenses.Values.New_Property (L))); - - function Project_File (File : Platform_Independent_Path) return Release_Properties; -- Concatenate function "and" (L, R : Release_Properties) return Release_Properties @@ -322,7 +321,7 @@ package Alire.Index is package Plat_Reqs renames Requisites.Platform; function Compiler is new Requisites.Platform.Compilers.Factory; - function Compiler_Is_Native return Release_Requisites renames Plat_Reqs.Compiler_Is_Native; +-- function Compiler_Is_Native return Release_Requisites renames Plat_Reqs.Compiler_Is_Native; use all type Requisites.Platform.Compilers.Comparable; function Distribution is new Requisites.Platform.Distributions.Factory; @@ -400,11 +399,6 @@ private function Project (C : Catalog_Entry) return Alire.Project is (C.Project); - function Project_File_Unsafe is new PL.Cond_New_Label (Properties.Labeled.Project_File); - - function Project_File (File : Platform_Independent_Path) return Release_Properties is - (Project_File_Unsafe (Utils.To_Native (File))); - function Unavailable return Conditional.Dependencies is (Conditional.For_Dependencies.New_Value -- A conditional (without condition) dependency vector (Dependencies.Unavailable)); diff --git a/src/alire-properties-labeled.ads b/src/alire-properties-labeled.ads index 3c569c58..4a46a9b9 100644 --- a/src/alire-properties-labeled.ads +++ b/src/alire-properties-labeled.ads @@ -6,19 +6,20 @@ package Alire.Properties.Labeled with Preelaborate is -- Properties that have a single string value and a name - type Labels is (-- user labels - Author, -- VIP + type Labels is (Author, -- VIP Comment, -- Extra text Description, -- One-liner description, so it is searched too Executable, -- A resulting executable built by the project Maintainer, -- Info about the maintainer of the alr-packaged project + Path, -- Extra path for PATH to add to build (prepended) Project_File,-- Buildable project files in the release, with full relative path Website -- A website other than the repository ); type Label (<>) is new Properties.Property with private; - function New_Label (Name : Labels; Value : String) return Label; + function New_Label (Name : Labels; + Value : String) return Label; function Name (L : Label) return Labels; @@ -35,6 +36,10 @@ package Alire.Properties.Labeled with Preelaborate is Name : Labels; function Cond_New_Label (Value : String) return Conditional.Properties; + generic + Name : Labels; + function Cond_New_Path_Label (Value : Platform_Independent_Path) return Conditional.Properties; + private type Label (Length : Natural) is new Properties.Property with record @@ -55,6 +60,9 @@ private function Cond_New_Label (Value : String) return Conditional.Properties is (Conditional.For_Properties.New_Value (New_Label (Name, Value))); + function Cond_New_Path_Label (Value : Platform_Independent_Path) return Conditional.Properties is + (Conditional.For_Properties.New_Value (New_Label (Name, Utils.To_Native (Value)))); + overriding function Image (L : Label) return String is (Utils.To_Mixed_Case (L.Name'Img) & ": " & L.Value); end Alire.Properties.Labeled;