Jelajahi Sumber

+ introduce the $OPENBSD_LOCALBASE and $OPENBSD_X11BASE pseudo variables; these
may now be used in fpc.cfg, etc. They evaluate to /usr/local and /usr/X11R6 by
default, but may optionally be overriden via the LOCALBASE and X11BASE
environment variables.
* use the new $OPENBSD_LOCALBASE and $OPENBSD_X11BASE variables in the default
library search path on OpenBSD

git-svn-id: trunk@41755 -

nickysn 6 tahun lalu
induk
melakukan
261114ff32
2 mengubah file dengan 29 tambahan dan 1 penghapusan
  1. 28 0
      compiler/globals.pas
  2. 1 1
      compiler/systems/t_bsd.pas

+ 28 - 0
compiler/globals.pas

@@ -892,6 +892,30 @@ implementation
          end;
 
 {$endif mswindows}
+{$ifdef openbsd}
+       function GetOpenBSDLocalBase: ansistring;
+         var
+           envvalue: pchar;
+         begin
+           envvalue := GetEnvPChar('LOCALBASE');
+           if assigned(envvalue) then
+             Result:=envvalue
+           else
+             Result:='/usr/local';
+           FreeEnvPChar(envvalue);
+         end;
+       function GetOpenBSDX11Base: ansistring;
+         var
+           envvalue: pchar;
+         begin
+           envvalue := GetEnvPChar('X11BASE');
+           if assigned(envvalue) then
+             Result:=envvalue
+           else
+             Result:='/usr/X11R6';
+           FreeEnvPChar(envvalue);
+         end;
+{$endif openbsd}
        var
          envstr: string;
          envvalue: pchar;
@@ -924,6 +948,10 @@ implementation
          ReplaceSpecialFolder('$PROGRAM_FILES_COMMON',CSIDL_PROGRAM_FILES_COMMON);
          ReplaceSpecialFolder('$PROFILE',CSIDL_PROFILE);
 {$endif mswindows}
+{$ifdef openbsd}
+         Replace(s,'$OPENBSD_LOCALBASE',GetOpenBSDLocalBase);
+         Replace(s,'$OPENBSD_X11BASE',GetOpenBSDX11Base);
+{$endif openbsd}
          { Replace environment variables between dollar signs }
          i := pos('$',s);
          while i>0 do

+ 1 - 1
compiler/systems/t_bsd.pas

@@ -154,7 +154,7 @@ begin
      { Mac OS X doesn't have a /lib }
      LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
    else if target_info.system in systems_openbsd then
-     LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;${X11BASE}/lib;${LOCALBASE}/lib',true)
+     LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;$OPENBSD_X11BASE/lib;$OPENBSD_LOCALBASE/lib',true)
    else
      LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
 end;