소스 검색

* separate compiler setting for compiling fpmake.pp
* first auto-detected fpc is used for compiling fpmake.pp

git-svn-id: trunk@6567 -

peter 18 년 전
부모
커밋
7fa93d8b1a
3개의 변경된 파일26개의 추가작업 그리고 9개의 파일을 삭제
  1. 1 1
      utils/fppkg/fppkg.pp
  2. 4 4
      utils/fppkg/pkgfpmake.pp
  3. 21 4
      utils/fppkg/pkgoptions.pp

+ 1 - 1
utils/fppkg/fppkg.pp

@@ -297,8 +297,8 @@ var
   Args   : TActionArgs;
   OldCurrDir : String;
 begin
-  LoadGlobalDefaults;
   OldCurrDir:=GetCurrentDir;
+  LoadGlobalDefaults;
   Try
     ProcessCommandLine;
     MaybeCreateLocalDirs;

+ 4 - 4
utils/fppkg/pkgfpmake.pp

@@ -76,8 +76,8 @@ begin
       if Not HaveFPMake then
         Error(SErrMissingFPMake);
       { Call compiler }
-      C:=Defaults.Compiler;
-      O:=FPmakeSrc;
+      C:=Defaults.FPMakeCompiler;
+      O:='-vi -n -Fu'+Defaults.FPMakeUnitDir+' -Fu'+Defaults.FPMakeUnitDir+'..'+PathDelim+'rtl'+PathDelim+' '+FPmakeSrc;
       If ExecuteProcess(C,O)<>0 then
         Error(SErrFailedToCompileFPCMake)
     end
@@ -112,14 +112,14 @@ end;
 
 function TFPMakeRunnerBuild.Execute(const Args:TActionArgs):boolean;
 begin
-  result:=(RunFPMake('--build')=0);
+  result:=(RunFPMake('build')=0);
 end;
 
 
 
 function TFPMakeRunnerInstall.Execute(const Args:TActionArgs):boolean;
 begin
-  result:=(RunFPMake('--install')=0);
+  result:=(RunFPMake('install')=0);
 end;
 
 

+ 21 - 4
utils/fppkg/pkgoptions.pp

@@ -41,6 +41,9 @@ Type
     FCompilerOS: TOS;
     FCompilerVersion : String;
     FInstallDir : String;
+    // Compiler settings for compiling FPMake.pp
+    FFPMakeCompiler : String;
+    FFPMakeUnitDir : String;
     function GetOptString(Index: integer): String;
     procedure SetOptString(Index: integer; const AValue: String);
     procedure SetCompilerCPU(const AValue: TCPU);
@@ -75,6 +78,8 @@ Type
     Property DefaultVerbosity : String Index 11 Read GetOptString Write SetOptString;
     Property PackagesDir : String Index 12 Read GetOptString Write SetOptString;
     Property CompilerConfigDir : String Index 13 Read GetOptString Write SetOptString;
+    Property FPMakeCompiler : String Index 14 Read GetOptString Write SetOptString;
+    Property FPMakeUnitDir : String Index 15 Read GetOptString Write SetOptString;
     Property CompilerOS : TOS Read FCompilerOS Write SetCompilerOS;
     Property CompilerCPU : TCPU Read FCompilerCPU Write SetCompilerCPU;
   end;
@@ -122,6 +127,8 @@ Const
   KeyCompilerOS            = 'OS';
   KeyCompilerCPU           = 'CPU';
   KeyCompilerVersion       = 'Version';
+  KeyFPMakeCompiler        = 'FPMakeCompiler';
+  KeyFPMakeUnitDir         = 'FPMakeUnitDir';
 
 
 { TPackagerOptions }
@@ -148,6 +155,8 @@ begin
    11 : Result:=FDefaultVerbosity;
    12 : Result:=FPackagesDir;
    13 : Result:=FCompilerConfigDir;
+   14 : Result:=FFPMakeCompiler;
+   15 : Result:=FFPMakeUnitDir;
   end;
 end;
 
@@ -169,6 +178,8 @@ begin
    11 : FDefaultVerbosity:=AValue;
    12 : FPackagesDir:=FixPath(AValue);
    13 : FCompilerConfigDir:=FixPath(AValue);
+   14 : FFPMakeCompiler:=AValue;
+   15 : FFPMakeUnitDir:=FixPath(AValue);
   end;
   FDirty:=True;
 end;
@@ -209,7 +220,6 @@ begin
   Result:=FLocalRepository+Format(DefaultVersionsFile,[CompilerConfig]);
 end;
 
-
 Procedure TPackagerOptions.InitGlobalDefaults;
 var
   LocalDir : String;
@@ -258,9 +268,9 @@ begin
   FInstallDir:=FixPath(GetEnvironmentVariable('FPCDIR'));
   if FInstallDir='' then
     begin
-      if DirectoryExists('/usr/local/lib/fpc/'+FCompilerVersion) then
-        FInstallDir:='/usr/local/lib/fpc/'+FCompilerVersion+'/'
-      else
+      FInstallDir:='/usr/local/lib/fpc/'+FCompilerVersion+'/';
+      if not DirectoryExists(FInstallDir) and
+         DirectoryExists('/usr/lib/fpc/'+FCompilerVersion) then
         FInstallDir:='/usr/lib/fpc/'+FCompilerVersion+'/';
     end;
 {$else unix}
@@ -273,6 +283,9 @@ begin
         FInstallDir:=FInstallDir+'../';
     end;
 {$endif unix}
+  // Detect directory where fpmake units are located
+  FFPMakeCompiler:=FCompiler;
+  FFPMakeUnitDir:=FInstallDir+'units'+PathDelim+CompilerTarget+PathDelim+'fpmake'+PathDelim;
 end;
 
 
@@ -346,6 +359,8 @@ begin
      FCompilerOS:=StringToOS(ReadString(SDefaults,KeyCompilerOS,OSToString(CompilerOS)));
      FCompilerCPU:=StringToCPU(ReadString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU)));
      FCompilerVersion:=ReadString(SDefaults,KeyCompilerVersion,FCompilerVersion);
+     FFPMakeCompiler:=ReadString(SDefaults,KeyFPMakeCompiler,FFPMakeCompiler);
+     FFPMakeUnitDir:=FixPath(ReadString(SDefaults,KeyFPMakeUnitDir,FFPMakeUnitDir));
    end;
 end;
 
@@ -359,6 +374,8 @@ begin
      WriteString(SDefaults,KeyCompilerOS,OSToString(CompilerOS));
      WriteString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU));
      WriteString(SDefaults,KeyCompilerVersion,FCompilerVersion);
+     WriteString(SDefaults,KeyFPMakeCompiler,FFPMakeCompiler);
+     WriteString(SDefaults,KeyFPMakeUnitDir,FFPMakeUnitDir);
    end;
 end;