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';
   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';
   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';
   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';
   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';
   SWarnCleanPackagecomplete = 'Clean of package %s completed';
 
 
   SInfoCompilingPackage   = 'Compiling package %s';
   SInfoCompilingPackage   = 'Compiling package %s';
@@ -4899,7 +4899,7 @@ begin
   For I:=0 to Packages.Count-1 do
   For I:=0 to Packages.Count-1 do
     begin
     begin
       P:=Packages.PackageItems[i];
       P:=Packages.PackageItems[i];
-      log(vlWarning,SWarnStartBuildingPackage,[P.Name]);
+      log(vlWarning,SWarnStartBuildingPackage,[P.Name, Defaults.Target]);
       If PackageOK(P) then
       If PackageOK(P) then
         MaybeCompile(P);
         MaybeCompile(P);
 
 
@@ -4923,7 +4923,7 @@ begin
       P:=Packages.PackageItems[i];
       P:=Packages.PackageItems[i];
       If PackageOK(P) then
       If PackageOK(P) then
         Install(P);
         Install(P);
-      log(vlWarning, SWarnInstallationPackagecomplete, [P.Name]);
+      log(vlWarning, SWarnInstallationPackagecomplete, [P.Name, Defaults.Target]);
     end;
     end;
   If Assigned(AfterInstall) then
   If Assigned(AfterInstall) then
     AfterInstall(Self);
     AfterInstall(Self);

+ 4 - 3
utils/fppkg/fppkg.pp

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

+ 31 - 2
utils/fppkg/pkgcommands.pp

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

+ 1 - 0
utils/fppkg/pkgdownload.pp

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

+ 1 - 1
utils/fppkg/pkgfpmake.pp

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

+ 0 - 4
utils/fppkg/pkgglobals.pp

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

+ 19 - 17
utils/fppkg/pkgmessages.pp

@@ -81,24 +81,25 @@ Resourcestring
   SLogPackageChecksumChanged = 'Package %s needs to be rebuild, dependency %s is modified';
   SLogPackageChecksumChanged = 'Package %s needs to be rebuild, dependency %s is modified';
   SLogCheckBrokenDependenvies= 'Checking for broken dependencies';
   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"';
   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';
   SDbgFound                  = 'Found';
   SDbgNotFound               = 'Not Found';
   SDbgNotFound               = 'Not Found';
@@ -112,6 +113,7 @@ Resourcestring
   SProgrReinstallDependent   = 'Re-install packages which are dependent on just installed packages';
   SProgrReinstallDependent   = 'Re-install packages which are dependent on just installed packages';
   SProgrInstallDependencies  = 'Install dependencies';
   SProgrInstallDependencies  = 'Install dependencies';
   SProgrDependenciesInstalled= 'Dependencies installed';
   SProgrDependenciesInstalled= 'Dependencies installed';
+  SProgrDownloadPackage      = 'Downloading package %s version %s';
 
 
 implementation
 implementation
 
 

+ 61 - 52
utils/fppkg/pkgoptions.pp

@@ -16,7 +16,7 @@ unit pkgoptions;
 
 
 interface
 interface
 
 
-uses Classes, Sysutils, Inifiles, fprepos, fpTemplate;
+uses Classes, Sysutils, Inifiles, fprepos, fpTemplate, pkgglobals;
 
 
 Const
 Const
   UnitConfigFileName   = 'fpunits.conf';
   UnitConfigFileName   = 'fpunits.conf';
@@ -32,6 +32,7 @@ Type
 
 
   TGlobalOptions = Class(TPersistent)
   TGlobalOptions = Class(TPersistent)
   private
   private
+    FConfigFilename: string;
     FSaveInifileChanges : Boolean;
     FSaveInifileChanges : Boolean;
     FConfigVersion : Integer;
     FConfigVersion : Integer;
     FRemoteMirrorsURL,
     FRemoteMirrorsURL,
@@ -62,7 +63,7 @@ Type
     Procedure InitGlobalDefaults;
     Procedure InitGlobalDefaults;
     Procedure LoadGlobalFromFile(const AFileName : String);
     Procedure LoadGlobalFromFile(const AFileName : String);
     Procedure SaveGlobalToFile(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)
     // 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 SaveInifileChanges : Boolean Read FSaveInifileChanges;
     Property ConfigVersion : Integer read FConfigVersion;
     Property ConfigVersion : Integer read FConfigVersion;
@@ -96,6 +97,7 @@ Type
 
 
   TCompilerOptions = Class(TPersistent)
   TCompilerOptions = Class(TPersistent)
   private
   private
+    FConfigFilename: string;
     FSaveInifileChanges: Boolean;
     FSaveInifileChanges: Boolean;
     FConfigVersion : Integer;
     FConfigVersion : Integer;
     FCompiler,
     FCompiler,
@@ -119,7 +121,7 @@ Type
     Procedure InitCompilerDefaults;
     Procedure InitCompilerDefaults;
     Procedure LoadCompilerFromFile(const AFileName : String);
     Procedure LoadCompilerFromFile(const AFileName : String);
     Procedure SaveCompilerToFile(const AFileName : String);
     Procedure SaveCompilerToFile(const AFileName : String);
-    procedure LogValues(const ACfgName:string);
+    procedure LogValues(ALogLevel: TLogLevel; const ACfgName:string);
     procedure UpdateLocalRepositoryOption;
     procedure UpdateLocalRepositoryOption;
     procedure CheckCompilerValues;
     procedure CheckCompilerValues;
     Function LocalUnitDir:string;
     Function LocalUnitDir:string;
@@ -150,7 +152,6 @@ var
 Implementation
 Implementation
 
 
 uses
 uses
-  pkgglobals,
   pkgmessages;
   pkgmessages;
 
 
 Const
 Const
@@ -292,7 +293,10 @@ begin
   else
   else
     FLocalRepository:='{UserDir}.fppkg/';
     FLocalRepository:='{UserDir}.fppkg/';
 {$else}
 {$else}
-  FLocalRepository:=IncludeTrailingPathDelimiter(GetAppConfigDir(IsSuperUser));
+  if IsSuperUser then
+    FLocalRepository:=IncludeTrailingPathDelimiter(GetAppConfigDir(true))
+  else
+    FLocalRepository:='{AppConfigDir}';
 {$endif}
 {$endif}
   UpdateLocalRepositoryOption;
   UpdateLocalRepositoryOption;
   // Directories
   // Directories
@@ -329,6 +333,7 @@ Var
 begin
 begin
   try
   try
     Ini:=TMemIniFile.Create(AFileName);
     Ini:=TMemIniFile.Create(AFileName);
+    FConfigFileName:=AFileName;
     With Ini do
     With Ini do
       begin
       begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
@@ -397,18 +402,18 @@ begin
 end;
 end;
 
 
 
 
-procedure TGlobalOptions.LogValues;
+procedure TGlobalOptions.LogValues(ALogLevel: TLogLevel);
 begin
 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;
 end;
 
 
 
 
@@ -421,6 +426,13 @@ begin
   FOptionParser := TTemplateParser.Create;
   FOptionParser := TTemplateParser.Create;
   FOptionParser.Values['AppConfigDir'] := GetAppConfigDir(false);
   FOptionParser.Values['AppConfigDir'] := GetAppConfigDir(false);
   FOptionParser.Values['UserDir'] := GetUserDir;
   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;
 end;
 
 
 destructor TCompilerOptions.Destroy;
 destructor TCompilerOptions.Destroy;
@@ -465,7 +477,10 @@ begin
   Case Index of
   Case Index of
     1 : FCompiler:=AValue;
     1 : FCompiler:=AValue;
     2 : StringToCPUOS(AValue,FCompilerCPU,FCompilerOS);
     2 : StringToCPUOS(AValue,FCompilerCPU,FCompilerOS);
-    3 : FCompilerVersion:=AValue;
+    3 : begin
+          FCompilerVersion:=AValue;
+          FOptionParser.Values['CompilerVersion'] := FCompilerVersion;
+        end;
     4 : FGlobalInstallDir:=FixPath(AValue);
     4 : FGlobalInstallDir:=FixPath(AValue);
     5 : FLocalInstallDir:=FixPath(AValue);
     5 : FLocalInstallDir:=FixPath(AValue);
     6 : begin
     6 : begin
@@ -529,14 +544,7 @@ end;
 function TCompilerOptions.LocalUnitDir:string;
 function TCompilerOptions.LocalUnitDir:string;
 var ALocalInstallDir: string;
 var ALocalInstallDir: string;
 begin
 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
   if ALocalInstallDir<>'' then
     result:=ALocalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim
     result:=ALocalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim
@@ -548,14 +556,7 @@ end;
 function TCompilerOptions.GlobalUnitDir:string;
 function TCompilerOptions.GlobalUnitDir:string;
 var AGlobalInstallDir: string;
 var AGlobalInstallDir: string;
 begin
 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
   if AGlobalInstallDir<>'' then
     result:=AGlobalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim
     result:=AGlobalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim
@@ -571,7 +572,9 @@ end;
 
 
 
 
 procedure TCompilerOptions.InitCompilerDefaults;
 procedure TCompilerOptions.InitCompilerDefaults;
-
+var
+  ACompilerVersion: string;
+  fpcdir: string;
 begin
 begin
   FConfigVersion:=CurrentConfigVersion;
   FConfigVersion:=CurrentConfigVersion;
   if fcompiler = '' then
   if fcompiler = '' then
@@ -579,7 +582,8 @@ begin
   if FCompiler='' then
   if FCompiler='' then
     Raise EPackagerError.Create(SErrMissingFPC);
     Raise EPackagerError.Create(SErrMissingFPC);
   // Detect compiler version/target from -i option
   // 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
   // Temporary hack to workaround bug in fpc.exe that doesn't support spaces
   // We retrieve the real binary
   // We retrieve the real binary
   if FCompilerVersion='2.2.0' then
   if FCompilerVersion='2.2.0' then
@@ -599,7 +603,7 @@ begin
   if not(DirectoryExists(FGlobalPrefix+PathDelim+'units')) and
   if not(DirectoryExists(FGlobalPrefix+PathDelim+'units')) and
      not(DirectoryExists(FGlobalPrefix+PathDelim+'rtl')) then
      not(DirectoryExists(FGlobalPrefix+PathDelim+'rtl')) then
     FGlobalPrefix:=FGlobalPrefix+'..'+PathDelim;
     FGlobalPrefix:=FGlobalPrefix+'..'+PathDelim;
-  FGlobalPrefix:=ExpandFileName(FGlobalInstallDir);
+  FGlobalPrefix:=ExpandFileName(FGlobalPrefix);
 {$endif unix}
 {$endif unix}
 
 
   Log(vlDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
   Log(vlDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
@@ -610,12 +614,15 @@ begin
       Log(vlDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
       Log(vlDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
     end;
     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;
 end;
 
 
 
 
@@ -625,6 +632,7 @@ Var
 begin
 begin
   try
   try
     Ini:=TMemIniFile.Create(AFileName);
     Ini:=TMemIniFile.Create(AFileName);
+    FConfigFilename:=AFileName;
     With Ini do
     With Ini do
       begin
       begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
@@ -642,7 +650,7 @@ begin
         FCompiler:=ReadString(SDefaults,KeyCompiler,FCompiler);
         FCompiler:=ReadString(SDefaults,KeyCompiler,FCompiler);
         FCompilerOS:=StringToOS(ReadString(SDefaults,KeyCompilerOS,OSToString(CompilerOS)));
         FCompilerOS:=StringToOS(ReadString(SDefaults,KeyCompilerOS,OSToString(CompilerOS)));
         FCompilerCPU:=StringToCPU(ReadString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU)));
         FCompilerCPU:=StringToCPU(ReadString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU)));
-        FCompilerVersion:=ReadString(SDefaults,KeyCompilerVersion,FCompilerVersion);
+        CompilerVersion:=ReadString(SDefaults,KeyCompilerVersion,FCompilerVersion);
       end;
       end;
   finally
   finally
     Ini.Free;
     Ini.Free;
@@ -678,16 +686,17 @@ begin
 end;
 end;
 
 
 
 
-procedure TCompilerOptions.LogValues(const ACfgName:string);
+procedure TCompilerOptions.LogValues(ALogLevel: TLogLevel; const ACfgName:string);
 begin
 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;
 end;
 
 
 
 

+ 12 - 9
utils/fppkg/pkgrepos.pp

@@ -15,6 +15,7 @@ procedure LoadLocalAvailableRepository;
 procedure LoadUnitConfigFromFile(APackage:TFPPackage;const AFileName: String);
 procedure LoadUnitConfigFromFile(APackage:TFPPackage;const AFileName: String);
 function LoadManifestFromFile(const AManifestFN:string):TFPPackage;
 function LoadManifestFromFile(const AManifestFN:string):TFPPackage;
 procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boolean=true);
 procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boolean=true);
+Procedure AddFPMakeAddIn(APackage: TFPPackage);
 function  PackageIsBroken(APackage:TFPPackage; MarkForReInstall: boolean):boolean;
 function  PackageIsBroken(APackage:TFPPackage; MarkForReInstall: boolean):boolean;
 function  FindBrokenPackages(SL:TStrings):Boolean;
 function  FindBrokenPackages(SL:TStrings):Boolean;
 procedure CheckFPMakeDependencies;
 procedure CheckFPMakeDependencies;
@@ -289,15 +290,6 @@ procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boole
     end;
     end;
   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;
   function CheckUnitDir(const AUnitDir:string; const Local: boolean):boolean;
   var
   var
     SR : TSearchRec;
     SR : TSearchRec;
@@ -349,6 +341,17 @@ begin
 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;
+  FPMKUnitDeps[high(FPMKUnitDeps)].available:=true;
+end;
+
+
 function PackageIsBroken(APackage:TFPPackage; MarkForReInstall: boolean):boolean;
 function PackageIsBroken(APackage:TFPPackage; MarkForReInstall: boolean):boolean;
 var
 var
   j : integer;
   j : integer;