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 Jan 9, 2024
1 parent b8ebe6e commit 873afb8
Show file tree
Hide file tree
Showing 34 changed files with 1,779 additions and 44 deletions.
80 changes: 80 additions & 0 deletions deps.ffmpeg/10-zlib.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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"
}
)
)

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

$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 += @($CmakePostfix)

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
}
73 changes: 73 additions & 0 deletions deps.ffmpeg/20-libpng.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
param(
[string] $Name = 'libpng',
[string] $Version = '1.6.40',
[string] $Uri = 'https://sourceforge.net/projects/libpng/files/libpng16/1.6.40/lpng1640.zip',
[string] $Hash = "${PSScriptRoot}/checksums/lpng1640.zip.sha256"
)

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:BOOL=OFF'
'-DPNG_STATIC:BOOL=ON'
"-DPNG_SHARED:BOOL=$($OnOff[$script:Shared.isPresent])"
)

if ( $Configuration -eq 'Debug' ) {
$Options += '-DPNG_DEBUG:BOOL=ON'
} else {
$Options += '-DPNG_DEBUG: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 += @($CmakePostfix)

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
}
67 changes: 67 additions & 0 deletions deps.ffmpeg/20-opus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
param(
[string] $Name = 'opus',
[string] $Version = '1.4',
[string] $Uri = 'https://github.com/xiph/opus.git',
[string] $Hash = "82ac57d9f1aaf575800cf17373348e45b7ce6c0d"
)

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 += @($CmakePostfix)

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
}
67 changes: 67 additions & 0 deletions deps.ffmpeg/30-libogg.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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"
)

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 += @($CmakePostfix)

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
}
67 changes: 67 additions & 0 deletions deps.ffmpeg/30-libvorbis.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
param(
[string] $Name = 'libvorbis',
[string] $Version = '1.3.7',
[string] $Uri = 'https://github.com/xiph/vorbis.git',
[string] $Hash = "84c023699cdf023a32fa4ded32019f194afcdad0"
)

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 += @($CmakePostfix)

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 873afb8

Please sign in to comment.