-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from RytoEX/add-windows-deps
Add Windows dependencies build scripts and workflows
- Loading branch information
Showing
59 changed files
with
7,052 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/bash | ||
|
||
############################################################################## | ||
# Windows cross-compiled dependencies build script | ||
############################################################################## | ||
# | ||
# This script compiles all the FFmpeg dependencies required to build OBS | ||
# | ||
# Parameters: | ||
# -h, --help : Print usage help | ||
# -q, --quiet : Suppress most build process output | ||
# -v, --verbose : Enable more verbose build process output | ||
# -a, --architecture : Specify build architecture | ||
# (default: x86_64, alternative: x86)" | ||
# | ||
############################################################################## | ||
|
||
# Halt on errors | ||
set -eE | ||
|
||
## SET UP ENVIRONMENT ## | ||
_RUN_OBS_BUILD_SCRIPT=TRUE | ||
PRODUCT_NAME="obs-deps" | ||
REQUIRED_DEPS=( | ||
"mbedtls 2.24.0 523f0554b6cdc7ace5d360885c3f5bbcc73ec0e8" | ||
"pthread-win32 2.10.0.0 19fd5054b29af1b4e3b3278bfffbb6274c6c89f5" | ||
"libsrt 1.4.2 50b7af06f3a0a456c172b4cb3aceafa8a5cc0036" | ||
"libx264 r3020 d198931a63049db1f2c92d96c34904c69fde8117" | ||
"libopus 1.3.1 e85ed7726db5d677c9c0677298ea0cb9c65bdd23" | ||
"zlib 1.2.11 cacf7f1d4e3d44d871b605da3b647f07d718623f" | ||
"libpng 1.6.37 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca" | ||
"libogg 1.3.4 31bd3f2707fb7dbae539a7093ba1fc4b2b37d84e" | ||
"libvorbis 1.3.7 83a82dd9296400d811b78c06e9ca429e24dd1e5c" | ||
"libvpx 1.8.1 8ae686757b708cd8df1d10c71586aff5355cfe1e" | ||
"nv-codec-headers 9.0.18.2 96a6db017b096ad48612890083464a7214902afa" | ||
"amf 1.4.16.1 802f92ee52b9efa77bf0d3ea8bfaed6040cdd35e" | ||
"ffmpeg 4.2.4 f9f95ceebfbd7b7f43c1b7ad34e25d366e6e2d2b" | ||
) | ||
|
||
## MAIN SCRIPT FUNCTIONS ## | ||
obs-deps-build-main() { | ||
CHECKOUT_DIR="$(/usr/bin/git rev-parse --show-toplevel)" | ||
BUILD_DIR="${CHECKOUT_DIR}/../obs-prebuilt-dependencies" | ||
source "${CHECKOUT_DIR}/CI/include/build_support.sh" | ||
source "${CHECKOUT_DIR}/CI/include/build_support_windows_cross.sh" | ||
_check_parameters $* | ||
|
||
_build_checks | ||
|
||
ensure_dir "${CHECKOUT_DIR}" | ||
|
||
FILE_NAME="windows-cross-deps-${CURRENT_DATE}-${ARCH:-${CURRENT_ARCH}}.tar.xz" | ||
ORIG_PATH="${PATH}" | ||
|
||
for DEPENDENCY in "${REQUIRED_DEPS[@]}"; do | ||
unset -f _build_product | ||
unset -f _patch_product | ||
unset -f _install_product | ||
unset NOCONTINUE | ||
PATH="${ORIG_PATH}" | ||
|
||
set -- ${DEPENDENCY} | ||
trap "caught_error ${DEPENDENCY}" ERR | ||
|
||
PRODUCT_NAME="${1}" | ||
PRODUCT_VERSION="${2}" | ||
PRODUCT_HASH="${3}" | ||
|
||
source "${CHECKOUT_DIR}/CI/windows/build_${1}.sh" | ||
done | ||
|
||
cd "${CHECKOUT_DIR}/windows/obs-dependencies-${ARCH}" | ||
|
||
step "Copy license files..." | ||
cp -R "${CHECKOUT_DIR}/licenses" . | ||
|
||
step "Create archive ${FILE_NAME}" | ||
XZ_OPT=-T0 tar -cJf "${FILE_NAME}" * | ||
|
||
mv ${FILE_NAME} .. | ||
|
||
cleanup | ||
} | ||
|
||
obs-deps-build-main $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
Param( | ||
[Switch]$Help = $(if (Test-Path variable:Help) { $Help }), | ||
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }), | ||
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }), | ||
[Switch]$NoChoco = $(if (Test-Path variable:NoChoco) { $NoChoco }), | ||
[Switch]$SkipDependencyChecks = $(if (Test-Path variable:SkipDependencyChecks) { $SkipDependencyChecks }), | ||
[String]$BuildDirectory = "build", | ||
[ValidateSet("32-bit", "64-bit")] | ||
[String]$BuildArch = (Get-CimInstance CIM_OperatingSystem).OSArchitecture, | ||
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")] | ||
[String]$BuildConfiguration = "RelWithDebInfo" | ||
) | ||
|
||
############################################################################## | ||
# Windows OBS deps native build script | ||
############################################################################## | ||
# | ||
# This script contains all steps necessary to: | ||
# | ||
# * Build OBS required dependencies | ||
# * Create 64-bit and 32-bit variants | ||
# | ||
# Parameters: | ||
# -Help : Print usage help | ||
# -Quiet : Suppress most build process output | ||
# -Verbose : Enable more verbose build process output | ||
# -SkipDependencyChecks : Skip dependency checks | ||
# -NoChoco : Skip automatic dependency installation | ||
# via Chocolatey | ||
# -BuildDirectory : Directory to use for builds | ||
# Default: Win64 on 64-bit systems | ||
# Win32 on 32-bit systems | ||
# -BuildArch : Build architecture to use (32-bit or 64-bit) | ||
# -BuildConfiguration : Build configuration to use | ||
# Default: RelWithDebInfo | ||
# | ||
############################################################################## | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
$_ScriptName = "$($MyInvocation.MyCommand.Name)" | ||
$_RunObsDepsBuildScript = $true | ||
$ProductName = "obs-deps" | ||
|
||
$CheckoutDir = git rev-parse --show-toplevel | ||
$DepsBuildDir = "${CheckoutDir}\windows_native_build_temp" | ||
|
||
. ${CheckoutDir}\CI\include\build_support_windows.ps1 | ||
|
||
$ObsBuildDependencies = @( | ||
@('mbedtls', '523f0554b6cdc7ace5d360885c3f5bbcc73ec0e8'), | ||
@('cmocka', '9c114ac31a33217cf003bbb674c1aff7bb048917'), | ||
@('freetype', '6a2b3e4007e794bfc6c91030d0ed987f925164a8'), | ||
@('curl', '315ee3fe75dade912b48a21ceec9ccda0230d937'), | ||
@('rnnoise', '90ec41ef659fd82cfec2103e9bb7fc235e9ea66c'), | ||
@('speexdsp', '20ed3452074664ad07e380e51321b148acebdf20'), | ||
@('detours', 'e4bfd6b03e50de46b47abfbd1e46b384f0c5f833'), | ||
@('luajit', '0bf80b07b0672ce874feedcc777afe1b791ccb5a'), | ||
@('python', '3.6.2'), | ||
@('vulkan', '1.2.131.2', '49d515f091d69c005a9e52e69829d28383fe157a764caebaa3dbc4b8d9bb383d'), | ||
@('nasm', '2.15.01'), | ||
@('swig', '3.0.12', '21ce6cbe297a56b697ef6e7e92a83e75ca41dedc87e48282ab444591986c35f5') | ||
) | ||
|
||
function Build-OBS-Deps-Main { | ||
Ensure-Directory "${CheckoutDir}" | ||
Write-Step "Fetching version tags..." | ||
& git fetch origin --tags | ||
$GitBranch = git rev-parse --abbrev-ref HEAD | ||
$GitHash = git rev-parse --short HEAD | ||
$ErrorActionPreference = "SilentlyContinue" | ||
$GitTag = git describe --tags --abbrev=0 | ||
$ErrorActionPreference = "Stop" | ||
|
||
Build-Checks | ||
|
||
if (!$CurrentDate) { | ||
$CurrentDate = Get-Date -UFormat "%Y-%m-%d" | ||
} | ||
$FileName = "${ProductName}-win-native-${CurrentDate}-${CMAKE_INSTALL_DIR}.tar.gz" | ||
|
||
if (!$SkipDependencyChecks) { | ||
Install-Dependencies -NoChoco:$NoChoco | ||
} | ||
|
||
Foreach ($Dependency in $ObsBuildDependencies) { | ||
if ($Dependency -is [system.array]) { | ||
$DepName = $Dependency[0] | ||
$DepVersion = $Dependency[1] | ||
if ($Dependency[2]) { | ||
$DepHash = $Dependency[2] | ||
} else { | ||
$DepHash = $DepVersion | ||
} | ||
} else { | ||
Write-Error "ObsBuildDependencies item Dependency is not array" | ||
exit 1 | ||
} | ||
if (Test-CommandExists Build-Product) { | ||
Remove-Item -Path Function:Build-Product | ||
} | ||
if (Test-CommandExists Patch-Product) { | ||
Remove-Item -Path Function:Patch-Product | ||
} | ||
if (Test-CommandExists Install-Product) { | ||
Remove-Item -Path Function:Install-Product | ||
} | ||
|
||
Trap { Caught-Error "${DepName}" } | ||
|
||
Write-Step "Build dependency ${DepName}..." | ||
$ProductName = "${DepName}" | ||
$ProductVersion = "${DepVersion}" | ||
$ProductHash = "${DepHash}" | ||
. "${CheckoutDir}\CI\windows\build_${DepName}.ps1" | ||
} | ||
|
||
Write-Step "Create archive ${FileName}" | ||
cd "${DepsBuildDir}" | ||
tar -czf "${FileName}" -C "${CMAKE_INSTALL_DIR}" * | ||
|
||
Write-Info "All done!" | ||
} | ||
|
||
## MAIN SCRIPT FUNCTIONS ## | ||
function Print-Usage { | ||
Write-Host "build-deps-windows-native.ps1 - Build script for ${ProductName}" | ||
$Lines = @( | ||
"Usage: ${_ScriptName}", | ||
"-Help : Print this help", | ||
"-Quiet : Suppress most build process output", | ||
"-Verbose : Enable more verbose build process output", | ||
"-SkipDependencyChecks : Skip dependency checks - Default: off", | ||
"-NoChoco : Skip automatic dependency installation via Chocolatey - Default: off", | ||
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems", | ||
"-BuildArch : Build architecture to use (32-bit or 64-bit) - Default: local architecture", | ||
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo" | ||
) | ||
$Lines | Write-Host | ||
} | ||
|
||
if ($Help) { | ||
Print-Usage | ||
exit 0 | ||
} | ||
|
||
Build-OBS-Deps-Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.