aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-11-06 07:00:38 +0100
committerTristan Gingold <tgingold@free.fr>2014-11-06 07:00:38 +0100
commit30e6f0ac82456a8d5e39e88b113bef635fc6877e (patch)
treef81c544f65a76c62ce98e62b9eca50d582e2c493 /src
parent338c27598d9ca5de600b51d942de498dee5d6306 (diff)
downloadghdl-30e6f0ac82456a8d5e39e88b113bef635fc6877e.tar.gz
ghdl-30e6f0ac82456a8d5e39e88b113bef635fc6877e.tar.bz2
ghdl-30e6f0ac82456a8d5e39e88b113bef635fc6877e.zip
mcode build and install from top makefile.
Diffstat (limited to 'src')
-rw-r--r--src/ghdldrv/ghdllocal.adb28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index ce061e27b..568f93bbe 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -187,6 +187,23 @@ package body Ghdllocal is
return 0;
end Get_Basename_Pos;
+ -- Simple lower case conversion, used to compare with "bin".
+ function To_Lower (S : String) return String
+ is
+ Res : String (S'Range);
+ C : Character;
+ begin
+ for I in S'Range loop
+ C := S (I);
+ if C >= 'A' and then C <= 'Z' then
+ C := Character'Val
+ (Character'Pos (C) - Character'Pos ('A') + Character'Pos ('a'));
+ end if;
+ Res (I) := C;
+ end loop;
+ return Res;
+ end To_Lower;
+
procedure Set_Prefix_From_Program_Path (Prog_Path : String)
is
Dir_Pos : Natural;
@@ -278,13 +295,16 @@ package body Ghdllocal is
-- Remove last '/'
Dir_Pos := Dir_Pos - 1;
- -- Skip directory.
- Dir_Pos := Get_Basename_Pos (Pathname (Pathname'First .. Dir_Pos));
- if Dir_Pos = 0 then
+ -- Skip '/bin' directory if present
+ Pos := Get_Basename_Pos (Pathname (Pathname'First .. Dir_Pos));
+ if Pos = 0 then
return;
end if;
+ if To_Lower (Pathname (Pos + 1 .. Dir_Pos)) = "bin" then
+ Dir_Pos := Pos - 1;
+ end if;
- Exec_Prefix := new String'(Pathname (Pathname'First .. Dir_Pos - 1));
+ Exec_Prefix := new String'(Pathname (Pathname'First .. Dir_Pos));
end;
end Set_Prefix_From_Program_Path;