From 25c7edc16ddc80c150786b9d3954617f601c14db Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Thu, 8 Aug 2019 16:39:21 -0400 Subject: [PATCH] Add linux-arm64 RID builds The normal approach is to take the oldest OS supported and use that to make linux-$ARCH RID packages. Here, we use ubuntu 16.04. This commit makes the following changes: Add a new dockerfile for linux-arm64, which is actually just a copy of Dockerfile.ubuntu.16.04-arm64. This is so we can build linux-arm64 RID packages in CI. Add a dllmap for mapping from armv8 (which is what mono calls arm64 - see https://www.mono-project.com/docs/advanced/pinvoke/dllmap/) to the linux-arm64 RID. Also fix build.libgit2.sh to handle building natively on arm64. I used this to build libgit2, using ./build.libgit2.sh, on RHEL 8 on arm64. --- .travis.yml | 4 ++++ Dockerfile.linux-arm64 | 17 +++++++++++++++++ UpdateLibgit2ToSha.ps1 | 1 + build.libgit2.sh | 2 ++ 4 files changed, 24 insertions(+) create mode 100644 Dockerfile.linux-arm64 diff --git a/.travis.yml b/.travis.yml index 359cc59a..f0576c3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,10 @@ matrix: dist: trusty sudo: required env: RID=linux-x64 + - os: linux + dist: trusty + sudo: required + env: RID=linux-arm64 - os: linux dist: trusty sudo: required diff --git a/Dockerfile.linux-arm64 b/Dockerfile.linux-arm64 new file mode 100644 index 00000000..c9c21af6 --- /dev/null +++ b/Dockerfile.linux-arm64 @@ -0,0 +1,17 @@ +FROM ubuntu:16.04 + +WORKDIR /nativebinaries +COPY . /nativebinaries/ + +RUN dpkg --add-architecture arm64 \ +&& sed -i 's/deb/deb [arch=amd64]/g' /etc/apt/sources.list \ +&& echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports xenial main universe" > /etc/apt/sources.list.d/arm64.list \ +&& echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports xenial-updates main universe" > /etc/apt/sources.list.d/arm64-updates.list + +RUN apt update \ +&& apt -y install cmake pkg-config \ + crossbuild-essential-arm64 \ + pkg-config-aarch64-linux-gnu \ + libssl-dev:arm64 + +CMD ["/bin/bash", "-c", "./build.libgit2.sh"] diff --git a/UpdateLibgit2ToSha.ps1 b/UpdateLibgit2ToSha.ps1 index f9ead7bb..a09cbbf6 100644 --- a/UpdateLibgit2ToSha.ps1 +++ b/UpdateLibgit2ToSha.ps1 @@ -123,6 +123,7 @@ Push-Location $libgit2Directory $dllConfig = @" + "@ diff --git a/build.libgit2.sh b/build.libgit2.sh index 85f4c65c..585976fa 100755 --- a/build.libgit2.sh +++ b/build.libgit2.sh @@ -34,6 +34,8 @@ PACKAGEPATH="nuget.package/runtimes" if [[ $RID == "" ]]; then if [[ $ARCH == "x86_64" ]]; then RID="unix-x64" + elif [[ $ARCH == "aarch64" ]]; then + RID="unix-arm64" else RID="unix-x86" fi