Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable building Linux x64 Nuget runtime package #27

Merged
merged 1 commit into from
Aug 10, 2020
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
70 changes: 70 additions & 0 deletions build/azure-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,69 @@ variables:
stages:
- stage: Build
jobs:
- job: BuildLinux
pool:
name: Azure Pipelines
vmImage: 'ubuntu-18.04'
workspace:
clean: all

# Note: We only have one distro for now, but this lets others be added more easily in the future.
strategy:
matrix:
centos:
distro: 'centos'

steps:
- checkout: self
lfs: true
fetchDepth: 1

- task: PowerShell@2
displayName: 'Set ICU Version'
inputs:
targetType: filePath
filePath: './build/scripts/Set-ICUVersion.ps1'
arguments: '-icuVersionFile "$(BUILD.SOURCESDIRECTORY)\version.txt"'

- task: Docker@2
displayName: 'Setup Docker Container: $(distro)'
inputs:
command: build
Dockerfile: 'build/dockerfiles/$(distro)/Dockerfile'
arguments: -t ms-icu-container

- script: |
mkdir /tmp/build-output && docker run --rm -v $(pwd):/src -v /tmp/build-output:/dist ms-icu-container /src/build/scripts/build-icu.sh
displayName: 'Build, test, and make install'

- script: |
cd /tmp/build-output && ls -Rl
displayName: 'DIAG: ls -Rl'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
PathtoPublish: '/tmp/build-output/icu-binaries.tar.gz'
ArtifactName: 'linux_$(distro).tar.gz'

# Note: We only copy the .so files with the full version (ex: libicuuc.so.67.1.0.4)
- script: |
mkdir /tmp/icu-binaries
ls -al /tmp/build-output/icu/usr/local/lib/
cp /tmp/build-output/icu/usr/local/lib/libicudata.so.$(ICUVersion) /tmp/icu-binaries
cp /tmp/build-output/icu/usr/local/lib/libicui18n.so.$(ICUVersion) /tmp/icu-binaries
cp /tmp/build-output/icu/usr/local/lib/libicuuc.so.$(ICUVersion) /tmp/icu-binaries
displayName: 'Copy .so files'

- task: PublishBuildArtifacts@1
displayName: 'Publish: binaries'
inputs:
PathtoPublish: '/tmp/icu-binaries'
ArtifactName: 'linux-x64'

- job: BuildWindows
timeoutInMinutes: 30
pool:
name: Azure Pipelines
vmImage: 'vs2017-win2016'
Expand Down Expand Up @@ -176,6 +238,7 @@ stages:
name: Package ES CodeHub Lab E
jobs:
- job: CodeSignBits
timeoutInMinutes: 30
workspace:
clean: all

Expand Down Expand Up @@ -257,6 +320,7 @@ stages:

jobs:
- job: CreateNugetAndCodeSign
timeoutInMinutes: 30
workspace:
clean: all
steps:
Expand Down Expand Up @@ -307,6 +371,12 @@ stages:
artifactName: 'win-ARM64'
downloadPath: '$(Build.BINARIESDIRECTORY)\bits'

- task: DownloadBuildArtifacts@0
displayName: 'Download linux-x64'
inputs:
artifactName: 'linux-x64'
downloadPath: '$(Build.BINARIESDIRECTORY)\bits'

# Symbols (PDBs)
- task: DownloadBuildArtifacts@0
displayName: 'Download symbols-win-x86'
Expand Down
19 changes: 19 additions & 0 deletions build/dockerfiles/centos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This uses the DotNet CentOS 7 docker image to build.
# https://github.com/dotnet/dotnet-buildtools-prereqs-docker

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-359e48e-20200313130914
MAINTAINER Jeff Genovy <29107334+jefgen@users.noreply.github.com>
LABEL com.github.microsoft.icu="centos-7"

# Remove icu-dev, so it doesn't conflict.
RUN yum -y remove libicu-devel

# When we run the docker container we will mount the source repo here
VOLUME /src

# The output from make install will go here
VOLUME /dist

# Do the actual build in tmp
RUN mkdir /tmp/build
WORKDIR /tmp/build
1 change: 1 addition & 0 deletions build/nuget/SignConfig-ICU-Nuget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<file src="__INPATHROOT__\Microsoft.ICU.ICU4C.Runtime.win-x64*.nupkg" signType="Nuget" />
<file src="__INPATHROOT__\Microsoft.ICU.ICU4C.Runtime.win-x86*.nupkg" signType="Nuget" />
<file src="__INPATHROOT__\Microsoft.ICU.ICU4C.Runtime.win-arm64*.nupkg" signType="Nuget" />
<file src="__INPATHROOT__\Microsoft.ICU.ICU4C.Runtime.linux-x64*.nupkg" signType="Nuget" />
<!-- Symbol packages -->
<file src="__INPATHROOT__\Microsoft.ICU.ICU4C.Runtime.win-x64*.snupkg" signType="Nuget" />
<file src="__INPATHROOT__\Microsoft.ICU.ICU4C.Runtime.win-x86*.snupkg" signType="Nuget" />
Expand Down
12 changes: 11 additions & 1 deletion build/scripts/Create-Nuget-Runtime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ foreach ($rid in $runtimeIdentifiers)
$ret = New-Item -Path "$stagingLocation\runtimes\$rid" -ItemType Directory
$ret = New-Item -Path "$stagingLocation\runtimes\$rid\native" -ItemType Directory

$haveSymbols = 0

if ($rid.StartsWith('win'))
{
# Compiled DLLs
Expand All @@ -114,8 +116,13 @@ foreach ($rid in $runtimeIdentifiers)
# If we have symbols, also add them to the package location as well.
if (Test-Path "$icuSymbols\symbols-$rid" -PathType Container) {
Copy-Item "$icuSymbols\symbols-$rid\*.pdb" -Destination $dllOutput -Recurse
$haveSymbols = 1
}
}
elseif ($rid.StartsWith('linux'))
{
Copy-Item "$icuBinaries\$rid\*.so*" -Destination "$stagingLocation\runtimes\$rid\native" -Recurse
}

# Add the License file
Write-Host 'Copying the License file into the Nuget location.'
Expand All @@ -140,7 +147,10 @@ foreach ($rid in $runtimeIdentifiers)
&cmd /c Tree /F /A $stagingLocation

# Actually do the "nuget pack" operation
$nugetCmd = ("nuget pack $stagingLocation\$runtimePackageId.nuspec -BasePath $stagingLocation -OutputDirectory $output\package -Symbols -SymbolPackageFormat snupkg")
$nugetCmd = "nuget pack $stagingLocation\$runtimePackageId.nuspec -BasePath $stagingLocation -OutputDirectory $output\package"
if ($haveSymbols) {
$nugetCmd = "$nugetCmd -Symbols -SymbolPackageFormat snupkg"
}
Write-Host 'Executing: ' $nugetCmd
&cmd /c $nugetCmd
}
Expand Down
34 changes: 34 additions & 0 deletions build/scripts/build-icu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# echo commands when executing them
set -x

# Disable color output
export TERM=xterm

# Number of CPU Cores to use for make
export CPUCORES=$(nproc)

echo Building in: $(pwd)

# Configure ICU for building. Skip layout[ex] and samples
/src/icu/icu4c/source/runConfigureICU Linux --disable-layout --disable-layoutex --disable-samples || exit 1

# Build, run the tests, then install into DESTDIR.
make -j${CORES} check && make -j${CORES} DESTDIR=/dist/icu releaseDist || exit 1

# Test that icuinfo works with the built libs in the installed location
LD_LIBRARY_PATH=/dist/icu/usr/local/lib /dist/icu/usr/local/bin/icuinfo || exit 1

# Copy OS Release (name of the distro) if it exists
if [ -f /etc/os-release ];
then
cat /etc/os-release
cp /etc/os-release /dist/icu
fi

# Copy the MS-ICU version number
cp /src/version.txt /dist/icu

# Pack up the binaries into a tarball
cd /dist && tar -czpf icu-binaries.tar.gz -C /dist/icu .