From 4783c36f8c04f584ec4d232958afae9d32bc61d5 Mon Sep 17 00:00:00 2001 From: ras0219 <533828+ras0219@users.noreply.github.com> Date: Wed, 13 Jan 2021 14:41:23 -0800 Subject: [boost][many ports] Reformat manifest files in preparation for #15424 (#15616) Co-authored-by: Robert Schumacher --- scripts/boost/generate-ports.ps1 | 154 +++++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 69 deletions(-) (limited to 'scripts/boost') diff --git a/scripts/boost/generate-ports.ps1 b/scripts/boost/generate-ports.ps1 index afa7d64da..f3620aa73 100644 --- a/scripts/boost/generate-ports.ps1 +++ b/scripts/boost/generate-ports.ps1 @@ -16,15 +16,19 @@ if ($null -eq $portsDir) if ($IsWindows) { $vcpkg = "$scriptsDir/../../vcpkg.exe" + $curl = "curl.exe" } else { $vcpkg = "$scriptsDir/../../vcpkg" + $curl = "curl" } -# Optionally clear this array when moving to a new boost version +# Clear this array when moving to a new boost version $port_versions = @{ #e.g. "asio" = 1; + "asio" = 1; + "python" = 1; } $per_port_data = @{ @@ -42,25 +46,32 @@ $per_port_data = @{ "log" = @{ "supports" = "!uwp&!emscripten" }; "locale" = @{ "supports" = "!uwp"; - "features" = @( - "Feature: icu" - "Build-Depends: icu" - "Description: ICU backend for Boost.Locale" - )}; + "features" = @{ + icu=@{ + dependencies=@("icu") + description="ICU backend for Boost.Locale" + } + } + }; "parameter-python" = @{ "supports" = "!emscripten" }; "process" = @{ "supports" = "!emscripten" }; "python" = @{ "supports" = "!uwp&!(arm&windows)&!emscripten"; - "features" = @( - "Feature: python2" - "Build-Depends: python2 (windows)" - "Description: Build with Python2 support" - )}; - "regex" = @{ "features" = @( - "Feature: icu" - "Build-Depends: icu" - "Description: ICU backend for Boost.Regex" - )} + "features" = @{ + python2=@{ + dependencies=@(@{name="python2"; platform="windows"}) + description="Build with Python2 support" + } + } + }; + "regex" = @{ + "features" = @{ + icu=@{ + dependencies=@("icu") + description="ICU backend for Boost.Regex" + } + } + } } function TransformReference() @@ -71,11 +82,11 @@ function TransformReference() if ($per_port_data[$library].supports) { - "$library ($($per_port_data[$library].supports))" + @{name="boost-$library"; platform=$per_port_data[$library].supports} } else { - "$library" + "boost-$library" } } @@ -89,32 +100,25 @@ function Generate() $Depends = @() ) - $controlDeps = ($Depends | sort) -join ", " - - mkdir "$portsDir/boost-$PortName" -erroraction SilentlyContinue | out-null - $controlLines = @( - "# Automatically generated by scripts/boost/generate-ports.ps1" - "Source: boost-$PortName" - "Version: $version" - ) - if ($port_versions[$PortName]) - { - $controlLines += @("Port-Version: $($port_versions[$PortName])") + New-Item -ItemType "Directory" "$portsDir/boost-$PortName" -erroraction SilentlyContinue | out-null + $controlLines = @{ + name="boost-$PortName"; ` + "version-string"=$version; ` + dependencies=$Depends; ` + homepage="https://github.com/boostorg/$Name"; ` + description="Boost $Name module" ` } - $controlLines += @( - "Build-Depends: $controlDeps" - "Homepage: https://github.com/boostorg/$Name" - "Description: Boost $Name module" - ) - if ($per_port_data[$PortName].supports) + if ($port_versions[$PortName]) { - $controlLines += @("Supports: $($per_port_data[$PortName].supports)") + $controlLines["port-version"] = $port_versions[$PortName] } - if ($per_port_data[$PortName].features) + + if ($per_port_data[$PortName]) { - $controlLines += @("") + $per_port_data[$PortName].features + $controlLines += $per_port_data[$PortName] } - $controlLines | out-file -enc ascii "$portsDir/boost-$PortName/CONTROL" + $controlLines | ConvertTo-Json -Depth 10 -Compress | out-file -enc ascii "$portsDir/boost-$PortName/vcpkg.json" + & $vcpkg format-manifest "$portsDir/boost-$PortName/vcpkg.json" $portfileLines = @( "# Automatically generated by scripts/boost/generate-ports.ps1" @@ -137,7 +141,7 @@ function Generate() " SHA512 $Hash" " HEAD_REF master" ) - $patches = ls $portsDir/boost-$PortName/*.patch + $patches = Get-ChildItem $portsDir/boost-$PortName/*.patch if ($patches.Count -eq 0) { } @@ -210,7 +214,8 @@ function Generate() $portfileLines += @(get-content "$scriptsDir/post-build-stubs/$PortName.cmake") } - $portfileLines | out-file -enc ascii "$portsDir/boost-$PortName/portfile.cmake" + $portfileLines += @("") + $($portfileLines -join "`r`n") | out-file -enc ascii "$portsDir/boost-$PortName/portfile.cmake" -NoNewline } if (!(Test-Path "$scriptsDir/boost")) @@ -240,7 +245,7 @@ else } } -$libraries_found = ls $scriptsDir/boost/libs -directory | % name | % { +$libraries_found = Get-ChildItem $scriptsDir/boost/libs -directory | % name | % { if ($_ -match "numeric") { "numeric_conversion" @@ -258,7 +263,7 @@ $libraries_found = ls $scriptsDir/boost/libs -directory | % name | % { } } -mkdir $scriptsDir/downloads -erroraction SilentlyContinue | out-null +New-Item -ItemType "Directory" $scriptsDir/downloads -erroraction SilentlyContinue | out-null if ($libraries.Length -eq 0) { @@ -274,14 +279,14 @@ foreach ($library in $libraries) if (!(Test-Path $archive)) { "Downloading boost/$library..." - & @(& $vcpkg fetch aria2)[-1] "https://github.com/boostorg/$library/archive/boost-$version.tar.gz" -d "$scriptsDir/downloads" -o "$library-boost-$version.tar.gz" + & $curl -L "https://github.com/boostorg/$library/archive/boost-$version.tar.gz" --output "$scriptsDir/downloads/$library-boost-$version.tar.gz" } $hash = & $vcpkg hash $archive $unpacked = "$scriptsDir/libs/$library-boost-$version" if (!(Test-Path $unpacked)) { "Unpacking boost/$library..." - mkdir $scriptsDir/libs -erroraction SilentlyContinue | out-null + New-Item -ItemType "Directory" $scriptsDir/libs -erroraction SilentlyContinue | out-null pushd $scriptsDir/libs try { @@ -295,12 +300,22 @@ foreach ($library in $libraries) pushd $unpacked try { - $groups = $( - findstr /si /C:"include