/usr/lib/lazarus/0.9.30.4/ide/idefpcinfo.pas is in lazarus-src-0.9.30.4 0.9.30.4-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | {
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
IDE dialog showing stats about the used FPC.
}
unit IDEFPCInfo;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, AVL_Tree, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, FileProcs, DefineTemplates, CodeToolManager, BaseBuildManager,
Project, EnvironmentOpts, LazarusIDEStrConsts, AboutFrm;
type
{ TIDEFPCInfoDialog }
TIDEFPCInfoDialog = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
procedure UpdateMemo;
procedure GatherIDEVersion(sl: TStrings);
procedure GatherEnvironmentVars(sl: TStrings);
procedure GatherGlobalOptions(sl: TStrings);
procedure GatherProjectOptions(sl: TStrings);
procedure GatherActiveOptions(sl: TStrings);
procedure GatherFPCExecutable(UnitSetCache: TFPCUnitSetCache; sl: TStrings);
public
end;
function ShowFPCInfo: TModalResult;
implementation
function ShowFPCInfo: TModalResult;
var
Dlg: TIDEFPCInfoDialog;
begin
Dlg:=TIDEFPCInfoDialog.Create(nil);
try
Result:=Dlg.ShowModal;
finally
Dlg.Free;
end;
end;
{$R *.lfm}
{ TIDEFPCInfoDialog }
procedure TIDEFPCInfoDialog.FormCreate(Sender: TObject);
begin
Caption:=lisInformationAboutUsedFPC;
UpdateMemo;
end;
procedure TIDEFPCInfoDialog.UpdateMemo;
var
sl: TStringList;
TargetOS: String;
TargetCPU: String;
CompilerFilename: String;
FPCSrcDir: String;
UnitSetCache: TFPCUnitSetCache;
begin
sl:=TStringList.Create;
try
GatherIDEVersion(sl);
GatherEnvironmentVars(sl);
GatherGlobalOptions(sl);
GatherProjectOptions(sl);
GatherActiveOptions(sl);
TargetOS:=BuildBoss.GetTargetOS(true);
TargetCPU:=BuildBoss.GetTargetCPU(true);
CompilerFilename:=EnvironmentOptions.GetCompilerFilename;
FPCSrcDir:=EnvironmentOptions.GetFPCSourceDirectory; // needs FPCVer macro
UnitSetCache:=CodeToolBoss.FPCDefinesCache.FindUnitSet(
CompilerFilename,TargetOS,TargetCPU,'',FPCSrcDir,true);
GatherFPCExecutable(UnitSetCache,sl);
Memo1.Lines.Assign(sl);
finally
sl.Free;
end;
end;
procedure TIDEFPCInfoDialog.GatherIDEVersion(sl: TStrings);
const
LazarusVersionStr= {$I version.inc};
begin
sl.Add('Lazarus version: '+GetLazarusVersionString);
sl.Add('Lazarus svn revision: '+LazarusRevisionStr);
sl.Add('Lazarus build date: '+{$I %date%});
sl.Add('Lazarus was compiled for '+GetCompiledTargetCPU+'-'+GetCompiledTargetOS);
sl.Add('Lazarus was compiled with fpc '+{$I %FPCVERSION%});
sl.Add('');
end;
procedure TIDEFPCInfoDialog.GatherEnvironmentVars(sl: TStrings);
procedure Add(EnvName: string);
begin
sl.Add(EnvName+'='+GetEnvironmentVariableUTF8(EnvName));
end;
begin
sl.Add('Environment variables:');
Add('PATH');
Add('PP');
Add('FPCDIR');
Add('USESVN2REVISIONINC');
Add('USER');
Add('HOME');
Add('PWD');
Add('LANG');
Add('LANGUAGE');
sl.Add('');
end;
procedure TIDEFPCInfoDialog.GatherGlobalOptions(sl: TStrings);
begin
sl.add('Global IDE options:');
sl.Add('LazarusDirectory='+EnvironmentOptions.LazarusDirectory);
sl.Add('CompilerFilename='+EnvironmentOptions.CompilerFilename);
sl.Add('Real CompilerFilename='+EnvironmentOptions.GetCompilerFilename);
sl.Add('CompilerMessagesFilename='+EnvironmentOptions.CompilerMessagesFilename);
sl.Add('');
end;
procedure TIDEFPCInfoDialog.GatherProjectOptions(sl: TStrings);
begin
sl.Add('Project:');
if Project1<>nil then begin
sl.Add('lpi='+Project1.ProjectInfoFile);
sl.Add('Directory='+Project1.ProjectDirectory);
sl.Add('TargetOS='+Project1.CompilerOptions.TargetOS);
sl.Add('TargetCPU='+Project1.CompilerOptions.TargetCPU);
sl.Add('CompilerFilename='+Project1.CompilerOptions.CompilerPath);
end else begin
sl.Add('no project');
end;
sl.Add('');
end;
procedure TIDEFPCInfoDialog.GatherActiveOptions(sl: TStrings);
begin
sl.Add('Active target:');
sl.Add('TargetOS='+BuildBoss.GetTargetOS(true));
sl.Add('TargetCPU='+BuildBoss.GetTargetCPU(true));
sl.Add('');
end;
procedure TIDEFPCInfoDialog.GatherFPCExecutable(UnitSetCache: TFPCUnitSetCache;
sl: TStrings);
var
CfgCache: TFPCTargetConfigCache;
i: Integer;
CfgFileItem: TFPCConfigFileState;
begin
sl.Add('FPC executable:');
if UnitSetCache<>nil then begin
CfgCache:=UnitSetCache.GetConfigCache(false);
if CfgCache<>nil then begin
sl.Add('Compiler='+CfgCache.Compiler);
sl.Add('Options='+CfgCache.CompilerOptions);
sl.Add('CompilerDate='+DateTimeToStr(FileDateToDateTime(CfgCache.CompilerDate)));
sl.Add('RealCompiler='+CfgCache.RealCompiler);
sl.Add('RealCompilerDate='+DateTimeToStr(FileDateToDateTime(CfgCache.RealCompilerDate)));
sl.Add('RealTargetOS='+CfgCache.RealTargetOS);
sl.Add('RealTargetCPU='+CfgCache.RealTargetCPU);
sl.Add('RealCompilerInPath='+CfgCache.RealCompilerInPath);
if CfgCache.ConfigFiles<>nil then begin
for i:=0 to CfgCache.ConfigFiles.Count-1 do begin
CfgFileItem:=CfgCache.ConfigFiles[i];
if CfgFileItem.FileExists then
sl.Add('CfgFilename='+CfgFileItem.Filename);
end;
end;
sl.Add('Defines:');
if CfgCache.Defines<>nil then begin
sl.Add(CfgCache.Defines.AsText);
end;
sl.Add('Undefines:');
if CfgCache.Undefines<>nil then begin
sl.Add(CfgCache.Undefines.AsText);
end;
sl.Add('UnitPaths:');
if CfgCache.UnitPaths<>nil then begin
sl.AddStrings(CfgCache.UnitPaths);
end;
sl.add('Units:');
if CfgCache.Units<>nil then begin
sl.Add(CfgCache.Units.AsText);
end;
end;
end;
sl.Add('');
end;
end.
|