PageRenderTime 39ms CodeModel.GetById 10ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 0ms

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