Add MacPorts
support to the build system (#10736)
This commit is contained in:
parent
c091b9ccc4
commit
273b4abd40
@ -6,6 +6,7 @@
|
||||
0-powershell-crossplatform
|
||||
0xfeeddeadbeef
|
||||
100ms
|
||||
2.x
|
||||
2ae5d07
|
||||
32-bit
|
||||
64-bit
|
||||
@ -379,6 +380,7 @@ lynda.com
|
||||
lzybkr
|
||||
mababio
|
||||
macos
|
||||
macports
|
||||
maertendmsft
|
||||
mahawar
|
||||
markekraus
|
||||
|
17
build.psm1
17
build.psm1
@ -123,6 +123,15 @@ function Get-EnvironmentInformation
|
||||
$environment += @{'nugetPackagesRoot' = "${env:HOME}/.nuget/packages"}
|
||||
}
|
||||
|
||||
if ($Environment.IsMacOS) {
|
||||
$environment += @{'UsingHomebrew' = [bool](Get-Command brew -ErrorAction ignore)}
|
||||
$environment += @{'UsingMacports' = [bool](Get-Command port -ErrorAction ignore)}
|
||||
|
||||
if (-not($environment.UsingHomebrew -or $environment.UsingMacports)) {
|
||||
throw "Neither Homebrew nor MacPorts is installed on this system, visit https://brew.sh/ or https://www.macports.org/ to continue"
|
||||
}
|
||||
}
|
||||
|
||||
if ($Environment.IsLinux) {
|
||||
$LinuxInfo = Get-Content /etc/os-release -Raw | ConvertFrom-StringData
|
||||
|
||||
@ -1710,7 +1719,11 @@ function Start-PSBootstrap {
|
||||
Invoke-Expression "$baseCommand $Deps"
|
||||
}
|
||||
} elseif ($Environment.IsMacOS) {
|
||||
precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See https://brew.sh/"
|
||||
if ($Environment.UsingHomebrew) {
|
||||
$PackageManager = "brew"
|
||||
} elseif ($Environment.UsingMacports) {
|
||||
$PackageManager = "$sudo port"
|
||||
}
|
||||
|
||||
# Build tools
|
||||
$Deps += "cmake"
|
||||
@ -1720,7 +1733,7 @@ function Start-PSBootstrap {
|
||||
|
||||
# Install dependencies
|
||||
# ignore exitcode, because they may be already installed
|
||||
Start-NativeExecution { brew install $Deps } -IgnoreExitcode
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$PackageManager install $Deps")) -IgnoreExitcode
|
||||
} elseif ($Environment.IsAlpine) {
|
||||
$Deps += 'libunwind', 'libcurl', 'bash', 'cmake', 'clang', 'build-base', 'git', 'curl'
|
||||
|
||||
|
@ -7,14 +7,14 @@ building on macOS is almost identical.
|
||||
|
||||
## Environment
|
||||
|
||||
You will want [Homebrew](https://brew.sh/), the missing package manager for macOS.
|
||||
You will want [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/), the missing package manager for macOS.
|
||||
Once installed, follow the same instructions to download and
|
||||
install a self-hosted copy of PowerShell on your macOS machine.
|
||||
From `pwsh.exe`, run `Import-Module ./build.psm1` and use `Start-PSBootstrap` to install the dependencies.
|
||||
|
||||
The `Start-PSBootstrap` function does the following:
|
||||
|
||||
- Uses `brew` to install CMake, OpenSSL, and GNU WGet
|
||||
- Uses `brew` or `port` to install CMake, OpenSSL, and GNU WGet
|
||||
- Uninstalls any prior versions of .NET CLI
|
||||
- Downloads and installs .NET Core SDK to `~/.dotnet`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user