Skip to content

Commit

Permalink
deps.ffmpeg: Add Powershell variants of FFmpeg build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
PatTheMav committed Jun 10, 2023
1 parent f16c07d commit 14e8f0e
Show file tree
Hide file tree
Showing 30 changed files with 1,886 additions and 0 deletions.
88 changes: 88 additions & 0 deletions deps.ffmpeg/10-zlib.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
param(
[string] $Name = 'zlib',
[string] $Version = '1.2.13',
[string] $Uri = 'https://github.com/madler/zlib.git',
[string] $Hash = "04f42ceca40f73e2978b50e93806c2a18c1281fc",
[array] $Patches = @(
@{
PatchFile = "${PSScriptRoot}/patches/zlib/0001-fix-unistd-detection.patch"
HashSum = "2114ff9ebfc79765019353b06915a09f4dc4802ce722d2df6e640a59666dd875"
}
),
[array] $Targets = @('x64')
)

function Setup {
Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath $Path
}

function Clean {
Set-Location $Path
if ( Test-Path "build_${Target}" ) {
Log-Information "Clean build directory (${Target})"
Remove-Item -Path "build_${Target}" -Recurse -Force
}
}

function Patch {
Log-Information "Patch (${Target})"
Set-Location $Path

$Patches | ForEach-Object {
$Params = $_
Safe-Patch @Params
}
}

function Configure {
Log-Information "Configure (${Target})"
Set-Location $Path

$OnOff = @('OFF', 'ON')
$Options = @(
$CmakeOptions
'-DZ_HAVE_UNISTD_H:BOOL=OFF'
)

Invoke-External cmake -S . -B "build_${Target}" @Options
}

function Build {
Log-Information "Build (${Target})"
Set-Location $Path

$Options = @(
'--build', "build_${Target}"
'--config', $Configuration
)

if ( $VerbosePreference -eq 'Continue' ) {
$Options += '--verbose'
}

$Options += @(
'--'
'/consoleLoggerParameters:Summary'
'/noLogo'
'/p:UseMultiToolTask=true'
'/p:EnforceProcessCountAcrossBuilds=true'
)

Invoke-External cmake @Options
}

function Install {
Log-Information "Install (${Target})"
Set-Location $Path

$Options = @(
'--install', "build_${Target}"
'--config', $Configuration
)

if ( $Configuration -match "(Release|MinSizeRel)" ) {
$Options += '--strip'
}

Invoke-External cmake @Options
}
80 changes: 80 additions & 0 deletions deps.ffmpeg/20-libpng.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
param(
[string] $Name = 'libpng',
[string] $Version = '1.6.39',
[string] $Uri = 'https://sourceforge.net/projects/libpng/files/libpng16/1.6.39/lpng1639.zip',
[string] $Hash = "${PSScriptRoot}/checksums/lpng1639.zip.sha256",
[array] $Targets = @('x64')
)

function Setup {
Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath .
}

function Clean {
Set-Location $Path
if ( Test-Path "build_${Target}" ) {
Log-Information "Clean build directory (${Target})"
Remove-Item -Path "build_${Target}" -Recurse -Force
}
}

function Configure {
Log-Information "Configure (${Target})"
Set-Location $Path

$OnOff = @('OFF', 'ON')
$Options = @(
$CmakeOptions
'-DPNG_TESTS=OFF'
'-DPNG_STATIC=ON'
"-DPNG_SHARED=$($OnOff[$script:Shared.isPresent])"
)

if ( $Configuration -eq 'Debug' ) {
$Options += '-DPNG_DEBUG=ON'
} else {
$Options += '-DPNG_DEBUG=OFF'
}

Invoke-External cmake -S . -B "build_${Target}" @Options
}

function Build {
Log-Information "Build (${Target})"
Set-Location $Path

$Options = @(
'--build', "build_${Target}"
'--config', $Configuration
)

if ( $VerbosePreference -eq 'Continue' ) {
$Options += '--verbose'
}

$Options += @(
'--'
'/consoleLoggerParameters:Summary'
'/noLogo'
'/p:UseMultiToolTask=true'
'/p:EnforceProcessCountAcrossBuilds=true'
)

Invoke-External cmake @Options
}

function Install {
Log-Information "Install (${Target})"
Set-Location $Path

$Options = @(
'--install', "build_${Target}"
'--config', $Configuration
)

if ( $Configuration -match "(Release|MinSizeRel)" ) {
$Options += '--strip'
}

Invoke-External cmake @Options
}
74 changes: 74 additions & 0 deletions deps.ffmpeg/20-opus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
param(
[string] $Name = 'opus',
[string] $Version = '1.3.1',
[string] $Uri = 'https://github.com/xiph/opus.git',
[string] $Hash = "8cf872a186b96085b1bb3a547afd598354ebeb87",
[array] $Targets = @('x64')
)

function Setup {
Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath $Path
}

function Clean {
Set-Location $Path
if ( Test-Path "build_${Target}" ) {
Log-Information "Clean build directory (${Target})"
Remove-Item -Path "build_${Target}" -Recurse -Force
}
}

function Configure {
Log-Information "Configure (${Target})"
Set-Location $Path

$OnOff = @('OFF', 'ON')
$Options = @(
$CmakeOptions
'-DBUILD_TESTING:BOOL=OFF'
'-DOPUS_BUILD_PROGRAMS:BOOL=OFF'
"-DBUILD_SHARED_LIBS:BOOL=$($OnOff[$script:Shared.isPresent])"
)

Invoke-External cmake -S . -B "build_${Target}" @Options
}

function Build {
Log-Information "Build (${Target})"
Set-Location $Path

$Options = @(
'--build', "build_${Target}"
'--config', $Configuration
)

if ( $VerbosePreference -eq 'Continue' ) {
$Options += '--verbose'
}

$Options += @(
'--'
'/consoleLoggerParameters:Summary'
'/noLogo'
'/p:UseMultiToolTask=true'
'/p:EnforceProcessCountAcrossBuilds=true'
)

Invoke-External cmake @Options
}

function Install {
Log-Information "Install (${Target})"
Set-Location $Path

$Options = @(
'--install', "build_${Target}"
'--config', $Configuration
)

if ( $Configuration -match "(Release|MinSizeRel)" ) {
$Options += '--strip'
}

Invoke-External cmake @Options
}
74 changes: 74 additions & 0 deletions deps.ffmpeg/30-libogg.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
param(
[string] $Name = 'libogg',
[string] $Version = '1.3.5',
[string] $Uri = 'https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.zip',
[string] $Hash = "${PSScriptRoot}/checksums/libogg-1.3.5.zip.sha256",
[array] $Targets = @('x64')
)

function Setup {
Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath .
}

function Clean {
Set-Location $Path
if ( Test-Path "build_${Target}" ) {
Log-Information "Clean build directory (${Target})"
Remove-Item -Path "build_${Target}" -Recurse -Force
}
}

function Configure {
Log-Information "Configure (${Target})"
Set-Location $Path

$OnOff = @('OFF', 'ON')
$Options = @(
$CmakeOptions
'-DINSTALL_DOCS:BOOL=OFF'
'-DBUILD_TESTING:BOOL=OFF'
"-DBUILD_SHARED_LIBS:BOOL=$($OnOff[$script:Shared.isPresent])"
)

Invoke-External cmake -S . -B "build_${Target}" @Options
}

function Build {
Log-Information "Build (${Target})"
Set-Location $Path

$Options = @(
'--build', "build_${Target}"
'--config', $Configuration
)

if ( $VerbosePreference -eq 'Continue' ) {
$Options += '--verbose'
}

$Options += @(
'--'
'/consoleLoggerParameters:Summary'
'/noLogo'
'/p:UseMultiToolTask=true'
'/p:EnforceProcessCountAcrossBuilds=true'
)

Invoke-External cmake @Options
}

function Install {
Log-Information "Install (${Target})"
Set-Location $Path

$Options = @(
'--install', "build_${Target}"
'--config', $Configuration
)

if ( $Configuration -match "(Release|MinSizeRel)" ) {
$Options += '--strip'
}

Invoke-External cmake @Options
}
74 changes: 74 additions & 0 deletions deps.ffmpeg/30-libvorbis.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
param(
[string] $Name = 'libvorbis',
[string] $Version = '1.3.7',
[string] $Uri = 'https://github.com/xiph/vorbis.git',
[string] $Hash = "84c023699cdf023a32fa4ded32019f194afcdad0",
[array] $Targets = @('x64')
)

function Setup {
Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath $Path
}

function Clean {
Set-Location $Path
if ( Test-Path "build_${Target}" ) {
Log-Information "Clean build directory (${Target})"
Remove-Item -Path "build_${Target}" -Recurse -Force
}
}

function Configure {
Log-Information "Configure (${Target})"
Set-Location $Path

$OnOff = @('OFF', 'ON')
$Options = @(
$CmakeOptions
'-DBUILD_TESTING:BOOL=OFF'
"-DBUILD_SHARED_LIBS:BOOL=$($OnOff[$script:Shared.isPresent])"
'-DCMAKE_C_FLAGS=-wd4244'
)

Invoke-External cmake -S . -B "build_${Target}" @Options
}

function Build {
Log-Information "Build (${Target})"
Set-Location $Path

$Options = @(
'--build', "build_${Target}"
'--config', $Configuration
)

if ( $VerbosePreference -eq 'Continue' ) {
$Options += '--verbose'
}

$Options += @(
'--'
'/consoleLoggerParameters:Summary'
'/noLogo'
'/p:UseMultiToolTask=true'
'/p:EnforceProcessCountAcrossBuilds=true'
)

Invoke-External cmake @Options
}

function Install {
Log-Information "Install (${Target})"
Set-Location $Path

$Options = @(
'--install', "build_${Target}"
'--config', $Configuration
)

if ( $Configuration -match "(Release|MinSizeRel)" ) {
$Options += '--strip'
}

Invoke-External cmake @Options
}
Loading

0 comments on commit 14e8f0e

Please sign in to comment.