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

This commit is contained in:
Andrey Volk
2026-07-03 22:45:13 +03:00
committed by GitHub
parent 2096190199
commit 0615f8f3fa
3 changed files with 61 additions and 18 deletions
+7
View File
@@ -172,6 +172,11 @@ BuildLog.htm
!/libs/win32/ !/libs/win32/
!/libs/speex/win32/ !/libs/speex/win32/
# 7-Zip extraction tool bootstrap (downloaded/extracted by w32/downloadpackage.task)
/libs/win32/7za/
/libs/win32/7z*-extra.7z
*.suo *.suo
*.sdf *.sdf
x64/ x64/
@@ -245,6 +250,8 @@ libs/libcodec2-*/
libs/libsilk-*/ libs/libsilk-*/
libs/rabbitmq-c-*/ libs/rabbitmq-c-*/
libs/rabbitmq-c-*.zip libs/rabbitmq-c-*.zip
libs/SharpZipLib.*/
libs/SharpZipLib.*.nupkg
libs/ffmpeg-*/ libs/ffmpeg-*/
libs/sofia-sip*/ libs/sofia-sip*/
libs/sofia-sip* libs/sofia-sip*
+16 -5
View File
@@ -7,6 +7,12 @@
<downloadSharpZipLibPropsImported>true</downloadSharpZipLibPropsImported> <downloadSharpZipLibPropsImported>true</downloadSharpZipLibPropsImported>
</PropertyGroup> </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. Download Target.
Name must be unique. Name must be unique.
@@ -32,13 +38,18 @@
<Target Name="SharpZipLibDownloadTarget" BeforeTargets="Build" DependsOnTargets="7za"> <Target Name="SharpZipLibDownloadTarget" BeforeTargets="Build" DependsOnTargets="7za">
<DownloadPackageTask <DownloadPackageTask
package="http://files.freeswitch.org/downloads/libs/ICSharpCode.SharpZipLib.dll.bz2" package="https://github.com/icsharpcode/SharpZipLib/releases/download/v$(SharpZipLibVersion)/SharpZipLib.$(SharpZipLibVersion).nupkg"
expectfileordirectory="$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\ICSharpCode.SharpZipLib.dll" expectfileordirectory="$(SharpZipLibCADir)\ICSharpCode.SharpZipLib.dll"
outputfolder="" outputfolder="$(BaseDir)libs\"
outputfilename="" outputfilename="SharpZipLib.$(SharpZipLibVersion).nupkg"
extractto="$(BaseDir)w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\" extractto="$(SharpZipLibDir)"
archivecontains="binary" 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> </Target>
</Project> </Project>
+33 -8
View File
@@ -15,6 +15,7 @@
<extractto /> <extractto />
<moveafter /> <moveafter />
<archivecontains /> <archivecontains />
<arctool />
</ParameterGroup> </ParameterGroup>
<Task> <Task>
<Reference Include="Microsoft.Build" /> <Reference Include="Microsoft.Build" />
@@ -57,6 +58,7 @@ using System.Diagnostics;
public string extractto { get; set; } public string extractto { get; set; }
public string moveafter { get; set; } public string moveafter { get; set; }
public string archivecontains { get; set; } public string archivecontains { get; set; }
public string arctool { get; set; }
internal static bool FileOrDirectoryExists(string name) internal static bool FileOrDirectoryExists(string name)
{ {
@@ -193,26 +195,31 @@ using System.Diagnostics;
private void Extract(string filename, string extracttofolder) 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 + "\""; string args = " x \"" + filename + "\" -y -o\"" + extracttofolder + "\"";
Log.LogMessage(MessageImportance.High, Log.LogMessage(MessageImportance.High,
"arctool : " + arctool); "arctool : " + tool);
Log.LogMessage(MessageImportance.High, Log.LogMessage(MessageImportance.High,
"args : " + args); "args : " + args);
Log.LogMessage(MessageImportance.High, Log.LogMessage(MessageImportance.High,
"WorkingDirectory : " + Path.GetDirectoryName(arctool)); "WorkingDirectory : " + Path.GetDirectoryName(tool));
var proc = new Process var proc = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = arctool, FileName = tool,
Arguments = args, Arguments = args,
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,
CreateNoWindow = true, CreateNoWindow = true,
WorkingDirectory = Path.GetDirectoryName(arctool) WorkingDirectory = Path.GetDirectoryName(tool)
} }
}; };
@@ -274,14 +281,32 @@ using System.Diagnostics;
</Task> </Task>
</UsingTask> </UsingTask>
<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"> <Target Name="7za" BeforeTargets="Build">
<!-- Step 1: download 7zr.exe. As an .exe it is stored as-is, not extracted. -->
<DownloadPackageTask <DownloadPackageTask
package="http://files.freeswitch.org/downloads/win32/7za1701.exe" package="$(SevenZipBaseUrl)/7zr.exe"
expectfileordirectory="$(BaseDir)libs/win32/7za1701.exe" expectfileordirectory="$(BaseDir)libs/win32/7zr.exe"
outputfolder="$(BaseDir)libs/win32/" outputfolder="$(BaseDir)libs/win32/"
outputfilename="7za1701.exe" outputfilename="7zr.exe"
extractto="" extractto=""
/> />
<!-- 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> </Target>
<PropertyGroup> <PropertyGroup>