Skip to content

Commit

Permalink
gha/linux: cross-compile ARM64 libs & package them
Browse files Browse the repository at this point in the history
  • Loading branch information
yanok committed Jan 20, 2025
1 parent dee1ce7 commit ccc5706
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/actions/5a-linux-arm64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Linux: Cross-compile ARM64 libraries & copy to install dir"
runs:
using: composite
steps:

- name: Install Cross-Compile Support (ARM64)
uses: cyberjunk/gha-ubuntu-cross@v5
with:
arch: arm64

# - name: Install libx11-dev for ARM64
#run: sudo apt-get install libx11-dev:arm64

- shell: bash
run: |
set -eux
cd ..
# keep using our own lld as a linker
sudo rm /usr/bin/aarch64-linux-gnu-ld
sudo ln -sf /usr/bin/ld /usr
arch='aarch64'
triple="$arch-linux-gnu"
export CC=clang
./installed/bin/ldc-build-runtime --ninja \
--buildDir="build-libs-$arch" \
--dFlags="-mtriple=$triple -gcc=clang" \
--cFlags="--target=$triple" \
--linkerFlags="--target=$triple" \
--ldcSrcDir="$PWD/ldc"
mkdir "installed/lib-$arch"
cp -rv "build-libs-$arch"/lib/* "installed/lib-$arch/"
section="
\"($arch|arm64).*-linux-gnu\":
{
switches = [
\"-defaultlib=phobos2-ldc,druntime-ldc\",
\"--mcpu=neoverse-n1\",
\"-mattr=+crc\",
\"-gcc=$arch-linux-gnu-gcc\",
\"-linker=gold\",
];
lib-dirs = [
\"%%ldcbinarypath%%/../lib-$arch\",
];
rpath = \"%%ldcbinarypath%%/../lib-$arch\";
};"
echo "$section" >> installed/etc/ldc2.conf
cat installed/etc/ldc2.conf
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ jobs:
# with:
# arch: ${{ matrix.arch }}

- name: "Linux: Cross-compile ARM64 libraries, copy to install dir & extend ldc2.conf"
if: runner.os == 'Linux'
uses: ./.github/actions/5a-linux-arm64
- name: Run a few integration tests against the installed compiler
uses: ./.github/actions/6-integration-test
# - name: 'macOS: Run iOS cross-compilation integration test'
Expand Down

0 comments on commit ccc5706

Please sign in to comment.