Skip to content

Commit

Permalink
Move required linux packages into pre-build script
Browse files Browse the repository at this point in the history
  • Loading branch information
MHenley committed Oct 7, 2024
1 parent 32529fb commit cacdbb0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
7 changes: 0 additions & 7 deletions .pipelines/templates/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
31 changes: 27 additions & 4 deletions custom-steps/ffmpeg-cloud/pre-build.ps1
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cacdbb0

Please sign in to comment.