Răsfoiți Sursa

* Combine all utils into one achive, several installers depend on this

git-svn-id: trunk@28887 -
joost 10 ani în urmă
părinte
comite
8da7914438

+ 71 - 56
packages/fpmkunit/src/fpmkunit.pp

@@ -710,6 +710,7 @@ Type
     FFlags: TStrings;
     FFPDocFormat: TFPDocFormats;
     FIsFPMakeAddIn: boolean;
+    FSeparateArchive: boolean;
     FSupportBuildModes: TBuildModes;
     FUnitPath,
     FObjectPath,
@@ -802,6 +803,7 @@ Type
     Property SupportBuildModes: TBuildModes read FSupportBuildModes write FSupportBuildModes;
     Property BuildMode: TBuildMode read FBuildMode;
     Property Flags: TStrings read FFlags;
+    Property SeparateArchive: boolean read FSeparateArchive write FSeparateArchive;
     // Compiler options.
     Property OSes : TOSes Read FOSes Write FOSes;
     Property CPUs : TCPUs Read FCPUs Write FCPUs;
@@ -3092,6 +3094,7 @@ begin
   FOSes:=AllOSes;
   FInstalledChecksum:=$ffffffff;
   FFlags := TStringList.Create;
+  FSeparateArchive:=true;
   // Implicit dependency on RTL
   FDependencies.Add('rtl');
   FSupportBuildModes:=[bmBuildUnit, bmOneByOne];
@@ -6971,81 +6974,93 @@ end;
 
 procedure TBuildEngine.ZipInstall(Packages: TPackages);
 
-  procedure CreateZipFile;
+{$ifdef unix}
+  {$ifdef HAS_TAR_SUPPORT}
+    {$define CreateTarFile}
+  {$endif HAS_TAR_SUPPORT}
+{$endif unix}
+
+{$ifdef CreateTarFile}
   var
-    I : Integer;
-    P : TPackage;
+    S : TGZFileStream;
+
+  procedure InitArchive(AFileName: string);
+  begin
+    S := TGZFileStream.create(AFileName +'.tar.gz', gzopenwrite);
+    try
+      FTarWriter := TTarWriter.Create(S);
+      FTarWriter.Permissions := [tpReadByOwner, tpWriteByOwner, tpReadByGroup, tpReadByOther];
+      FTarWriter.UserName := 'root';
+      FTarWriter.GroupName := 'root';
+    except
+      S.Free;
+    end;
+  end;
+
+  procedure FinishArchive;
+  begin
+    FreeAndNil(FTarWriter);
+    S.Free;
+  end;
+
+{$else}
+
+  procedure InitArchive(AFileName: string);
   begin
     FZipper := TZipper.Create;
+    FZipper.FileName := AFileName + '.zip';
+  end;
+
+  procedure FinishArchive;
+  begin
     try
-      For I:=0 to Packages.Count-1 do
-        begin
-          P:=Packages.PackageItems[i];
-          If PackageOK(P) then
-            begin
-              FZipper.FileName := Defaults.ZipPrefix + P.Name + MakeZipSuffix(Defaults.CPU,Defaults.OS) +'.zip';
-              Install(P);
-              FZipper.ZipAllFiles;
-              FZipper.Clear;
-              log(vlWarning, SWarnInstallationPackagecomplete, [P.Name, Defaults.Target]);
-            end
-          else
-            log(vlWarning,SWarnSkipPackageTarget,[P.Name, Defaults.Target]);
-        end;
+      FZipper.ZipAllFiles;
+      FZipper.Clear;
     finally
-      FZipper.Free;
+      FreeAndNil(FZipper);
     end;
   end;
 
-  {$ifdef HAS_TAR_SUPPORT}
-  procedure CreateTarFile;
-  var
-    I : Integer;
-    P : TPackage;
-    S : TGZFileStream;
-  begin;
+{$endif}
+
+var
+  I : Integer;
+  P : TPackage;
+  IsArchiveInitialized : boolean;
+
+begin
+  If Assigned(BeforeInstall) then
+    BeforeInstall(Self);
+
+  IsArchiveInitialized:=false;
+  Defaults.IntSetBaseInstallDir('lib/fpc/' + Defaults.FCompilerVersion+ '/');
+
+  try
     For I:=0 to Packages.Count-1 do
       begin
         P:=Packages.PackageItems[i];
         If PackageOK(P) then
           begin
-            S := TGZFileStream.create(Defaults.ZipPrefix + P.Name + MakeZipSuffix(Defaults.CPU,Defaults.OS) +'.tar.gz', gzopenwrite);
-            try
-              FTarWriter := TTarWriter.Create(S);
-              FTarWriter.Permissions := [tpReadByOwner, tpWriteByOwner, tpReadByGroup, tpReadByOther];
-              FTarWriter.UserName := 'root';
-              FTarWriter.GroupName := 'root';
-              try
-                Install(P);
-                log(vlWarning, SWarnInstallationPackagecomplete, [P.Name, Defaults.Target]);
-              finally
-                FTarWriter.Free;
+            if IsArchiveInitialized and P.SeparateArchive then
+              begin
+                FinishArchive;
+                IsArchiveInitialized:=false;
               end;
-            finally
-              S.Free;
-            end;
+            if not IsArchiveInitialized then
+              begin
+                InitArchive(Defaults.ZipPrefix + P.Name + MakeZipSuffix(Defaults.CPU,Defaults.OS));
+                IsArchiveInitialized:=true;
+              end;
+            Install(P);
+            log(vlWarning, SWarnInstallationPackagecomplete, [P.Name, Defaults.Target]);
           end
         else
           log(vlWarning,SWarnSkipPackageTarget,[P.Name, Defaults.Target]);
       end;
+  finally
+    if IsArchiveInitialized then
+      FinishArchive;
   end;
-  {$endif HAS_TAR_SUPPORT}
-
-begin
-  If Assigned(BeforeInstall) then
-    BeforeInstall(Self);
-
-  Defaults.IntSetBaseInstallDir('lib/fpc/' + Defaults.FCompilerVersion+ '/');
-
-  {$ifdef unix}
-  {$ifdef HAS_TAR_SUPPORT}
-  CreateTarFile;
-  {$else HAS_TAR_SUPPORT}
-  CreateZipFile;
-  {$endif HAS_TAR_SUPPORT}
-  {$else unix}
-  CreateZipFile;
-  {$endif unix}
 
   If Assigned(AfterInstall) then
     AfterInstall(Self);

+ 1 - 0
utils/dxegen/fpmake.pp

@@ -25,6 +25,7 @@ begin
     P.NeedLibC:= false;
 
     P.OSes:=[go32v2];
+    P.SeparateArchive:=false;
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';

+ 1 - 0
utils/fpcm/fpmake.pp

@@ -221,6 +221,7 @@ begin
     P.Directory:=ADirectory;
 {$endif ALLPACKAGES}
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.Dependencies.Add('fcl-base');
 

+ 1 - 0
utils/fpcmkcfg/fpmake.pp

@@ -26,6 +26,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.Dependencies.Add('fcl-base');
     P.Dependencies.Add('fpmkunit');

+ 1 - 0
utils/fpcres/fpmake.pp

@@ -25,6 +25,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.OSes:=[win32,win64,wince,haiku,linux,freebsd,openbsd,netbsd,darwin,iphonesim,solaris,os2,emx,aix,aros];
 

+ 1 - 0
utils/fpcreslipo/fpmake.pp

@@ -23,6 +23,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
     P.Dependencies.Add('fcl-res');
 
     P.OSes:=[darwin, iphonesim];

+ 1 - 1
utils/fpdoc/fpmake.pp

@@ -32,7 +32,7 @@ begin
     P.Dependencies.Add('chm');
     P.Dependencies.Add('univint',[darwin,iphonesim]);
 
-
+    P.SeparateArchive:=false;
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
 

+ 2 - 2
utils/fpmake.pp

@@ -47,8 +47,6 @@ Var
   T : TTarget;
 
 begin
-{$include fpmake_add.inc}
-
   With Installer do
     begin
     P:=AddPackage('utils');
@@ -87,6 +85,8 @@ begin
     P.Targets.AddUnit('usubst.pp').install:=false;
     P.Targets.AddUnit('ptopu.pp').install:=false;
     end;
+
+  {$include fpmake_add.inc}
 end;
 
 {$ifdef NO_PARENT}

+ 1 - 0
utils/fpmc/fpmake.pp

@@ -29,6 +29,7 @@ begin
     P.Version:='2.7.1';
 
     P.OSes := [win32, win64, os2, emx];
+    P.SeparateArchive:=false;
 
     gtkOSes:=[linux];
     // Only compile fpmcgtk on win32 when the gtk-library is found in the path

+ 1 - 0
utils/fppkg/fpmake.pp

@@ -28,6 +28,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.SourcePath.Add('lnet',lnetOSes);
     P.IncludePath.Add('lnet/sys',lnetOSes);

+ 1 - 0
utils/fprcp/fpmake.pp

@@ -24,6 +24,7 @@ begin
                      'scripts numerical constants and replaces these constants to its values '+
                      'in resource script.';
     P.NeedLibC:= false;
+    P.SeparateArchive:=false;
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';

+ 1 - 0
utils/h2pas/fpmake.pp

@@ -25,6 +25,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.Options.Add('-Sg');
 

+ 1 - 0
utils/importtl/fpmake.pp

@@ -28,6 +28,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.OSes:=[win32,win64];
 

+ 1 - 0
utils/instantfpc/fpmake.pp

@@ -25,6 +25,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.Dependencies.Add('fcl-process');
     P.Options.Add('-S2h');

+ 1 - 0
utils/pas2fpm/fpmake.pp

@@ -22,6 +22,7 @@ begin
     P.Description := 'Generate fpmake.pp for Pascal source.';
     P.Email := '';
     P.NeedLibC:= false;
+    P.SeparateArchive:=false;
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';

+ 1 - 0
utils/pas2jni/fpmake.pp

@@ -23,6 +23,7 @@ begin
     P.Email := '';
     P.NeedLibC:= false;
 
+    P.SeparateArchive:=false;
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
     P.Dependencies.Add('fcl-base');

+ 1 - 0
utils/pas2ut/fpmake.pp

@@ -23,6 +23,7 @@ begin
     P.Email := '';
     P.NeedLibC:= false;
 
+    P.SeparateArchive:=false;
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
     P.Dependencies.Add('fcl-passrc');

+ 1 - 0
utils/rmwait/fpmake.pp

@@ -23,6 +23,7 @@ begin
     P.Description := 'Tool to remove (delete) file(s) with optional retries';
     P.NeedLibC:= false;
 
+    P.SeparateArchive:=false;
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
 

+ 1 - 0
utils/tply/fpmake.pp

@@ -24,6 +24,7 @@ begin
     P.Description := 'A compiler generator for Turbo Pascal and compatibles.';
     P.NeedLibC:= false;
 
+    P.SeparateArchive:=false;
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
 

+ 1 - 0
utils/unicode/fpmake.pp

@@ -25,6 +25,7 @@ begin
     P.Directory:=ADirectory;
 {$endif ALLPACKAGES}
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
     P.Dependencies.Add('rtl');
     P.Dependencies.Add('fcl-base');
     P.Dependencies.Add('fcl-xml');