Commit 0615f8f3fa for freeswitch.com

commit 0615f8f3fafe50594c9d162f23e94cde97fffbad
Author: Andrey Volk <andywolk@gmail.com>
Date:   Fri Jul 3 22:45:13 2026 +0300

    [Build-System] Windows: Download 7z, icsharpcode/SharpZipLib from GitHub instead of files.freeswitch.org during the build.

diff --git a/.gitignore b/.gitignore
index 41e5c0cce8..40b3662444 100644
--- a/.gitignore
+++ b/.gitignore
@@ -172,6 +172,11 @@ BuildLog.htm

 !/libs/win32/
 !/libs/speex/win32/
+
+# 7-Zip extraction tool bootstrap (downloaded/extracted by w32/downloadpackage.task)
+/libs/win32/7za/
+/libs/win32/7z*-extra.7z
+
 *.suo
 *.sdf
 x64/
@@ -245,6 +250,8 @@ libs/libcodec2-*/
 libs/libsilk-*/
 libs/rabbitmq-c-*/
 libs/rabbitmq-c-*.zip
+libs/SharpZipLib.*/
+libs/SharpZipLib.*.nupkg
 libs/ffmpeg-*/
 libs/sofia-sip*/
 libs/sofia-sip*
diff --git a/w32/download_sharpziplib.props b/w32/download_sharpziplib.props
index 7a87d49d37..f24533871e 100644
--- a/w32/download_sharpziplib.props
+++ b/w32/download_sharpziplib.props
@@ -7,6 +7,12 @@
     <downloadSharpZipLibPropsImported>true</downloadSharpZipLibPropsImported>
   </PropertyGroup>

+  <PropertyGroup>
+    <SharpZipLibVersion Condition=" '$(SharpZipLibVersion)' == '' ">1.1.0</SharpZipLibVersion>
+    <SharpZipLibDir>$(BaseDir)libs\SharpZipLib.$(SharpZipLibVersion)</SharpZipLibDir>
+    <SharpZipLibCADir>$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264</SharpZipLibCADir>
+  </PropertyGroup>
+
   <!--
        Download Target.
        Name must be unique.
@@ -32,13 +38,18 @@

   <Target Name="SharpZipLibDownloadTarget" BeforeTargets="Build" DependsOnTargets="7za">
       <DownloadPackageTask
-           package="http://files.freeswitch.org/downloads/libs/ICSharpCode.SharpZipLib.dll.bz2"
-           expectfileordirectory="$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\ICSharpCode.SharpZipLib.dll"
-           outputfolder=""
-           outputfilename=""
-           extractto="$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\"
+           package="https://github.com/icsharpcode/SharpZipLib/releases/download/v$(SharpZipLibVersion)/SharpZipLib.$(SharpZipLibVersion).nupkg"
+           expectfileordirectory="$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll"
+           outputfolder="$(BaseDir)libs\"
+           outputfilename="SharpZipLib.$(SharpZipLibVersion).nupkg"
+           extractto="$(SharpZipLibDir)"
            archivecontains="binary"
       />
+      <!-- Place the net45 build where the custom action's <HintPath> expects it. -->
+      <Copy Condition="!Exists('$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll')"
+          SourceFiles="$(SharpZipLibDir)\lib\net45\ICSharpCode.SharpZipLib.dll"
+          DestinationFiles="$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll"
+      />
   </Target>

 </Project>
diff --git a/w32/downloadpackage.task b/w32/downloadpackage.task
index fbcf75ee0f..0223e98cb0 100644
--- a/w32/downloadpackage.task
+++ b/w32/downloadpackage.task
@@ -15,7 +15,8 @@
                 <extractto />
                 <moveafter />
                 <archivecontains />
-             </ParameterGroup>
+                <arctool />
+             </ParameterGroup>
              <Task>
                 <Reference Include="Microsoft.Build" />
                 <Reference Include="Microsoft.Build.Framework" />
@@ -57,6 +58,7 @@ using System.Diagnostics;
         public string extractto { get; set; }
         public string moveafter { get; set; }
         public string archivecontains { get; set; }
+        public string arctool { get; set; }

         internal static bool FileOrDirectoryExists(string name)
         {
@@ -193,26 +195,31 @@ using System.Diagnostics;

         private void Extract(string filename, string extracttofolder)
         {
-            string arctool = Path.Combine(new string[] { basedir, "libs", "win32", "7za1701.exe" });
+            // Use the caller-supplied extraction tool when set (the 7za bootstrap
+            // passes 7zr.exe to unpack the full 7za.exe out of the "extra" package);
+            // otherwise fall back to that bootstrapped 7za.exe for every other package.
+            string tool = (arctool != null && arctool.Trim() != "")
+                ? arctool
+                : Path.Combine(new string[] { basedir, "libs", "win32", "7za", "7za.exe" });
             string args = " x \"" + filename + "\" -y -o\"" + extracttofolder + "\"";

             Log.LogMessage(MessageImportance.High,
-                  "arctool : " + arctool);
+                  "arctool : " + tool);
             Log.LogMessage(MessageImportance.High,
                   "args : " + args);
             Log.LogMessage(MessageImportance.High,
-                  "WorkingDirectory : " + Path.GetDirectoryName(arctool));
+                  "WorkingDirectory : " + Path.GetDirectoryName(tool));

             var proc = new Process
             {
                 StartInfo = new ProcessStartInfo
                 {
-                    FileName = arctool,
+                    FileName = tool,
                     Arguments = args,
                     UseShellExecute = false,
                     RedirectStandardOutput = true,
                     CreateNoWindow = true,
-                    WorkingDirectory = Path.GetDirectoryName(arctool)
+                    WorkingDirectory = Path.GetDirectoryName(tool)
                 }
             };

@@ -274,15 +281,33 @@ using System.Diagnostics;
              </Task>
   </UsingTask>

-  <Target Name="7za" BeforeTargets="Build">
-      <DownloadPackageTask
-          package="http://files.freeswitch.org/downloads/win32/7za1701.exe"
-          expectfileordirectory="$(BaseDir)libs/win32/7za1701.exe"
-          outputfolder="$(BaseDir)libs/win32/"
-          outputfilename="7za1701.exe"
+  <PropertyGroup>
+    <SevenZipVersion Condition=" '$(SevenZipVersion)' == '' ">26.02</SevenZipVersion>
+    <SevenZipBaseUrl Condition=" '$(SevenZipBaseUrl)' == '' ">https://github.com/ip7z/7zip/releases/download/$(SevenZipVersion)</SevenZipBaseUrl>
+    <SevenZipExtra Condition=" '$(SevenZipExtra)' == '' ">7z$(SevenZipVersion.Replace('.',''))-extra</SevenZipExtra>
+  </PropertyGroup>
+
+  <Target Name="7za" BeforeTargets="Build">
+      <!-- Step 1: download 7zr.exe. As an .exe it is stored as-is, not extracted. -->
+      <DownloadPackageTask
+          package="$(SevenZipBaseUrl)/7zr.exe"
+          expectfileordirectory="$(BaseDir)libs/win32/7zr.exe"
+          outputfolder="$(BaseDir)libs/win32/"
+          outputfilename="7zr.exe"
           extractto=""
       />
-  </Target>
+      <!-- Step 2: download the extra package and unpack the full 7za.exe from it
+           with 7zr.exe (the default 7za.exe does not exist yet at this point). -->
+      <DownloadPackageTask
+          package="$(SevenZipBaseUrl)/$(SevenZipExtra).7z"
+          expectfileordirectory="$(BaseDir)libs/win32/7za/7za.exe"
+          outputfolder="$(BaseDir)libs/win32/"
+          outputfilename="$(SevenZipExtra).7z"
+          extractto="$(BaseDir)libs/win32/7za"
+          archivecontains="binary"
+          arctool="$(BaseDir)libs/win32/7zr.exe"
+      />
+  </Target>

   <PropertyGroup>
     <downloadpackagetask_Imported>true</downloadpackagetask_Imported>