/ide/include/unix/lazbaseconf.inc

http://github.com/graemeg/lazarus · Pascal · 154 lines · 93 code · 19 blank · 42 comment · 8 complexity · 6cfc4753d98083e88f9d8957f888c124 MD5 · raw file

  1. {%MainUnit ../linux/lazconf.inc}
  2. // included by linux/lazconf.inc, freebsd/lazconf.inc, netbsd/lazconf.inc
  3. // todo: use $target here ?
  4. {
  5. ***************************************************************************
  6. * *
  7. * This source is free software; you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation; either version 2 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This code is distributed in the hope that it will be useful, but *
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
  15. * General Public License for more details. *
  16. * *
  17. * A copy of the GNU General Public License is available on the World *
  18. * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
  19. * obtain it by writing to the Free Software Foundation, *
  20. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  21. * *
  22. ***************************************************************************
  23. }
  24. const
  25. DefaultFPCSrcDirs: array[1..15] of string = (
  26. // search first for sources with right version
  27. '/usr/share/fpcsrc/$(FPCVer)',
  28. // then search for global paths
  29. '/usr/share/fpcsrc',
  30. '/usr/local/share/fpcsrc',
  31. '/usr/fpcsrc',
  32. '/usr/share/fpc/src',
  33. '/usr/fpc/src',
  34. '/usr/local/fpc/src',
  35. '/usr/local/share/fpc/src',
  36. '/usr/local/src/fpc',
  37. '/usr/lib/fpc/src',
  38. '/usr/local/lib/fpc/src',
  39. '/vol/fpc/src',
  40. '/vol/lib/fpc/src',
  41. // These paths are created by the fpc rpm creation script and do not
  42. // contain all sources. So, they are searched last.
  43. '/usr/src/fpc',
  44. '/vol/src/fpc'
  45. );
  46. DefaultLazarusSrcDirs: array[1..8] of string = (
  47. '/usr/share/lazarus',
  48. '/usr/local/share/lazarus',
  49. '/usr/local/lib/lazarus',
  50. '/usr/local/lazarus',
  51. '/usr/lib/lazarus',
  52. '/usr/lib/lazarus/'+LazarusVersionStr,
  53. '~/pascal/lazarus',
  54. '~/lazarus'
  55. );
  56. var
  57. PrimaryConfigPath,
  58. SecondaryConfigPath: string;
  59. {---------------------------------------------------------------------------
  60. function FindDefaultCompilerPath: string;
  61. ---------------------------------------------------------------------------}
  62. function FindDefaultCompilerPath: string;
  63. begin
  64. Result:=FindDefaultExecutablePath(GetDefaultCompilerFilename);
  65. end;
  66. {---------------------------------------------------------------------------
  67. function FindDefaultMakePath: string;
  68. ---------------------------------------------------------------------------}
  69. function FindDefaultMakePath: string;
  70. begin
  71. {$IFDEF FreeBSD}
  72. Result:=FindDefaultExecutablePath('gmake');
  73. {$ELSE}
  74. Result:=FindDefaultExecutablePath('make');
  75. {$ENDIF}
  76. end;
  77. function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
  78. begin
  79. Result:='.ppu';
  80. end;
  81. function OSLocksExecutables: boolean;
  82. begin
  83. Result:=false;
  84. end;
  85. function GetDefaultTestBuildDirectory: string;
  86. begin
  87. Result:='~/tmp/';
  88. end;
  89. procedure GetDefaultCompilerFilenames(List: TStrings);
  90. begin
  91. AddFilenameToList(List,'/usr/local/bin/'+GetDefaultCompilerFilename);
  92. AddFilenameToList(List,'/usr/bin/'+GetDefaultCompilerFilename);
  93. AddFilenameToList(List,'/opt/fpc/'+GetDefaultCompilerFilename);
  94. end;
  95. procedure GetDefaultMakeFilenames(List: TStrings);
  96. begin
  97. AddFilenameToList(List,'/usr/bin/make');
  98. end;
  99. procedure GetDefaultTestBuildDirs(List: TStrings);
  100. begin
  101. AddFilenameToList(List,'~/tmp/');
  102. AddFilenameToList(List,'/tmp/');
  103. AddFilenameToList(List,'/var/tmp/');
  104. end;
  105. procedure GetDefaultBrowser(var Browser, Params: string);
  106. function Find(const ShortFilename: string; var Filename: string): boolean;
  107. begin
  108. Filename:=SearchFileInPath(ShortFilename,'',
  109. GetEnvironmentVariableUTF8('PATH'),PathSeparator,[]);
  110. Result:=Filename<>'';
  111. end;
  112. begin
  113. Params:='%s';
  114. Browser:='';
  115. // prefer open source ;)
  116. if Find('xdg-open',Browser) then exit;
  117. if Find('mozilla',Browser) then exit;
  118. if Find('galeon',Browser) then exit;
  119. if Find('konqueror',Browser) then exit;
  120. if Find('safari',Browser) then exit;
  121. if Find('netscape',Browser) then exit;
  122. if Find('opera',Browser) then exit;
  123. if Find('iexplore.exe',Browser) then exit;
  124. end;
  125. {---------------------------------------------------------------------------
  126. procedure InternalInit;
  127. ---------------------------------------------------------------------------}
  128. procedure InternalInit;
  129. begin
  130. // For the Unix file functions only the slash is a directory separator.
  131. // The RTL defines AllowDirectorySeparators ['/','\'] for historical reasons.
  132. AllowDirectorySeparators:=['/'];
  133. PrimaryConfigPath:=ExpandFileNameUTF8('~/.lazarus');
  134. SecondaryConfigPath:='/etc/lazarus';
  135. end;