diff --git a/packages/fpmkunit/src/fpmkunit.pp b/packages/fpmkunit/src/fpmkunit.pp
index 21007e4fbf..21e17da65b 100644
--- a/packages/fpmkunit/src/fpmkunit.pp
+++ b/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
-    FZipper := TZipper.Create;
+    S := TGZFileStream.create(AFileName +'.tar.gz', gzopenwrite);
     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;
-    finally
-      FZipper.Free;
+      FTarWriter := TTarWriter.Create(S);
+      FTarWriter.Permissions := [tpReadByOwner, tpWriteByOwner, tpReadByGroup, tpReadByOther];
+      FTarWriter.UserName := 'root';
+      FTarWriter.GroupName := 'root';
+    except
+      S.Free;
     end;
   end;
 
-  {$ifdef HAS_TAR_SUPPORT}
-  procedure CreateTarFile;
-  var
-    I : Integer;
-    P : TPackage;
-    S : TGZFileStream;
-  begin;
-    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;
-              end;
-            finally
-              S.Free;
-            end;
-          end
-        else
-          log(vlWarning,SWarnSkipPackageTarget,[P.Name, Defaults.Target]);
-      end;
+  procedure FinishArchive;
+  begin
+    FreeAndNil(FTarWriter);
+    S.Free;
   end;
-  {$endif HAS_TAR_SUPPORT}
+
+{$else}
+
+  procedure InitArchive(AFileName: string);
+  begin
+    FZipper := TZipper.Create;
+    FZipper.FileName := AFileName + '.zip';
+  end;
+
+  procedure FinishArchive;
+  begin
+    try
+      FZipper.ZipAllFiles;
+      FZipper.Clear;
+    finally
+      FreeAndNil(FZipper);
+    end;
+  end;
+
+{$endif}
+
+var
+  I : Integer;
+  P : TPackage;
+  IsArchiveInitialized : boolean;
 
 begin
   If Assigned(BeforeInstall) then
     BeforeInstall(Self);
 
+  IsArchiveInitialized:=false;
   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}
+  try
+    For I:=0 to Packages.Count-1 do
+      begin
+        P:=Packages.PackageItems[i];
+        If PackageOK(P) then
+          begin
+            if IsArchiveInitialized and P.SeparateArchive then
+              begin
+                FinishArchive;
+                IsArchiveInitialized:=false;
+              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;
 
   If Assigned(AfterInstall) then
     AfterInstall(Self);
diff --git a/utils/dxegen/fpmake.pp b/utils/dxegen/fpmake.pp
index 5fa2bfd50c..aca957f952 100644
--- a/utils/dxegen/fpmake.pp
+++ b/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';
diff --git a/utils/fpcm/fpmake.pp b/utils/fpcm/fpmake.pp
index 972ef0fef6..0f5b423e6a 100644
--- a/utils/fpcm/fpmake.pp
+++ b/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');
 
diff --git a/utils/fpcmkcfg/fpmake.pp b/utils/fpcmkcfg/fpmake.pp
index a0a9265dc2..2ab0276bcc 100644
--- a/utils/fpcmkcfg/fpmake.pp
+++ b/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');
diff --git a/utils/fpcres/fpmake.pp b/utils/fpcres/fpmake.pp
index 2cdc0885eb..c6806a0ba8 100644
--- a/utils/fpcres/fpmake.pp
+++ b/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];
 
diff --git a/utils/fpcreslipo/fpmake.pp b/utils/fpcreslipo/fpmake.pp
index 19f498124f..664b306d6c 100644
--- a/utils/fpcreslipo/fpmake.pp
+++ b/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];
diff --git a/utils/fpdoc/fpmake.pp b/utils/fpdoc/fpmake.pp
index fc4d7b9d81..ec403d7051 100644
--- a/utils/fpdoc/fpmake.pp
+++ b/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';
 
diff --git a/utils/fpmake.pp b/utils/fpmake.pp
index d0115cae8a..c88b115af3 100644
--- a/utils/fpmake.pp
+++ b/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}
diff --git a/utils/fpmc/fpmake.pp b/utils/fpmc/fpmake.pp
index ad48f8a607..c607e0e51d 100644
--- a/utils/fpmc/fpmake.pp
+++ b/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
diff --git a/utils/fppkg/fpmake.pp b/utils/fppkg/fpmake.pp
index 568e5cd2a6..122484349d 100644
--- a/utils/fppkg/fpmake.pp
+++ b/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);
diff --git a/utils/fprcp/fpmake.pp b/utils/fprcp/fpmake.pp
index eec968c89e..11b6489ed8 100644
--- a/utils/fprcp/fpmake.pp
+++ b/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';
diff --git a/utils/h2pas/fpmake.pp b/utils/h2pas/fpmake.pp
index 31db2b38a9..f8f9481865 100644
--- a/utils/h2pas/fpmake.pp
+++ b/utils/h2pas/fpmake.pp
@@ -25,6 +25,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.Options.Add('-Sg');
 
diff --git a/utils/importtl/fpmake.pp b/utils/importtl/fpmake.pp
index 2172ce1de7..5de513ab2c 100644
--- a/utils/importtl/fpmake.pp
+++ b/utils/importtl/fpmake.pp
@@ -28,6 +28,7 @@ begin
 
     P.Directory:=ADirectory;
     P.Version:='2.7.1';
+    P.SeparateArchive:=false;
 
     P.OSes:=[win32,win64];
 
diff --git a/utils/instantfpc/fpmake.pp b/utils/instantfpc/fpmake.pp
index f4fd7fb334..2f1ce3670f 100644
--- a/utils/instantfpc/fpmake.pp
+++ b/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');
diff --git a/utils/pas2fpm/fpmake.pp b/utils/pas2fpm/fpmake.pp
index b9b82605dc..25012d34f8 100644
--- a/utils/pas2fpm/fpmake.pp
+++ b/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';
diff --git a/utils/pas2jni/fpmake.pp b/utils/pas2jni/fpmake.pp
index fab14a32c1..b3ad6f495e 100644
--- a/utils/pas2jni/fpmake.pp
+++ b/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');
diff --git a/utils/pas2ut/fpmake.pp b/utils/pas2ut/fpmake.pp
index a98e0950da..c07198843e 100644
--- a/utils/pas2ut/fpmake.pp
+++ b/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');
diff --git a/utils/rmwait/fpmake.pp b/utils/rmwait/fpmake.pp
index aa8e8fd706..bc63eda1ed 100644
--- a/utils/rmwait/fpmake.pp
+++ b/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';
 
diff --git a/utils/tply/fpmake.pp b/utils/tply/fpmake.pp
index 539118dfa4..8d8b6b98d6 100644
--- a/utils/tply/fpmake.pp
+++ b/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';
 
diff --git a/utils/unicode/fpmake.pp b/utils/unicode/fpmake.pp
index 4cfc84fcbb..16e06142cd 100644
--- a/utils/unicode/fpmake.pp
+++ b/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');