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