FS-11400: [Build-System] FreeSWITCH Sound packages on Windows.

This commit is contained in:
Andrey Volk
2018-09-20 17:47:20 +03:00
parent 1d6f53a19e
commit 5409a47885
9 changed files with 924 additions and 20 deletions

3
w32/Setup/Sounds/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
Fragments
bin
obj

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Platform specific variables -->
<?define ProductName = "FreeSWITCH Sounds - $(var.SoundPrimaryName) $(var.SoundQuality)Hz $(var.SoundVersion)" ?>
<?define ComponentGroup = "FreeSWITCHSoundFiles$(var.SoundSuffix)" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.SoundVersion)" Manufacturer="FreeSWITCH" UpgradeCode="$(var.SoundUpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="FREESWITCHFOLDER" Name="FreeSWITCH">
<Directory Id="SOUNDLOCATION" Name="sounds">
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="$(var.ProductName)" Level="1">
<ComponentGroupRef Id="$(var.ComponentGroup)" />
</Feature>
<UIRef Id="WixUI_Minimal" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.BaseDir)/docs/COPYING.rtf" />
</Product>
</Wix>

View File

@@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup.Sounds.2017", "Setup.Sounds.2017.wixproj", "{4B082D46-C1B0-4DBB-8D8D-AC0D0FDCDBDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B082D46-C1B0-4DBB-8D8D-AC0D0FDCDBDA}.Release|x64.ActiveCfg = Release|x64
{4B082D46-C1B0-4DBB-8D8D-AC0D0FDCDBDA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="LoadDynamicVariables" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="../../basedir.props" Condition=" '$(BaseDirImported)' == ''" />
<Import Project="../../downloadpackage.task" Condition=" '$(downloadpackagetask_Imported)' == '' " />
</ImportGroup>
<PropertyGroup>
<SoundPrimaryName Condition=" '$(SoundPrimaryName)' == '' ">en-us-callie</SoundPrimaryName>
<SoundQuality Condition=" '$(SoundQuality)' == '' ">8000</SoundQuality>
</PropertyGroup>
<PropertyGroup>
<SoundVersionFile Condition=" '$(SoundPrimaryName)' == 'music' ">moh_version.txt</SoundVersionFile>
<SoundVersionFile Condition=" '$(SoundPrimaryName)' != 'music' ">sounds_version.txt</SoundVersionFile>
<OutputName>Freeswitch-Sounds-$(SoundPrimaryName)-$(SoundQuality)Hz</OutputName>
<SoundSuffix>$(SoundPrimaryName.Replace("-","_"))$(SoundQuality)</SoundSuffix>
<CodeIndex Condition=" $(SoundQuality) == '8000' ">1</CodeIndex>
<CodeIndex Condition=" $(SoundQuality) == '16000' ">2</CodeIndex>
<CodeIndex Condition=" $(SoundQuality) == '32000' ">3</CodeIndex>
<CodeIndex Condition=" $(SoundQuality) == '48000' ">4</CodeIndex>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>4b082d46-c1b0-4dbb-8d8d-ac0d0fdcdbda</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" $(Platform) == 'x64' ">
<OutputPath>bin\x64\release\</OutputPath>
<IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Fragments\FreeSWITCHSoundFiles$(SoundSuffix).wxs" />
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<Folder Include="Fragments" />
</ItemGroup>
<ItemGroup>
<Content Include="../filter.xslt">
<Link>filter.xslt</Link>
</Content>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<PropertyGroup>
<PreBuildEvent>"$(WixToolPath)\heat.exe" dir "$(BaseDir)libs\sounds\$(SoundSuffix)" -cg FreeSWITCHSoundFiles$(SoundSuffix) -gg -scom -sreg -sfrag -srd -dr SOUNDLOCATION -var var.FreeSWITCHSoundFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHSoundFiles$(SoundSuffix).wxs"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DefineConstants>SoundPrimaryName=music;SoundQuality=8000</DefineConstants>
</PropertyGroup>
<Target Name="LoadDynamicVariables">
<ReadLinesFromFile File="$(BaseDir)build/$(SoundVersionFile)">
<Output TaskParameter="Lines" ItemName="LinesFromFile" />
</ReadLinesFromFile>
<CreateProperty Value="$([System.String]::Copy('%(LinesFromFile.Identity)').Split(' ')[1])" Condition=" $([System.String]::Copy('%(LinesFromFile.Identity)').Split(' ')[0]) == '$(SoundPrimaryName)'">
<Output TaskParameter="Value" PropertyName="SoundVersion" />
</CreateProperty>
<CreateProperty Value="%(LinesFromFile.Identity)" Condition=" $(SoundPrimaryName) == 'music' ">
<Output TaskParameter="Value" PropertyName="SoundVersion" />
</CreateProperty>
<Message Importance="High" Text="SoundVersion is $(SoundVersion)" />
<ReadLinesFromFile File="$(BaseDir)build/sounds_upgradecode.txt">
<Output TaskParameter="Lines" ItemName="LinesFromCodeFile" />
</ReadLinesFromFile>
<CreateProperty Value="$([System.String]::Copy('%(LinesFromCodeFile.Identity)').Split(' ')[$(CodeIndex)])" Condition=" $([System.String]::Copy('%(LinesFromCodeFile.Identity)').Split(' ')[0]) == '$(SoundPrimaryName)'">
<Output TaskParameter="Value" PropertyName="SoundUpgradeCode" />
</CreateProperty>
<Message Importance="High" Text="SoundUpgradeCode is $(SoundUpgradeCode)" />
<Message Importance="High" Text="SoundSuffix is '$(SoundSuffix)'" />
<PropertyGroup>
<SoundFileName>freeswitch-sounds-$(SoundPrimaryName)-$(SoundQuality)-$(SoundVersion).tar.gz</SoundFileName>
<DefineConstants>BaseDir=$(BaseDir);SoundUpgradeCode=$(SoundUpgradeCode);SoundVersion=$(SoundVersion);SoundSuffix=$(SoundSuffix);SoundPrimaryName=$(SoundPrimaryName);SoundQuality=$(SoundQuality);FreeSWITCHSoundFilesDir=$(BaseDir)libs\sounds\$(SoundSuffix);</DefineConstants>
</PropertyGroup>
<CreateProperty Condition="'$(Platform)'=='x64'" Value="x64">
<Output TaskParameter="Value" PropertyName="UserFriendlyPlatform" />
</CreateProperty>
<CreateProperty Value="$(BaseDir)$(UserFriendlyPlatform)\FreeSWITCH-Sounds-$(SoundPrimaryName)-$(SoundVersion)-$(SoundQuality)Hz.msi">
<Output TaskParameter="Value" PropertyName="DestinationFileName" />
</CreateProperty>
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
-->
<Target Name="BeforeBuild" DependsOnTargets="7za">
<!--
Download Target.
Name must be unique.
By design, targets are executed only once per project.
Usage:
package: URI
expectfileordirectory: Skips the download and extraction if exists
outputfolder: Folder to store a downloaded file.
By default "$(BaseDir)libs", if empty
outputfilename: If not empty, overrides filename from URI.
.exe files don't get extracted
extractto: Folder to extract an archive to
-->
<DownloadPackageTask package="http://files.freeswitch.org/releases/sounds/$(SoundFileName)" expectfileordirectory="$(BaseDir)libs\download-always" outputfolder="" outputfilename="" extractto="$(BaseDir)libs\sounds\$(SoundSuffix)\" />
</Target>
<Target Name="AfterBuild">
<Copy SourceFiles="$(OutputPath)$(OutputName).msi" DestinationFiles="$(DestinationFileName)" />
<Message Importance="High" Condition="Exists('$(DestinationFileName)')" Text="Success. An output MSI has been copied to $(DestinationFileName)" />
</Target>
</Project>

View File

@@ -0,0 +1,35 @@
@ECHO OFF
SETLOCAL
CALL ..\..\..\msbuild.cmd
if exist %msbuild% (
for /F "tokens=*" %%A in (%cd%\..\..\..\build\sounds_upgradecode.txt) do (
for /F "tokens=1 delims= " %%a in ("%%A") do (
CALL :Build %%a
)
)
) ELSE (
echo "echo ERROR: Cannot find msbuild. You need Visual Studio 2017 to compile this solution."
EXIT /B 1
)
REM CALL :Build music
REM CALL :Build en-us-callie
:: force execution to quit at the end of the "main" logic
EXIT /B %ERRORLEVEL%
:Build
set SoundPrimaryName=%1
set SoundQuality=8000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
set SoundQuality=16000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
set SoundQuality=32000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
set SoundQuality=48000
cmd /C %msbuild% %solution% /p:SoundPrimaryName=%SoundPrimaryName% /p:SoundQuality=%SoundQuality% /p:Configuration=Release /p:Platform=x64 /t:Build /p:PlatformToolset=v141 /verbosity:normal /fl /flp:logfile=..\..\..\x64\sound_logs\sounds_%SoundPrimaryName%_%SoundQuality%.log;verbosity=normal
EXIT /B 0