|
@@ -114,6 +114,8 @@ end;
|
|
{ TFPMakeCompiler }
|
|
{ TFPMakeCompiler }
|
|
|
|
|
|
Procedure TFPMakeCompiler.CompileFPMake;
|
|
Procedure TFPMakeCompiler.CompileFPMake;
|
|
|
|
+var
|
|
|
|
+ OOptions : string;
|
|
|
|
|
|
function CheckUnitDir(const AUnitName:string;Out AUnitDir:string):boolean;
|
|
function CheckUnitDir(const AUnitName:string;Out AUnitDir:string):boolean;
|
|
begin
|
|
begin
|
|
@@ -136,17 +138,24 @@ Procedure TFPMakeCompiler.CompileFPMake;
|
|
AUnitDir:='';
|
|
AUnitDir:='';
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ procedure AddOption(const s:string);
|
|
|
|
+ begin
|
|
|
|
+ if OOptions<>'' then
|
|
|
|
+ OOptions:=OOptions+' ';
|
|
|
|
+ OOptions:=OOptions+maybequoted(s);
|
|
|
|
+ end;
|
|
|
|
+
|
|
const
|
|
const
|
|
TempBuildDir = 'build-fpmake';
|
|
TempBuildDir = 'build-fpmake';
|
|
Var
|
|
Var
|
|
i : Integer;
|
|
i : Integer;
|
|
- OOptions,
|
|
|
|
DepDir,
|
|
DepDir,
|
|
FPMakeBin,
|
|
FPMakeBin,
|
|
FPMakeSrc : string;
|
|
FPMakeSrc : string;
|
|
NeedFPMKUnitSource,
|
|
NeedFPMKUnitSource,
|
|
HaveFpmake : boolean;
|
|
HaveFpmake : boolean;
|
|
begin
|
|
begin
|
|
|
|
+ OOptions:='';
|
|
SetCurrentDir(PackageBuildPath);
|
|
SetCurrentDir(PackageBuildPath);
|
|
// Check for fpmake source
|
|
// Check for fpmake source
|
|
FPMakeBin:='fpmake'+ExeExt;
|
|
FPMakeBin:='fpmake'+ExeExt;
|
|
@@ -164,13 +173,13 @@ begin
|
|
begin
|
|
begin
|
|
if Not HaveFPMake then
|
|
if Not HaveFPMake then
|
|
Error(SErrMissingFPMake);
|
|
Error(SErrMissingFPMake);
|
|
- OOptions:='-n';
|
|
|
|
|
|
+ AddOption('-n');
|
|
for i:=1 to FPMKUnitDepCount do
|
|
for i:=1 to FPMKUnitDepCount do
|
|
begin
|
|
begin
|
|
if FPMKUnitDepAvailable[i] then
|
|
if FPMKUnitDepAvailable[i] then
|
|
begin
|
|
begin
|
|
if CheckUnitDir(FPMKUnitDeps[i].package,DepDir) then
|
|
if CheckUnitDir(FPMKUnitDeps[i].package,DepDir) then
|
|
- OOptions:=OOptions+' -Fu'+DepDir
|
|
|
|
|
|
+ AddOption(maybequoted('-Fu'+DepDir))
|
|
else
|
|
else
|
|
Error(SErrMissingInstallPackage,[FPMKUnitDeps[i].package]);
|
|
Error(SErrMissingInstallPackage,[FPMKUnitDeps[i].package]);
|
|
end
|
|
end
|
|
@@ -180,26 +189,27 @@ begin
|
|
if FPMKUnitDeps[i].package='fpmkunit' then
|
|
if FPMKUnitDeps[i].package='fpmkunit' then
|
|
begin
|
|
begin
|
|
NeedFPMKUnitSource:=true;
|
|
NeedFPMKUnitSource:=true;
|
|
- OOptions:=OOptions+' -Fu'+TempBuildDir;
|
|
|
|
|
|
+ AddOption('-Fu'+TempBuildDir);
|
|
end;
|
|
end;
|
|
if FPMKUnitDeps[i].undef<>'' then
|
|
if FPMKUnitDeps[i].undef<>'' then
|
|
- OOptions:=OOptions+' -d'+FPMKUnitDeps[i].undef;
|
|
|
|
|
|
+ AddOption('-d'+FPMKUnitDeps[i].undef);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
// Add RTL unit dir
|
|
// Add RTL unit dir
|
|
if not CheckUnitDir('rtl',DepDir) then
|
|
if not CheckUnitDir('rtl',DepDir) then
|
|
Error(SErrMissingInstallPackage,['rtl']);
|
|
Error(SErrMissingInstallPackage,['rtl']);
|
|
- OOptions:=OOptions+' -Fu'+DepDir;
|
|
|
|
|
|
+ AddOption('-Fu'+DepDir);
|
|
// Units in a directory for easy cleaning
|
|
// Units in a directory for easy cleaning
|
|
DeleteDir(TempBuildDir);
|
|
DeleteDir(TempBuildDir);
|
|
ForceDirectories(TempBuildDir);
|
|
ForceDirectories(TempBuildDir);
|
|
- OOptions:=OOptions+' -FU'+TempBuildDir;
|
|
|
|
|
|
+ AddOption('-FU'+TempBuildDir);
|
|
// Compile options
|
|
// Compile options
|
|
// -- default is to optimize, smartlink and strip to reduce
|
|
// -- default is to optimize, smartlink and strip to reduce
|
|
// the executable size (there can be 100's of fpmake's on a system)
|
|
// the executable size (there can be 100's of fpmake's on a system)
|
|
if vlInfo in LogLevels then
|
|
if vlInfo in LogLevels then
|
|
- OOptions:=OOptions+' -vi';
|
|
|
|
- OOptions:=OOptions+' -O2 -XXs';
|
|
|
|
|
|
+ AddOption('-vi');
|
|
|
|
+ AddOption('-O2');
|
|
|
|
+ AddOption('-XXs');
|
|
// Create fpmkunit.pp if needed
|
|
// Create fpmkunit.pp if needed
|
|
if NeedFPMKUnitSource then
|
|
if NeedFPMKUnitSource then
|
|
CreateFPMKUnitSource(TempBuildDir+PathDelim+'fpmkunit.pp');
|
|
CreateFPMKUnitSource(TempBuildDir+PathDelim+'fpmkunit.pp');
|
|
@@ -228,27 +238,36 @@ Function TFPMakeRunner.RunFPMake(const Command:string) : Integer;
|
|
Var
|
|
Var
|
|
FPMakeBin,
|
|
FPMakeBin,
|
|
OOptions : string;
|
|
OOptions : string;
|
|
|
|
+
|
|
|
|
+ procedure AddOption(const s:string);
|
|
|
|
+ begin
|
|
|
|
+ if OOptions<>'' then
|
|
|
|
+ OOptions:=OOptions+' ';
|
|
|
|
+ OOptions:=OOptions+maybequoted(s);
|
|
|
|
+ end;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
|
|
+ OOptions:='';
|
|
{ Maybe compile fpmake executable? }
|
|
{ Maybe compile fpmake executable? }
|
|
ExecuteAction(CurrentPackage,'compilefpmake');
|
|
ExecuteAction(CurrentPackage,'compilefpmake');
|
|
{ Create options }
|
|
{ Create options }
|
|
- OOptions:=' --nofpccfg';
|
|
|
|
|
|
+ AddOption('--nofpccfg');
|
|
if vlInfo in LogLevels then
|
|
if vlInfo in LogLevels then
|
|
- OOptions:=OOptions+' --verbose';
|
|
|
|
- OOptions:=OOptions+' --compiler='+CompilerOptions.Compiler;
|
|
|
|
- OOptions:=OOptions+' --cpu='+CPUToString(CompilerOptions.CompilerCPU);
|
|
|
|
- OOptions:=OOptions+' --os='+OSToString(CompilerOptions.CompilerOS);
|
|
|
|
|
|
+ AddOption('--verbose');
|
|
|
|
+ AddOption('--compiler='+CompilerOptions.Compiler);
|
|
|
|
+ AddOption('--cpu='+CPUToString(CompilerOptions.CompilerCPU));
|
|
|
|
+ AddOption('--os='+OSToString(CompilerOptions.CompilerOS));
|
|
if IsSuperUser or GlobalOptions.InstallGlobal then
|
|
if IsSuperUser or GlobalOptions.InstallGlobal then
|
|
- OOptions:=OOptions+' --baseinstalldir='+CompilerOptions.GlobalInstallDir
|
|
|
|
|
|
+ AddOption('--baseinstalldir='+CompilerOptions.GlobalInstallDir)
|
|
else
|
|
else
|
|
- OOptions:=OOptions+' --baseinstalldir='+CompilerOptions.LocalInstallDir;
|
|
|
|
|
|
+ AddOption('--baseinstalldir='+CompilerOptions.LocalInstallDir);
|
|
if CompilerOptions.LocalInstallDir<>'' then
|
|
if CompilerOptions.LocalInstallDir<>'' then
|
|
- OOptions:=OOptions+' --localunitdir='+CompilerOptions.LocalUnitDir;
|
|
|
|
- OOptions:=OOptions+' --globalunitdir='+CompilerOptions.GlobalUnitDir;
|
|
|
|
|
|
+ AddOption('--localunitdir='+CompilerOptions.LocalUnitDir);
|
|
|
|
+ AddOption('--globalunitdir='+CompilerOptions.GlobalUnitDir);
|
|
{ Run FPMake }
|
|
{ Run FPMake }
|
|
FPMakeBin:='fpmake'+ExeExt;
|
|
FPMakeBin:='fpmake'+ExeExt;
|
|
SetCurrentDir(PackageBuildPath);
|
|
SetCurrentDir(PackageBuildPath);
|
|
- Result:=ExecuteProcess(FPMakeBin,Command+OOptions);
|
|
|
|
|
|
+ Result:=ExecuteProcess(FPMakeBin,Command+' '+OOptions);
|
|
if Result<>0 then
|
|
if Result<>0 then
|
|
Error(SErrExecutionFPMake,[Command]);
|
|
Error(SErrExecutionFPMake,[Command]);
|
|
end;
|
|
end;
|