1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- M L I B --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1999-2009, AdaCore --
|
10 |
|
|
-- --
|
11 |
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
12 |
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
13 |
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
15 |
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
16 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
17 |
|
|
-- for more details. You should have received a copy of the GNU General --
|
18 |
|
|
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
19 |
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
20 |
|
|
-- --
|
21 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
22 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
23 |
|
|
-- --
|
24 |
|
|
------------------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
-- This package provides the core high level routines used by GNATMLIB
|
27 |
|
|
-- and GNATMAKE to build libraries
|
28 |
|
|
|
29 |
|
|
with Namet; use Namet;
|
30 |
|
|
with Osint; use Osint;
|
31 |
|
|
|
32 |
|
|
with GNAT.OS_Lib; use GNAT.OS_Lib;
|
33 |
|
|
|
34 |
|
|
package MLib is
|
35 |
|
|
|
36 |
|
|
No_Argument_List : aliased String_List := (1 .. 0 => null);
|
37 |
|
|
No_Argument : constant String_List_Access := No_Argument_List'Access;
|
38 |
|
|
|
39 |
|
|
Max_Characters_In_Library_Name : constant := 20;
|
40 |
|
|
-- Maximum number of characters in a library name.
|
41 |
|
|
-- Used by Check_Library_Name below.
|
42 |
|
|
|
43 |
|
|
type Fail_Proc is access procedure (S1 : String);
|
44 |
|
|
|
45 |
|
|
Fail : Fail_Proc := Osint.Fail'Access;
|
46 |
|
|
-- This procedure is used in the MLib hierarchy, instead of
|
47 |
|
|
-- directly calling Osint.Fail.
|
48 |
|
|
-- It is redirected to Make.Make_Failed by gnatmake.
|
49 |
|
|
|
50 |
|
|
procedure Check_Library_Name (Name : String);
|
51 |
|
|
-- Verify that the name of a library has the following characteristics
|
52 |
|
|
-- - starts with a letter
|
53 |
|
|
-- - includes only letters and digits
|
54 |
|
|
-- - contains not more than Max_Characters_In_Library_Name characters
|
55 |
|
|
|
56 |
|
|
procedure Build_Library
|
57 |
|
|
(Ofiles : Argument_List;
|
58 |
|
|
Output_File : String;
|
59 |
|
|
Output_Dir : String);
|
60 |
|
|
-- Build a static library from a set of object files
|
61 |
|
|
|
62 |
|
|
procedure Copy_ALI_Files
|
63 |
|
|
(Files : Argument_List;
|
64 |
|
|
To : Path_Name_Type;
|
65 |
|
|
Interfaces : String_List);
|
66 |
|
|
-- Copy all ALI files Files to directory To.
|
67 |
|
|
-- Mark Interfaces ALI files as interfaces, if any.
|
68 |
|
|
|
69 |
|
|
procedure Create_Sym_Links
|
70 |
|
|
(Lib_Path : String;
|
71 |
|
|
Lib_Version : String;
|
72 |
|
|
Lib_Dir : String;
|
73 |
|
|
Maj_Version : String);
|
74 |
|
|
|
75 |
|
|
function Linker_Library_Path_Option return String_Access;
|
76 |
|
|
-- Linker option to specify to the linker the library directory path.
|
77 |
|
|
-- If non null, the library directory path is to be appended.
|
78 |
|
|
-- Should be deallocated by the caller, when no longer needed.
|
79 |
|
|
|
80 |
|
|
function Major_Id_Name
|
81 |
|
|
(Lib_Filename : String;
|
82 |
|
|
Lib_Version : String) return String;
|
83 |
|
|
-- Returns the major id library file name, if it exists.
|
84 |
|
|
-- For example, if Lib_Filename is "libtoto.so" and Lib_Version is
|
85 |
|
|
-- "libtoto.so.1.2", then "libtoto.so.1" is returned.
|
86 |
|
|
|
87 |
|
|
function Separate_Run_Path_Options return Boolean;
|
88 |
|
|
-- Return True if separate rpath arguments must be passed to the linker
|
89 |
|
|
-- for each directory in the rpath.
|
90 |
|
|
|
91 |
|
|
private
|
92 |
|
|
|
93 |
|
|
Preserve : Attribute := Time_Stamps;
|
94 |
|
|
-- Used by Copy_ALI_Files. Changed to None for OpenVMS, because
|
95 |
|
|
-- Copy_Attributes always fails on VMS.
|
96 |
|
|
|
97 |
|
|
end MLib;
|