From e349704fa1b5797682d3094cf16e99dbdb2d9af8 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 26 Feb 2016 18:51:13 -0800 Subject: [PATCH] Add Start-PSPackage -Type switch to build any output If not specified, "deb" is used as default on Linux. This should be updated to check the distribution and required package build dependencies. Dependency names switched per package type, since specific package names are different. Should check if this causes an issue on OS X when the names are empty. --- PowerShellGitHubDev.psm1 | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 91f0a4eff..0c090c58e 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -82,7 +82,9 @@ function Start-PSPackage # Ubuntu and OS X packages are supported. param( [string]$Version, - [int]$Iteration = 1 + [int]$Iteration = 1, + [ValidateSet("deb", "osxpkg", "rpm")] + [string]$Type ) if ($IsWindows) { throw "Building Windows packages is not yet supported!" } @@ -99,13 +101,26 @@ function Start-PSPackage chmod -R go=u "$PSScriptRoot/bin" # Decide package output type - $Output = if ($IsLinux) { "deb" } elseif ($IsOSX) { "osxpkg" } + if (-Not($Type)) { + $Type = if ($IsLinux) { "deb" } elseif ($IsOSX) { "osxpkg" } + Write-Warning "-Type was not specified, continuing with $Type" + } # Use Git tag if not given a version if (-Not($Version)) { $Version = (git --git-dir="$PSScriptRoot/.git" describe) -Replace '^v' } + $libunwind = switch ($Type) { + "deb" { "libunwind8" } + "rpm" { "libunwind" } + } + + $libicu = switch ($Type) { + "deb" { "libicu52" } + "rpm" { "libicu" } + } + # Build package fpm --force --verbose ` --name "powershell" ` @@ -117,12 +132,12 @@ function Start-PSPackage --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" ` + --depends $libunwind ` + --depends $libicu ` --deb-build-depends "dotnet" ` --deb-build-depends "cmake" ` --deb-build-depends "g++" ` - -t $Output ` + -t $Type ` -s dir ` "$PSScriptRoot/bin/=/usr/local/share/powershell/" ` "$PSScriptRoot/package/powershell=/usr/local/bin"