Skip to content

Commit e34dc18

Browse files
committed
Restore GitHub Action to build ALS on AArch64 Linux
with cross-toolchain. Ref #1387
1 parent 517316b commit e34dc18

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

.github/workflows/build-binaries.yml

+25
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,34 @@ jobs:
5858
bin/alr index --reset-community
5959
bin/alr toolchain --select gnat_native^14 gprbuild
6060
echo $PWD/bin >> $GITHUB_PATH
61+
- name: Get cross GNAT toolchain (Linux)
62+
if: ${{ runner.os == 'Linux' }}
63+
run: |
64+
sudo apt install -y libc6-dev-arm64-cross linux-libc-dev-arm64-cross binutils-aarch64-linux-gnu
65+
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gcc-14.2.tar.bz2 . --sse=AES256
66+
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gmp-6.2.1.tar.bz2 . --sse=AES256
67+
sudo tar xjf aarch64-Linux-gcc-14.2.tar.bz2 -C /
68+
sudo tar xjf aarch64-Linux-gmp-6.2.1.tar.bz2 -C /
6169
- name: Build
6270
shell: bash
6371
run: |
6472
alr settings --global --set dependencies.shared false
6573
pip3 install e3-testsuite
6674
scripts/build_als.sh all "$TAG"
75+
- name: Build ALS with cross (Linux)
76+
if: ${{ runner.os == 'Linux' }}
77+
run: |
78+
if alr exec -- gprconfig --show-targets | grep aarch64-linux; then
79+
export GPRBUILD_EXTRA=--target=aarch64-linux
80+
export NODE_ARCH_PLATFORM=arm64/linux
81+
find . -name '*.ali' -delete
82+
find . -name '*.[ao]' -delete
83+
scripts/build_als.sh build_als "$TAG" arm64/linux
84+
scripts/build_als.sh strip_debug "$TAG" arm64/linux
85+
else
86+
echo "No AArch64 cross compiler found:"
87+
alr exec -- gprconfig --show-targets || true
88+
fi
6789
- name: Archive ALS binary
6890
uses: actions/upload-artifact@v4
6991
with:
@@ -80,6 +102,9 @@ jobs:
80102
if: ${{ env.TAG != env.DEFAULT_TAG }}
81103
run: |
82104
.github/workflows/release.sh "${{ secrets.GITHUB_TOKEN }}" $TAG ""
105+
if [ -f integration/vscode/ada/arm64/linux/ada_language_server ] ; then
106+
.github/workflows/release.sh "${{ secrets.GITHUB_TOKEN }}" $TAG arm64/linux
107+
fi
83108
- name: Package
84109
shell: bash
85110
run: |

Makefile

+5-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TESTER=$(ROOTDIR)/.obj/tester/tester-run$(EXE)
3737
# Env variable to set for update VS Code test references
3838
MOCHA_ALS_UPDATE=
3939

40-
GPRBUILD_EXTRA=
40+
GPRBUILD_EXTRA ?=
4141
GPRBUILD_FLAGS=-m -j$(PROCESSORS) $(GPRBUILD_EXTRA)
4242
GPRBUILD=gprbuild $(GPRBUILD_FLAGS) -XSUPERPROJECT=
4343
GPRCLEAN_EXTRA=
@@ -70,6 +70,7 @@ else
7070
# Code Ada extension.
7171
NODE_ARCH=$(shell node -e "console.log(process.arch)")
7272
NODE_PLATFORM=$(shell node -e "console.log(process.platform)")
73+
NODE_ARCH_PLATFORM ?= $(NODE_ARCH)/$(NODE_PLATFORM)
7374
endif
7475

7576
VSCE=npx vsce
@@ -112,8 +113,8 @@ endif
112113
$(GPRBUILD) -P gnat/tester.gpr -p $(BUILD_FLAGS)
113114
$(GPRBUILD) -P gnat/lsp_client.gpr -p $(COVERAGE_BUILD_FLAGS)
114115
ifdef NODE
115-
mkdir -p integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM)
116-
cp -v -f $(ALS) integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM)
116+
mkdir -p integration/vscode/ada/$(NODE_ARCH_PLATFORM)
117+
cp -v -f $(ALS) integration/vscode/ada/$(NODE_ARCH_PLATFORM)
117118
endif
118119

119120
generate:
@@ -150,7 +151,7 @@ clean:
150151
-$(GPRCLEAN) -P gnat/lsp_3_17.gpr $(LIBRARY_FLAGS)
151152
-$(GPRCLEAN) -P gnat/lsp_server.gpr $(LIBRARY_FLAGS)
152153
-$(GPRCLEAN) -P gnat/tester.gpr $(LIBRARY_FLAGS)
153-
-rm -rf integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM)
154+
-rm -rf integration/vscode/ada/$(NODE_ARCH_PLATFORM)
154155

155156
vscode:
156157
ifneq ($(npm_config_offline),true)

scripts/build_als.sh

+4
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ function strip_debug() {
208208
# system (or by XCode).
209209
dsymutil "$ALS"
210210
strip "$ALS"
211+
elif [[ $NODE_ARCH_PLATFORM == "arm64/linux" ]]; then
212+
aarch64-linux-gnu-objcopy --only-keep-debug ${ALS} ${ALS}.debug
213+
aarch64-linux-gnu-objcopy --strip-all ${ALS}
214+
aarch64-linux-gnu-objcopy --add-gnu-debuglink=${ALS}.debug ${ALS}
211215
else
212216
objcopy --only-keep-debug ${ALS} ${ALS}.debug
213217
objcopy --strip-all ${ALS}

subprojects/libgpr2.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ command = [
3737

3838
[[actions]]
3939
type = "pre-build"
40-
command = ["bash", "-c", "-x", "make setup build-lib-${LIBRARY_TYPE:-static} GPR2KBDIR=./gprconfig_kb/db"]
40+
command = ["make", "setup", ".build/kb/gpr2-kb-embedded.ads", ".build/kb/gpr2-kb-embedded.adb", "GPR2KBDIR=./gprconfig_kb/db"]
4141

4242
[[depends-on]]
4343
gnatcoll = "~24.0.0"

0 commit comments

Comments
 (0)