Browse Source

--- Merging r16921 into '.':
U utils/fppkg/pkgglobals.pp
--- Merging r16925 into '.':
U utils/fppkg/pkgcommands.pp
U utils/fppkg/fppkg.pp
U utils/fppkg/pkgmessages.pp
U utils/fppkg/pkgoptions.pp
--- Merging r16926 into '.':
G utils/fppkg/pkgmessages.pp
--- Merging r16927 into '.':
G utils/fppkg/pkgoptions.pp
--- Merging r16928 into '.':
G utils/fppkg/pkgoptions.pp
--- Merging r16929 into '.':
G utils/fppkg/pkgoptions.pp
--- Merging r16930 into '.':
G utils/fppkg/pkgoptions.pp
--- Merging r16931 into '.':
G utils/fppkg/pkgcommands.pp
U utils/fppkg/pkgrepos.pp
--- Merging r16933 into '.':
G utils/fppkg/pkgcommands.pp
--- Merging r16934 into '.':
U packages/fpmkunit/src/fpmkunit.pp
--- Merging r16935 into '.':
G utils/fppkg/pkgmessages.pp
U utils/fppkg/pkgdownload.pp
--- Merging r16936 into '.':
U utils/fppkg/pkgfpmake.pp

# revisions: 16921,16925,16926,16927,16928,16929,16930,16931,16933,16934,16935,16936
------------------------------------------------------------------------
r16921 | joost | 2011-02-16 14:25:23 +0100 (Wed, 16 Feb 2011) | 4 lines
Changed paths:
M /trunk/utils/fppkg/pkgglobals.pp

* Use fppkg as application name on Windows and other OS'es. This means that
on all targets the same configuration filename and the same prefix for the
local repository is used. This is easier to explain in the documentation.

------------------------------------------------------------------------
------------------------------------------------------------------------
r16925 | joost | 2011-02-16 21:44:56 +0100 (Wed, 16 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/fppkg.pp
M /trunk/utils/fppkg/pkgcommands.pp
M /trunk/utils/fppkg/pkgmessages.pp
M /trunk/utils/fppkg/pkgoptions.pp

* Added command listsettings to values for all settings
------------------------------------------------------------------------
------------------------------------------------------------------------
r16926 | joost | 2011-02-16 21:53:23 +0100 (Wed, 16 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/pkgmessages.pp

* Alined settings output
------------------------------------------------------------------------
------------------------------------------------------------------------
r16927 | joost | 2011-02-17 10:57:42 +0100 (Thu, 17 Feb 2011) | 3 lines
Changed paths:
M /trunk/utils/fppkg/pkgoptions.pp

* Use macros instead of code to resolve Global-and Local-InstallDir
* Added CompilerVersion macro

------------------------------------------------------------------------
------------------------------------------------------------------------
r16928 | joost | 2011-02-17 12:25:06 +0100 (Thu, 17 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/pkgoptions.pp

* Do now show newlines in listsettings
------------------------------------------------------------------------
------------------------------------------------------------------------
r16929 | joost | 2011-02-17 13:17:31 +0100 (Thu, 17 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/pkgoptions.pp

* Solved issues setting the default GlobalPrefix and GlobalInstallDir
------------------------------------------------------------------------
------------------------------------------------------------------------
r16930 | joost | 2011-02-17 14:12:26 +0100 (Thu, 17 Feb 2011) | 2 lines
Changed paths:
M /trunk/utils/fppkg/pkgoptions.pp

* Use macro in default LocalRepository setting
* When no FPCDIR env. variable is set, do not clear the GlobalInstallDir
------------------------------------------------------------------------
------------------------------------------------------------------------
r16931 | joost | 2011-02-17 18:03:18 +0100 (Thu, 17 Feb 2011) | 2 lines
Changed paths:
M /trunk/utils/fppkg/pkgcommands.pp
M /trunk/utils/fppkg/pkgrepos.pp

* When a add-in is installed, add it to the fpmake dependencies list, so that packages
depending on it can be installed in one go.
------------------------------------------------------------------------
------------------------------------------------------------------------
r16933 | joost | 2011-02-18 21:58:12 +0100 (Fri, 18 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/pkgcommands.pp

* Do not show the message that dependencies are being installed in recursive calls
------------------------------------------------------------------------
------------------------------------------------------------------------
r16934 | joost | 2011-02-18 22:17:55 +0100 (Fri, 18 Feb 2011) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Show target when compiling/installing
------------------------------------------------------------------------
------------------------------------------------------------------------
r16935 | joost | 2011-02-18 23:03:38 +0100 (Fri, 18 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/pkgdownload.pp
M /trunk/utils/fppkg/pkgmessages.pp

* Show message when downloading package
------------------------------------------------------------------------
------------------------------------------------------------------------
r16936 | joost | 2011-02-19 11:38:36 +0100 (Sat, 19 Feb 2011) | 1 line
Changed paths:
M /trunk/utils/fppkg/pkgfpmake.pp

* Fixed problem with spaces in path of add-ins (maybequoted was called twice)
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@16974 -

marco 14 years ago
parent
commit
2512c648fc

+ 4 - 4
packages/fpmkunit/src/fpmkunit.pp

@@ -1042,9 +1042,9 @@ ResourceString
   SWarnDepUnitNotFound     = 'Warning: Dependency on unit %s is not supported for %s';
   SWarnTargetDependsOnPackage = 'Warning: Target %s of package %s depends on another package (%s). These kind of dependencies are not processed';
   SWarnDependOnOtherPlatformPackage = 'Warning: Package %s depends on package %s which is not available for the %s platform';
-  SWarnStartBuildingPackage = 'Start building package %s';
+  SWarnStartBuildingPackage = 'Start building package %s for target %s.';
   SWarnBuildingPackagecomplete = '[%3.0f%%] Built target %s';
-  SWarnInstallationPackagecomplete = 'Installation package %s succeeded';
+  SWarnInstallationPackagecomplete = 'Installation package %s for target %s succeeded';
   SWarnCleanPackagecomplete = 'Clean of package %s completed';
 
   SInfoCompilingPackage   = 'Compiling package %s';
@@ -4899,7 +4899,7 @@ begin
   For I:=0 to Packages.Count-1 do
     begin
       P:=Packages.PackageItems[i];
-      log(vlWarning,SWarnStartBuildingPackage,[P.Name]);
+      log(vlWarning,SWarnStartBuildingPackage,[P.Name, Defaults.Target]);
       If PackageOK(P) then
         MaybeCompile(P);
 
@@ -4923,7 +4923,7 @@ begin
       P:=Packages.PackageItems[i];
       If PackageOK(P) then
         Install(P);
-      log(vlWarning, SWarnInstallationPackagecomplete, [P.Name]);
+      log(vlWarning, SWarnInstallationPackagecomplete, [P.Name, Defaults.Target]);
     end;
   If Assigned(AfterInstall) then
     AfterInstall(Self);

+ 4 - 3
utils/fppkg/fppkg.pp

@@ -107,7 +107,7 @@ begin
   else
     pkgglobals.Log(vlDebug,SLogLoadingGlobalConfig,[cfgfile]);
   // Log configuration
-  GlobalOptions.LogValues;
+  GlobalOptions.LogValues(vlDebug);
 end;
 
 
@@ -146,7 +146,7 @@ begin
         Error(SErrMissingCompilerConfig,[S]);
     end;
   // Log compiler configuration
-  CompilerOptions.LogValues('');
+  CompilerOptions.LogValues(vlDebug,'');
   // Load FPMake compiler config, this is normally the same config as above
   S:=GlobalOptions.CompilerConfigDir+GlobalOptions.FPMakeCompilerConfig;
   FPMakeCompilerOptions.UpdateLocalRepositoryOption;
@@ -160,7 +160,7 @@ begin
   else
     Error(SErrMissingCompilerConfig,[S]);
   // Log compiler configuration
-  FPMakeCompilerOptions.LogValues('fpmake-building ');
+  FPMakeCompilerOptions.LogValues(vlDebug,'fpmake-building ');
 end;
 
 
@@ -195,6 +195,7 @@ begin
   Writeln('  download          Download package');
   Writeln('  convertmk         Convert Makefile.fpc to fpmake.pp');
   Writeln('  fixbroken         Recompile all (broken) packages with changed dependencies');
+  Writeln('  listsettings      Show the values for all fppkg settings');
 //  Writeln('  addconfig          Add a compiler configuration for the supplied compiler');
   Halt(0);
 end;

+ 31 - 2
utils/fppkg/pkgcommands.pp

@@ -110,6 +110,25 @@ type
     Procedure Execute;override;
   end;
 
+  { TCommandListSettings }
+
+  TCommandListSettings = Class(TPackagehandler)
+  Public
+    Procedure Execute;override;
+  end;
+
+var
+  DependenciesDepth: integer;
+
+{ TCommandListSettings }
+
+procedure TCommandListSettings.Execute;
+begin
+  GlobalOptions.LogValues(vlProgres);
+  CompilerOptions.LogValues(vlProgres,'');
+  FPMakeCompilerOptions.LogValues(vlProgres,'fpmake-building ');
+end;
+
 
 procedure TCommandAddConfig.Execute;
 begin
@@ -304,6 +323,8 @@ begin
         end;
       UFN:=IncludeTrailingPathDelimiter(UFN)+S+PathDelim+UnitConfigFileName;
       LoadUnitConfigFromFile(P,UFN);
+      if P.IsFPMakeAddIn then
+        AddFPMakeAddIn(P);
     end
   else
     ExecuteAction(PackageName,'fpmakeinstall');
@@ -396,10 +417,16 @@ begin
   // Install needed updates
   if L.Count > 0 then
     begin
-      pkgglobals.Log(vlProgres,SProgrInstallDependencies);
+      if DependenciesDepth=0 then
+        pkgglobals.Log(vlProgres,SProgrInstallDependencies);
+      inc(DependenciesDepth);
+
       for i:=0 to L.Count-1 do
         ExecuteAction(L[i],'install');
-      pkgglobals.Log(vlProgres,SProgrDependenciesInstalled);
+
+      dec(DependenciesDepth);
+      if DependenciesDepth=0 then
+        pkgglobals.Log(vlProgres,SProgrDependenciesInstalled);
     end;
   FreeAndNil(L);
   if FreeManifest then
@@ -429,6 +456,7 @@ end;
 
 
 initialization
+  DependenciesDepth:=0;
   RegisterPkgHandler('update',TCommandUpdate);
   RegisterPkgHandler('list',TCommandListPackages);
   RegisterPkgHandler('scan',TCommandScanPackages);
@@ -441,4 +469,5 @@ initialization
   RegisterPkgHandler('archive',TCommandArchive);
   RegisterPkgHandler('installdependencies',TCommandInstallDependencies);
   RegisterPkgHandler('fixbroken',TCommandFixBroken);
+  RegisterPkgHandler('listsettings',TCommandListSettings);
 end.

+ 1 - 0
utils/fppkg/pkgdownload.pp

@@ -169,6 +169,7 @@ begin
   with DownloaderClass.Create(nil) do
     try
       Log(vlCommands,SLogDownloading,[PackageRemoteArchive(P),PackageLocalArchive(P)]);
+      pkgglobals.Log(vlProgres,SProgrDownloadPackage,[P.Name, P.Version.AsString]);
       Download(PackageRemoteArchive(P),PackageLocalArchive(P));
     finally
       Free;

+ 1 - 1
utils/fppkg/pkgfpmake.pp

@@ -195,7 +195,7 @@ begin
           if FPMKUnitDeps[i].available then
             begin
               if CheckUnitDir(FPMKUnitDeps[i].package,DepDir) then
-                AddOption(maybequoted('-Fu'+DepDir))
+                AddOption('-Fu'+DepDir)
               else
                 Error(SErrMissingInstallPackage,[FPMKUnitDeps[i].package]);
               if FPMKUnitDeps[i].def<>'' then

+ 0 - 4
utils/fppkg/pkgglobals.pp

@@ -118,11 +118,7 @@ end;
 
 function FPPkgGetApplicationName:string;
 begin
-{$ifdef unix}
   result:='fppkg';
-{$else}
-  result:='Packages'
-{$endif}
 end;
 
 

+ 19 - 17
utils/fppkg/pkgmessages.pp

@@ -81,24 +81,25 @@ Resourcestring
   SLogPackageChecksumChanged = 'Package %s needs to be rebuild, dependency %s is modified';
   SLogCheckBrokenDependenvies= 'Checking for broken dependencies';
 
-  SLogGlobalCfgHeader        = 'Using global configuration:';
-  SLogGlobalCfgRemoteMirrorsURL = ' RemoteMirrorsURL: "%s"';
-  SLogGlobalCfgRemoteRepository = ' RemoteRepository: "%s"';
-  SLogGlobalCfgLocalRepository = ' LocalRepository: "%s"';
-  SLogGlobalCfgBuildDir      = ' BuildDir: "%s"';
-  SLogGlobalCfgArchivesDir   = ' ArchivesDir: "%s"';
-  SLogGlobalCfgCompilerConfigDir = ' CompilerConfigDir: "%s"';
+  SLogGlobalCfgHeader                = 'Using global configuration from file "%s":';
+  SLogGlobalCfgRemoteMirrorsURL      = ' RemoteMirrorsURL:      %s';
+  SLogGlobalCfgRemoteRepository      = ' RemoteRepository:      %s';
+  SLogGlobalCfgLocalRepository       = ' LocalRepository:       "%s" -> "%s"';
+  SLogGlobalCfgBuildDir              = ' BuildDir:              "%s" -> "%s"';
+  SLogGlobalCfgArchivesDir           = ' ArchivesDir:           "%s" -> "%s"';
+  SLogGlobalCfgCompilerConfigDir     = ' CompilerConfigDir:     "%s" -> "%s"';
   SLogGlobalCfgDefaultCompilerConfig = ' DefaultCompilerConfig: "%s"';
-  SLogGlobalCfgFPMakeCompilerConfig = ' FPMakeCompilerConfig: "%s"';
-  SLogGlobalCfgDownloader    = ' Downloader: "%s"';
-  SLogCompilerCfgHeader      = 'Using %scompiler configuration:';
-  SLogCompilerCfgCompiler    = ' Compiler: "%s"';
-  SLogCompilerCfgTarget      = ' Target: "%s"';
-  SLogCompilerCfgVersion     = ' Version: "%s"';
-  SLogCompilerCfgGlobalInstallDir = ' GlobalInstallDir: "%s"';
-  SLogCompilerCfgLocalInstallDir = ' LocalInstallDir: "%s"';
-  SLogCompilerCfgGlobalPrefix = ' GlobalPrefix: "%s"';
-  SLogCompilerCfgLocalPrefix = ' LocalPrefix: "%s"';
+  SLogGlobalCfgFPMakeCompilerConfig  = ' FPMakeCompilerConfig:  "%s"';
+  SLogGlobalCfgDownloader            = ' Downloader:            %s';
+  SLogCompilerCfgHeader           = 'Using %scompiler configuration file "%s":';
+  SLogCompilerCfgCompiler         = ' Compiler:         "%s"';
+  SLogCompilerCfgTarget           = ' Target:           %s';
+  SLogCompilerCfgOptions          = ' Options:          "%s"';
+  SLogCompilerCfgVersion          = ' Version:          %s';
+  SLogCompilerCfgGlobalInstallDir = ' GlobalInstallDir: "%s" -> "%S"';
+  SLogCompilerCfgLocalInstallDir  = ' LocalInstallDir:  "%s" -> "%s"';
+  SLogCompilerCfgGlobalPrefix     = ' GlobalPrefix:     "%s" -> "%s"';
+  SLogCompilerCfgLocalPrefix      = ' LocalPrefix:      "%s" -> "%s"';
 
   SDbgFound                  = 'Found';
   SDbgNotFound               = 'Not Found';
@@ -112,6 +113,7 @@ Resourcestring
   SProgrReinstallDependent   = 'Re-install packages which are dependent on just installed packages';
   SProgrInstallDependencies  = 'Install dependencies';
   SProgrDependenciesInstalled= 'Dependencies installed';
+  SProgrDownloadPackage      = 'Downloading package %s version %s';
 
 implementation
 

+ 61 - 52
utils/fppkg/pkgoptions.pp

@@ -16,7 +16,7 @@ unit pkgoptions;
 
 interface
 
-uses Classes, Sysutils, Inifiles, fprepos, fpTemplate;
+uses Classes, Sysutils, Inifiles, fprepos, fpTemplate, pkgglobals;
 
 Const
   UnitConfigFileName   = 'fpunits.conf';
@@ -32,6 +32,7 @@ Type
 
   TGlobalOptions = Class(TPersistent)
   private
+    FConfigFilename: string;
     FSaveInifileChanges : Boolean;
     FConfigVersion : Integer;
     FRemoteMirrorsURL,
@@ -62,7 +63,7 @@ Type
     Procedure InitGlobalDefaults;
     Procedure LoadGlobalFromFile(const AFileName : String);
     Procedure SaveGlobalToFile(const AFileName : String);
-    procedure LogValues;
+    procedure LogValues(ALogLevel: TLogLevel);
     // Is set when the inifile has an old version number (which is also the case when a new file is generated)
     Property SaveInifileChanges : Boolean Read FSaveInifileChanges;
     Property ConfigVersion : Integer read FConfigVersion;
@@ -96,6 +97,7 @@ Type
 
   TCompilerOptions = Class(TPersistent)
   private
+    FConfigFilename: string;
     FSaveInifileChanges: Boolean;
     FConfigVersion : Integer;
     FCompiler,
@@ -119,7 +121,7 @@ Type
     Procedure InitCompilerDefaults;
     Procedure LoadCompilerFromFile(const AFileName : String);
     Procedure SaveCompilerToFile(const AFileName : String);
-    procedure LogValues(const ACfgName:string);
+    procedure LogValues(ALogLevel: TLogLevel; const ACfgName:string);
     procedure UpdateLocalRepositoryOption;
     procedure CheckCompilerValues;
     Function LocalUnitDir:string;
@@ -150,7 +152,6 @@ var
 Implementation
 
 uses
-  pkgglobals,
   pkgmessages;
 
 Const
@@ -292,7 +293,10 @@ begin
   else
     FLocalRepository:='{UserDir}.fppkg/';
 {$else}
-  FLocalRepository:=IncludeTrailingPathDelimiter(GetAppConfigDir(IsSuperUser));
+  if IsSuperUser then
+    FLocalRepository:=IncludeTrailingPathDelimiter(GetAppConfigDir(true))
+  else
+    FLocalRepository:='{AppConfigDir}';
 {$endif}
   UpdateLocalRepositoryOption;
   // Directories
@@ -329,6 +333,7 @@ Var
 begin
   try
     Ini:=TMemIniFile.Create(AFileName);
+    FConfigFileName:=AFileName;
     With Ini do
       begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
@@ -397,18 +402,18 @@ begin
 end;
 
 
-procedure TGlobalOptions.LogValues;
+procedure TGlobalOptions.LogValues(ALogLevel: TLogLevel);
 begin
-  Log(vlDebug,SLogGlobalCfgHeader);
-  Log(vlDebug,SLogGlobalCfgRemoteMirrorsURL,[FRemoteMirrorsURL]);
-  Log(vlDebug,SLogGlobalCfgRemoteRepository,[FRemoteRepository]);
-  Log(vlDebug,SLogGlobalCfgLocalRepository,[LocalRepository]);
-  Log(vlDebug,SLogGlobalCfgBuildDir,[BuildDir]);
-  Log(vlDebug,SLogGlobalCfgArchivesDir,[ArchivesDir]);
-  Log(vlDebug,SLogGlobalCfgCompilerConfigDir,[CompilerConfigDir]);
-  Log(vlDebug,SLogGlobalCfgDefaultCompilerConfig,[FDefaultCompilerConfig]);
-  Log(vlDebug,SLogGlobalCfgFPMakeCompilerConfig,[FFPMakeCompilerConfig]);
-  Log(vlDebug,SLogGlobalCfgDownloader,[FDownloader]);
+  Log(ALogLevel,SLogGlobalCfgHeader,[FConfigFilename]);
+  Log(ALogLevel,SLogGlobalCfgRemoteMirrorsURL,[FRemoteMirrorsURL]);
+  Log(ALogLevel,SLogGlobalCfgRemoteRepository,[FRemoteRepository]);
+  Log(ALogLevel,SLogGlobalCfgLocalRepository,[FLocalRepository,LocalRepository]);
+  Log(ALogLevel,SLogGlobalCfgBuildDir,[FBuildDir,BuildDir]);
+  Log(ALogLevel,SLogGlobalCfgArchivesDir,[FArchivesDir,ArchivesDir]);
+  Log(ALogLevel,SLogGlobalCfgCompilerConfigDir,[FCompilerConfigDir,CompilerConfigDir]);
+  Log(ALogLevel,SLogGlobalCfgDefaultCompilerConfig,[FDefaultCompilerConfig]);
+  Log(ALogLevel,SLogGlobalCfgFPMakeCompilerConfig,[FPMakeCompilerConfig]);
+  Log(ALogLevel,SLogGlobalCfgDownloader,[FDownloader]);
 end;
 
 
@@ -421,6 +426,13 @@ begin
   FOptionParser := TTemplateParser.Create;
   FOptionParser.Values['AppConfigDir'] := GetAppConfigDir(false);
   FOptionParser.Values['UserDir'] := GetUserDir;
+  {$ifdef unix}
+  FLocalInstallDir:='{LocalPrefix}'+'lib'+PathDelim+'fpc'+PathDelim+'{CompilerVersion}'+PathDelim;
+  FGlobalInstallDir:='{GlobalPrefix}'+'lib'+PathDelim+'fpc'+PathDelim+'{CompilerVersion}'+PathDelim;
+  {$else unix}
+  FLocalInstallDir:='{LocalPrefix}';
+  FGlobalInstallDir:='{GlobalPrefix}';
+  {$endif}
 end;
 
 destructor TCompilerOptions.Destroy;
@@ -465,7 +477,10 @@ begin
   Case Index of
     1 : FCompiler:=AValue;
     2 : StringToCPUOS(AValue,FCompilerCPU,FCompilerOS);
-    3 : FCompilerVersion:=AValue;
+    3 : begin
+          FCompilerVersion:=AValue;
+          FOptionParser.Values['CompilerVersion'] := FCompilerVersion;
+        end;
     4 : FGlobalInstallDir:=FixPath(AValue);
     5 : FLocalInstallDir:=FixPath(AValue);
     6 : begin
@@ -529,14 +544,7 @@ end;
 function TCompilerOptions.LocalUnitDir:string;
 var ALocalInstallDir: string;
 begin
-  if LocalInstallDir<>'' then
-    ALocalInstallDir:=LocalInstallDir
-  else if LocalPrefix<>'' then
-{$ifdef unix}
-    ALocalInstallDir:=LocalPrefix+'lib'+PathDelim+'fpc'+PathDelim+FCompilerVersion+PathDelim;
-{$else unix}
-    ALocalInstallDir:=LocalPrefix;
-{$endif}
+  ALocalInstallDir:=LocalInstallDir;
 
   if ALocalInstallDir<>'' then
     result:=ALocalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim
@@ -548,14 +556,7 @@ end;
 function TCompilerOptions.GlobalUnitDir:string;
 var AGlobalInstallDir: string;
 begin
-  if GlobalInstallDir<>'' then
-    AGlobalInstallDir:=GlobalInstallDir
-  else if GlobalPrefix<>'' then
-{$ifdef unix}
-    AGlobalInstallDir:=GlobalPrefix+'lib'+PathDelim+'fpc'+PathDelim+FCompilerVersion+PathDelim;
-{$else unix}
-    AGlobalInstallDir:=GlobalPrefix;
-{$endif}
+  AGlobalInstallDir:=GlobalInstallDir;
 
   if AGlobalInstallDir<>'' then
     result:=AGlobalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim
@@ -571,7 +572,9 @@ end;
 
 
 procedure TCompilerOptions.InitCompilerDefaults;
-
+var
+  ACompilerVersion: string;
+  fpcdir: string;
 begin
   FConfigVersion:=CurrentConfigVersion;
   if fcompiler = '' then
@@ -579,7 +582,8 @@ begin
   if FCompiler='' then
     Raise EPackagerError.Create(SErrMissingFPC);
   // Detect compiler version/target from -i option
-  GetCompilerInfo(FCompiler,'-iVTPTO',FCompilerVersion,FCompilerCPU,FCompilerOS);
+  GetCompilerInfo(FCompiler,'-iVTPTO',ACompilerVersion,FCompilerCPU,FCompilerOS);
+  CompilerVersion := ACompilerVersion;
   // Temporary hack to workaround bug in fpc.exe that doesn't support spaces
   // We retrieve the real binary
   if FCompilerVersion='2.2.0' then
@@ -599,7 +603,7 @@ begin
   if not(DirectoryExists(FGlobalPrefix+PathDelim+'units')) and
      not(DirectoryExists(FGlobalPrefix+PathDelim+'rtl')) then
     FGlobalPrefix:=FGlobalPrefix+'..'+PathDelim;
-  FGlobalPrefix:=ExpandFileName(FGlobalInstallDir);
+  FGlobalPrefix:=ExpandFileName(FGlobalPrefix);
 {$endif unix}
 
   Log(vlDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
@@ -610,12 +614,15 @@ begin
       Log(vlDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
     end;
 
-  FGlobalInstallDir:=FixPath(GetEnvironmentVariable('FPCDIR'));
-{$ifndef Unix}
-  FGlobalInstallDir:=ExpandFileName(FGlobalInstallDir);
-{$endif unix}
-  if FGlobalInstallDir<>'' then
-    Log(vlDebug,SLogFPCDirEnv,[FGlobalInstallDir]);
+  fpcdir:=FixPath(GetEnvironmentVariable('FPCDIR'));
+  if fpcdir<>'' then
+    begin
+    {$ifndef Unix}
+    fpcdir:=ExpandFileName(fpcdir);
+    {$endif unix}
+    Log(vlDebug,SLogFPCDirEnv,[fpcdir]);
+    FGlobalInstallDir:=fpcdir;
+    end;
 end;
 
 
@@ -625,6 +632,7 @@ Var
 begin
   try
     Ini:=TMemIniFile.Create(AFileName);
+    FConfigFilename:=AFileName;
     With Ini do
       begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
@@ -642,7 +650,7 @@ begin
         FCompiler:=ReadString(SDefaults,KeyCompiler,FCompiler);
         FCompilerOS:=StringToOS(ReadString(SDefaults,KeyCompilerOS,OSToString(CompilerOS)));
         FCompilerCPU:=StringToCPU(ReadString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU)));
-        FCompilerVersion:=ReadString(SDefaults,KeyCompilerVersion,FCompilerVersion);
+        CompilerVersion:=ReadString(SDefaults,KeyCompilerVersion,FCompilerVersion);
       end;
   finally
     Ini.Free;
@@ -678,16 +686,17 @@ begin
 end;
 
 
-procedure TCompilerOptions.LogValues(const ACfgName:string);
+procedure TCompilerOptions.LogValues(ALogLevel: TLogLevel; const ACfgName:string);
 begin
-  Log(vlDebug,SLogCompilerCfgHeader,[ACfgName]);
-  Log(vlDebug,SLogCompilerCfgCompiler,[FCompiler]);
-  Log(vlDebug,SLogCompilerCfgTarget,[MakeTargetString(CompilerCPU,CompilerOS)]);
-  Log(vlDebug,SLogCompilerCfgVersion,[FCompilerVersion]);
-  Log(vlDebug,SLogCompilerCfgGlobalInstallDir,[GlobalInstallDir]);
-  Log(vlDebug,SLogCompilerCfgLocalInstallDir,[LocalInstallDir]);
-  Log(vlDebug,SLogCompilerCfgGlobalPrefix,[GlobalPrefix]);
-  Log(vlDebug,SLogCompilerCfgLocalPrefix,[LocalPrefix]);
+  Log(ALogLevel,SLogCompilerCfgHeader,[ACfgName,FConfigFilename]);
+  Log(ALogLevel,SLogCompilerCfgCompiler,[FCompiler]);
+  Log(ALogLevel,SLogCompilerCfgTarget,[MakeTargetString(CompilerCPU,CompilerOS)]);
+  Log(ALogLevel,SLogCompilerCfgVersion,[FCompilerVersion]);
+  Log(ALogLevel,SLogCompilerCfgGlobalPrefix,[FGlobalPrefix,GlobalPrefix]);
+  Log(ALogLevel,SLogCompilerCfgLocalPrefix,[FLocalPrefix,LocalPrefix]);
+  Log(ALogLevel,SLogCompilerCfgGlobalInstallDir,[FGlobalInstallDir,GlobalInstallDir]);
+  Log(ALogLevel,SLogCompilerCfgLocalInstallDir,[FLocalInstallDir,LocalInstallDir]);
+  Log(ALogLevel,SLogCompilerCfgOptions,[Options.DelimitedText]);
 end;
 
 

+ 12 - 9
utils/fppkg/pkgrepos.pp

@@ -15,6 +15,7 @@ procedure LoadLocalAvailableRepository;
 procedure LoadUnitConfigFromFile(APackage:TFPPackage;const AFileName: String);
 function LoadManifestFromFile(const AManifestFN:string):TFPPackage;
 procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boolean=true);
+Procedure AddFPMakeAddIn(APackage: TFPPackage);
 function  PackageIsBroken(APackage:TFPPackage; MarkForReInstall: boolean):boolean;
 function  FindBrokenPackages(SL:TStrings):Boolean;
 procedure CheckFPMakeDependencies;
@@ -289,15 +290,6 @@ procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boole
     end;
   end;
 
-  Procedure AddFPMakeAddIn(APackage: TFPPackage);
-  begin
-    Log(vlDebug,SLogFoundFPMakeAddin,[APackage.Name]);
-    setlength(FPMKUnitDeps,length(FPMKUnitDeps)+1);
-    FPMKUnitDeps[high(FPMKUnitDeps)].package:=APackage.Name;
-    FPMKUnitDeps[high(FPMKUnitDeps)].reqver:=APackage.Version.AsString;
-    FPMKUnitDeps[high(FPMKUnitDeps)].def:='HAS_PACKAGE_'+APackage.Name;
-  end;
-
   function CheckUnitDir(const AUnitDir:string; const Local: boolean):boolean;
   var
     SR : TSearchRec;
@@ -349,6 +341,17 @@ begin
 end;
 
 
+Procedure AddFPMakeAddIn(APackage: TFPPackage);
+begin
+  Log(vlDebug,SLogFoundFPMakeAddin,[APackage.Name]);
+  setlength(FPMKUnitDeps,length(FPMKUnitDeps)+1);
+  FPMKUnitDeps[high(FPMKUnitDeps)].package:=APackage.Name;
+  FPMKUnitDeps[high(FPMKUnitDeps)].reqver:=APackage.Version.AsString;
+  FPMKUnitDeps[high(FPMKUnitDeps)].def:='HAS_PACKAGE_'+APackage.Name;
+  FPMKUnitDeps[high(FPMKUnitDeps)].available:=true;
+end;
+
+
 function PackageIsBroken(APackage:TFPPackage; MarkForReInstall: boolean):boolean;
 var
   j : integer;