diff --git a/.pipelines/templates/build.yml b/.pipelines/templates/build.yml index ac3fb41..c2cb12b 100644 --- a/.pipelines/templates/build.yml +++ b/.pipelines/templates/build.yml @@ -74,13 +74,6 @@ stages: - template: steps/full-checkout.yml - - task: Bash@3 - condition: and(succeeded(), eq(variables['osName'], 'linux')) - inputs: - targetType: 'inline' - script: sudo apt-get update && sudo apt-get install -y nasm - displayName: 'Install Required Linux Package: nasm' - - pwsh: | ./build-package.ps1 -PackageName "${{ parameters.packageName }}" -StagedArtifactsPath "$(Build.ArtifactStagingDirectory)/package" displayName: 'Run: install & stage (preconfigured)' diff --git a/README.md b/README.md index a2eea27..2dd4afe 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,4 @@ It does the following: ### Testing Linux Builds Locally Linux builds can be developed and run from Windows via WSL. The ffmpeg-cloud pre-configured package for example was created using Ubuntu, which is the default WSL OS. -A few system packages are required to run the powershell `build-package.ps1` script, specifically `clang` (or a similar compiler) and `pkg-config`. Some pre-configured builds require additional packages, such as ffmpeg-cloud needing `nasm`. You can install them via: -``` -sudo apt update -sudo apt install clang, pkg-config, nasm -``` - Given that WSL is quite slow when reading / writing files between Linux and Windows, it's best to run builds directly within a Linux mounted file location (for example `~/projects/ThirdParty-Packages-vcpkg` instead of `/mnt/c/projects/ThirdParty-Packages-vcpkg`). diff --git a/custom-steps/ffmpeg-cloud/pre-build.ps1 b/custom-steps/ffmpeg-cloud/pre-build.ps1 index 881496b..610b9a8 100644 --- a/custom-steps/ffmpeg-cloud/pre-build.ps1 +++ b/custom-steps/ffmpeg-cloud/pre-build.ps1 @@ -1,7 +1,30 @@ Import-Module "$PSScriptRoot/../../scripts/ps-modules/Build" -DisableNameChecking -if (-not (Get-IsOnMacOS)) { - exit +if (Get-IsOnMacOS) { + Write-Message "Installing nasm..." + brew install nasm +} + +if (Get-IsOnLinux) { + Write-Message "Verifying required packages are installed..." + + $isClangMissing = -not(dpkg-query -W -f='${Status}' clang 2>/dev/null | Select-String "install ok installed"); + $isPkgConfigMissing = -not(dpkg-query -W -f='${Status}' pkg-config 2>/dev/null | Select-String "install ok installed"); + $isNasmMissing = -not(dpkg-query -W -f='${Status}' nasm 2>/dev/null | Select-String "install ok installed"); + + if ($isClangMissing -or $isPkgConfigMissing -or $isNasmMissing) { + sudo apt-get update + } + + if ($isClangMissing) { + sudo apt-get install -y clang + } + + if ($isPkgConfigMissing) { + sudo apt-get install -y pkg-config + } + + if ($isNasmMissing) { + sudo apt-get install -y nasm + } } -Write-Message "Installing nasm..." -brew install nasm