]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Build-System] Windows: Download 7z, icsharpcode/SharpZipLib from GitHub instead...
authorAndrey Volk <andywolk@gmail.com>
Fri, 3 Jul 2026 19:45:13 +0000 (22:45 +0300)
committerGitHub <noreply@github.com>
Fri, 3 Jul 2026 19:45:13 +0000 (22:45 +0300)
.gitignore
w32/download_sharpziplib.props
w32/downloadpackage.task

index 41e5c0cce876bd0f87fbc36b87f217ff10ef271e..40b36624443487dd1c5423f0e06fb36e6e421732 100644 (file)
@@ -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*
index 7a87d49d371be6679e4add85484810bc36fdd677..f24533871e98487afb4c3469824be4520de2b22c 100644 (file)
@@ -7,6 +7,12 @@
     <downloadSharpZipLibPropsImported>true</downloadSharpZipLibPropsImported>\r
   </PropertyGroup>\r
 \r
+  <PropertyGroup>\r
+    <SharpZipLibVersion Condition=" '$(SharpZipLibVersion)' == '' ">1.1.0</SharpZipLibVersion>\r
+    <SharpZipLibDir>$(BaseDir)libs\SharpZipLib.$(SharpZipLibVersion)</SharpZipLibDir>\r
+    <SharpZipLibCADir>$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264</SharpZipLibCADir>\r
+  </PropertyGroup>\r
+\r
   <!--\r
        Download Target.\r
        Name must be unique.\r
 \r
   <Target Name="SharpZipLibDownloadTarget" BeforeTargets="Build" DependsOnTargets="7za">\r
       <DownloadPackageTask\r
-           package="http://files.freeswitch.org/downloads/libs/ICSharpCode.SharpZipLib.dll.bz2"\r
-           expectfileordirectory="$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\ICSharpCode.SharpZipLib.dll"\r
-           outputfolder=""\r
-           outputfilename=""\r
-           extractto="$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\"\r
+           package="https://github.com/icsharpcode/SharpZipLib/releases/download/v$(SharpZipLibVersion)/SharpZipLib.$(SharpZipLibVersion).nupkg"\r
+           expectfileordirectory="$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll"\r
+           outputfolder="$(BaseDir)libs\"\r
+           outputfilename="SharpZipLib.$(SharpZipLibVersion).nupkg"\r
+           extractto="$(SharpZipLibDir)"\r
            archivecontains="binary"\r
       />\r
+      <!-- Place the net45 build where the custom action's <HintPath> expects it. -->\r
+      <Copy Condition="!Exists('$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll')"\r
+          SourceFiles="$(SharpZipLibDir)\lib\net45\ICSharpCode.SharpZipLib.dll"\r
+          DestinationFiles="$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll"\r
+      />\r
   </Target>\r
 \r
 </Project>\r
index fbcf75ee0f99bdc35fd3a19b32ed7486468178e7..0223e98cb0db6154ef60058ec96bf4ed5ca57173 100644 (file)
@@ -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>