Skip to content

Commit 1b83ca3

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents 2cd8443 + e3f696e commit 1b83ca3

File tree

14 files changed

+1176
-474
lines changed

14 files changed

+1176
-474
lines changed

.github/workflows/build-binaries.sh

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ NO_REBASE=$4 # Specify this to skip the rebase over the edge branch. Used for lo
1010
CROSS=$5 # '' for native, aarch64 for ARM cross
1111

1212
prefix=/tmp/ADALIB_DIR
13-
TARGET=${CROSS:+$CROSS-linux} # '' or aarch64-linux
13+
if [ $RUNNER_OS = Linux ] ; then
14+
TARGET=${CROSS:+$CROSS-linux} # '' or aarch64-linux
15+
else
16+
TARGET=${CROSS:+$CROSS-darwin} # '' or aarch64-darwin
17+
fi
18+
1419
TARGET_OPTION=${TARGET:+--target=$TARGET} # '' or --target=aarch64-linux
1520

1621
export CPATH=/usr/local/include
@@ -103,20 +108,37 @@ make LIBRARY_TYPE=static VERSION=$TAG all GPRBUILD_EXTRA=$TARGET_OPTION NODE_ARC
103108
[ -z "$CROSS" ] && make LIBRARY_TYPE=static check
104109

105110

106-
function fix_rpath ()
107-
{
108-
for R in `otool -l $1 |grep -A2 LC_RPATH |awk '/ path /{ print $2 }'`; do
109-
install_name_tool -delete_rpath $R $1
111+
# Find the path to libgmp as linked in the given executable
112+
function get_gmp_full_path() {
113+
otool -l "$1" | grep '^\s*name.*libgmp.10.dylib' | awk '/ name /{print $2 }'
114+
}
115+
116+
function fix_rpath() {
117+
# Remove all rpath entries
118+
for R in $(otool -l "$1" | grep -A2 LC_RPATH | awk '/ path /{ print $2 }'); do
119+
install_name_tool -delete_rpath "$R" "$1"
110120
done
111-
install_name_tool -change /usr/local/opt/gmp/lib/libgmp.10.dylib @rpath/libgmp.10.dylib $1
112-
install_name_tool -add_rpath @executable_path $1
121+
# Change reference to full path of libgmp into a reference to the rpath.
122+
gmp_full_path=$(get_gmp_full_path "$1")
123+
if [ -n "$gmp_full_path" ]; then
124+
install_name_tool -change "$gmp_full_path" @rpath/libgmp.10.dylib "$1"
125+
fi
126+
# Add the executable directory to rpath so it can find shared libraries
127+
# packaged alongside the executable.
128+
install_name_tool -add_rpath @executable_path "$1"
113129
}
114130

115131
ALS_EXEC_DIR=integration/vscode/ada/$NODE_ARCH/$NODE_PLATFORM
116132

117133
if [ $RUNNER_OS = macOS ]; then
118-
cp -v -f /usr/local/opt/gmp/lib/libgmp.10.dylib $ALS_EXEC_DIR
119-
fix_rpath $ALS_EXEC_DIR/ada_language_server
134+
# Get full path of libgmp as linked in the ALS exec
135+
gmp_full_path=$(get_gmp_full_path $ALS_EXEC_DIR/ada_language_server)
136+
if [ -f "$gmp_full_path" ]; then
137+
# Copy libgmp alongside the ALS exec
138+
cp -v -f "$gmp_full_path" "$ALS_EXEC_DIR"
139+
fi
140+
# Fix rpath entries of the ALS exec so it can find libgmp alongside it
141+
fix_rpath "$ALS_EXEC_DIR/ada_language_server"
120142
fi
121143

122144
if [ "$DEBUG" != "debug" ]; then

.github/workflows/build-binaries.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020
exclude:
2121
- os: windows-latest
2222
cross: aarch64
23-
- os: macos-11
24-
cross: aarch64
2523
runs-on: ${{ matrix.os }}
2624
steps:
2725
- name: Setup Python
@@ -37,18 +35,29 @@ jobs:
3735
else
3836
echo "TAG=$DEFAULT_TAG" >> $GITHUB_ENV
3937
fi
40-
- name: Unpack cross toolchain from AWS S3
41-
if: ${{ matrix.cross != '' }}
38+
- name: Install cross toolchain (Linux)
39+
if: ${{ matrix.cross != '' && runner.os == 'Linux' }}
4240
env:
4341
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
4442
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
4543
AWS_DEFAULT_REGION: eu-west-1
4644
run: |
47-
aws s3 cp s3://adacore-gha-tray-eu-west-1/libadalang/${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 . --sse=AES256
48-
aws s3 cp s3://adacore-gha-tray-eu-west-1/libadalang/${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 . --sse=AES256
4945
sudo apt install -y libc6-dev-arm64-cross linux-libc-dev-arm64-cross binutils-aarch64-linux-gnu
50-
sudo tar xavf ${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 -C /
51-
sudo tar xavf ${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 -C /
46+
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 . --sse=AES256
47+
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 . --sse=AES256
48+
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 -C /
49+
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 -C /
50+
- name: Install cross toolchain (MacOS)
51+
if: ${{ matrix.cross != '' && runner.os != 'Linux' }}
52+
env:
53+
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
54+
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
55+
AWS_DEFAULT_REGION: eu-west-1
56+
run: |
57+
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 . --sse=AES256
58+
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 . --sse=AES256
59+
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 --strip-components=3 -C /usr/local
60+
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 --strip-components=3 -C /usr/local
5261
- name: Force Alire use preinstalled MSYS2
5362
shell: bash
5463
if: ${{ runner.os == 'Windows' }}

.github/workflows/pack-binaries.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ function make_change_log()
1717
done
1818
}
1919

20-
chmod -R -v +x als-*-$DEBUG als-Linux-${DEBUG}aarch64
20+
chmod -R -v +x als-*-$DEBUG als-{Linux,macOS}-${DEBUG}aarch64
2121

2222
for X in Linux macOS Windows ; do
2323
rsync -rva als-$X-$DEBUG/ integration/vscode/ada/
2424
done
2525

26-
rsync -rva als-Linux-${DEBUG}aarch64/ integration/vscode/ada/
26+
rsync -rva als-{Linux,macOS}-${DEBUG}aarch64/ integration/vscode/ada/
2727

2828
# VS Code is supported on arm, arm64 and x64 so we only consider those
2929
# architectures

.github/workflows/release.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ echo "upload_url=$upload_url"
3838

3939
chmod -R -v +x als-*-$DEBUG
4040

41+
for CROSS in "" "aarch64" ; do
4142
for X in Linux macOS Windows ; do
42-
FILE=als-$TAG-$X${DEBUG:+-debug}_amd64.zip
43-
cd als-$X-$DEBUG
43+
FILE=als-$TAG-$X${DEBUG:+-debug}_${CROSS:-amd64}.zip
44+
cd als-$X-$DEBUG$CROSS
4445
zip -9 -r ../$FILE .
4546
cd ..
4647

@@ -54,3 +55,4 @@ for X in Linux macOS Windows ; do
5455
$upload_url?name=$FILE
5556
rm -v -f $FILE
5657
done
58+
done

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ It provides a full set of features including syntax highlighting, navigation, bu
133133

134134
### Getting Started
135135

136-
[Tutorial: Using Ada in VS Code](https://github.com/AdaCore/ada_language_server/wiki/Getting-Started).
136+
Here are some links that will help you get familiar with the VS Code extension for Ada & SPARK:
137+
138+
* [Ada & SPARK for VS Code](integration/vscode/ada/README.md).
139+
* [Tutorial: Using Ada in VS Code](https://github.com/AdaCore/ada_language_server/wiki/Getting-Started).
137140

138141
### Configuration
139142

integration/vscode/ada/src/clients.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@ export function createClient(
1313
) {
1414
let serverExecPath: string;
1515

16-
if (process.arch == 'arm64' && process.platform == 'darwin') {
17-
// On arm64 darwin use the x64 darwin executable thanks to Apple Rosetta.
18-
serverExecPath = context.asAbsolutePath(`x64/darwin/ada_language_server`);
19-
} else {
20-
serverExecPath = context.asAbsolutePath(
21-
`${process.arch}/${process.platform}/ada_language_server`
22-
);
23-
}
24-
25-
if (process.platform == 'win32') {
26-
// Add the extension for the file lookup further below
27-
serverExecPath = `${serverExecPath}.exe`;
28-
}
29-
3016
// If the ALS environment variable is specified, use it as the path of the
3117
// server executable.
3218
if (process.env.ALS) {
@@ -39,6 +25,28 @@ export function createClient(
3925
);
4026
}
4127
} else {
28+
serverExecPath = context.asAbsolutePath(
29+
`${process.arch}/${process.platform}/ada_language_server`
30+
);
31+
32+
if (process.arch == 'arm64' && process.platform == 'darwin') {
33+
// On arm64 darwin check if the executable exists, and if not, try to
34+
// fallback to the x64 darwin executable thanks to Apple Rosetta.
35+
if (!existsSync(serverExecPath)) {
36+
// The arm64 executable doesn't exist. Try x86.
37+
const alternateExecPath = context.asAbsolutePath(
38+
`x64/${process.platform}/ada_language_server`
39+
);
40+
if (existsSync(alternateExecPath)) {
41+
// The x86 executable exists, use that instead.
42+
serverExecPath = alternateExecPath;
43+
}
44+
}
45+
} else if (process.platform == 'win32') {
46+
// Add the extension for the file lookup further below
47+
serverExecPath = `${serverExecPath}.exe`;
48+
}
49+
4250
if (!existsSync(serverExecPath)) {
4351
logErrorAndThrow(
4452
`This installation of the Ada extension does not have the Ada ` +

0 commit comments

Comments
 (0)