mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 23:49:28 +02:00
added GetExecutableExt and GetLibraryExt
git-svn-id: trunk@8789 -
This commit is contained in:
parent
fb16ad9a8f
commit
a43501c484
@ -525,7 +525,7 @@ begin
|
||||
if OSLocksExecutables then begin
|
||||
// Case 4. the current executable is locked
|
||||
// => use a different output name
|
||||
NewTargetFilename:='lazarus.new'+GetDefaultExecutableExt;
|
||||
NewTargetFilename:='lazarus.new'+GetExecutableExt(Options.TargetOS);
|
||||
debugln('CreateBuildLazarusOptions exe locked NewTargetFilename=',NewTargetFilename);
|
||||
end else begin
|
||||
// Case 5. or else: => just compile to current directory
|
||||
@ -547,10 +547,10 @@ begin
|
||||
|
||||
if NewTargetFilename<>'' then begin
|
||||
// FPC automatically changes the last extension (append or replace)
|
||||
// For example under linux, where executable don't need any extension
|
||||
// For example under linux, where executables don't need any extension
|
||||
// fpc removes the last extension of the -o option.
|
||||
// Trick fpc:
|
||||
if GetDefaultExecutableExt='' then
|
||||
if GetExecutableExt(Options.TargetOS)='' then
|
||||
NewTargetFilename:=NewTargetFilename+'.dummy';
|
||||
AppendExtraOption('-o'+NewTargetFilename);
|
||||
end;
|
||||
@ -895,7 +895,7 @@ begin
|
||||
try
|
||||
DirDialog.Options:=DirDialog.Options+[ofPathMustExist];
|
||||
DirDialog.Title:='Choose output directory of the IDE executable '
|
||||
+'(lazarus'+GetDefaultExecutableExt+')';
|
||||
+'(lazarus'+GetExecutableExt(Options.TargetOS)+')';
|
||||
if DirDialog.Execute then begin
|
||||
AFilename:=CleanAndExpandDirectory(DirDialog.Filename);
|
||||
TargetDirectoryComboBox.AddHistoryItem(AFilename,10,true,true);
|
||||
|
@ -1333,19 +1333,9 @@ function TBaseCompilerOptions.GetTargetFileExt: string;
|
||||
begin
|
||||
case ExecutableType of
|
||||
cetProgram:
|
||||
begin
|
||||
if CompareText(fTargetOS, 'win32') = 0 then
|
||||
Result:='.exe'
|
||||
else
|
||||
Result:=GetDefaultExecutableExt;
|
||||
end;
|
||||
Result:=GetExecutableExt(fTargetOS);
|
||||
cetLibrary:
|
||||
begin
|
||||
if CompareText(fTargetOS, 'win32') = 0 then
|
||||
Result:='.dll'
|
||||
else
|
||||
Result:=GetDefaultLibraryExt;
|
||||
end;
|
||||
Result:=GetLibraryExt(fTargetOS);
|
||||
else
|
||||
RaiseGDBException('');
|
||||
end;
|
||||
|
@ -2318,6 +2318,7 @@ begin
|
||||
// Display options
|
||||
ASynEdit.Gutter.Visible := fVisibleGutter;
|
||||
ASynEdit.Gutter.ShowLineNumbers := fShowLineNumbers;
|
||||
//ASynEdit.Gutter.AutoSize:= fShowLineNumbers;
|
||||
ASynEdit.Gutter.ShowCodeFolding := FUseCodeFolding;
|
||||
ASynEdit.Gutter.Color := fGutterColor;
|
||||
ASynEdit.Gutter.Width := fGutterWidth;
|
||||
|
@ -32,21 +32,11 @@
|
||||
uses
|
||||
BaseUnix, Unix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.dylib';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='darwin';
|
||||
end;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.dynlib';
|
||||
end;
|
||||
|
||||
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
|
||||
begin
|
||||
if DirPathExists(Directory) then List.Add(Directory);
|
||||
|
@ -32,11 +32,6 @@
|
||||
uses
|
||||
BaseUnix, Unix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='freebsd';
|
||||
@ -46,11 +41,6 @@ procedure GetDefaultLCLLibPaths(List: TStrings);
|
||||
begin
|
||||
end;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
{$I ../unix/lazbaseconf.inc}
|
||||
|
||||
|
||||
|
@ -31,11 +31,6 @@
|
||||
uses
|
||||
Unix, BaseUnix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='linux';
|
||||
|
@ -32,11 +32,6 @@
|
||||
uses
|
||||
baseunix, unix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='netbsd';
|
||||
@ -46,11 +41,6 @@ procedure GetDefaultLCLLibPaths(List: TStrings);
|
||||
begin
|
||||
end;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
{$I ../unix/lazbaseconf.inc}
|
||||
|
||||
|
||||
|
@ -128,14 +128,6 @@ begin
|
||||
Result:=FindDefaultExecutablePath('make');
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
function GetDefaultExecutableExt: string;
|
||||
---------------------------------------------------------------------------}
|
||||
function GetDefaultExecutableExt: string;
|
||||
begin
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
begin
|
||||
Result:='.ppu';
|
||||
|
@ -115,19 +115,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
function GetDefaultExecutableExt: string;
|
||||
---------------------------------------------------------------------------}
|
||||
function GetDefaultExecutableExt: string;
|
||||
begin
|
||||
Result:='.exe';
|
||||
end;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.dll';
|
||||
end;
|
||||
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
begin
|
||||
if (FPCVersion=1) and (FPCRelease=0) then
|
||||
|
@ -177,7 +177,7 @@ end;
|
||||
function TLazarusManager.GetLazarusPath(const FileName: string) : string;
|
||||
begin
|
||||
Result := AppendPathDelim(FStartLazarusOptions.LazarusDir) + FileName +
|
||||
GetDefaultExecutableExt;
|
||||
GetExecutableExt;
|
||||
end;
|
||||
|
||||
function TLazarusManager.RenameLazarusExecutables: TModalResult;
|
||||
|
@ -97,10 +97,10 @@ const
|
||||
// create a pascal file, which can be used to test the compiler
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
|
||||
// returns the standard file extension (e.g '.exe')
|
||||
function GetDefaultExecutableExt: string;
|
||||
// returns the standard file extension (e.g '.dll' or '.dylib')
|
||||
function GetDefaultLibraryExt: string;
|
||||
// returns the standard executable extension (e.g '.exe')
|
||||
function GetExecutableExt(TargetOS: string = ''): string;
|
||||
// returns the standard library extension (e.g '.dll' or '.dynlib')
|
||||
function GetLibraryExt(TargetOS: string = ''): string;
|
||||
|
||||
// returns the standard file extension for compiled units (e.g '.ppu')
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
@ -192,6 +192,28 @@ begin
|
||||
Result:=AppendPathDelim(GetPrimaryConfigPath)+'projectsessions';
|
||||
end;
|
||||
|
||||
function GetExecutableExt(TargetOS: string): string;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
if CompareText(TargetOS, 'win32') = 0 then
|
||||
Result:='.exe'
|
||||
else
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function GetLibraryExt(TargetOS: string): string;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
if CompareText(TargetOS, 'win32') = 0 then
|
||||
Result:='.dll'
|
||||
else if CompareText(TargetOS, 'darwin') = 0 then
|
||||
Result:='.dylib'
|
||||
else
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetCPU: string;
|
||||
begin
|
||||
Result:='undefined';
|
||||
|
@ -7544,7 +7544,7 @@ procedure TMainIDE.DoRestart;
|
||||
// TODO: use the target directory, where the new startlazarus is
|
||||
StartLazProcess.CurrentDirectory := ExtractFileDir(ParamStr(0));
|
||||
ExeName := AppendPathDelim(StartLazProcess.CurrentDirectory) +
|
||||
'startlazarus' + GetDefaultExecutableExt;
|
||||
'startlazarus' + GetExecutableExt;
|
||||
if not FileExists(ExeName) then begin
|
||||
ShowMessage(format(lisCannotFindLazarusStarter,
|
||||
[LineEnding, ExeName]));
|
||||
@ -9290,7 +9290,7 @@ var
|
||||
begin
|
||||
Result:=Filename;
|
||||
OldExt:=ExtractFileExt(Filename);
|
||||
ExeExt:=LazConf.GetDefaultExecutableExt;
|
||||
ExeExt:=LazConf.GetExecutableExt(GetTargetOS(true));
|
||||
if OldExt<>ExeExt then
|
||||
Result:=copy(Result,1,length(Result)-length(OldExt))+ExeExt;
|
||||
DebugLn('TMainIDE.OnMacroFuncMakeExe A ',Filename,' ',Result);
|
||||
|
@ -993,7 +993,7 @@ var
|
||||
MakeMsg: String;
|
||||
begin
|
||||
Result:=false;
|
||||
MakeBeginPattern:= 'make' + GetDefaultExecutableExt + '[';
|
||||
MakeBeginPattern:= 'make' + GetExecutableExt + '[';
|
||||
i:=length(MakeBeginPattern);
|
||||
if copy(s,1,i)=MakeBeginPattern then begin
|
||||
Result:=true;
|
||||
|
@ -1424,7 +1424,7 @@ begin
|
||||
UpdateProjectDirectory;
|
||||
FPublishOptions:=TPublishProjectOptions.Create(Self);
|
||||
FRunParameterOptions:=TRunParamsOptions.Create;
|
||||
FTargetFileExt := GetDefaultExecutableExt;
|
||||
FTargetFileExt := GetExecutableExt;
|
||||
Title := '';
|
||||
FUnitList := TList.Create; // list of TUnitInfo
|
||||
end;
|
||||
@ -1918,7 +1918,7 @@ begin
|
||||
Path+'General/AutoCreateForms/Value', true);
|
||||
IconPath := xmlconfig.GetValue(Path+'General/IconPath/Value', './');
|
||||
TargetFileExt := xmlconfig.GetValue(
|
||||
Path+'General/TargetFileExt/Value', GetDefaultExecutableExt);
|
||||
Path+'General/TargetFileExt/Value', GetExecutableExt);
|
||||
Title := xmlconfig.GetValue(Path+'General/Title/Value', '');
|
||||
|
||||
// Lazdoc
|
||||
@ -2137,7 +2137,7 @@ begin
|
||||
ClearSourceDirectories;
|
||||
UpdateProjectDirectory;
|
||||
FPublishOptions.Clear;
|
||||
FTargetFileExt := GetDefaultExecutableExt;
|
||||
FTargetFileExt := GetExecutableExt;
|
||||
Title := '';
|
||||
EndUpdate;
|
||||
end;
|
||||
|
@ -1048,6 +1048,7 @@ end;
|
||||
procedure TLazProject.SetTitle(const AValue: String);
|
||||
begin
|
||||
if fTitle=AValue then exit;
|
||||
Modified:=true;
|
||||
fTitle:=AValue;
|
||||
end;
|
||||
|
||||
|
@ -1348,7 +1348,7 @@ begin
|
||||
try
|
||||
FPCMakeTool.Title:='Creating Makefile for package '+APackage.IDAsString;
|
||||
FPCMakeTool.WorkingDirectory:=APackage.Directory;
|
||||
FPCMakeTool.Filename:=FindFPCTool('fpcmake'+GetDefaultExecutableExt,
|
||||
FPCMakeTool.Filename:=FindFPCTool('fpcmake'+GetExecutableExt,
|
||||
EnvironmentOptions.CompilerFilename);
|
||||
FPCMakeTool.CmdLineParams:='-q -TAll';
|
||||
FPCMakeTool.EnvironmentOverrides.Add(
|
||||
|
Loading…
Reference in New Issue
Block a user