mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Add Start-PSPackage command to build deb/pkg packages
Deprecates `package.sh`. Committed necessary package symlink because creating one with PowerShell is not yet implemented.
This commit is contained in:
1 parent
1453048674
commit
472b17d547
3 files changed
+50
-28
No files matched your search
@@ -1,3 +1,10 @@
|
||||
# TODO: use PowerShell to check OS when available
|
||||
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
|
||||
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]
|
||||
$Linux = $Runtime::IsOSPlatform($OSPlatform::Linux)
|
||||
$OSX = $Runtime::IsOSPlatform($OSPlatform::OSX)
|
||||
$Windows = $Runtime::IsOSPlatform($OSPlatform::Windows)
|
||||
|
||||
function Start-PSBuild
|
||||
{
|
||||
param(
|
||||
@@ -9,18 +16,13 @@ function Start-PSBuild
|
||||
throw "Build dependency 'dotnet' not found in PATH! See: https://dotnet.github.io/getting-started/"
|
||||
}
|
||||
|
||||
New-Item -Force -Type Directory $Output | Out-Null
|
||||
|
||||
$Top = "$PSScriptRoot/src/Microsoft.PowerShell.Linux.Host"
|
||||
if ($Restore -Or -Not (Test-Path "$Top/project.lock.json")) {
|
||||
dotnet restore
|
||||
}
|
||||
|
||||
# TODO: use PowerShell to check OS when available
|
||||
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
|
||||
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]
|
||||
$Linux = $Runtime::IsOSPlatform($OSPlatform::Linux)
|
||||
$OSX = $Runtime::IsOSPlatform($OSPlatform::OSX)
|
||||
$Windows = $Runtime::IsOSPlatform($OSPlatform::Windows)
|
||||
|
||||
if ($Linux -Or $OSX) {
|
||||
$InstallCommand = if ($Linux) { "apt-get" } elseif ($OSX) { "brew" }
|
||||
foreach ($Dependency in "cmake", "g++") {
|
||||
@@ -52,6 +54,46 @@ function Start-PSBuild
|
||||
dotnet publish -o $Output -c $Configuration -f "netstandardapp1.5" $Top
|
||||
}
|
||||
|
||||
function Start-PSPackage
|
||||
{
|
||||
param(
|
||||
[version]$Version = "0.1.0",
|
||||
[int]$Iteration = 1
|
||||
)
|
||||
|
||||
if ($Windows) { throw "Building Windows packages is not yet supported!" }
|
||||
|
||||
if (-Not (Get-Command "fpm" -ErrorAction SilentlyContinue)) {
|
||||
throw "Build dependency 'fpm' not found in PATH! See: https://github.com/jordansissel/fpm"
|
||||
}
|
||||
|
||||
Start-PSBuild
|
||||
|
||||
Write-Host "Change permissions for packaging"
|
||||
chmod -R go=u bin
|
||||
|
||||
$Output = if ($Linux) { "deb" } elseif ($OSX) { "osxpkg" }
|
||||
|
||||
fpm --force --verbose `
|
||||
--name "powershell" `
|
||||
--version $Version `
|
||||
--iteration $Iteration `
|
||||
--maintainer "Andrew Schwartzmeyer <andschwa@microsoft.com>" `
|
||||
--vendor "Microsoft <mageng@microsoft.com>" `
|
||||
--url "https://github.com/PowerShell/PowerShell" `
|
||||
--license "Unlicensed" `
|
||||
--description "Open PowerShell on .NET Core\nPowerShell is an open-source, cross-platform, scripting language and rich object shell. Built upon .NET Core, it is also a C# REPL.\n" `
|
||||
--category "shells" `
|
||||
--depends "libunwind8" `
|
||||
--depends "libicu52" `
|
||||
--deb-build-depends "dotnet" `
|
||||
--deb-build-depends "cmake" `
|
||||
--deb-build-depends "g++" `
|
||||
-t $Output `
|
||||
-s dir `
|
||||
-- "bin/=/usr/local/share/powershell/" "package/powershell=/usr/local/bin"
|
||||
}
|
||||
|
||||
function Start-DevPSGitHub
|
||||
{
|
||||
param(
|
||||
|
||||
Reference in new issue
Block a user