aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/mlib-tgt-linux.adb
diff options
context:
space:
mode:
authorVincent Celier <celier@adacore.com>2007-08-14 10:43:34 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:43:34 +0200
commit2cd44f5a448ad1e160edae120cc7b945ca1a5db3 (patch)
tree5875d0102588a0bdaf32f61cb26f856f87ff7ec6 /gcc/ada/mlib-tgt-linux.adb
parentc9b9ec14ece5acf23bf0817633914e28c43c0678 (diff)
downloadgcc-2cd44f5a448ad1e160edae120cc7b945ca1a5db3.zip
gcc-2cd44f5a448ad1e160edae120cc7b945ca1a5db3.tar.gz
gcc-2cd44f5a448ad1e160edae120cc7b945ca1a5db3.tar.bz2
clean.adb, [...] (Create_Sym_Links): New procedure.
2007-08-14 Vincent Celier <celier@adacore.com> * clean.adb, fmap.adb, sinput-p.adb, sinput-p.ads, gnatcmd.adb, gnatname.adb, makeutl.ads, makeutl.adb, makegpr.adb, mlib-tgt-vms.adb mlib-tgt-darwin.adb, mlib-tgt-lynxos.adb, mlib-prj.adb, mlib-tgt.adb, mlib-tgt.ads, mlib-tgt-irix.adb mlib-tgt-hpux.adb, mlib-tgt-linux.adb, mlib-tgt-solaris.adb, mlib-tgt-vms-alpha.adb, mlib-tgt-vms-ia64.adb, mlib-tgt-mingw.adb, mlib-tgt-vxworks.adb, mlib-tgt-aix.adb, mlib-tgt-tru64.adb, mlib.ads, mlib.adb (Create_Sym_Links): New procedure. (Major_Id_Name): New function. mlib-tgt.ads/mlib.tgt.adb: (Library_Major_Minor_Id_Supported): New function, default returns True Most mlib-tgt-*.adb that support shared libraries and symbolic links: (Build_Dynamic_Library): Add support for major/minor ids for shared libs Other mlib-tgt-*.adb (aix, mingw, vms, vxworks, xi): Implementation of Library_Major_Minor_Id_Supported returns False clean.adb: (Clean_Library_Directory): If major/minor ids are supported, clean all library files. Major update of the Project Manager and of the project aware tools, including gprmake, so that the same sources in the GNAT repository can be used by gprbuild. From-SVN: r127432
Diffstat (limited to 'gcc/ada/mlib-tgt-linux.adb')
-rw-r--r--gcc/ada/mlib-tgt-linux.adb119
1 files changed, 9 insertions, 110 deletions
diff --git a/gcc/ada/mlib-tgt-linux.adb b/gcc/ada/mlib-tgt-linux.adb
index 848a11c..001e1a4 100644
--- a/gcc/ada/mlib-tgt-linux.adb
+++ b/gcc/ada/mlib-tgt-linux.adb
@@ -31,7 +31,6 @@ with MLib.Fil;
with MLib.Utl;
with Opt;
with Output; use Output;
-with System;
package body MLib.Tgt.Specific is
@@ -41,10 +40,7 @@ package body MLib.Tgt.Specific is
procedure Build_Dynamic_Library
(Ofiles : Argument_List;
- Foreign : Argument_List;
- Afiles : Argument_List;
Options : Argument_List;
- Options_2 : Argument_List;
Interfaces : Argument_List;
Lib_Filename : String;
Lib_Dir : String;
@@ -61,10 +57,7 @@ package body MLib.Tgt.Specific is
procedure Build_Dynamic_Library
(Ofiles : Argument_List;
- Foreign : Argument_List;
- Afiles : Argument_List;
Options : Argument_List;
- Options_2 : Argument_List;
Interfaces : Argument_List;
Lib_Filename : String;
Lib_Dir : String;
@@ -73,8 +66,6 @@ package body MLib.Tgt.Specific is
Lib_Version : String := "";
Auto_Init : Boolean := False)
is
- pragma Unreferenced (Foreign);
- pragma Unreferenced (Afiles);
pragma Unreferenced (Interfaces);
pragma Unreferenced (Symbol_Data);
pragma Unreferenced (Auto_Init);
@@ -101,56 +92,15 @@ package body MLib.Tgt.Specific is
Objects => Ofiles,
Options => Options,
Driver_Name => Driver_Name,
- Options_2 => Options_2);
+ Options_2 => No_Argument_List);
else
declare
- Maj_Version : constant String := Lib_Version;
- Last_Maj : Positive := Maj_Version'Last;
- Last : Positive;
- Ok_Maj : Boolean := False;
+ Maj_Version : constant String :=
+ Major_Id_Name (Lib_File, Lib_Version);
begin
- while Last_Maj > Maj_Version'First loop
- if Maj_Version (Last_Maj) in '0' .. '9' then
- Last_Maj := Last_Maj - 1;
-
- else
- Ok_Maj := Last_Maj /= Maj_Version'Last and then
- Maj_Version (Last_Maj) = '.';
-
- if Ok_Maj then
- Last_Maj := Last_Maj - 1;
- end if;
-
- exit;
- end if;
- end loop;
-
- if Ok_Maj then
- Last := Last_Maj;
-
- while Last > Maj_Version'First loop
- if Maj_Version (Last) in '0' .. '9' then
- Last := Last - 1;
-
- else
- Ok_Maj := Last /= Last_Maj and then
- Maj_Version (Last) = '.';
-
- if Ok_Maj then
- Last := Last - 1;
-
- Ok_Maj := Maj_Version (1 .. Last) = Lib_File;
- end if;
-
- exit;
- end if;
- end loop;
- end if;
-
- if Ok_Maj then
- Version_Arg := new String'("-Wl,-soname," &
- Maj_Version (1 .. Last_Maj));
+ if Maj_Version'Length /= 0 then
+ Version_Arg := new String'("-Wl,-soname," & Maj_Version);
else
Version_Arg := new String'("-Wl,-soname," & Lib_Version);
@@ -162,7 +112,7 @@ package body MLib.Tgt.Specific is
Objects => Ofiles,
Options => Options & Version_Arg,
Driver_Name => Driver_Name,
- Options_2 => Options_2);
+ Options_2 => No_Argument_List);
Symbolic_Link_Needed := Lib_Version /= Lib_Path;
else
@@ -171,65 +121,14 @@ package body MLib.Tgt.Specific is
Objects => Ofiles,
Options => Options & Version_Arg,
Driver_Name => Driver_Name,
- Options_2 => Options_2);
+ Options_2 => No_Argument_List);
Symbolic_Link_Needed :=
Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path;
end if;
if Symbolic_Link_Needed then
- declare
- Success : Boolean;
- Oldpath : String (1 .. Lib_Version'Length + 1);
- Newpath : String (1 .. Lib_Path'Length + 1);
-
- Result : Integer;
- pragma Unreferenced (Result);
-
- function Symlink
- (Oldpath : System.Address;
- Newpath : System.Address) return Integer;
- pragma Import (C, Symlink, "__gnat_symlink");
-
- begin
- Oldpath (1 .. Lib_Version'Length) := Lib_Version;
- Oldpath (Oldpath'Last) := ASCII.NUL;
- Newpath (1 .. Lib_Path'Length) := Lib_Path;
- Newpath (Newpath'Last) := ASCII.NUL;
-
- Delete_File (Lib_Path, Success);
-
- Result := Symlink (Oldpath'Address, Newpath'Address);
- end;
-
- if Ok_Maj then
- declare
- Success : Boolean;
- Oldpath : String (1 .. Lib_Version'Length + 1);
- Maj_Path : constant String :=
- Lib_Dir & Directory_Separator &
- Maj_Version (1 .. Last_Maj);
- Newpath : String (1 .. Maj_Path'Length + 1);
-
- Result : Integer;
- pragma Unreferenced (Result);
-
- function Symlink
- (Oldpath : System.Address;
- Newpath : System.Address) return Integer;
- pragma Import (C, Symlink, "__gnat_symlink");
-
- begin
- Oldpath (1 .. Lib_Version'Length) := Lib_Version;
- Oldpath (Oldpath'Last) := ASCII.NUL;
- Newpath (1 .. Maj_Path'Length) := Maj_Path;
- Newpath (Newpath'Last) := ASCII.NUL;
-
- Delete_File (Maj_Path, Success);
-
- Result := Symlink (Oldpath'Address, Newpath'Address);
- end;
- end if;
-
+ Create_Sym_Links
+ (Lib_Path, Lib_Version, Lib_Dir, Maj_Version);
end if;
end;
end if;