Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 40 additions & 13 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ function Start-PSBuild {
"win10-x64",
"osx.10.12-x64",
"opensuse.13.2-x64",
"opensuse.42.1-x64")]
"opensuse.42.1-x64",
"linux-arm")]
[string]$Runtime,

[ValidateSet('Linux', 'Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well
Expand Down Expand Up @@ -363,6 +364,12 @@ function Start-PSBuild {
}
}

if ($RunTime -eq "linux-arm") {
foreach ($Dependency in 'arm-linux-gnueabihf-gcc', 'arm-linux-gnueabihf-g++') {
$precheck = $precheck -and (precheck $Dependency "Build dependency '$Dependency' not found. Run 'Start-PSBootstrap'.")
}
}

# Abort if any precheck failed
if (-not $precheck) {
return
Expand Down Expand Up @@ -464,9 +471,15 @@ Fix steps:

try {
Push-Location $Native
Start-NativeExecution { cmake -DCMAKE_BUILD_TYPE=Debug . }
Start-NativeExecution { make -j }
Start-NativeExecution { ctest --verbose }
if ($Runtime -eq "linux-arm") {
Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./arm.toolchain.cmake" . }
Start-NativeExecution { make -j }
}
else {
Start-NativeExecution { cmake -DCMAKE_BUILD_TYPE=Debug . }
Start-NativeExecution { make -j }
Start-NativeExecution { ctest --verbose }
}
} finally {
Pop-Location
}
Expand Down Expand Up @@ -587,7 +600,8 @@ function New-PSOptions {
"win10-x64",
"osx.10.12-x64",
"opensuse.13.2-x64",
"opensuse.42.1-x64")]
"opensuse.42.1-x64",
"linux-arm")]
[string]$Runtime,

[switch]$CrossGen,
Expand Down Expand Up @@ -651,7 +665,7 @@ function New-PSOptions {
}
}

# We plan to release packages targetting win7-x64 and win7-x86 RIDs,
# We plan to release packages targetting win7-x64 and win7-x86 RIDs,
# which supports all supported windows platforms.
# So we, will change the RID to win7-<arch>
if ($Environment.IsWindows) {
Expand Down Expand Up @@ -937,7 +951,7 @@ function Start-PSPester {
if ($PassThru.IsPresent)
{
$passThruFile = [System.IO.Path]::GetTempFileName()
try
try
{
$Command += "|Export-Clixml -Path '$passThruFile' -Force"
Start-NativeExecution -sb {& $powershell -noprofile -c $Command} | ForEach-Object { Write-Host $_}
Expand All @@ -948,7 +962,7 @@ function Start-PSPester {
Remove-Item $passThruFile -ErrorAction SilentlyContinue
}
}
else
else
{
Start-NativeExecution -sb {& $powershell -noprofile -c $Command}
}
Expand Down Expand Up @@ -984,13 +998,13 @@ function script:Start-UnelevatedProcess
function Show-PSPesterError
{
[CmdletBinding(DefaultParameterSetName='xml')]
param (
param (
[Parameter(ParameterSetName='xml',Mandatory)]
[Xml.XmlElement]$testFailure,
[Parameter(ParameterSetName='object',Mandatory)]
[PSCustomObject]$testFailureObject
)

if ($PSCmdLet.ParameterSetName -eq 'xml')
{
$description = $testFailure.description
Expand Down Expand Up @@ -1046,11 +1060,11 @@ function Test-PSPesterResults
{
logerror "TEST FAILURES"
# switch between methods, SelectNode is not available on dotnet core
if ( "System.Xml.XmlDocumentXPathExtensions" -as [Type] )
if ( "System.Xml.XmlDocumentXPathExtensions" -as [Type] )
{
$failures = [System.Xml.XmlDocumentXPathExtensions]::SelectNodes($x."test-results",'.//test-case[@result = "Failure"]')
}
else
else
{
$failures = $x.SelectNodes('.//test-case[@result = "Failure"]')
}
Expand Down Expand Up @@ -1202,6 +1216,7 @@ function Start-PSBootstrap {
[switch]$Package,
[switch]$NoSudo,
[switch]$BuildWindowsNative,
[switch]$BuildLinuxArm,
[switch]$Force
)

Expand All @@ -1225,12 +1240,21 @@ function Start-PSBootstrap {
Pop-Location
}

if ($BuildLinuxArm -and -not $Environment.IsUbuntu) {
Write-Error "Cross compiling for linux-arm is only supported on Ubuntu environment"
return
}

# Install ours and .NET's dependencies
$Deps = @()
if ($Environment.IsUbuntu) {
# Build tools
$Deps += "curl", "g++", "cmake", "make"

if ($BuildLinuxArm) {
$Deps += "gcc-arm-linux-gnueabihf", "g++-arm-linux-gnueabihf"
}

# .NET Core required runtime libraries
$Deps += "libunwind8"
if ($Environment.IsUbuntu14) { $Deps += "libicu52" }
Expand Down Expand Up @@ -1837,7 +1861,8 @@ function Start-CrossGen {
"win10-x64",
"osx.10.12-x64",
"opensuse.13.2-x64",
"opensuse.42.1-x64")]
"opensuse.42.1-x64",
"linux-arm")]
[string]
$Runtime
)
Expand Down Expand Up @@ -1894,6 +1919,8 @@ function Start-CrossGen {
} else {
"win-x64"
}
} elseif ($Runtime -eq "linux-arm") {
throw "crossgen is not available for 'linux-arm'"
} elseif ($Environment.IsLinux) {
"linux-x64"
} elseif ($Environment.IsMacOS) {
Expand Down
59 changes: 0 additions & 59 deletions build.sh

This file was deleted.

14 changes: 10 additions & 4 deletions src/libpsl-native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/../powershell-unix")

# test in BUILD_DIR
enable_testing()
add_subdirectory(src)
add_subdirectory(test)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
message(STATUS "Building for ARM, no tests")
add_subdirectory(src)
else ()
# test in BUILD_DIR
message(STATUS "Tests enabled")
enable_testing()
add_subdirectory(src)
add_subdirectory(test)
endif ()
19 changes: 19 additions & 0 deletions src/libpsl-native/arm.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)

# add_compile_options(-target armv7-linux-gnueabihf)
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
add_compile_options(-g)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
12 changes: 9 additions & 3 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ function Start-PSPackage {
[string]$Name = "powershell",

# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg")]
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "deb-arm")]
[string[]]$Type,

# Generate windows downlevel package
[ValidateSet("win7-x86", "win7-x64")]
[ValidateScript({$Environment.IsWindows})]
[string]$WindowsRuntime,
[string] $WindowsRuntime,

[Switch] $Force,

Expand All @@ -37,6 +37,8 @@ function Start-PSPackage {
# Runtime and Configuration settings required by the package
($Runtime, $Configuration) = if ($WindowsRuntime) {
$WindowsRuntime, "Release"
} elseif ($Type -eq "deb-arm") {
New-PSOptions -Configuration "Release" -Runtime "Linux-ARM" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
} else {
New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
}
Expand All @@ -54,7 +56,11 @@ function Start-PSPackage {
$Script:Options = Get-PSOptions

$crossGenCorrect = $false
if(-not $IncludeSymbols.IsPresent -and $Script:Options.CrossGen) {
if ($Type -eq "deb-arm") {
# crossgen doesn't support arm32 yet
$crossGenCorrect = $true
}
elseif(-not $IncludeSymbols.IsPresent -and $Script:Options.CrossGen) {
$crossGenCorrect = $true
}
elseif ($IncludeSymbols.IsPresent -and -not $Script:Options.CrossGen) {
Expand Down