From b360ed3dda50e02beab636732fcb458c5b877962 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Tue, 6 Mar 2018 20:24:00 +0100 Subject: [PATCH] GPR Paths + bunch'o libs --- index/alire-index-alire.ads | 5 +- index/alire-index-dak.ads | 29 +++++---- index/alire-index-libadacrypt.ads | 17 ++--- index/alire-index-openglada.ads | 53 ++++++++++++++++ index/alire-index-sdlada.ads | 63 ++++++++++++++++++ index/native/alire-index-libglfw3.ads | 15 +++++ index/{ => native}/alire-index-libgnutls.ads | 0 index/native/alire-index-libsdl2.ads | 26 ++++++++ index/native/alire-index-libx11.ads | 15 +++++ index/{ => native}/alire-index-unixodbc.ads | 0 src/alire-index.adb | 29 ++++++++- src/alire-index.ads | 67 +++++++++++++------- src/alire-properties-labeled.ads | 15 +++-- src/alire-utils.ads | 11 ++++ 14 files changed, 290 insertions(+), 55 deletions(-) create mode 100644 index/alire-index-openglada.ads create mode 100644 index/alire-index-sdlada.ads create mode 100644 index/native/alire-index-libglfw3.ads rename index/{ => native}/alire-index-libgnutls.ads (100%) create mode 100644 index/native/alire-index-libsdl2.ads create mode 100644 index/native/alire-index-libx11.ads rename index/{ => native}/alire-index-unixodbc.ads (100%) diff --git a/index/alire-index-alire.ads b/index/alire-index-alire.ads index 452d8ce5..a9d7a7bc 100644 --- a/index/alire-index-alire.ads +++ b/index/alire-index-alire.ads @@ -41,10 +41,11 @@ package Alire.Index.Alire is (Preferred => Within_Major ("alire_alt", V ("1.0")), Otherwise => Within_Major ("alire", V ("0.5")))), - Properties => - GPR_Extra_Config ("-XProfile=False") and + Alr_Properties => -- These are only interesting to alr, not users + GPR_Config ("-XProfile=False"), -- Sample extra params for build + Properties => GPR_Scenario ("Build", "Debug" or "Release") and GPR_Free_Scenario ("Path_To_Something") and -- Known scenario variables diff --git a/index/alire-index-dak.ads b/index/alire-index-dak.ads index 1eba8a7f..9de46f89 100644 --- a/index/alire-index-dak.ads +++ b/index/alire-index-dak.ads @@ -243,24 +243,25 @@ package Alire.Index.DAK is GPR_File ("components-odbc.gpr") and GPR_File ("test_components/components-odbc-odbc_bindings_tests.gpr") and - On_Condition - (System_Is (GNU_Linux), - GPR_Extra_Config ("-Xodbc=unixODBC")) and - On_Condition - (System_Is (Windows), - GPR_Extra_Config ("-Xodbc=ODBC32")) and - On_Condition - (Word_Size_Is (Bits_32), - GPR_Extra_Config ("-Xarch=i686")) and - On_Condition - (Word_Size_Is (Bits_64), - GPR_Extra_Config ("-Xarch=x86_64")) and - Executable ("test_odbc_bindings") and License (GMGPL_2_0) and Author (DAK_Author) and - Website (DAK_Website) + Website (DAK_Website), + + Alr_Properties => + On_Condition + (System_Is (GNU_Linux), + GPR_Config ("-Xodbc=unixODBC")) and + On_Condition + (System_Is (Windows), + GPR_Config ("-Xodbc=ODBC32")) and + On_Condition + (Word_Size_Is (Bits_32), + GPR_Config ("-Xarch=i686")) and + On_Condition + (Word_Size_Is (Bits_64), + GPR_Config ("-Xarch=x86_64")) ); end Alire.Index.DAK; diff --git a/index/alire-index-libadacrypt.ads b/index/alire-index-libadacrypt.ads index 16846e7d..da94e70f 100644 --- a/index/alire-index-libadacrypt.ads +++ b/index/alire-index-libadacrypt.ads @@ -21,13 +21,6 @@ package Alire.Index.Libadacrypt is GPR_File ("libadacrypt.gpr") and GPR_File ("acltest.gpr") and - On_Condition - (System_Is (GNU_Linux), - GPR_Extra_Config ("-Xsystem=unix")) and - On_Condition - (System_Is (Windows), - GPR_Extra_Config ("-Xsystem=windows")) and - GPR_Scenario ("system", "unix" or "windows") and GPR_Scenario ("mode", "debug" or "release") and @@ -39,7 +32,15 @@ package Alire.Index.Libadacrypt is Author (Prj_Author) and License (GMGPL_2_0) and - License (GMGPL_3_0) + License (GMGPL_3_0), + + Alr_Properties => + On_Condition + (System_Is (GNU_Linux), + GPR_Config ("-Xsystem=unix")) and + On_Condition + (System_Is (Windows), + GPR_Config ("-Xsystem=windows")) ); end Alire.Index.Libadacrypt; diff --git a/index/alire-index-openglada.ads b/index/alire-index-openglada.ads new file mode 100644 index 00000000..f531c372 --- /dev/null +++ b/index/alire-index-openglada.ads @@ -0,0 +1,53 @@ +with Alire.Index.Libglfw3; +with Alire.Index.LibX11; + +package Alire.Index.OpenGLAda is + + Prj_Name : constant Project_Name := "openglada"; + Prj_Desc : constant Project_Description := "Thick Ada binding for OpenGL and GLFW"; + Prj_Repo : constant URL := "https://github.com/flyx/OpenGLAda.git"; + + Prj_Author : constant String := "Felix Krause "; + Prj_Website : constant URL := "http://flyx.github.io/OpenGLAda/"; + + V_0_0_0 : constant Release := + Register (Prj_Name, + V ("0.6"), + Prj_Desc, + Git (Prj_Repo, "54a7a50cebab2cba0262c7f59b927e9ddf6e4649"), + + Dependencies => + On_Condition + (System_Is (GNU_Linux), + Within_Major (Libglfw3.V_3) and Within_Major (LibX11.V_2)), + + Properties => + GPR_File ("opengl.gpr") and + GPR_File ("opengl-glfw.gpr") and + GPR_File ("opengl-soil.gpr") and + GPR_File ("opengl-test.gpr") and + + GPR_Scenario ("GLFW_Version", "2" or "3") and + GPR_Scenario ("Mode", "debug" or "release") and + GPR_Scenario ("Auto_Exceptions", "enabled" or "disabled") and + + Executable ("gl_test-opengl3") and + Executable ("gl_test-context") and + Executable ("gl_test-vbos") and + Executable ("gl_test-shaders") and + Executable ("gl_test-framebuffers") and + Executable ("gl_test-immediate") and + + Author (Prj_Author) and + Website (Prj_Website) and + License (MIT), + + Alr_Properties => + On_Condition + (System_Is (GNU_Linux), GPR_Config ("-XWindowing_System=x11")), + + Available_When => + System_Is (GNU_Linux) + ); + +end Alire.Index.OpenGLAda; diff --git a/index/alire-index-sdlada.ads b/index/alire-index-sdlada.ads new file mode 100644 index 00000000..0a364f51 --- /dev/null +++ b/index/alire-index-sdlada.ads @@ -0,0 +1,63 @@ +with Alire.Index.LibSDL2; + +package Alire.Index.SDLAda is + + Prj_Name : constant Project_Name := "sdlada"; + Prj_Desc : constant Project_Description := "Ada 2012 bindings to SDL 2"; + Prj_Repo : constant URL := "https://github.com/alire-project/sdlada.git"; + + Prj_Author : constant String := "Luke A. Guest"; + + V_2_3_1 : constant Release := + Register (Prj_Name, + V ("2.3.1"), + Prj_Desc, + Git (Prj_Repo, "570232193facb90a58f67aadac93df9dfae8bcd4"), + + Dependencies => + Within_Major (LibSDL2.SDL_V_2) and + Within_Major (LibSDL2.SDL_Image_V_2) and + Within_Major (LibSDL2.SDL_TTF_V_2), + + Properties => + Project_File ("sdlada.gpr") and + + GPR_Scenario ("SDL_MODE", "debug" or "release") and + GPR_Scenario ("SDL_PLATFORM", "linux" or "bsd" or "windows" or "macosx" or "ios" or "android") and + + Author (Prj_Author) and + License (Zlib), + + Alr_Properties => + GPR_Path ("build/gnat") and + + GPR_File ("build/gnat/sdlada.gpr") and +-- GPR_File ("build/gnat/sdlada_image.gpr") and + GPR_File ("build/gnat/tests.gpr") and +-- GPR_File ("build/gnat/tests_image.gpr") and + GPR_File ("build/gnat/test_maths_build.gpr") and +-- GPR_File ("build/gnat/tools.gpr") and +-- GPR_File ("build/gnat/unit_tests.gpr") and + + Executable ("clipboard") and + Executable ("error") and + Executable ("libraries") and + Executable ("load_surface") and + Executable ("platform") and + Executable ("rwops") and + Executable ("stream") and + Executable ("stream2") and + Executable ("surface") and + Executable ("test") and + Executable ("version") and + + GPR_Config ("-XSDL_MODE=release") and + On_Condition + (System_Is (GNU_Linux), + GPR_Config ("-XSDL_PLATFORM=linux")), + + Available_When => + System_Is (GNU_Linux) + ); + +end Alire.Index.SDLAda; diff --git a/index/native/alire-index-libglfw3.ads b/index/native/alire-index-libglfw3.ads new file mode 100644 index 00000000..0a414641 --- /dev/null +++ b/index/native/alire-index-libglfw3.ads @@ -0,0 +1,15 @@ +package Alire.Index.Libglfw3 is + + Name : constant String := "libglfw3"; + Desc : constant String := "portable library for OpenGL, window and input"; + + V_3 : constant Release := + Register (Name, + V ("3"), + Desc, + Native ((Debian | Ubuntu => Packaged_As ("libglfw3-dev"), + others => Unavailable))); + -- Note: the minor version will change with versions of distributions. + -- If this proved to be a problem several releases should be isolated using the Version property + +end Alire.Index.Libglfw3; diff --git a/index/alire-index-libgnutls.ads b/index/native/alire-index-libgnutls.ads similarity index 100% rename from index/alire-index-libgnutls.ads rename to index/native/alire-index-libgnutls.ads diff --git a/index/native/alire-index-libsdl2.ads b/index/native/alire-index-libsdl2.ads new file mode 100644 index 00000000..1b1c7cfd --- /dev/null +++ b/index/native/alire-index-libsdl2.ads @@ -0,0 +1,26 @@ +package Alire.Index.LibSDL2 is + + SDL_V_2 : constant Release := + Register ("libsdl2", + V ("2"), + "Simple DirectMedia Layer development files", + Native ((Debian | Ubuntu => Packaged_As ("libsdl2-dev"), + others => Unavailable))); + -- Note: the minor version will change with versions of distributions. + -- If this proved to be a problem several releases should be isolated using the Version property + + SDL_Image_V_2 : constant Release := + Register ("libsdl2_image", + V ("2"), + "Image loading library for Simple DirectMedia Layer 2", + Native ((Debian | Ubuntu => Packaged_As ("libsdl2-image-dev"), + others => Unavailable))); + + SDL_TTF_V_2 : constant Release := + Register ("libsdl2_ttf", + V ("2"), + "TrueType Font library for Simple DirectMedia Layer 2", + Native ((Debian | Ubuntu => Packaged_As ("libsdl2-ttf-dev"), + others => Unavailable))); + +end Alire.Index.LibSDL2; diff --git a/index/native/alire-index-libx11.ads b/index/native/alire-index-libx11.ads new file mode 100644 index 00000000..21d22063 --- /dev/null +++ b/index/native/alire-index-libx11.ads @@ -0,0 +1,15 @@ +package Alire.Index.LibX11 is + + Name : constant String := "libx11"; + Desc : constant String := "X11 client-side library"; + + V_2 : constant Release := + Register (Name, + V ("2"), + Desc, + Native ((Debian | Ubuntu => Packaged_As ("libx11-dev"), + others => Unavailable))); + -- Note: the minor version will change with versions of distributions. + -- If this proved to be a problem several releases should be isolated using the Version property + +end Alire.Index.LibX11; diff --git a/index/alire-index-unixodbc.ads b/index/native/alire-index-unixodbc.ads similarity index 100% rename from index/alire-index-unixodbc.ads rename to index/native/alire-index-unixodbc.ads diff --git a/src/alire-index.adb b/src/alire-index.adb index 2f0eea33..3d74fbe3 100644 --- a/src/alire-index.adb +++ b/src/alire-index.adb @@ -47,20 +47,43 @@ package body Alire.Index is Version : Semantic_Versioning.Version; Description : Project_Description; Origin : Origins.Origin; + -- Barrier + XXXXXXXXXXXXXX : Utils.XXX_XXX := Utils.XXX_XXX_XXX; -- Optional Dependencies : Release_Dependencies := No_Dependencies; - Properties : Release_Properties := No_Properties; - Available_When : Alire.Requisites.Tree := No_Requisites) + Properties : Release_Properties := No_Properties; + Alr_Properties : Build_Properties := No_Properties; + Available_When : Alire.Requisites.Tree := No_Requisites) return Release is + pragma Unreferenced (XXXXXXXXXXXXXX); + use all type Alire.Properties.Labeled.Labels; begin + -- Until the user/internal properties settle, we'll keep these checks off + +-- for P of Properties.All_Values loop +-- if P in Alire.Properties.Labeled.Label and then +-- Alire.Properties.Labeled.Label (P).Name = GPR_Config +-- then +-- raise Program_Error with "alr property given as user property"; +-- end if; +-- end loop; +-- +-- for P of Alr_Properties.All_Values loop +-- if P not in Alire.Properties.Labeled.Label and then +-- Alire.Properties.Labeled.Label (P).Name /= GPR_Config +-- then +-- raise Program_Error with "user property given as alr property"; +-- end if; +-- end loop; + return Rel : constant Alire.Releases.Release := Alire.Releases.New_Release (Project, Description, Version, Origin, Dependencies, - Properties => Properties, + Properties => Alr_Properties and Properties, Available => Available_When) do if Catalog.Contains (Rel) then diff --git a/src/alire-index.ads b/src/alire-index.ads index c1df3fc0..6ead26ae 100644 --- a/src/alire-index.ads +++ b/src/alire-index.ads @@ -16,35 +16,54 @@ with Alire.Requisites; with Alire.Requisites.Dependencies; with Alire.Requisites.Platform; with Alire.Root_Project; +with Alire.Utils; with Semantic_Versioning; package Alire.Index is + --------------- + -- CATALOG -- + --------------- + Catalog : Containers.Release_Set; + ----------------- + -- Index types -- + ----------------- + subtype Release_Dependencies is Conditional.Dependencies; - subtype Release_Properties is Conditional.Properties; + + subtype Release_Properties is Conditional.Properties; + Subtype Build_Properties is Conditional.Properties; + -- We separate properties of a release in two sets: + -- Properties that are of interest to the user of a project, + -- and properties that concern only the alr packaging. + -- This is purely for reading clarity. Only GPR_Config at this time belongs to the latter set + -- Unfortunately it would be too much a hassle to have separate types for those, so this is only + -- checked at runtime. I'm not sure that this separation is really useful yet anyway. No_Dependencies : constant Release_Dependencies := Conditional.For_Dependencies.Empty; No_Properties : constant Release_Properties := Conditional.For_Properties.Empty; No_Requisites : constant Requisites.Tree := Requisites.Trees.Empty_Tree; - + subtype Release is Alire.Releases.Release; function Register (-- Mandatory - Project : Project_Name; - Version : Semantic_Versioning.Version; - Description : Project_Description; - Origin : Origins.Origin; - -- Optional - Dependencies : Release_Dependencies := No_Dependencies; - Properties : Release_Properties := No_Properties; + Project : Project_Name; + Version : Semantic_Versioning.Version; + Description : Project_Description; + Origin : Origins.Origin; + -- we force naming beyond this point with this ugly guard: + XXXXXXXXXXXXXX : Utils.XXX_XXX := Utils.XXX_XXX_XXX; + -- Optional + Dependencies : Release_Dependencies := No_Dependencies; + Properties : Release_Properties := No_Properties; + Alr_Properties : Build_Properties := No_Properties; Available_When : Alire.Requisites.Tree := No_Requisites) return Release; - -- Properties are of the Release - -- Requisites are properties that dependencies have to fulfill, not used yet. - -- Available_On are properties the platform has to fulfill. + -- Properties are generally interesting to the user + -- Alr_Properties are only interesting to alr subtype Platform_Independent_Path is String with Dynamic_Predicate => (for all C of Platform_Independent_Path => C /= '\'); @@ -184,9 +203,8 @@ package Alire.Index is function Author is new PL.Cond_New_Label (Properties.Labeled.Author); function Comment is new PL.Cond_New_Label (Properties.Labeled.Comment); function Executable is new PL.Cond_New_Label (Properties.Labeled.Executable); - function GPR_Extra_Config is new PL.Cond_New_Label (Properties.Labeled.GPR_Extra_Config); - function GPR_File (File : Platform_Independent_Path) return Release_Properties; function Maintainer is new PL.Cond_New_Label (Properties.Labeled.Maintainer); + function Project_File is new PL.Cond_New_Label (Properties.Labeled.Project_File); function Website is new PL.Cond_New_Label (Properties.Labeled.Website); function U (Prop : Properties.Vector) return Conditional.Properties @@ -204,15 +222,15 @@ package Alire.Index is function "and" (L, R : Release_Properties) return Release_Properties renames Conditional.For_Properties."and"; - --- function "and" (D1, D2 : Dependencies.Vector) return Dependencies.Vector renames Alire.Dependencies.Vectors."and"; --- function "and" (P1, P2 : Properties.Vector) return Properties.Vector renames Alire.Properties."and"; --- function Verifies (P : Properties.Property'Class) return Properties.Vector; --- function "+" (P : Properties.Property'Class) return Properties.Vector renames Verifies; --- --- function Requires (R : Requisites.Requisite'Class) return Requisites.Tree; --- function "+" (R : Requisites.Requisite'Class) return Requisites.Tree renames Requires; + ------------------------ + -- BUILD PROPERTIES -- + ------------------------ + -- Those instruct alr on how to build, but are not the main concern of the project user + + function GPR_Config is new PL.Cond_New_Label (Properties.Labeled.GPR_Config); + function GPR_File (File : Platform_Independent_Path) return Release_Properties; + function GPR_Path (Path : Platform_Independent_Path) return Release_Properties; ------------------ -- REQUISITES -- @@ -248,8 +266,9 @@ package Alire.Index is private function GPR_File_Unsafe is new PL.Cond_New_Label (Properties.Labeled.GPR_File); + function GPR_Path_Unsafe is new PL.Cond_New_Label (Properties.Labeled.GPR_Path); - function GPR_File (File : Platform_Independent_Path) return Release_Properties - renames GPR_File_Unsafe; + function GPR_File (File : Platform_Independent_Path) return Release_Properties renames GPR_File_Unsafe; + function GPR_Path (Path : Platform_Independent_Path) return Release_Properties renames GPR_Path_Unsafe; end Alire.Index; diff --git a/src/alire-properties-labeled.ads b/src/alire-properties-labeled.ads index 04766787..9c499d3a 100644 --- a/src/alire-properties-labeled.ads +++ b/src/alire-properties-labeled.ads @@ -6,14 +6,21 @@ package Alire.Properties.Labeled with Preelaborate is -- Properties that have a single string value and a name - type Labels is (Author, -- VIP + type Labels is (-- user labels + Author, -- VIP Comment, -- Extra text Description, -- One-liner description, so it is searched too Executable, -- A resulting executable built by the project - GPR_Extra_Config, -- Extra config to pass to gprbuild for building the project with alr - GPR_File, -- Alternative naming of the project file (or more than one) Maintainer, -- Info about the maintainer of the alr-packaged project - Website); -- A website other than the repository + Project_File,-- GPR files that the user can use. No path. This is purely informative + Website, + + -- internal labels + GPR_Config, -- Extra config to pass to gprbuild for building the project with alr + GPR_File, -- Alternative naming of the project file (or more than one) + -- Those are used when testing the build, and must include full relative path + GPR_Path -- Extra path to add to the environment to look for projects + ); -- A website other than the repository type Label (<>) is new Properties.Property with private; diff --git a/src/alire-utils.ads b/src/alire-utils.ads index 7a9c2e79..91549db7 100644 --- a/src/alire-utils.ads +++ b/src/alire-utils.ads @@ -40,10 +40,21 @@ package Alire.Utils with Preelaborate is function Flatten (V : String_Vector; Separator : String := " ") return String; -- Concatenate all elements + ----------------- + -- XXX_XXX_XXX -- + ----------------- + + type XXX_XXX (<>) is limited private; + function XXX_XXX_XXX return XXX_XXX; + + private Empty_Vector : constant String_Vector := (String_Vectors.Empty_Vector with null record); function Count (V : String_Vector) return Natural is (Natural (String_Vectors.Vector (V).Length)); + type XXX_XXX is limited null record; + function XXX_XXX_XXX return XXX_XXX is (null record); + end Alire.Utils;