| 1 |
# Copyright (C) 2016 and later: Unicode, Inc. and others. |
| 2 |
# License & terms of use: http://www.unicode.org/copyright.html |
| 3 |
#------------------------- |
| 4 |
# Script: icu\packaging\distrelease.ps1 |
| 5 |
# Author: Steven R. Loomis |
| 6 |
# Date: 2017-04-14 |
| 7 |
#------------------------- |
| 8 |
# |
| 9 |
# This builds a zipfile containing the 64-bit (x64) and/or 32-bit (x86) Windows binaries. |
| 10 |
# (Note: The zipfile does not include the UWP binaries.) |
| 11 |
# |
| 12 |
# Usage: (after building ICU using MSVC) |
| 13 |
# (bring up Powershell ISE) |
| 14 |
# cd C:\icu\icu4c\ |
| 15 |
# Set-ExecutionPolicy -Scope Process Unrestricted |
| 16 |
# .\packaging\distrelease.ps1 -arch "x64 or x86 or ARM64" |
| 17 |
# |
| 18 |
# Will emit: c:\icu4c\icu\source\dist\icu-windows.zip |
| 19 |
# |
| 20 |
# |
| 21 |
# You will get warnings from the execution policy and the script itself. |
| 22 |
# see https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1&viewFallbackFrom=powershell-Microsoft.PowerShell.Core |
| 23 |
# for more about execution policies. |
| 24 |
|
| 25 |
Param( |
| 26 |
[string]$arch = "x64" # use x64 as default |
| 27 |
) |
| 28 |
|
| 29 |
$icuDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent |
| 30 |
$icuDir = Resolve-Path -Path '$icuDir\..' |
| 31 |
|
| 32 |
echo $icuDir |
| 33 |
|
| 34 |
# ok, create some work areas |
| 35 |
New-Item -Path "$icuDir\source\dist" -ErrorAction SilentlyContinue -ItemType "directory" |
| 36 |
$source = "$icuDir\source\dist\icu" |
| 37 |
Get-ChildItem -Path $source -ErrorAction SilentlyContinue | Remove-Item -Recurse |
| 38 |
New-Item -Path $source -ItemType "directory" -ErrorAction SilentlyContinue |
| 39 |
|
| 40 |
# copy required stuff |
| 41 |
if ($arch -eq "x64") |
| 42 |
{ |
| 43 |
Copy-Item -Path "$icuDir\lib64" -Destination $source -Recurse |
| 44 |
Copy-Item -Path "$icuDir\bin64" -Destination $source -Recurse |
| 45 |
} |
| 46 |
elseif ($arch -eq "x86") |
| 47 |
{ |
| 48 |
Copy-Item -Path "$icuDir\lib" -Destination $source -Recurse |
| 49 |
Copy-Item -Path "$icuDir\bin" -Destination $source -Recurse |
| 50 |
} |
| 51 |
elseif ($arch -eq "ARM64") |
| 52 |
{ |
| 53 |
Copy-Item -Path "$icuDir\libARM64" -Destination $source -Recurse |
| 54 |
Copy-Item -Path "$icuDir\binARM64" -Destination $source -Recurse |
| 55 |
} |
| 56 |
else |
| 57 |
{ |
| 58 |
$filename = $MyInvocation.MyCommand.Name; |
| 59 |
echo "Invalid architecture." |
| 60 |
echo "Usage: $filename -arch `"x64 or x86`"" |
| 61 |
exit |
| 62 |
} |
| 63 |
|
| 64 |
Copy-Item -Path "$icuDir\include" -Destination $source -Recurse |
| 65 |
Copy-Item -Path "$icuDir\APIChangeReport.html" -Destination $source -Recurse |
| 66 |
Copy-Item -Path "$icuDir\icu4c.css" -Destination $source -Recurse |
| 67 |
Copy-Item -Path "$icuDir\LICENSE" -Destination $source -Recurse |
| 68 |
Copy-Item -Path "$icuDir\readme.html" -Destination $source -Recurse |
| 69 |
|
| 70 |
|
| 71 |
$destination = "$icuDir\source\dist\icu-windows.zip" |
| 72 |
Remove-Item -Path $destination -ErrorAction Continue |
| 73 |
Echo $source |
| 74 |
Echo $destination |
| 75 |
|
| 76 |
# Use 7Zip to build zip file to avoid backslash path separator errors when unzipping on CygWin |
| 77 |
if (-not (Get-Module -ListAvailable -Name 7Zip4PowerShell)) |
| 78 |
{ |
| 79 |
Install-Module 7Zip4PowerShell -Force -Verbose |
| 80 |
} |
| 81 |
Compress-7Zip $source -ArchiveFileName $destination -Format Zip |
| 82 |
|
| 83 |
echo $destination |